Win7 x64 注册表 WOW6432Node

0013.jpg


Windows7 64bit系统的注册表分32 位注册表项和64位注册表项两部分。32位应用在操作注册表时,会被重新定向到HKEY_LOCAL_MACHINE\Software\WOW6432Node。所以为了32位应用能够准确操作注册表,需要在TRegistry.Create时加入参数:KEY_WOW64_32KEY (0x0200)  或者  KEY_WOW64_64KEY (0x0100),对于这两个参数MSND说明如下:


KEY_WOW64_32KEY (0x0200):

Indicates that an application on 64-bit Windows should operate on the 32-bit registry view. This flag is ignored by 32-bit Windows. For more information, see Accessing an Alternate Registry View.

This flag must be combined using the OR operator with the other flags in this table that either query or access registry values.(Windows 2000:  This flag is not supported.)


KEY_WOW64_64KEY (0x0100):

Indicates that an application on 64-bit Windows should operate on the 64-bit registry view. This flag is ignored by 32-bit Windows. For more information, see Accessing an Alternate Registry View.

This flag must be combined using the OR operator with the other flags in this table that either query or access registry values.(Windows 2000:  This flag is not supported.)


(Either KEY_WOW64_32KEY or KEY_WOW64_64KEY can be specified. If both flags are specified, the function fails with ERROR_INVALID_PARAMETER.

Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP: If both flags are specified, the function’s behavior is undefined.)


Delphi代码:

Reg:=TRegistry.Create(KEY_WRITE OR KEY_READ or KEY_WOW64_64KEY);
Reg:=Tregistry.create(KEY_ALL_ACCESS or $0100) ;


上述说明只针对HKEY_LOCAL_MACHINE主键而言,HKEY_CURRENT_USER主键下没有类似情况;当访问HKEY_CURRENT_USER主键时,明确指定KEY_WOW64_64KEY和KEY_WOW64_32KEY标志也没有意义。

标签:DelphiWindows

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://evelee.net/blog/?id=14