11

It appears that specifying the KEY_WOW64_64KEY flag (reference) when accessing a registry key under 32-bit Windows XP has no effect - that is, no error is thrown, and the key is opened as if you hadn't had the flag set.

I know Windows 2000 throws an error when it encounters this flag.

I want to make sure my app is compatible with as many versions of windows (2k and later) as possible.

Is there a Microsoft reference that specifies each version of Windows' behaviour for this flag? In particular, I'd like something that validates my assumption that it has no effect at all on post-2k 32-bit Windows.

Blorgbeard
  • 101,031
  • 48
  • 228
  • 272

4 Answers4

4

I can't speak to Windows 2000 or XP, but I know that on Vista and above, KEY_WOW64_64KEY opens the registry key in the 64bit registry if it's a 64bit OS and the 32bit registry if it's a 32bit OS.

Larry Osterman
  • 16,086
  • 32
  • 60
2

According to this Windows page:

https://learn.microsoft.com/en-us/windows/win32/sysinfo/registry-key-security-and-access-rights?redirectedfrom=MSDN

Both

KEY_WOW64_32KEY (0x0200)

KEY_WOW64_64KEY (0x0100)

will be ignored on 32-bit Windows.

And those flags are not supported on Windows 2000.

Minh
  • 424
  • 3
  • 12
2

I have tested on Windows XP 32 bit, and it seems to work OK.

Jeppe
  • 31
  • 1
-1

Also, you should usually be avoiding this key - WOW64 provides a pretty complete "illusion" to 32-bit apps; just write your app properly on 32-bit without this flag, and it will still work on WOW64. Don't try to use this flag (and other mechanisms) to be "64-bit compatible".

Ana Betts
  • 73,868
  • 16
  • 141
  • 209
  • 8
    I need to detect whether certain other applications are installed, and where - and they have 64-bit versions. – Blorgbeard Oct 28 '09 at 19:38
  • In that case, you should probably write your app as 64-bit, then inspect the Wow6432Node if needed, instead of forcing yourself to think for every file/reg/path access, "Should I care about redirection?" – Ana Betts Oct 28 '09 at 20:07
  • Agreed, but converting and recompiling a large Delphi7 codebase to 64bit is not really an option right now :P – Blorgbeard Oct 29 '09 at 23:15