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.

302 lines
7.1 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1999 **/
  4. /**********************************************************************/
  5. /*
  6. cprogdlg.h
  7. progress dialog for checking version consistency
  8. FILE HISTORY:
  9. */
  10. #if !defined _CPROGDLG_H
  11. #define _CPROGDLG_H
  12. #if _MSC_VER >= 1000
  13. #pragma once
  14. #endif // _MSC_VER >= 1000
  15. #ifndef _ACTREG_H
  16. #include "actreg.h"
  17. #endif
  18. #ifndef _VERIFY_H
  19. #include "verify.h"
  20. #endif
  21. #ifndef _CONFIG_H
  22. #include "config.h"
  23. #endif
  24. #include "dialog.h"
  25. #define MAX_WINS 1000
  26. #define INIT_SIZE 100
  27. #define VERSION_NT_50 5
  28. #define VERSION_NT_40 4
  29. #define VERSION_NT_351 3
  30. typedef CArray<u_long, u_long> CULongArray;
  31. class CCheckNamesProgress;
  32. class CCheckVersionProgress;
  33. class CDBCompactProgress;
  34. /*---------------------------------------------------------------------------
  35. Class: CWinsThread
  36. ---------------------------------------------------------------------------*/
  37. class CWinsThread : public CWinThread
  38. {
  39. public:
  40. CWinsThread();
  41. ~CWinsThread();
  42. public:
  43. BOOL Start();
  44. void Abort(BOOL fAutoDelete = TRUE);
  45. void AbortAndWait();
  46. BOOL FCheckForAbort();
  47. BOOL IsRunning();
  48. virtual BOOL InitInstance() { return TRUE; } // MFC override
  49. virtual int Run() { return 1; }
  50. private:
  51. HANDLE m_hEventHandle;
  52. };
  53. /*---------------------------------------------------------------------------
  54. Class: CCheckNamesThread
  55. ---------------------------------------------------------------------------*/
  56. class CCheckNamesThread : public CWinsThread
  57. {
  58. public:
  59. CCheckNamesThread() { m_bAutoDelete = FALSE; }
  60. virtual int Run();
  61. void AddStatusMessage(LPCTSTR pszMessage);
  62. void DisplayInfo(int uNames, u_long ulValidAddr);
  63. public:
  64. CCheckNamesProgress * m_pDlg;
  65. CWinsNameArray m_strNameArray;
  66. WinsServersArray m_winsServersArray;
  67. CStringArray m_strSummaryArray;
  68. CULongArray m_verifiedAddressArray;
  69. };
  70. /*---------------------------------------------------------------------------
  71. Class: CCheckVersionThread
  72. ---------------------------------------------------------------------------*/
  73. class CCheckVersionThread : public CWinsThread
  74. {
  75. public:
  76. CCheckVersionThread()
  77. {
  78. m_bAutoDelete = FALSE;
  79. m_uLATableDim = 0;
  80. m_pLISOTable = NULL;
  81. m_uLISOTableDim = 0;
  82. }
  83. virtual int Run();
  84. void AddStatusMessage(LPCTSTR pszMessage);
  85. //helpers
  86. protected:
  87. DWORD InitLATable(PWINSINTF_ADD_VERS_MAP_T pAddVersMaps,
  88. DWORD NoOfOwners);
  89. DWORD AddSOTableEntry(CString & strIP,
  90. PWINSINTF_ADD_VERS_MAP_T pMasterMaps,
  91. DWORD NoOfOwners);
  92. LONG IPToIndex(CString & strIP);
  93. BOOL CheckSOTableConsistency();
  94. void RemoveFromSOTable(CString & strIP);
  95. ULARGE_INTEGER& SOCell(UINT i, UINT j);
  96. public:
  97. CCheckVersionProgress * m_pDlg;
  98. handle_t m_hBinding;
  99. DWORD m_dwIpAddress;
  100. CStringArray m_strLATable;
  101. UINT m_uLATableDim;
  102. ULARGE_INTEGER *m_pLISOTable;
  103. UINT m_uLISOTableDim;
  104. };
  105. /*---------------------------------------------------------------------------
  106. Class: CDBCompactThread
  107. ---------------------------------------------------------------------------*/
  108. class CDBCompactThread : public CWinsThread
  109. {
  110. public:
  111. CDBCompactThread()
  112. {
  113. m_bAutoDelete = FALSE;
  114. m_hHeapHandle = NULL;
  115. }
  116. ~CDBCompactThread()
  117. {
  118. if (m_hHeapHandle)
  119. {
  120. HeapDestroy(m_hHeapHandle);
  121. m_hHeapHandle = NULL;
  122. }
  123. }
  124. virtual int Run();
  125. void AddStatusMessage(LPCTSTR pszMessage);
  126. protected:
  127. void DisConnectFromWinsServer();
  128. DWORD ConnectToWinsServer();
  129. DWORD_PTR RunApp(LPCTSTR input, LPCTSTR startingDirectory, LPSTR * output);
  130. public:
  131. CDBCompactProgress * m_pDlg;
  132. CConfiguration * m_pConfig;
  133. handle_t m_hBinding;
  134. DWORD m_dwIpAddress;
  135. CString m_strServerName;
  136. // for the output of RunApp
  137. HANDLE m_hHeapHandle;
  138. };
  139. /////////////////////////////////////////////////////////////////////////////
  140. // CProgress dialog
  141. class CProgress : public CBaseDialog
  142. {
  143. // Construction
  144. public:
  145. CProgress(CWnd* pParent = NULL); // standard constructor
  146. void AddStatusMessage(LPCTSTR pszMessage)
  147. {
  148. m_editMessage.SetFocus();
  149. int nLength = m_editMessage.GetWindowTextLength();
  150. m_editMessage.SetSel(nLength, nLength, TRUE);
  151. m_editMessage.ReplaceSel(pszMessage);
  152. }
  153. // Dialog Data
  154. //{{AFX_DATA(CProgress)
  155. enum { IDD = IDD_VERSION_CONSIS };
  156. CButton m_buttonCancel;
  157. CEdit m_editMessage;
  158. //}}AFX_DATA
  159. // Overrides
  160. // ClassWizard generated virtual function overrides
  161. //{{AFX_VIRTUAL(CProgress)
  162. protected:
  163. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  164. //}}AFX_VIRTUAL
  165. // Implementation
  166. protected:
  167. // Generated message map functions
  168. //{{AFX_MSG(CProgress)
  169. virtual void OnCancel();
  170. virtual BOOL OnInitDialog();
  171. //}}AFX_MSG
  172. DECLARE_MESSAGE_MAP()
  173. public:
  174. virtual DWORD * GetHelpMap() { return WinsGetHelpMap(CProgress::IDD);};
  175. };
  176. /*---------------------------------------------------------------------------
  177. Class: CCheckNamesProgress
  178. ---------------------------------------------------------------------------*/
  179. class CCheckNamesProgress : public CProgress
  180. {
  181. public:
  182. CCheckNamesProgress()
  183. {
  184. m_fVerifyWithPartners = FALSE;
  185. }
  186. void NotifyCompleted();
  187. void BuildServerList();
  188. protected:
  189. virtual BOOL OnInitDialog();
  190. virtual void OnCancel();
  191. void AddServerToList(u_long ip);
  192. public:
  193. CWinsNameArray m_strNameArray;
  194. CStringArray m_strServerArray;
  195. WinsServersArray m_winsServersArray;
  196. BOOL m_fVerifyWithPartners;
  197. protected:
  198. CCheckNamesThread m_Thread;
  199. };
  200. /*---------------------------------------------------------------------------
  201. Class: CCheckVersionProgress
  202. ---------------------------------------------------------------------------*/
  203. class CCheckVersionProgress : public CProgress
  204. {
  205. public:
  206. void NotifyCompleted();
  207. protected:
  208. virtual BOOL OnInitDialog();
  209. virtual void OnCancel();
  210. public:
  211. handle_t m_hBinding;
  212. DWORD m_dwIpAddress;
  213. protected:
  214. CCheckVersionThread m_Thread;
  215. };
  216. /*---------------------------------------------------------------------------
  217. Class: CDBCompactProgress
  218. ---------------------------------------------------------------------------*/
  219. class CDBCompactProgress : public CProgress
  220. {
  221. public:
  222. void NotifyCompleted();
  223. protected:
  224. virtual BOOL OnInitDialog();
  225. virtual void OnCancel();
  226. public:
  227. CConfiguration * m_pConfig;
  228. handle_t m_hBinding;
  229. DWORD m_dwIpAddress;
  230. CString m_strServerName;
  231. protected:
  232. CDBCompactThread m_Thread;
  233. };
  234. //{{AFX_INSERT_LOCATION}}
  235. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  236. #endif // !defined _CPROGDLG_H