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.

127 lines
3.6 KiB

  1. // MSConfig.h : main header file for the MSCONFIG application
  2. //
  3. #if !defined(AFX_MSCONFIG_H__E8C06876_EEE6_49C2_B461_07F39EECC0B8__INCLUDED_)
  4. #define AFX_MSCONFIG_H__E8C06876_EEE6_49C2_B461_07F39EECC0B8__INCLUDED_
  5. #if _MSC_VER > 1000
  6. #pragma once
  7. #endif // _MSC_VER > 1000
  8. #ifndef __AFXWIN_H__
  9. #error include 'stdafx.h' before including this file for PCH
  10. #endif
  11. #include "resource.h" // main symbols
  12. // #include "MSConfig_i.h"
  13. //=============================================================================
  14. // Constants used in MSConfig (done as defines since this include file might
  15. // be included multiple times).
  16. //=============================================================================
  17. #define MSCONFIGDIR _T("%systemroot%\\pss")
  18. #define MSCONFIGUNDOLOG _T("msconfig.log")
  19. #define COMMANDLINE_AUTO _T("/auto")
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CMSConfigApp:
  22. // See MSConfig.cpp for the implementation of this class
  23. //
  24. class CMSConfigApp : public CWinApp
  25. {
  26. public:
  27. CMSConfigApp();
  28. // Overrides
  29. // ClassWizard generated virtual function overrides
  30. //{{AFX_VIRTUAL(CMSConfigApp)
  31. public:
  32. virtual BOOL InitInstance();
  33. virtual int ExitInstance();
  34. //}}AFX_VIRTUAL
  35. // Implementation
  36. //{{AFX_MSG(CMSConfigApp)
  37. // NOTE - the ClassWizard will add and remove member functions here.
  38. // DO NOT EDIT what you see in these blocks of generated code !
  39. //}}AFX_MSG
  40. DECLARE_MESSAGE_MAP()
  41. public:
  42. //---------------------------------------------------------------------------
  43. // DoIExist is a way of detecting if another version of this app is
  44. // running - it avoids the problem of rapid invocations succeeding before
  45. // the window is created. It uses a semaphore to tell if we are already
  46. // running somewhere else.
  47. //---------------------------------------------------------------------------
  48. BOOL DoIExist(LPCTSTR szSemName)
  49. {
  50. HANDLE hSem;
  51. hSem = CreateSemaphore(NULL, 0, 1, szSemName);
  52. if (hSem != NULL && GetLastError() == ERROR_ALREADY_EXISTS)
  53. {
  54. CloseHandle(hSem);
  55. return TRUE;
  56. }
  57. return FALSE;
  58. }
  59. //---------------------------------------------------------------------------
  60. // FirstInstance is used to keep the app from loading multiple times. If this
  61. // is the first instance to run, this function returns TRUE. Otherwise it
  62. // activates the previous instance and returns FALSE. It looks for the
  63. // previous instance based on the window title.
  64. //---------------------------------------------------------------------------
  65. BOOL FirstInstance()
  66. {
  67. if (DoIExist(_T("MSConfigRunning")))
  68. {
  69. CString strCaption;
  70. if (strCaption.LoadString(IDS_DIALOGCAPTION))
  71. {
  72. CWnd *PrevCWnd = CWnd::FindWindow(NULL, strCaption);
  73. if (PrevCWnd)
  74. {
  75. CWnd *ChildCWnd = PrevCWnd->GetLastActivePopup();
  76. PrevCWnd->SetForegroundWindow();
  77. if (PrevCWnd->IsIconic())
  78. PrevCWnd->ShowWindow(SW_RESTORE);
  79. if (PrevCWnd != ChildCWnd)
  80. ChildCWnd->SetForegroundWindow();
  81. }
  82. }
  83. return (FALSE);
  84. }
  85. return (TRUE);
  86. }
  87. void InitializePages();
  88. BOOL ShowPropertySheet(int nInitialTab);
  89. void CleanupPages();
  90. void SetAutoRun(BOOL fAutoRun);
  91. void Reboot();
  92. private:
  93. BOOL m_bATLInited;
  94. private:
  95. BOOL InitATL();
  96. };
  97. /////////////////////////////////////////////////////////////////////////////
  98. //{{AFX_INSERT_LOCATION}}
  99. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  100. #endif // !defined(AFX_MSCONFIG_H__E8C06876_EEE6_49C2_B461_07F39EECC0B8__INCLUDED_)