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.

143 lines
3.6 KiB

  1. extern "C" {
  2. #include <nt.h>
  3. #include <ntrtl.h>
  4. #include <nturtl.h>
  5. }
  6. #include <windows.h>
  7. #include <setupapi.h>
  8. VOID
  9. DoUninstall(
  10. IN HWND hWnd
  11. )
  12. /*++
  13. Routine Description:
  14. Uninstalls the cluster software by running the uninstall
  15. section of the cluster INF.
  16. Arguments:
  17. hWnd - Supplies the hWnd of the dialog to run the INF in.
  18. Return Value:
  19. None.
  20. --*/
  21. {
  22. HINF ClusterSetupInf;
  23. CString TargetInf;
  24. CString error;
  25. CString GroupName;
  26. CString ItemName;
  27. DoingUninstall = TRUE;
  28. if(IsOtherSoftwareInstalled())
  29. return;
  30. //
  31. // Stop the services if they are running.
  32. //
  33. StopService(L"ClusSvc");
  34. // StopService(L"ClusDisk");
  35. StopService(L"TimeServ");
  36. UnloadClusDB();
  37. //
  38. // Register CluAdMMC.
  39. //
  40. error = registerCOMObject(FALSE /*bRegister*/, _T("CluAdMMC.dll"), theApp.m_SetupDirectory);
  41. if (!error.IsEmpty()) {
  42. MessageBox(hWnd, error, _T("SETUP ERROR"), MB_OK | MB_ICONEXCLAMATION);
  43. }
  44. //
  45. // Register ClAdmWiz.
  46. //
  47. error = registerCOMObject(FALSE /*bRegister*/, _T("ClAdmWiz.dll"), theApp.m_SetupDirectory);
  48. if (!error.IsEmpty()) {
  49. MessageBox(hWnd, error, _T("SETUP ERROR"), MB_OK | MB_ICONEXCLAMATION);
  50. }
  51. //
  52. // Register CluAdmEx.
  53. //
  54. error = registerCOMObject(FALSE /*bRegister*/, _T("CluAdmEx.dll"), theApp.m_SetupDirectory);
  55. if (!error.IsEmpty()) {
  56. MessageBox(hWnd, error, _T("SETUP ERROR"), MB_OK | MB_ICONEXCLAMATION);
  57. }
  58. //
  59. // Register IISClEx3.
  60. //
  61. error = registerCOMObject(FALSE /*bRegister*/, _T("IISClEx3.dll"), theApp.m_SetupDirectory);
  62. if (!error.IsEmpty()) {
  63. MessageBox(hWnd, error, _T("SETUP ERROR"), MB_OK | MB_ICONEXCLAMATION);
  64. }
  65. //
  66. // Register ClNetREx.
  67. //
  68. error = registerCOMObject(FALSE /*bRegister*/, _T("ClNetREx.dll"), theApp.m_SetupDirectory);
  69. if (!error.IsEmpty()) {
  70. MessageBox(hWnd, error, _T("SETUP ERROR"), MB_OK | MB_ICONEXCLAMATION);
  71. }
  72. TargetInf = theApp.m_SetupDirectory;
  73. TargetInf +=_T("\\CLUSTER.INF");
  74. //
  75. // Open the cluster setup INF file.
  76. //
  77. ClusterSetupInf = SetupOpenInfFile(TargetInf,
  78. NULL,
  79. INF_STYLE_WIN4,
  80. NULL);
  81. if (ClusterSetupInf == INVALID_HANDLE_VALUE ) {
  82. MessageBox(hWnd,_T("couldn't open INF"),_T("SETUP ERROR"),MB_OK | MB_ICONEXCLAMATION);
  83. return;
  84. }
  85. // Uninstall stuff ...
  86. #ifdef COPYCLUSTERFILES_IS_OBSOLETE
  87. error = copyClusterFiles(ClusterSetupInf, hWnd, _T("DefaultUninstall"));
  88. if(!error.IsEmpty()) {
  89. MessageBox(hWnd,error, _T("SETUP ERROR"), MB_OK | MB_ICONEXCLAMATION);
  90. return;
  91. }
  92. #endif // COPYCLUSTERFILES_IS_OBSOLETE
  93. //
  94. // Remove the cluster network provider
  95. //
  96. error = removeNetworkProvider();
  97. if(!error.IsEmpty()) {
  98. MessageBox(hWnd,error, _T("SETUP ERROR"), MB_OK | MB_ICONEXCLAMATION);
  99. }
  100. //
  101. // Remove the cluster item from the start menu
  102. //
  103. GroupName.LoadString(IDS_START_GROUP_NAME);
  104. ItemName.LoadString(IDS_START_ITEM_NAME);
  105. DeleteItem(GroupName, TRUE, ItemName, FALSE);
  106. if ((!theApp.m_UninstallOnError) || theApp.m_RebootOnUninstall) {
  107. if (theApp.m_CommandLine->m_Force) {
  108. SystemShutdown();
  109. } else {
  110. BOOL nResponse = AfxMessageBox(IDS_WRN_UNINSTALL,MB_OKCANCEL | MB_ICONEXCLAMATION);
  111. if(nResponse == IDOK)
  112. SystemShutdown();
  113. /* SetupPromptReboot(NULL,
  114. hWnd,
  115. FALSE);*/
  116. }
  117. }
  118. }