VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2014-11-11 19:23:35 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2014-11-11 19:25:05 +0100
commitbc9005968a4d21822fbb0932842507afba0d41d7 (patch)
tree5d57122ff543f0509f05b29620a3e0a0ae6f9065 /src
parentb2438b5029bfed76e80d3aded8800c5e19c617bf (diff)
downloadVeraCrypt-bc9005968a4d21822fbb0932842507afba0d41d7.tar.gz
VeraCrypt-bc9005968a4d21822fbb0932842507afba0d41d7.zip
Windows: Avoid calling RegCloseKey on an invalid handle.
Diffstat (limited to 'src')
-rw-r--r--src/Common/Dlgcode.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 42e52468..e0fe6831 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -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;