NTSTATUS DownloadThread( _In_ PVOID Arguments ) { BOOLEAN setupSuccess = FALSE; // Download the latest build if (setupSuccess = SetupDownloadBuild(Arguments)) { // Reset the current installation if (setupSuccess = SetupResetCurrentInstall(Arguments)) { // Extract and install the latest build if (setupSuccess = SetupExtractBuild(Arguments)) { PostMessage(Arguments, PSM_SETCURSELID, 0, IDD_DIALOG5); } } } if (!setupSuccess) { // Retry download... PostMessage(Arguments, PSM_SETCURSELID, 0, IDD_DIALOG4); } return STATUS_SUCCESS; }
NTSTATUS SetupUpdateBuild( _In_ PPH_SETUP_CONTEXT Context ) { Context->SetupInstallPath = SetupFindInstallDirectory(); if (!ShutdownProcessHacker()) goto CleanupExit; if (!SetupUninstallKph(Context)) goto CleanupExit; if (!SetupCreateUninstallFile(Context)) goto CleanupExit; SetupCreateUninstallKey(Context); if (!SetupExtractBuild(Context)) goto CleanupExit; SetupStartKph(Context); if (!SetupExecuteProcessHacker(Context)) goto CleanupExit; PostMessage(Context->DialogHandle, WM_QUIT, 0, 0); PhDereferenceObject(Context); return STATUS_SUCCESS; CleanupExit: PostMessage(Context->DialogHandle, WM_APP + IDD_ERROR, 0, 0); PhDereferenceObject(Context); return STATUS_FAIL_CHECK; }