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.

185 lines
4.6 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1999 **/
  4. /**********************************************************************/
  5. /*
  6. svcctrl.h
  7. Prototypes for the dialog that pops up while waiting
  8. for the server to start.
  9. FILE HISTORY:
  10. */
  11. #if !defined(AFX_STARTSVC_H__0B2EAD4B_929C_11D0_9800_00C04FC3357A__INCLUDED_)
  12. #define AFX_STARTSVC_H__0B2EAD4B_929C_11D0_9800_00C04FC3357A__INCLUDED_
  13. #if _MSC_VER >= 1000
  14. #pragma once
  15. #endif // _MSC_VER >= 1000
  16. #include "clusapi.h"
  17. // startsvc.h : header file
  18. //
  19. //
  20. // TIMER_FREQ is the frequency of our timer messages.
  21. // TIMER_MULT is a multiplier. We'll actually poll the
  22. // service every (TIMER_FREQ * TIMER_MULT) seconds.
  23. // This allows us to advance the progress indicator more
  24. // fequently than we hit the net. Should keep the user better
  25. // amused.
  26. //
  27. #define TIMER_ID 29
  28. #define TIMER_FREQ 500
  29. #define TIMER_MULT 6
  30. #define POLL_TIMER_FREQ (TIMER_FREQ * TIMER_MULT)
  31. #define POLL_DEFAULT_MAX_TRIES 1
  32. #define PROGRESS_ICON_COUNT 12
  33. /////////////////////////////////////////////////////////////////////////////
  34. // CServiceCtrlDlg dialog
  35. class CServiceCtrlDlg : public CDialog
  36. {
  37. // Construction
  38. public:
  39. CServiceCtrlDlg(SC_HANDLE hService,
  40. LPCTSTR pServerName,
  41. LPCTSTR pszServiceDesc,
  42. BOOL bStart, CWnd* pParent = NULL); // standard constructor
  43. CServiceCtrlDlg(HRESOURCE hResource,
  44. LPCTSTR pServerName,
  45. LPCTSTR pszServiceDesc,
  46. BOOL bStart, CWnd* pParent = NULL); // standard constructor
  47. // Dialog Data
  48. //{{AFX_DATA(CServiceCtrlDlg)
  49. enum { IDD = IDD_SERVICE_CTRL_DIALOG };
  50. CStatic m_staticMessage;
  51. CStatic m_iconProgress;
  52. //}}AFX_DATA
  53. // Overrides
  54. // ClassWizard generated virtual function overrides
  55. //{{AFX_VIRTUAL(CServiceCtrlDlg)
  56. protected:
  57. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  58. //}}AFX_VIRTUAL
  59. // Implementation
  60. protected:
  61. // Generated message map functions
  62. //{{AFX_MSG(CServiceCtrlDlg)
  63. afx_msg void OnTimer(UINT nIDEvent);
  64. virtual BOOL OnInitDialog();
  65. afx_msg void OnClose();
  66. //}}AFX_MSG
  67. DECLARE_MESSAGE_MAP()
  68. public:
  69. DWORD m_dwErr;
  70. private:
  71. void UpdateIndicator();
  72. BOOL CheckForError(SERVICE_STATUS * pServiceStats);
  73. BOOL CheckForClusterError(SERVICE_STATUS * pServiceStats);
  74. void CheckService();
  75. void CheckClusterService();
  76. void GetClusterResourceTimeout();
  77. private:
  78. SC_HANDLE m_hService;
  79. HRESOURCE m_hResource;
  80. UINT_PTR m_timerId;
  81. int m_nTickCounter;
  82. int m_nTotalTickCount;
  83. CString m_strServerName;
  84. CString m_strServiceDesc;
  85. BOOL m_bStart;
  86. DWORD m_dwTickBegin;
  87. DWORD m_dwWaitPeriod;
  88. DWORD m_dwLastCheckPoint;
  89. };
  90. /*---------------------------------------------------------------------------
  91. Class: CWaitDlg
  92. This is a generic wait dialog (this can be used by anyone).
  93. ---------------------------------------------------------------------------*/
  94. class CWaitDlg : public CDialog
  95. {
  96. // Construction
  97. public:
  98. CWaitDlg(LPCTSTR pServerName,
  99. LPCTSTR pszText,
  100. LPCTSTR pszTitle,
  101. CWnd* pParent = NULL); // standard constructor
  102. // Dialog Data
  103. //{{AFX_DATA(CWaitDlg)
  104. enum { IDD = IDD_SERVICE_CTRL_DIALOG };
  105. CStatic m_staticMessage;
  106. CStatic m_iconProgress;
  107. //}}AFX_DATA
  108. // Overrides
  109. // ClassWizard generated virtual function overrides
  110. //{{AFX_VIRTUAL(CServiceCtrlDlg)
  111. protected:
  112. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  113. //}}AFX_VIRTUAL
  114. // Implementation
  115. protected:
  116. // Generated message map functions
  117. //{{AFX_MSG(CServiceCtrlDlg)
  118. afx_msg void OnTimer(UINT nIDEvent);
  119. virtual BOOL OnInitDialog();
  120. afx_msg void OnClose();
  121. //}}AFX_MSG
  122. DECLARE_MESSAGE_MAP()
  123. // Override this function to provide your own implementation
  124. // To exit out of the dialog, call CDialog::OnOK() here.
  125. virtual void OnTimerTick()
  126. {
  127. CDialog::OnOK();
  128. }
  129. void CloseTimer();
  130. CString m_strServerName;
  131. CString m_strText;
  132. CString m_strTitle;
  133. private:
  134. void UpdateIndicator();
  135. UINT_PTR m_timerId;
  136. int m_nTickCounter;
  137. int m_nTotalTickCount;
  138. };
  139. //{{AFX_INSERT_LOCATION}}
  140. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  141. #endif // !defined(AFX_STARTSVC_H__0B2EAD4B_929C_11D0_9800_00C04FC3357A__INCLUDED_)