We are trying to determine if auto rotation is currently enabled or disabled from our c++ application. The following code always returns a value of 1 even if regedit of the same key shows 0. It returns the same if the application is run as a standard user or as an administrator.
HKEY hkMain;
LONG lRes = RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\AutoRotation",0,KEY_QUERY_VALUE,&hkMain);
if (lRes==ERROR_SUCCESS) {
DWORD dwRegValue=0,dwSize=0,dwType=0;
dwSize = sizeof(DWORD);
lRes = RegQueryValueEx(hkMain,TEXT("Enable"),NULL,&dwType,(LPBYTE)&dwRegValue,&dwSize);
if (lRes==ERROR_SUCCESS) {
// dwRegValue value is always 1
}
RegCloseKey(hkMain);
}