Problems reading registry from Delphi 7 on Windows 7 64 bit
32bit-64bit, 64-bit, delphi, registry, windows
Solution
You already asked this question see Registry ReadString method is not working in Windows 7 in Delphi 7.
So you know that you have to add $0100 in the TRegistry.Create. The problem with your code is that you use OpenKeyReadOnly which resets the Access property of the registry to KEY_READ, so `KEY_READ or $0100` is lost.
Just use OpenKey instead of OpenKeyReadOnly, this won't reset your Access property.
Problem
I think this question was already asked, but I couldn't find a solution which works for me. I use Delphi 7 under Windows 7 Ultimate, 64 bit. Actually I started writing application under 32 bit OS, but then changes PC, so now its 64. In my program I use registration process with Licence ID generated from PROGID value of Windows. Unfortunately it doesn't read the value, seems like it is looking in a different folder, probably redirected by Windows 64 to 32 bit registry. Can you help? This is the code I use: ``` Registry := TRegistry.Create(KEY_READ OR $0100); try Registry.Lazywrite := false; Registry.RootKey := HKEY_LOCAL_MACHINE; if CheckForWinNT = true then Begin if not Registry.OpenKeyReadOnly('\Software\Microsoft\Windows NT\CurrentVersion') then showmessagE('cant open'); end else Registry.OpenKeyReadOnly('\Software\Microsoft\Windows\CurrentVersion'); result := Registry.ReadString('ProductID'); Registry.CloseKey; finally Registry.Free; end; // try..finally ``` Also, do you know how to find whether program is running under 64 bit or 32 bit computer in Delphi 7?