[Registry] Wert unter Win7 nicht vorhanden
spacer
Autor Nachricht
Bergmann89
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1572
Erhaltene Danke: 50

Win7 x64, Ubuntu 11.10
Delphi 7 Personal, Lazarus/FPC 2.2.4, C, C++, C# (Visual Studio 2010), PHP, Java (Netbeans, Eclipse)
BeitragVerfasst: Mi 28.09.11 21:56 
Betrifft: Registry
Hey,

ich versuch grad verzweifelt einen bestimmten Schlüssel aus der Regestry zu laden, aber es geht nicht so wie ich mir das vorstelle. Der Schlüssel ist 'HKEY_LOCAL_MACHINE\SOFTWARE\MayComputer\eDocPrintPro\' und der wird mir bei regedit auch richtig angezeigt. Wenn ich das ganze jetzt im Programm auslesen will, dann kann er den Schlüssel nicht finden. Hier ma der Code dazu:
ausblenden Delphi-Quelltext markieren
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
function ReadPrintProDir: String;
var
reg: TRegistry;
begin
result := '';
reg := TRegistry.Create(KEY_ALL_ACCESS);
try
reg.RootKey := HKEY_LOCAL_MACHINE;
if reg.OpenKey('SOFTWARE\MayComputer\eDocPrintPro\', False) then begin
try
if reg.ValueExists('eDocPrintPro') then
result := reg.ReadString('eDocPrintPro');
finally
reg.CloseKey;
end;
end;
finally
reg.Free;
end;
if (Length(result) > 0) and (result[Length(result)] <> '\') then
result := result + '\';
end;

OS ist Win7x64. Hat da jmd ne Idee oder wenigstens einen kleinen Tipp für mich?

MfG & Thx Bergmann.

_________________
Ich weiß nicht viel lern aber dafür umso schneller^^
 
Antworten mit Zitat Beitrag melden
Private Nachricht sendenPosting in privater Nachricht zitieren
Werbung ausblenden? Dann registriere Dich kostenlos. Weitere Gründe für eine Registrierung.


Werbung ausblenden? Dann registriere Dich kostenlos. Weitere Gründe für eine Registrierung.
Luckie
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starhalf offtopic starofftopic star
Beiträge: 11803
Erhaltene Danke: 146

WindowsXP Professional SP2
BDS2006, VS C++ Express, Eclipse (Java), Flex (Flash, AS)
BeitragVerfasst: Mi 28.09.11 22:48 
Das hätte unter Windows XP auch schon nicht geklappt, wenn du nicht standardmäßig als Administrator an deinem Rechner gearbeitet hättest. Bei mir hätte das nämlich nicht funktioniert. Den Hive HKLM kann man als normaler Benutzer nur lesen. Du öffnest ihn aber mit allen Rechten, also auch zum Schreiben. Und dann brauchst du Administratorenrechte. Und hättest du eine gescheite Fehlerbehandlung eingebaut, hättest du auch eine Fehlermeldung bekommen, warum es nicht funktioniert.

_________________
Gruß Michael
 
Antworten mit Zitat Beitrag melden
Private Nachricht sendenPosting in privater Nachricht zitieren
Bergmann89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1572
Erhaltene Danke: 50

Win7 x64, Ubuntu 11.10
Delphi 7 Personal, Lazarus/FPC 2.2.4, C, C++, C# (Visual Studio 2010), PHP, Java (Netbeans, Eclipse)
BeitragVerfasst: Mi 28.09.11 23:10 
Hey,

das Programm läuft mit Admin-Rechten (is eine Art Installation, also brauch es die Rechte sowieso). Und GetLastError ist 0. Also kein Fehler vorhanden. War es nicht so, das Win7 für 32-Bit Anwendungen eine Art VM hat? Die hat ja dann auch teilweise ne andere Registry, oder bin ich da grad auf dem Holzweg?

MfG Bergmann.

_________________
Ich weiß nicht viel lern aber dafür umso schneller^^
 
Antworten mit Zitat Beitrag melden
Private Nachricht sendenPosting in privater Nachricht zitieren
Luckie
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starhalf offtopic starofftopic star
Beiträge: 11803
Erhaltene Danke: 146

WindowsXP Professional SP2
BDS2006, VS C++ Express, Eclipse (Java), Flex (Flash, AS)
BeitragVerfasst: Mi 28.09.11 23:14 
Hmpf, warum gibst du die entscheidenden Informationen erst jetzt? Es ist also Windows 7 64-Bit. Und wie viel Bit hat dein Programm? Wenn es nur ein 32-Bit Programm ist, wird es in den 32-Bit Zweig der Registry umgeleitet. Das kann man aber mit einem zusätzliche Flag beim Öffnen der Registry verhindern. Musst du mal googlen. aber ich würde den Hive trotzdem nur lesend öffnen, wenn ich nur lesen will.

_________________
Gruß Michael
 
Antworten mit Zitat Beitrag melden
Private Nachricht sendenPosting in privater Nachricht zitieren
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starhalf offtopic star
Administrator
Beiträge: 8371
Erhaltene Danke: 244

W2k, WXPpro
TP3 - D7pro
BeitragVerfasst: Mi 28.09.11 23:18 
Moin!

user profile iconBergmann89 hat folgendes geschrieben Zum zitierten Posting springen:
OS ist Win7x64.
user profile iconLuckie hat folgendes geschrieben Zum zitierten Posting springen:
Hmpf, warum gibst du die entscheidenden Informationen erst jetzt?
:zwinker:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
 
Antworten mit Zitat Beitrag melden
Private Nachricht sendenPosting in privater Nachricht zitieren
Luckie
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starhalf offtopic starofftopic star
Beiträge: 11803
Erhaltene Danke: 146

WindowsXP Professional SP2
BDS2006, VS C++ Express, Eclipse (Java), Flex (Flash, AS)
BeitragVerfasst: Mi 28.09.11 23:21 
Wer liest schon das Kleingedruckte? Und es ist nicht gesagt, dass das Programm auch auf dem Rechner laufen soll mit dem Windows 7.

_________________
Gruß Michael
 
Antworten mit Zitat Beitrag melden
Private Nachricht sendenPosting in privater Nachricht zitieren
Bergmann89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1572
Erhaltene Danke: 50

Win7 x64, Ubuntu 11.10
Delphi 7 Personal, Lazarus/FPC 2.2.4, C, C++, C# (Visual Studio 2010), PHP, Java (Netbeans, Eclipse)
BeitragVerfasst: Mi 28.09.11 23:30 
Ahhh jetzt kommt Licht ins dunkel :) Hier die Beschreibung. Danke für die schnelle Hilfe.

_________________
Ich weiß nicht viel lern aber dafür umso schneller^^
 
Antworten mit Zitat Beitrag melden
Private Nachricht sendenPosting in privater Nachricht zitieren
Luckie
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starhalf offtopic starofftopic star
Beiträge: 11803
Erhaltene Danke: 146

WindowsXP Professional SP2
BDS2006, VS C++ Express, Eclipse (Java), Flex (Flash, AS)
BeitragVerfasst: Do 29.09.11 00:33 
Das gibt aber wieder ein Gefrickel bei 32-Bit/64-Bit. Das Programm muss dann feststellen ob es unter 32-BNit oder 64-Bit läuft und Windows 2000 kompatible ist es dann auch nicht mehr.

_________________
Gruß Michael
 
Antworten mit Zitat Beitrag melden
Private Nachricht sendenPosting in privater Nachricht zitieren
Bergmann89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1572
Erhaltene Danke: 50

Win7 x64, Ubuntu 11.10
Delphi 7 Personal, Lazarus/FPC 2.2.4, C, C++, C# (Visual Studio 2010), PHP, Java (Netbeans, Eclipse)
BeitragVerfasst: Do 29.09.11 00:42 
Hey,

das mit dem Win2000 weiß ich, aber das brauch ich nich wirklich. Und für das andere Problem:
ausblenden Delphi-Quelltext markieren
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
function IsWOW64: Boolean;
type
TIsWow64Process = function( // Type of IsWow64Process API fn
Handle: THandle;
var Res: BOOL
): BOOL; stdcall;
var
IsWow64Result: BOOL; // result from IsWow64Process
IsWow64Process: TIsWow64Process; // IsWow64Process fn reference
begin
// Try to load required function from kernel32
IsWow64Process := GetProcAddress(
GetModuleHandle('kernel32'), 'IsWow64Process'
);
if Assigned(IsWow64Process) then
begin
// Function is implemented: call it
if not IsWow64Process(GetCurrentProcess, IsWow64Result) then
raise Exception.Create('Bad process handle');
// Return result of function
Result := IsWow64Result;
end
else
// Function not implemented: can't be running on Wow64
Result := False;
end;

Es arbeitet unter Win7 zumindest erstmal so, wie es soll.

_________________
Ich weiß nicht viel lern aber dafür umso schneller^^
 
Antworten mit Zitat Beitrag melden
Private Nachricht sendenPosting in privater Nachricht zitieren
Luckie
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starhalf offtopic starofftopic star
Beiträge: 11803
Erhaltene Danke: 146

WindowsXP Professional SP2
BDS2006, VS C++ Express, Eclipse (Java), Flex (Flash, AS)
BeitragVerfasst: Do 29.09.11 00:48 
Wenn IsWOW64 wahr ist, dann ist es ein 32-Bit Prozess auf einen 64-Bit Windows? Ich hätte die Funktion Is32On64 genannt. Dieses WindowsOnWindows verursacht bei mir immer ein Knoten im Hirn. ;)

_________________
Gruß Michael
 
Antworten mit Zitat Beitrag melden
Private Nachricht sendenPosting in privater Nachricht zitieren
Aya
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1939
Erhaltene Danke: 12

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Do 29.09.11 08:29 
Ich vermute wenn isWOW64 wahr ist, ist es ein 64bit Windows... ob dein Programm in dem du die funktion aufrufst 32bit oder 64bit ist wirst du ja vermutlich selbst wissen ;)

Insofern ist der name schon ganz okay gewaehlt :)

Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!
 
Antworten mit Zitat Beitrag melden
Private Nachricht sendenPosting in privater Nachricht zitieren
Luckie
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starhalf offtopic starofftopic star
Beiträge: 11803
Erhaltene Danke: 146

WindowsXP Professional SP2
BDS2006, VS C++ Express, Eclipse (Java), Flex (Flash, AS)
BeitragVerfasst: Do 29.09.11 10:36 
Nicht unbedingt. Ich kann es mit Delphi einmal als 32-Bit compilieren und einmal als 64-Bit ohne was am Code ändern zu müssen. Also weiß ich nicht mit wie viel Bit mein Programm läuft.

_________________
Gruß Michael
 
Antworten mit Zitat Beitrag melden
Private Nachricht sendenPosting in privater Nachricht zitieren
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starhalf offtopic star
Moderator
Beiträge: 3722
Erhaltene Danke: 133

Arch Linux, Win 7
F#, C# (VS2010)
BeitragVerfasst: Do 29.09.11 11:30 
user profile iconAya hat folgendes geschrieben Zum zitierten Posting springen:
Ich vermute wenn isWOW64 wahr ist, ist es ein 64bit Windows...
Wofür soll dann "WO" stehen ;) ? Dass Windows on Windows64 das 32-Bit-Subsystem der x64-Versionen ist, sollte doch langsam bekannt sein.

_________________
>λ=
 
Antworten mit Zitat Beitrag melden
Private Nachricht sendenPosting in privater Nachricht zitieren
Luckie
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starhalf offtopic starofftopic star
Beiträge: 11803
Erhaltene Danke: 146

WindowsXP Professional SP2
BDS2006, VS C++ Express, Eclipse (Java), Flex (Flash, AS)
BeitragVerfasst: Do 29.09.11 11:44 
ist ja auch bekannt. Nur ich muss immer zwei mal nachdenken, was gemeint ist. Keine Ahnung, was mich da jedes mal verwirrt.

_________________
Gruß Michael
 
Antworten mit Zitat Beitrag melden
Private Nachricht sendenPosting in privater Nachricht zitieren
home home