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.

420 lines
8.4 KiB

  1. //Copyright (c) 1998 - 1999 Microsoft Corporation
  2. #ifndef _ASYNCDLG_H
  3. #define _ASYNCDLG_H
  4. #define ULONG_DIGIT_MAX 12
  5. #define UINT_DIGIT_MAX 7
  6. #define UCHAR_DIGIT_MAX 5
  7. #define WM_ADDWINSTATION (WM_USER + 0)
  8. #define WM_LISTINITERROR (WM_USER + 1)
  9. #define WM_EDITSETFIELDSERROR (WM_USER + 2)
  10. #define WM_ASYNCTESTERROR (WM_USER + 3)
  11. #define WM_ASYNCTESTABORT (WM_USER + 4)
  12. #define WM_ASYNCTESTSTATUSREADY (WM_USER + 5)
  13. #define WM_ASYNCTESTINPUTREADY (WM_USER + 6)
  14. #define WM_ASYNCTESTWRITECHAR (WM_USER + 7)
  15. #define NUM_LEDS 6
  16. #define MAX_COMMAND_LEN 255
  17. ////////////////////////////////////////////////////////////////////////////////
  18. class CAsyncDlg
  19. {
  20. HWND m_hDlg;
  21. ICfgComp * m_pCfgcomp;
  22. INT_PTR m_nHexBase;
  23. TCHAR m_szWinstation[ WINSTATIONNAME_LENGTH + 1 ];
  24. TCHAR m_szWDName[ WDNAME_LENGTH + 1 ];
  25. INT m_nOldAsyncDeviceNameSelection;
  26. INT m_nOldAsyncConnectType;
  27. INT m_nOldBaudRate;
  28. INT m_nOldModemCallBack;
  29. public:
  30. ASYNCCONFIG m_ac;
  31. ASYNCCONFIG m_oldAC;
  32. USERCONFIG m_uc;
  33. public:
  34. CAsyncDlg( );
  35. BOOL OnInitDialog( HWND , LPTSTR , LPTSTR , ICfgComp * );
  36. void OnClickedAsyncModemcallbackPhonenumberInherit( );
  37. void OnClickedAsyncModemcallbackInherit( );
  38. void OnClickedModemProperties();
  39. BOOL OnSelchangeAsyncDevicename( );
  40. BOOL OnSelchangeAsyncConnect();
  41. BOOL OnSelchangeAsyncModemcallback() ;
  42. void OnSelchangeAsyncModemcallbackPhoneNumber() ;
  43. BOOL OnSelchangeAsyncBaudrate();
  44. BOOL OnCommand( WORD , WORD , HWND , PBOOL );
  45. HRESULT SetDefaults( );
  46. HRESULT DoAsyncAdvance( );
  47. BOOL DoAsyncTest( );
  48. BOOL AsyncRelease( );
  49. BOOL GetAsyncFields(ASYNCCONFIG& AsyncConfig,USERCONFIG UsrCfg);
  50. HRESULT SetAsyncFields(ASYNCCONFIG& AsyncConfig , PUSERCONFIG );
  51. };
  52. ////////////////////////////////////////////////////////////////////////////////
  53. class CAdvancedAsyncDlg
  54. {
  55. /*
  56. * Member variables.
  57. */
  58. public:
  59. ASYNCCONFIG m_Async;
  60. BOOL m_bReadOnly;
  61. BOOL m_bModem;
  62. INT_PTR m_nHexBase;
  63. ULONG m_nWdFlag;
  64. HWND m_hDlg;
  65. ICfgComp *m_pCfgcomp;
  66. /*
  67. * Implementation.
  68. */
  69. public:
  70. CAdvancedAsyncDlg();
  71. static INT_PTR CALLBACK DlgProc( HWND , UINT , WPARAM , LPARAM );
  72. BOOL OnCommand( WORD , WORD , HWND );
  73. int GetCheckedRadioButton( int , int );
  74. BOOL OnInitDialog( HWND hDlg , WPARAM wp , LPARAM lp );
  75. /*
  76. * Operations.
  77. */
  78. protected:
  79. BOOL HandleEnterEscKey(int nID);
  80. void SetFields();
  81. void SetHWFlowText();
  82. void SetGlobalFields();
  83. void SetHWFields();
  84. void SetSWFields();
  85. BOOL GetFields();
  86. void GetFlowControlFields();
  87. BOOL GetGlobalFields();
  88. BOOL GetHWFields();
  89. BOOL GetSWFields( BOOL bValidate );
  90. /*
  91. * Message map / commands.
  92. */
  93. protected:
  94. void OnClickedAsyncAdvancedFlowcontrolHardware();
  95. void OnClickedAsyncAdvancedFlowcontrolSoftware();
  96. void OnClickedAsyncAdvancedFlowcontrolNone();
  97. void OnClickedAsyncAdvancedBasedec();
  98. void OnClickedAsyncAdvancedBasehex();
  99. void OnCloseupAsyncAdvancedHwrx();
  100. void OnSelchangeAsyncAdvancedHwrx();
  101. void OnCloseupAsyncAdvancedHwtx();
  102. void OnSelchangeAsyncAdvancedHwtx();
  103. void OnOK();
  104. void OnCancel();
  105. };
  106. ////////////////////////////////////////////////////////////////////////////////
  107. class cwnd
  108. {
  109. public:
  110. HWND m_hWnd;
  111. WNDPROC m_oldproc;
  112. };
  113. ////////////////////////////////////////////////////////////////////////////////
  114. // CEchoEditControl class
  115. //
  116. class CEchoEditControl : public cwnd
  117. {
  118. friend class CAsyncTestDlg;
  119. /*
  120. * Member variables.
  121. */
  122. public:
  123. BOOL m_bProcessingOutput;
  124. HWND m_hDlg;
  125. int m_FontHeight;
  126. int m_FontWidth;
  127. int m_FormatOffsetX;
  128. int m_FormatOffsetY;
  129. /*
  130. * Message map / commands.
  131. */
  132. void OnChar (UINT nChar, UINT nRepCnt, UINT nFlags);
  133. void SubclassDlgItem( HWND , int );
  134. static LRESULT CALLBACK WndProc( HWND , UINT , WPARAM , LPARAM );
  135. }; // end CEchoEditControl class interface
  136. ////////////////////////////////////////////////////////////////////////////////
  137. // CLed class
  138. //
  139. class CLed : public cwnd
  140. {
  141. private:
  142. HBRUSH m_hBrush;
  143. BOOL m_bOn;
  144. /*
  145. * Implementation.
  146. */
  147. public:
  148. CLed( HBRUSH hBrush );
  149. /*
  150. * Operations.
  151. */
  152. public:
  153. void Subclass( HWND , int );
  154. void Update(int nOn);
  155. void Toggle();
  156. /*
  157. * Message map / commands.
  158. */
  159. void OnPaint( HWND );
  160. static LRESULT CALLBACK WndProc( HWND , UINT , WPARAM , LPARAM );
  161. };
  162. ////////////////////////////////////////////////////////////////////////////////
  163. class CThread
  164. {
  165. /*
  166. * Member variables.
  167. */
  168. public:
  169. HANDLE m_hThread;
  170. DWORD m_dwThreadID;
  171. /*
  172. * Implementation
  173. */
  174. public:
  175. virtual ~CThread();
  176. CThread();
  177. static DWORD __stdcall ThreadEntryPoint(LPVOID lpParam);
  178. virtual DWORD RunThread() = 0;
  179. /*
  180. * Operations: primary thread
  181. */
  182. HANDLE CreateThread( DWORD cbStack = 0 , DWORD fdwCreate = 0 );
  183. }; // end CThread class interface
  184. ////////////////////////////////////////////////////////////////////////////////
  185. // CATDlgInputThread class
  186. //
  187. #define MAX_STATUS_SEMAPHORE_COUNT 1
  188. #define MAX_SLEEP_COUNT 10
  189. class CATDlgInputThread : public CThread
  190. {
  191. /*
  192. * Member variables.
  193. */
  194. public:
  195. HWND m_hDlg;
  196. HANDLE m_hDevice;
  197. ASYNCCONFIG m_ac;
  198. PROTOCOLSTATUS m_Status;
  199. BYTE m_Buffer[MAX_COMMAND_LEN+1];
  200. DWORD m_BufferBytes;
  201. DWORD m_ErrorStatus;
  202. HANDLE m_hConsumed;
  203. BOOL m_bExit;
  204. DWORD m_EventMask;
  205. OVERLAPPED m_OverlapSignal;
  206. OVERLAPPED m_OverlapRead;
  207. /*
  208. * Implementation
  209. */
  210. CATDlgInputThread();
  211. virtual ~CATDlgInputThread();
  212. virtual DWORD RunThread();
  213. /*
  214. * Operations: primary thread.
  215. */
  216. void SignalConsumed();
  217. void ExitThread();
  218. /*
  219. * Operations: secondary thread.
  220. */
  221. void NotifyAbort( UINT idError );
  222. int CommInputNotify();
  223. int CommStatusAndNotify();
  224. int PostInputRead();
  225. int PostStatusRead();
  226. }; // end CATDlgInputThread class interface
  227. ///////////////////////////////////////////////////////////////////////////////
  228. // CAsyncTestDlg class
  229. //
  230. class CAsyncTestDlg
  231. {
  232. /*
  233. * Member variables.
  234. */
  235. HWND m_hDlg;
  236. ICfgComp * m_pCfgComp;
  237. public:
  238. ASYNCCONFIG m_ac;
  239. PDCONFIG m_PdConfig1;
  240. PWINSTATIONNAME m_pWSName;
  241. CEchoEditControl m_EditControl;
  242. protected:
  243. HANDLE m_hDevice;
  244. HBRUSH m_hRedBrush;
  245. UINT_PTR m_LEDToggleTimer;
  246. PROTOCOLSTATUS m_Status;
  247. CATDlgInputThread *m_pATDlgInputThread;
  248. OVERLAPPED m_OverlapWrite;
  249. BYTE m_Buffer[MAX_COMMAND_LEN+1];
  250. INT_PTR m_CurrentPos;
  251. DWORD m_BufferBytes;
  252. TCHAR m_szModemInit[MAX_COMMAND_LEN+1];
  253. TCHAR m_szModemDial[MAX_COMMAND_LEN+1];
  254. TCHAR m_szModemListen[MAX_COMMAND_LEN+1];
  255. HANDLE m_hModem;
  256. BOOL m_bDeletedWinStation;
  257. CLed * m_pLeds[NUM_LEDS];
  258. WINSTATIONCONFIG2 m_WSConfig;
  259. /*
  260. * Implementation.
  261. */
  262. public:
  263. CAsyncTestDlg(ICfgComp * pCfgComp = NULL);
  264. ~CAsyncTestDlg();
  265. /*
  266. * Operations.
  267. */
  268. void NotifyAbort( UINT idError );
  269. BOOL DeviceSetParams();
  270. BOOL DeviceWrite();
  271. void SetInfoFields( PPROTOCOLSTATUS pCurrent, PPROTOCOLSTATUS pNew );
  272. void OutputToEditControl( BYTE *pBuffer, int *pIndex );
  273. /*
  274. * Message map / commands.
  275. */
  276. BOOL OnInitDialog( HWND hDlg , WPARAM wp , LPARAM lp );
  277. BOOL OnCommand( WORD , WORD , HWND );
  278. void OnTimer(UINT nIDEvent);
  279. LRESULT OnAsyncTestError(WPARAM wParam, LPARAM lParam);
  280. LRESULT OnAsyncTestAbort(WPARAM wParam, LPARAM lParam);
  281. LRESULT OnAsyncTestStatusReady(WPARAM wParam, LPARAM lParam);
  282. LRESULT OnAsyncTestInputReady(WPARAM wParam, LPARAM lParam);
  283. LRESULT OnAsyncTestWriteChar(WPARAM wParam, LPARAM lParam);
  284. void OnClickedAtdlgModemDial();
  285. void OnClickedAtdlgModemInit();
  286. void OnClickedAtdlgModemListen();
  287. void OnNcDestroy();
  288. cwnd *GetDlgItem( int nRes );
  289. static INT_PTR CALLBACK DlgProc( HWND , UINT , WPARAM , LPARAM );
  290. }; // end CAsyncTestDlg class interface
  291. #define ASYNC_LED_TOGGLE_MSEC 200
  292. #endif // _ASYNCDLG_H