close all open file handles when one of them fail to open

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3649 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2004-09-07 19:50:13 +00:00
parent 776eb349c0
commit eb0e1fa14d
2 changed files with 198 additions and 195 deletions

View file

@ -56,6 +56,7 @@ void __declspec(dllexport) vpatchfile(HWND hwndParent, int string_size,
hSource = CreateFile(source, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (hSource == INVALID_HANDLE_VALUE) {
CloseHandle(hPatch);
pushstring("Unable to open source file");
return;
}
@ -63,6 +64,8 @@ void __declspec(dllexport) vpatchfile(HWND hwndParent, int string_size,
hDest = CreateFile(dest, GENERIC_READ | GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
if (hDest == INVALID_HANDLE_VALUE) {
CloseHandle(hPatch);
CloseHandle(hSource);
pushstring("Unable to open output file");
return;
}

Binary file not shown.