Source code of Windows XP (NT5)
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.

294 lines
6.7 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() { m_bAutoDelete = FALSE; }
  77. virtual int Run();
  78. void AddStatusMessage(LPCTSTR pszMessage);
  79. //helpers
  80. protected:
  81. DWORD InitLATable(PWINSINTF_ADD_VERS_MAP_T pAddVersMaps,
  82. DWORD MasterOwners,
  83. DWORD NoOfOwners);
  84. void AddSOTableEntry(CString & strIP,
  85. PWINSINTF_ADD_VERS_MAP_T pMasterMaps,
  86. DWORD NoOfOwners,
  87. DWORD MasterOwners);
  88. LONG IPToIndex(CString & strIP, DWORD NoOfOwners);
  89. BOOL CheckSOTableConsistency(DWORD dwMasterOwners);
  90. void RemoveFromSOTable(CString & strIP, DWORD dwMasterOwners);
  91. public:
  92. CCheckVersionProgress * m_pDlg;
  93. handle_t m_hBinding;
  94. DWORD m_dwIpAddress;
  95. CStringArray m_strLATable;
  96. LARGE_INTEGER (*m_pLISOTable)[MAX_WINS];
  97. };
  98. /*---------------------------------------------------------------------------
  99. Class: CDBCompactThread
  100. ---------------------------------------------------------------------------*/
  101. class CDBCompactThread : public CWinsThread
  102. {
  103. public:
  104. CDBCompactThread()
  105. {
  106. m_bAutoDelete = FALSE;
  107. m_hHeapHandle = NULL;
  108. }
  109. ~CDBCompactThread()
  110. {
  111. if (m_hHeapHandle)
  112. {
  113. HeapDestroy(m_hHeapHandle);
  114. m_hHeapHandle = NULL;
  115. }
  116. }
  117. virtual int Run();
  118. void AddStatusMessage(LPCTSTR pszMessage);
  119. protected:
  120. void DisConnectFromWinsServer();
  121. DWORD ConnectToWinsServer();
  122. DWORD_PTR RunApp(LPCTSTR input, LPCTSTR startingDirectory, LPSTR * output);
  123. public:
  124. CDBCompactProgress * m_pDlg;
  125. CConfiguration * m_pConfig;
  126. handle_t m_hBinding;
  127. DWORD m_dwIpAddress;
  128. CString m_strServerName;
  129. // for the output of RunApp
  130. HANDLE m_hHeapHandle;
  131. };
  132. /////////////////////////////////////////////////////////////////////////////
  133. // CProgress dialog
  134. class CProgress : public CBaseDialog
  135. {
  136. // Construction
  137. public:
  138. CProgress(CWnd* pParent = NULL); // standard constructor
  139. void AddStatusMessage(LPCTSTR pszMessage)
  140. {
  141. m_editMessage.SetFocus();
  142. int nLength = m_editMessage.GetWindowTextLength();
  143. m_editMessage.SetSel(nLength, nLength, TRUE);
  144. m_editMessage.ReplaceSel(pszMessage);
  145. }
  146. // Dialog Data
  147. //{{AFX_DATA(CProgress)
  148. enum { IDD = IDD_VERSION_CONSIS };
  149. CButton m_buttonCancel;
  150. CEdit m_editMessage;
  151. //}}AFX_DATA
  152. // Overrides
  153. // ClassWizard generated virtual function overrides
  154. //{{AFX_VIRTUAL(CProgress)
  155. protected:
  156. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  157. //}}AFX_VIRTUAL
  158. // Implementation
  159. protected:
  160. // Generated message map functions
  161. //{{AFX_MSG(CProgress)
  162. virtual void OnCancel();
  163. virtual BOOL OnInitDialog();
  164. //}}AFX_MSG
  165. DECLARE_MESSAGE_MAP()
  166. public:
  167. virtual DWORD * GetHelpMap() { return WinsGetHelpMap(CProgress::IDD);};
  168. };
  169. /*---------------------------------------------------------------------------
  170. Class: CCheckNamesProgress
  171. ---------------------------------------------------------------------------*/
  172. class CCheckNamesProgress : public CProgress
  173. {
  174. public:
  175. CCheckNamesProgress()
  176. {
  177. m_fVerifyWithPartners = FALSE;
  178. }
  179. void NotifyCompleted();
  180. void BuildServerList();
  181. protected:
  182. virtual BOOL OnInitDialog();
  183. virtual void OnCancel();
  184. void AddServerToList(u_long ip);
  185. public:
  186. CWinsNameArray m_strNameArray;
  187. CStringArray m_strServerArray;
  188. WinsServersArray m_winsServersArray;
  189. BOOL m_fVerifyWithPartners;
  190. protected:
  191. CCheckNamesThread m_Thread;
  192. };
  193. /*---------------------------------------------------------------------------
  194. Class: CCheckVersionProgress
  195. ---------------------------------------------------------------------------*/
  196. class CCheckVersionProgress : public CProgress
  197. {
  198. public:
  199. void NotifyCompleted();
  200. protected:
  201. virtual BOOL OnInitDialog();
  202. virtual void OnCancel();
  203. public:
  204. handle_t m_hBinding;
  205. DWORD m_dwIpAddress;
  206. protected:
  207. CCheckVersionThread m_Thread;
  208. };
  209. /*---------------------------------------------------------------------------
  210. Class: CDBCompactProgress
  211. ---------------------------------------------------------------------------*/
  212. class CDBCompactProgress : public CProgress
  213. {
  214. public:
  215. void NotifyCompleted();
  216. protected:
  217. virtual BOOL OnInitDialog();
  218. virtual void OnCancel();
  219. public:
  220. CConfiguration * m_pConfig;
  221. handle_t m_hBinding;
  222. DWORD m_dwIpAddress;
  223. CString m_strServerName;
  224. protected:
  225. CDBCompactThread m_Thread;
  226. };
  227. //{{AFX_INSERT_LOCATION}}
  228. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  229. #endif // !defined _CPROGDLG_H