Commit d56217e9 authored by Lance Jackson's avatar Lance Jackson Committed by Alexandre Julliard

cmd: Fix some unclosed file and registry handles.

parent 2b1e487d
......@@ -70,9 +70,7 @@ void WCMD_batch (WCHAR *file, WCHAR *command, int called, WCHAR *startLabel, HAN
strcpyW (string, file);
CharLower (string);
if (strstrW (string, extension_exe) == NULL) strcatW (string, extension_exe);
h = CreateFile (string, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (h != INVALID_HANDLE_VALUE) {
if (GetFileAttributes (string) != INVALID_FILE_ATTRIBUTES) {
WCMD_run_program (command, 0);
} else {
SetLastError (ERROR_FILE_NOT_FOUND);
......
......@@ -2598,11 +2598,11 @@ void WCMD_assoc (WCHAR *command, BOOL assoc) {
WCMD_output_asis(keyValue);
}
WCMD_output_asis(newline);
RegCloseKey(readKey);
}
}
}
}
RegCloseKey(readKey);
} else {
......
......@@ -377,6 +377,7 @@ int wmain (int argc, WCHAR *argvW[])
value = strtoulW(strvalue, NULL, 10);
}
}
RegCloseKey(key);
}
if (value == 0 && RegOpenKeyEx(HKEY_LOCAL_MACHINE, regKeyW,
......@@ -397,6 +398,7 @@ int wmain (int argc, WCHAR *argvW[])
value = strtoulW(strvalue, NULL, 10);
}
}
RegCloseKey(key);
}
/* If one found, set the screen to that colour */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment