Windows 10 Questions on reading registry keys with calls to Kernel32.dll

  • Thread starter Thread starter ToddAndMargo3
  • Start date Start date
T

ToddAndMargo3

Guest
Questions on reading registry keys with calls to Kernel32.dll:

References:



I am trying to read the value of this key:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"EnableLUA"=dword:00000000

Am I correct that to read a registry key, you must
1) open the key (RegOpenKeyExW),
2) read the value (RegQueryValueExW),
3) close the key (RegCloseKey)?

In these calls, are the pointers 32 bit or 64 bit depending on the version of Windows?

To open the key, I must call
LSTATUS RegOpenKeyExW(
HKEY hKey,
LPCWSTR lpSubKey,
DWORD ulOptions,
REGSAM samDesired,
PHKEY phkResult
);

4) Is hKey is the handle of the key I just opened? And I need to keep track of (save) it.

5) Is this the same hKey used in RegQueryValueExW and RegCloseKey?

LSTATUS RegQueryValueExW(
HKEY hKey,
LPCWSTR lpValueName,
LPDWORD lpReserved,
LPDWORD lpType,
LPBYTE lpData,
LPDWORD lpcbData
);
LSTATUS RegCloseKey(
HKEY hKey
);


what is “lpSubKey”?

6) is “lpSubKey”

\Microsoft\Windows\CurrentVersion\Policies\System
or
\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA
or something else?

7) forward slashes or back slashes?

8) does it use a starting slash?

9) does it use an ending slash?


RegQueryValueExW

10) what is lpSubKey?

EnableLUA
or
\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA
or something else

Many thanks,
-T

More...
 
Back
Top