I’m using the below code to read the registry to get the value of EnableLUA
LPCTSTR pszSubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System";
LPCTSTR pszValue = "EnableLUA";
DWORD dwType = 0;
DWORD dwValue = 0;
DWORD dwValueSize = sizeof( DWORD );
if ( ERROR_SUCCESS != SHGetValue( HKEY_LOCAL_MACHINE, pszSubKey, pszValue,
&dwType, &dwValue, &dwValueSize) )
I run the above code in admin mode even then am getting runtime error.
Any other apis available to get this job done. I want to simply check whether EnableLUA value is 0 or 1..
I’m using mingw and LSTATUS is showing as compile time
error: unkown declararion LSTATUS.
Maybe Mingw doesn’t fully support Windows?
LSTATUS is the return type of SHGetValue, so should be defined. Look in Shlwapi.h for the prototype for SHGetValue.
You can probably temporarily change the code to assign the return value from SHGetValue to a variable and print it out. Then tell us what the value is. It’s probably 5 (access denied).
Are you including Windows.h AND Shlwapi.h in your code?
From MSDN:
Return value
Type: LSTATUS
Returns ERROR_SUCCESS if successful, or a nonzero error code defined in Winerror.h otherwise. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to retrieve a generic description of the error.