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.

112 lines
2.6 KiB

  1. /*
  2. ****************************************************************************
  3. | Copyright (C) 2001 Microsoft Corporation
  4. |
  5. | Module Name:
  6. |
  7. | IISMon.cpp
  8. |
  9. | Abstract:
  10. | This is the code that installs the IIS6 Monitor tool on Servers Beta
  11. |
  12. | Author:
  13. | Ivo Jeglov (ivelinj)
  14. |
  15. | Revision History:
  16. | November 2001
  17. |
  18. ****************************************************************************
  19. */
  20. #include "stdafx.h"
  21. #include "Utils.h"
  22. #include "UI.h"
  23. int APIENTRY WinMain( HINSTANCE hInstance,
  24. HINSTANCE hPrevInstance,
  25. LPSTR lpCmdLine,
  26. int nCmdShow )
  27. {
  28. BOOL bComInitialized = SUCCEEDED( ::CoInitialize( NULL ) );
  29. if ( !bComInitialized )
  30. {
  31. ::MessageBox( NULL, _T("Cannot initialize COM. The Setup will now exit"), _T("Error"), MB_OK | MB_ICONSTOP );
  32. return 1;
  33. }
  34. // There are two switches:
  35. // 1) -inst - installs the tool
  36. if ( ::strcmp( lpCmdLine, "-inst" ) == 0 )
  37. {
  38. DoInstallUI( hInstance );
  39. }
  40. // 2) -uninst - uninstalls the tool ( silent )
  41. else if ( ::strcmp( lpCmdLine, "-uninst" ) == 0 )
  42. {
  43. Uninstall( FALSE );
  44. }
  45. // 3) -uninstinter - uninstalls the tool ( interactive )
  46. else if ( ::strcmp( lpCmdLine, "-uninstinter" ) == 0 )
  47. {
  48. // Only admins can uninstall the Monitor
  49. if ( !IsAdmin() )
  50. {
  51. ::MessageBox( NULL,
  52. _T("Only members of the Administrator group can uninstall IIS 6.0 Monitor. Please add yourself to the Administrator group, and then run IIS 6.0 Monitor uninstall again. If you cannot add yourself to the Administrator group, contact your network administrator."),
  53. _T("IIS 6.0 Monitor"),
  54. MB_OK | MB_ICONSTOP );
  55. return 2;
  56. }
  57. if ( ::MessageBox( NULL,
  58. _T("Are you sure you want to uninstall IIS 6.0 Monitor?"),
  59. _T("IIS 6.0 Monitor Uninstall"),
  60. MB_YESNO | MB_ICONQUESTION ) == IDYES )
  61. {
  62. BOOL bRemoveTrail = ( ::MessageBox( NULL,
  63. _T("Would you like to delete the IIS 6.0 Monitor audit files?"),
  64. _T("Audit files"),
  65. MB_YESNO | MB_ICONQUESTION ) == IDYES );
  66. Uninstall( bRemoveTrail );
  67. ::MessageBox( NULL,
  68. _T("IIS 6.0 Monitor uninstalled successfully. Some files will be removed at next reboot."),
  69. _T("IIS 6.0 Monitor Uninstall"),
  70. MB_OK | MB_ICONINFORMATION );
  71. }
  72. }
  73. // 4) -unattend - unatended install
  74. else if ( ::strcmp( lpCmdLine, "-unattend" ) == 0 )
  75. {
  76. if ( CanInstall() == NULL )
  77. {
  78. Install( hInstance, TRUE, 7 );
  79. }
  80. }
  81. if ( bComInitialized )
  82. {
  83. ::CoUninitialize();
  84. }
  85. return 0;
  86. }
  87. // Local function declarations