Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.3 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. cleanup.c
  5. Abstract:
  6. Code to remove an uninstall image
  7. Author:
  8. Jim Schmidt (jimschm) 19-Jan-2001
  9. Revision History:
  10. <alias> <date> <comments>
  11. --*/
  12. #include "pch.h"
  13. #include <shlwapi.h>
  14. #include "undop.h"
  15. BOOL
  16. DoCleanup (
  17. VOID
  18. )
  19. {
  20. TCHAR path[MAX_PATH];
  21. PCTSTR backUpPath;
  22. BOOL result = FALSE;
  23. //
  24. // Remove the backup files
  25. //
  26. backUpPath = GetUndoDirPath();
  27. if (!backUpPath) {
  28. DEBUGMSG ((DBG_VERBOSE, "Can't get backup path"));
  29. return FALSE;
  30. }
  31. if (RemoveCompleteDirectory (backUpPath)) {
  32. result = TRUE;
  33. } else {
  34. DEBUGMSG ((DBG_VERBOSE, "Can't delete uninstall backup files"));
  35. }
  36. MemFree (g_hHeap, 0, backUpPath);
  37. //
  38. // Remove the Add/Remove Programs key and setup reg entries
  39. //
  40. if (ERROR_SUCCESS != SHDeleteKey (
  41. HKEY_LOCAL_MACHINE,
  42. TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Windows")
  43. )) {
  44. DEBUGMSG ((DBG_VERBOSE, "Can't delete uninstall key"));
  45. result = FALSE;
  46. }
  47. if (ERROR_SUCCESS != SHDeleteValue (
  48. HKEY_LOCAL_MACHINE,
  49. TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Setup"),
  50. S_REG_KEY_UNDO_PATH
  51. )) {
  52. DEBUGMSG ((DBG_VERBOSE, "Can't delete %s value", S_REG_KEY_UNDO_PATH));
  53. result = FALSE;
  54. }
  55. if (ERROR_SUCCESS != SHDeleteValue (
  56. HKEY_LOCAL_MACHINE,
  57. TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Setup"),
  58. S_REG_KEY_UNDO_APP_LIST
  59. )) {
  60. DEBUGMSG ((DBG_VERBOSE, "Can't delete %s value", S_REG_KEY_UNDO_APP_LIST));
  61. result = FALSE;
  62. }
  63. if (ERROR_SUCCESS != SHDeleteValue (
  64. HKEY_LOCAL_MACHINE,
  65. TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Setup"),
  66. S_REG_KEY_UNDO_INTEGRITY
  67. )) {
  68. DEBUGMSG ((DBG_VERBOSE, "Can't delete %s value", S_REG_KEY_UNDO_INTEGRITY));
  69. result = FALSE;
  70. }
  71. return result;
  72. }