 |
RegOpenKeyEx ..msdn Add comment W32 Constants Translate this page |
 |
 |
|
The RegOpenKeyEx function opens the specified registry key. |
 |
 |
| Code examples: |
 |
|
|
 |
 |
| Declaration: |
 |
 |
LONG RegOpenKeyEx(
HKEY hKey, // handle to open key
LPCTSTR lpSubKey, // subkey name
DWORD ulOptions, // reserved
REGSAM samDesired, // security access mask
PHKEY phkResult // handle to open key
);
|
 |
 |
 |
| FoxPro declaration: |
 |
 |
DECLARE INTEGER RegOpenKeyEx IN advapi32;
INTEGER hKey,;
STRING lpSubKey,;
INTEGER ulOptions,;
INTEGER samDesired,;
INTEGER @ phkResult
|
 |
 |
 |
| Parameters: |
 |
hKey
[in] Handle to a currently open key or a predefined reserved handle value.
lpSubKey
[in] Pointer to a null-terminated string containing the name of the subkey to open.
ulOptions
Reserved; must be zero.
samDesired
[in] An access mask that specifies the desired access rights to the key.
phkResult
[out] Pointer to a variable that receives a handle to the opened key. |
 |
 |
| Return value: |
 |
If the function succeeds, the return value is 0 (ERROR_SUCCESS). Otherwise, the return value is a nonzero error code.
|
 |
 |
| My comment: |
 |
When you no longer need the handle returned by this function, call the RegCloseKey function to close it.
* * *
June 2, 2010. Contributed by Igor Nikiforov:
Under Windows 2008 Server 64-bit, a call to RegOpenKeyEx returns error code 2 (ERROR_FILE_NOT_FOUND) for some keys.
Example:
RegOpenKeyEx(HKEY_LOCAL_MACHINE ,;
[SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\ ... ;
... \InstallProperties], 0, ;
KEY_READ, @hKey)
Changing samDesired input parameter from KEY_READ to ( KEY_READ | KEY_WOW64_64KEY ) resolves the issue.
RegOpenKeyEx(HKEY_LOCAL_MACHINE , ;
[SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\ ... ;
... \InstallProperties], 0, ;
BITOR(KEY_READ, KEY_WOW64_64KEY), @hKey)
Find more in Registry Key Security and Access Rights article on MSDN web site. |
 |
 |
| Word Index links for the RegOpenKeyEx : |
 |
|
|
 |
 |
| Translate this page: |
 |
|
 |
 |
| • |
 |
| Created: | 2001-09-03 12:00:00 | | Modified: | 2010-06-02 12:11:40 | Visited in last 7 days: 55 |