mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
Updater: fixed string leak, fixed invalid handle for Retry case
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@4890 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
@@ -188,22 +188,11 @@ static void __cdecl WorkerThreadStart(
|
||||
return;
|
||||
}
|
||||
|
||||
PhDereferenceObject(LocalFileNameString);
|
||||
|
||||
LocalFilePathString = PhConcatStrings2(lpTempPathBuffer, sText->Buffer);
|
||||
|
||||
PhDereferenceObject(sText);
|
||||
|
||||
// Create output file
|
||||
if ((TempFileHandle = CreateFile(
|
||||
LocalFilePathString->Buffer,
|
||||
GENERIC_WRITE,
|
||||
FILE_SHARE_WRITE,
|
||||
0, // handle cannot be inherited
|
||||
CREATE_ALWAYS, // if file exists, delete it
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
0)) == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
LogEvent(hwndDlg, PhFormatString(L"CreateFile failed (%d)", GetLastError()));
|
||||
}
|
||||
}
|
||||
|
||||
PhUpdaterState = Downloading;
|
||||
@@ -902,6 +891,21 @@ VOID RunAction(
|
||||
Edit_Visible(GetDlgItem(hwndDlg, IDC_SPEEDTEXT), TRUE);
|
||||
Edit_Visible(GetDlgItem(hwndDlg, IDC_RTIMETEXT), TRUE);
|
||||
|
||||
DisposeFileHandles();
|
||||
|
||||
// Create output file
|
||||
if ((TempFileHandle = CreateFile(
|
||||
LocalFilePathString->Buffer,
|
||||
GENERIC_WRITE,
|
||||
FILE_SHARE_WRITE,
|
||||
0, // handle cannot be inherited
|
||||
CREATE_ALWAYS, // if file exists, delete it
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
0)) == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
LogEvent(hwndDlg, PhFormatString(L"CreateFile failed (%d)", GetLastError()));
|
||||
}
|
||||
|
||||
// Star our Downloader thread
|
||||
_beginthread(DownloadWorkerThreadStart, 0, hwndDlg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user