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.

122 lines
4.1 KiB

  1. //*********************************************************************
  2. //* Microsoft Windows **
  3. //* Copyright(c) Microsoft Corp., 1994 **
  4. //*********************************************************************
  5. //
  6. // UNINSTAL.C - code to uninstall MSN
  7. //
  8. // HISTORY:
  9. //
  10. // 6/22/95 jeremys Created.
  11. //
  12. #include "wizard.h"
  13. extern DOGENINSTALL lpDoGenInstall;
  14. /*******************************************************************
  15. NAME: DoUninstall
  16. SYNOPSIS: Uninstalls MSN1.05 if we installed it in the past,
  17. and it's still installed
  18. ********************************************************************/
  19. BOOL DoUninstall(VOID)
  20. {
  21. BOOL fRet = TRUE;
  22. BOOL fNeedToRemoveMSN105 = FALSE;
  23. // check registry entry to see if we installed MSN1.05
  24. RegEntry re(szRegPathInternetSettings,HKEY_LOCAL_MACHINE);
  25. ASSERT(re.GetError() == ERROR_SUCCESS);
  26. if (re.GetError() == ERROR_SUCCESS) {
  27. if (re.GetNumber(szRegValInstalledMSN105,0) > 0) {
  28. // yes, we installed MSN1.05. now see if it's still installed.
  29. RegEntry reSetup(szRegPathOptComponents,HKEY_LOCAL_MACHINE);
  30. ASSERT(reSetup.GetError() == ERROR_SUCCESS);
  31. reSetup.MoveToSubKey(szRegPathMSNetwork105);
  32. ASSERT(reSetup.GetError() == ERROR_SUCCESS);
  33. if (reSetup.GetError() == ERROR_SUCCESS) {
  34. TCHAR szInstalledVal[10]; // big enough for "1"
  35. if (reSetup.GetString(szRegValInstalled,szInstalledVal,
  36. sizeof(szInstalledVal))
  37. && !lstrcmpi(szInstalledVal,sz1)) {
  38. // yes, MSN1.05 is still installed. we need to remove it.
  39. fNeedToRemoveMSN105 = TRUE;
  40. }
  41. }
  42. }
  43. }
  44. if (fNeedToRemoveMSN105) {
  45. // warn user that this will remove MSN!
  46. int iRet=MsgBox(NULL,IDS_WARNWillRemoveMSN,MB_ICONEXCLAMATION,MB_OKCANCEL);
  47. if (iRet == IDOK) {
  48. TCHAR szInfFilename[SMALL_BUF_LEN+1];
  49. TCHAR szInfSectionName[SMALL_BUF_LEN+1];
  50. DEBUGMSG("Uninstalling MSN 1.05");
  51. // load file name and section name out of resources
  52. LoadSz(IDS_MSN105_INF_FILE,szInfFilename,ARRAYSIZE(szInfFilename));
  53. LoadSz(IDS_MSN105_UNINSTALL_SECT,szInfSectionName,
  54. ARRAYSIZE(szInfSectionName));
  55. // call GenInstall to remove files, do registry edits, etc.
  56. RETERR err = lpDoGenInstall(NULL,szInfFilename,szInfSectionName);
  57. if (err == OK) {
  58. DEBUGMSG("Uninstalling MSN 1.0");
  59. // load file name and section name out of resources
  60. LoadSz(IDS_MSN100_INF_FILE,szInfFilename,ARRAYSIZE(szInfFilename));
  61. LoadSz(IDS_MSN100_UNINSTALL_SECT,szInfSectionName,
  62. ARRAYSIZE(szInfSectionName));
  63. // call GenInstall to remove files, do registry edits, etc.
  64. RETERR err = lpDoGenInstall(NULL,szInfFilename,szInfSectionName);
  65. }
  66. if (err != OK) {
  67. DisplayErrorMessage(NULL,IDS_ERRUninstallMSN,err,ERRCLS_SETUPX,
  68. MB_ICONEXCLAMATION);
  69. fRet = FALSE;
  70. } else {
  71. // remove our registry marker that we installed MSN 1.05
  72. re.DeleteValue(szRegValInstalledMSN105);
  73. }
  74. }
  75. }
  76. // remove the Internet icon from the desktop. To do this, we have to
  77. // delete a registry key (not a value!). Plus! setup won't
  78. // do this from their .inf file, they can only delete values. So we
  79. // have to write some actual code here to remove the key.
  80. // open the name space key. The key we want to remove is a subkey
  81. // of this key.
  82. // //10/24/96 jmazner Normandy 6968
  83. // //No longer neccessary thanks to Valdon's hooks for invoking ICW.
  84. // 11/21/96 jmazner Normandy 11812
  85. // oops, it _is_ neccessary, since if user downgrades from IE 4 to IE 3,
  86. // ICW 1.1 needs to morph the IE 3 icon.
  87. RegEntry reNameSpace(szRegPathNameSpace,HKEY_LOCAL_MACHINE);
  88. ASSERT(reNameSpace.GetError() == ERROR_SUCCESS);
  89. if (reNameSpace.GetError() == ERROR_SUCCESS) {
  90. // delete the subkey that causes the internet icon to appear
  91. RegDeleteKey(reNameSpace.GetKey(),szRegKeyInternetIcon);
  92. }
  93. return fRet;
  94. }