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.

117 lines
3.3 KiB

  1. //+---------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1993 - 1997.
  5. //
  6. // File: olecnfg.cpp
  7. //
  8. // Contents: Implements the class COlecnfgApp - the top level class
  9. // for dcomcnfg.exe
  10. //
  11. // Classes:
  12. //
  13. // Methods: COlecnfgApp::COlecnfgApp
  14. // COlecnfgApp::InitInstance
  15. //
  16. // History: 23-Apr-96 BruceMa Created.
  17. //
  18. //----------------------------------------------------------------------
  19. #include "stdafx.h"
  20. #include "afxtempl.h"
  21. #include "olecnfg.h"
  22. #include "CStrings.h"
  23. #include "CReg.h"
  24. #include "types.h"
  25. #include "datapkt.h"
  26. #include "virtreg.h"
  27. #include "CnfgPSht.h"
  28. #ifdef _DEBUG
  29. #define new DEBUG_NEW
  30. #undef THIS_FILE
  31. static char THIS_FILE[] = __FILE__;
  32. #endif
  33. /////////////////////////////////////////////////////////////////////////////
  34. // COlecnfgApp
  35. BEGIN_MESSAGE_MAP(COlecnfgApp, CWinApp)
  36. //{{AFX_MSG_MAP(COlecnfgApp)
  37. // NOTE - the ClassWizard will add and remove mapping macros here.
  38. // DO NOT EDIT what you see in these blocks of generated code!
  39. ON_COMMAND(ID_CONTEXT_HELP, CWinApp::OnContextHelp)
  40. //}}AFX_MSG
  41. END_MESSAGE_MAP()
  42. /////////////////////////////////////////////////////////////////////////////
  43. // COlecnfgApp construction
  44. COlecnfgApp::COlecnfgApp()
  45. {
  46. // TODO: add construction code here,
  47. // Place all significant initialization in InitInstance
  48. }
  49. /////////////////////////////////////////////////////////////////////////////
  50. // The one and only COlecnfgApp object
  51. COlecnfgApp theApp;
  52. /////////////////////////////////////////////////////////////////////////////
  53. // COlecnfgApp initialization
  54. BOOL COlecnfgApp::InitInstance()
  55. {
  56. // Standard initialization
  57. // If you are not using these features and wish to reduce the size
  58. // of your final executable, you should remove from the following
  59. // the specific initialization routines you do not need.
  60. #ifdef _AFXDLL
  61. Enable3dControls(); // Call this when using MFC in a shared DLL
  62. #else
  63. Enable3dControlsStatic(); // Call this when linking to MFC statically
  64. #endif
  65. // This tool really so only be run by administrators. We check this
  66. // by trying to get KEY_ALL_ACCESS rights to
  67. // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\OLE
  68. HKEY hKey;
  69. if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Microsoft\\OLE"),
  70. 0, KEY_ALL_ACCESS, &hKey)
  71. != ERROR_SUCCESS)
  72. {
  73. CString sCaption;
  74. CString sMessage;
  75. sCaption.LoadString(IDS_SYSTEMMESSAGE);
  76. sMessage.LoadString(IDS_ADMINSONLY);
  77. MessageBox(NULL, sMessage, sCaption, MB_OK);
  78. return FALSE;
  79. }
  80. // The main body of oleui
  81. COlecnfgPropertySheet psht;
  82. m_pMainWnd = &psht;
  83. INT_PTR nResponse = psht.DoModal();
  84. if (nResponse == IDOK)
  85. {
  86. g_virtreg.Ok(0);
  87. }
  88. else if (nResponse == IDCANCEL)
  89. {
  90. g_virtreg.Cancel(0);
  91. }
  92. // Remove the virtual registry
  93. g_virtreg.RemoveAll();
  94. // Since the dialog has been closed, return FALSE so that we exit the
  95. // application, rather than start the application's message pump.
  96. return FALSE;
  97. }