SetupTool: Fix duplicate uninstaller
@@ -177,8 +177,6 @@ BOOLEAN SetupCreateUninstallFile(
uninstallFilePath = PhConcatStrings2(PhGetString(SetupInstallPath), L"\\processhacker-setup.exe");
if (RtlDoesFileExists_U(backupFilePath->Buffer))
- {
- if (!NT_SUCCESS(PhDeleteFileWin32(backupFilePath->Buffer)))
{
PPH_STRING tempFileName;
PPH_STRING tempFilePath;
@@ -186,6 +184,7 @@ BOOLEAN SetupCreateUninstallFile(
tempFileName = PhCreateString(L"processhacker-setup.bak");
tempFilePath = PhCreateCacheFile(tempFileName);
+ //if (!NT_SUCCESS(PhDeleteFileWin32(backupFilePath->Buffer)))
if (!MoveFile(backupFilePath->Buffer, tempFilePath->Buffer))
{
Context->ErrorCode = GetLastError();
@@ -195,15 +194,24 @@ BOOLEAN SetupCreateUninstallFile(
PhDereferenceObject(tempFilePath);
PhDereferenceObject(tempFileName);
}
- }
if (RtlDoesFileExists_U(uninstallFilePath->Buffer))
{
- if (!MoveFile(uninstallFilePath->Buffer, backupFilePath->Buffer))
+ PPH_STRING tempFileName;
+ PPH_STRING tempFilePath;
+
+ //if (!NT_SUCCESS(PhDeleteFileWin32(uninstallFilePath->Buffer)))
+ tempFileName = PhCreateString(L"processhacker-setup.exe");
+ tempFilePath = PhCreateCacheFile(tempFileName);
+
+ if (!MoveFile(uninstallFilePath->Buffer, tempFilePath->Buffer))
{
Context->ErrorCode = GetLastError();
return FALSE;
}
+
+ PhDereferenceObject(tempFilePath);
+ PhDereferenceObject(tempFileName);
}
if (!CopyFile(currentFilePath->Buffer, uninstallFilePath->Buffer, TRUE))
