cmd: Fix some unclosed file and registry handles.
This commit is contained in:
parent
2b1e487d36
commit
d56217e98e
@ -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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user