Leaked source code of windows server 2003
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.

96 lines
2.4 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 "undop.h"
  14. #include <shlwapi.h>
  15. BOOL
  16. DoCleanup (
  17. VOID
  18. )
  19. {
  20. PCTSTR backUpPath;
  21. BOOL result = FALSE;
  22. //
  23. // Remove the backup files
  24. //
  25. backUpPath = GetUndoDirPath();
  26. if (!backUpPath) {
  27. DEBUGMSG ((DBG_VERBOSE, "Can't get backup path"));
  28. return FALSE;
  29. }
  30. if (RemoveCompleteDirectory (backUpPath)) {
  31. result = TRUE;
  32. } else {
  33. DEBUGMSG ((DBG_VERBOSE, "Can't delete uninstall backup files"));
  34. }
  35. MemFree (g_hHeap, 0, backUpPath);
  36. //
  37. // Remove the Add/Remove Programs key and setup reg entries
  38. //
  39. if (ERROR_SUCCESS != SHDeleteKey (
  40. HKEY_LOCAL_MACHINE,
  41. TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Windows")
  42. )) {
  43. DEBUGMSG ((DBG_VERBOSE, "Can't delete uninstall key"));
  44. result = FALSE;
  45. }
  46. if (ERROR_SUCCESS != SHDeleteValue (
  47. HKEY_LOCAL_MACHINE,
  48. TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Setup"),
  49. S_REG_KEY_UNDO_PATH
  50. )) {
  51. DEBUGMSG ((DBG_VERBOSE, "Can't delete %s value", S_REG_KEY_UNDO_PATH));
  52. result = FALSE;
  53. }
  54. if (ERROR_SUCCESS != SHDeleteValue (
  55. HKEY_LOCAL_MACHINE,
  56. TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Setup"),
  57. S_REG_KEY_UNDO_APP_LIST
  58. )) {
  59. DEBUGMSG ((DBG_VERBOSE, "Can't delete %s value", S_REG_KEY_UNDO_APP_LIST));
  60. result = FALSE;
  61. }
  62. if (ERROR_SUCCESS != SHDeleteValue (
  63. HKEY_LOCAL_MACHINE,
  64. TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Setup"),
  65. S_REG_KEY_UNDO_INTEGRITY
  66. )) {
  67. DEBUGMSG ((DBG_VERBOSE, "Can't delete %s value", S_REG_KEY_UNDO_INTEGRITY));
  68. result = FALSE;
  69. }
  70. return result;
  71. }