Skip to content

Commit

Permalink
Fixed incomplete uninstallation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sysprogs committed Dec 16, 2018
1 parent 6d52be2 commit d5064c0
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Uninstall/uninstall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ void RemoveRegistryKeys()
RegistryKey key(HKEY_CLASSES_ROOT, _T("Applications"));
key.DeleteSubKeyRecursive(_T("vmnt.exe"));
key.DeleteSubKeyRecursive(_T("vmnt64.exe"));
#ifdef _WIN64
RegistryKey key3(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall"));
#else
RegistryKey key3(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"));
#endif
key3.DeleteSubKeyRecursive(_T("WinCDEmu"));
}

Expand Down Expand Up @@ -119,9 +123,16 @@ void DeleteFiles(BazisLib::String path)
File::Delete(Path::Combine(path, _T("BazisVirtualCDBus.cat")));
File::Delete(Path::Combine(path, _T("uninstall.exe")));
File::Delete(Path::Combine(path, _T("uninstall64.exe")));
File::Delete(Path::Combine(path, _T("mkisofs.exe")));
Directory::Remove(path);
p[0] = '\\';
MoveFileEx(tsz, NULL, MOVEFILE_DELAY_UNTIL_REBOOT);
p[0] = '\\';

MoveFileEx(Path::Combine(path, _T("x86\\WinCDEmuContextMenu.dll")).c_str(), NULL, MOVEFILE_DELAY_UNTIL_REBOOT);
MoveFileEx(Path::Combine(path, _T("x64\\WinCDEmuContextMenu.dll")).c_str(), NULL, MOVEFILE_DELAY_UNTIL_REBOOT);

if (!RemoveDirectory(path.c_str()))
MoveFileEx(path.c_str(), NULL, MOVEFILE_DELAY_UNTIL_REBOOT);
}

#pragma comment(lib, "ntdll")
Expand Down Expand Up @@ -284,6 +295,6 @@ int WINAPI CALLBACK WinMain (
#endif

DeleteFiles(pszProgramDir);
MessageBox(0, _T("WinCDEmu was successfully uninstalled."), _T("Information"), MB_ICONINFORMATION);
MessageBox(0, _T("WinCDEmu was successfully uninstalled.\r\nFiles that are currently in use will be deleted next time you restart Windows."), _T("Information"), MB_ICONINFORMATION);
return 0;
}

0 comments on commit d5064c0

Please sign in to comment.