Windows: Avoid calling RegCloseKey on an invalid handle.

This commit is contained in:
Mounir IDRASSI 2014-11-11 19:23:35 +01:00
parent b2438b5029
commit bc9005968a

View File

@ -2409,14 +2409,15 @@ void InitApp (HINSTANCE hInstance, char *lpszCommandLine)
DWORD val = 0, size = sizeof(val);
HKEY hkey;
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Atapi\\Parameters", 0, KEY_READ, &hkey) == ERROR_SUCCESS
&& (RegQueryValueEx (hkey, "EnableBigLba", 0, 0, (LPBYTE) &val, &size) != ERROR_SUCCESS
|| val != 1))
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\Atapi\\Parameters", 0, KEY_READ, &hkey) == ERROR_SUCCESS)
{
Warning ("LARGE_IDE_WARNING_2K_REGISTRY");
if (RegQueryValueEx (hkey, "EnableBigLba", 0, 0, (LPBYTE) &val, &size) != ERROR_SUCCESS
|| val != 1)
{
Warning ("LARGE_IDE_WARNING_2K_REGISTRY");
}
RegCloseKey (hkey);
}
RegCloseKey (hkey);
}
break;