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.

480 lines
15 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // File: dialogs.h
  4. //
  5. // Module: CMDIAL32.DLL
  6. //
  7. // Synopsis: This header contains definitions for the dialog UI code.
  8. //
  9. // Copyright (c) 1996-1999 Microsoft Corporation
  10. //
  11. // Author: quintinb Created Header 08/17/99
  12. //
  13. //+----------------------------------------------------------------------------
  14. #include "cm_misc.h"
  15. #include "ModalDlg.h"
  16. //+---------------------------------------------------------------------------
  17. //
  18. // class CInetSignInDlg
  19. //
  20. // Description: The standalone "Internet Sign-In" dlg
  21. //
  22. // History: fengsun Created 10/30/97
  23. //
  24. //----------------------------------------------------------------------------
  25. class CInetSignInDlg : public CModalDlg
  26. {
  27. public:
  28. CInetSignInDlg(ArgsStruct * pArgs);
  29. virtual void OnOK();
  30. virtual BOOL OnInitDialog();
  31. virtual DWORD OnOtherCommand(WPARAM wParam, LPARAM lParam );
  32. protected:
  33. ArgsStruct *m_pArgs; // pointer to the huge structure
  34. static const DWORD m_dwHelp[]; // help id pairs
  35. };
  36. inline CInetSignInDlg::CInetSignInDlg(ArgsStruct * pArgs) : CModalDlg(m_dwHelp, pArgs->pszHelpFile)
  37. {
  38. MYDBGASSERT(pArgs);
  39. m_pArgs = pArgs;
  40. }
  41. //+---------------------------------------------------------------------------
  42. //
  43. // class CPropertiesPage
  44. //
  45. // Description: A general properties property page class
  46. //
  47. // History: fengsun Created 10/30/97
  48. //
  49. //----------------------------------------------------------------------------
  50. class CPropertiesPage : public CWindowWithHelp
  51. {
  52. friend class CPropertiesSheet;
  53. public:
  54. CPropertiesPage(UINT nIDTemplate, const DWORD* pHelpPairs = NULL,
  55. const TCHAR* lpszHelpFile = NULL);
  56. CPropertiesPage(LPCTSTR lpszTemplateName, const DWORD* pHelpPairs = NULL,
  57. const TCHAR* lpszHelpFile = NULL);
  58. virtual BOOL OnInitDialog(); // WM_INITDIALOG
  59. virtual DWORD OnCommand(WPARAM wParam, LPARAM lParam ); // WM_COMMAND
  60. virtual BOOL OnSetActive(); // PSN_SETACTIVE
  61. virtual BOOL OnKillActive(); // PSN_KILLACTIVE
  62. virtual void OnApply(); // PSN_APPLY
  63. virtual void OnReset(); // PSN_RESET
  64. // If the derived class need to overwrite thses help function, make this virtual
  65. void OnPsnHelp(HWND hwndFrom, UINT_PTR idFrom); // PSN_HELP
  66. virtual DWORD OnOtherMessage(UINT uMsg, WPARAM wParam, LPARAM lParam );
  67. protected:
  68. LPCTSTR m_pszTemplate; // the resource ID
  69. protected:
  70. void SetPropSheetResult(DWORD dwResult);
  71. static INT_PTR CALLBACK PropPageProc(HWND hwndDlg,UINT uMsg,WPARAM wParam, LPARAM lParam);
  72. };
  73. //+---------------------------------------------------------------------------
  74. //
  75. // class CPropertiesSheet
  76. //
  77. // Description: The properties property page class
  78. //
  79. // History: fengsun Created 10/30/97
  80. //
  81. //----------------------------------------------------------------------------
  82. class CPropertiesSheet
  83. {
  84. public:
  85. CPropertiesSheet(ArgsStruct *pArgs);
  86. void AddPage(const CPropertiesPage* pPage);
  87. void AddExternalPage(PROPSHEETPAGE *pPsp);
  88. BOOL HasPage(const CPropertiesPage* pPage) const;
  89. int DoPropertySheet(HWND hWndParent, LPTSTR pszCaption, HINSTANCE hInst);
  90. protected:
  91. enum {MAX_PAGES = 6};
  92. enum {CPROP_SHEET_TYPE_INTERNAL = 0,
  93. CPROP_SHEET_TYPE_EXTERNAL = 1};
  94. PROPSHEETHEADER m_psh; // propertysheet header
  95. PROPSHEETPAGE m_pages[MAX_PAGES]; // property pages array
  96. DWORD m_adwPageType[MAX_PAGES]; // property page type
  97. UINT m_numPages; // number of property pages
  98. ArgsStruct *m_pArgs;
  99. public:
  100. TCHAR* m_lpszServiceName; // the profile name, used as the mutex name for OK
  101. protected:
  102. static LRESULT CALLBACK SubClassPropSheetProc(HWND hwnd, UINT uMsg, WPARAM wParam,LPARAM lParam);
  103. static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam);
  104. static WNDPROC m_pfnOrgPropSheetProc; // Original propertysheet wnd proc before subclass
  105. // pointer to the property sheet which can be accessed by static function.
  106. // Not works quite safe, if there are multiple instance of CPropertySheet.
  107. // Should be protected by CriticalSection.
  108. static CPropertiesSheet* m_pThis;
  109. };
  110. //
  111. // Inline functions
  112. //
  113. inline CPropertiesSheet::CPropertiesSheet(ArgsStruct *pArgs)
  114. {
  115. m_pArgs = pArgs;
  116. MYDBGASSERT(m_pArgs);
  117. ZeroMemory(m_pages, sizeof(m_pages));
  118. m_numPages = 0;
  119. ZeroMemory((LPVOID)m_adwPageType, sizeof(m_adwPageType));
  120. }
  121. inline void CPropertiesPage::SetPropSheetResult(DWORD dwResult)
  122. {
  123. SetWindowLongU(m_hWnd, DWLP_MSGRESULT, (LONG_PTR)dwResult);
  124. }
  125. class CInetPage;
  126. //+---------------------------------------------------------------------------
  127. //
  128. // class CGeneralPage
  129. //
  130. // Description: A dialing property page class
  131. //
  132. // History: fengsun Created 10/30/97
  133. //
  134. //----------------------------------------------------------------------------
  135. class CGeneralPage :public CPropertiesPage
  136. {
  137. public:
  138. CGeneralPage(ArgsStruct* pArgs, UINT nIDTemplate);
  139. void SetEventListener(CInetPage* pEventListener) {m_pEventListener = pEventListener;}
  140. protected:
  141. virtual BOOL OnInitDialog();
  142. virtual DWORD OnCommand(WPARAM wParam, LPARAM lParam );
  143. virtual void OnApply();
  144. virtual BOOL OnKillActive(); // PSN_KILLACTIVE
  145. void OnDialingProperties();
  146. void OnPhoneBookButton(UINT nPhoneIdx);
  147. BOOL DisplayMungedPhone(UINT uiPhoneIdx);
  148. BOOL CheckTapi(TapiLinkageStruct *ptlsTapiLink, HINSTANCE hInst);
  149. DWORD InitDialInfo();
  150. void EnableDialupControls(BOOL fEnable);
  151. void ClearUseDialingRules(int iPhoneNdx);
  152. void UpdateDialingRulesButton(void);
  153. void UpdateNumberDescription(int nPhoneIdx, LPCTSTR pszDesc);
  154. //
  155. // Access Points
  156. //
  157. void UpdateForNewAccessPoint(BOOL fSetPhoneNumberDescriptions);
  158. BOOL AccessPointInfoChanged();
  159. void DeleteAccessPoint();
  160. void AddNewAPToReg(LPTSTR pszNewAPName, BOOL fRefreshUiWwithCurrentValues);
  161. virtual DWORD OnOtherMessage(UINT uMsg, WPARAM wParam, LPARAM lParam );
  162. enum {WM_INITDIALINFO = WM_USER+1}; // message posted to itself to load dial info
  163. protected:
  164. ArgsStruct* m_pArgs; // pointer to the huge structure
  165. PHONEINFO m_DialInfo[MAX_PHONE_NUMBERS]; // local copy of dial info,
  166. UINT m_NumPhones; // Number of phone # to display (1 for connectoid dialing)
  167. TCHAR m_szDeviceName[RAS_MaxDeviceName+1]; // modem device name
  168. TCHAR m_szDeviceType[RAS_MaxDeviceName+1]; // device type
  169. CInetPage* m_pEventListener; // the object to receive event on this page
  170. BOOL m_bDialInfoInit; // whether we have loaded dialing information
  171. static const DWORD m_dwHelp[]; // help id pairs
  172. BOOL m_bAPInfoChanged; // whether Access point information has changed
  173. protected:
  174. static LRESULT CALLBACK SubClassEditProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  175. static WNDPROC m_pfnOrgEditWndProc; // the original phone # edit window proc for subclassing
  176. };
  177. //+---------------------------------------------------------------------------
  178. //
  179. // class CInetPage
  180. //
  181. // Description: The internet sign-on property page class
  182. //
  183. // History: fengsun Created 10/30/97
  184. //
  185. //----------------------------------------------------------------------------
  186. class CInetPage :public CPropertiesPage
  187. {
  188. public:
  189. CInetPage(ArgsStruct* pArgs, UINT nIDTemplate);
  190. void OnGeneralPageKillActive(BOOL fDirect);
  191. //
  192. // The following functions are shared with CInetSignInDlg,
  193. // For simplicity, we makes them static member function of class CInetPage
  194. // instead of having another class
  195. //
  196. static void OnInetInit(HWND hwndDlg, ArgsStruct *pArgs);
  197. static void OnInetOk(HWND hwndDlg, ArgsStruct *pArgs);
  198. static void AdjustSavePasswordCheckBox(HWND hwndCheckBox, BOOL fEmptyPassword,
  199. BOOL fDialAutomatically, BOOL fPasswordOptional);
  200. protected:
  201. virtual BOOL OnInitDialog();
  202. virtual DWORD OnCommand(WPARAM wParam, LPARAM lParam );
  203. virtual void OnApply();
  204. virtual BOOL OnSetActive(); // PSN_SETACTIVE
  205. protected:
  206. ArgsStruct* m_pArgs;// pointer to the huge structure
  207. BOOL m_fDirect; // the current connection type selection in General page
  208. BOOL m_fPasswordOptional; // whether the PasswordOptional flag is set in
  209. // the profile
  210. static const DWORD m_dwHelp[]; // help id pairs
  211. };
  212. //+---------------------------------------------------------------------------
  213. //
  214. // class COptionPage
  215. //
  216. // Description: The options property page class
  217. //
  218. // History: fengsun Created 10/30/97
  219. //
  220. //----------------------------------------------------------------------------
  221. class COptionPage :public CPropertiesPage
  222. {
  223. public:
  224. COptionPage(ArgsStruct* pArgs, UINT nIDTemplate);
  225. protected:
  226. virtual BOOL OnInitDialog();
  227. virtual DWORD OnCommand(WPARAM wParam, LPARAM lParam ); // WM_COMMAND
  228. virtual void OnApply();
  229. void InitIdleTimeList(HWND hwndList, DWORD dwMinutes);
  230. DWORD GetIdleTimeList(HWND hwndList);
  231. BOOL ToggleLogging();
  232. protected:
  233. ArgsStruct* m_pArgs; // pointer to the huge structure
  234. BOOL m_fEnableLog; // is logging enabled
  235. static const DWORD m_dwHelp[]; // help id pairs
  236. static const DWORD m_adwTimeConst[]; // = {0,1, 5, 10, 30, 1*60, 2*60, 4*60, 24*60};
  237. static const int m_nTimeConstElements;// = sizeof(adwTimeConst)/sizeof(adwTimeConst[0]);
  238. };
  239. //+---------------------------------------------------------------------------
  240. //
  241. // class CVpnPage
  242. //
  243. // Description: The VPN property page class
  244. //
  245. // History: quintinb Created 10/26/00
  246. //
  247. //----------------------------------------------------------------------------
  248. class CVpnPage :public CPropertiesPage
  249. {
  250. public:
  251. CVpnPage(ArgsStruct* pArgs, UINT nIDTemplate);
  252. protected:
  253. virtual BOOL OnInitDialog();
  254. virtual void OnApply();
  255. protected:
  256. ArgsStruct* m_pArgs; // pointer to the huge structure
  257. static const DWORD m_dwHelp[]; // help id pairs
  258. };
  259. //+---------------------------------------------------------------------------
  260. //
  261. // class CAboutPage
  262. //
  263. // Description: The about property page class
  264. //
  265. // History: fengsun Created 10/30/97
  266. //
  267. //----------------------------------------------------------------------------
  268. class CAboutPage :public CPropertiesPage
  269. {
  270. public:
  271. CAboutPage(ArgsStruct* pArgs, UINT nIDTemplate);
  272. protected:
  273. virtual BOOL OnInitDialog();
  274. virtual BOOL OnSetActive();
  275. virtual BOOL OnKillActive();
  276. virtual void OnApply();
  277. virtual void OnReset();
  278. virtual DWORD OnOtherMessage(UINT uMsg, WPARAM wParam, LPARAM lParam );
  279. protected:
  280. ArgsStruct *m_pArgs; // pointer to the huge structure
  281. };
  282. //+---------------------------------------------------------------------------
  283. //
  284. // class CChangePasswordDlg
  285. //
  286. // Description: The network change password dlg
  287. //
  288. // History: v-vijayb Created 7/3/99
  289. //
  290. //----------------------------------------------------------------------------
  291. class CChangePasswordDlg : public CModalDlg
  292. {
  293. public:
  294. CChangePasswordDlg(ArgsStruct *pArgs);
  295. virtual void OnOK();
  296. virtual void OnCancel();
  297. virtual BOOL OnInitDialog();
  298. virtual DWORD OnOtherCommand(WPARAM wParam, LPARAM lParam );
  299. protected:
  300. ArgsStruct *m_pArgs;
  301. };
  302. inline CChangePasswordDlg::CChangePasswordDlg(ArgsStruct *pArgs) : CModalDlg()
  303. {
  304. MYDBGASSERT(pArgs);
  305. m_pArgs = pArgs;
  306. }
  307. //+---------------------------------------------------------------------------
  308. //
  309. // class CCallbackNumberDlg
  310. //
  311. // Description: Emulation of the RAS Callback Number dialog
  312. //
  313. // History: nickball Created 3/1/00
  314. //
  315. //----------------------------------------------------------------------------
  316. class CCallbackNumberDlg : public CModalDlg
  317. {
  318. public:
  319. CCallbackNumberDlg(ArgsStruct *pArgs);
  320. virtual void OnOK();
  321. virtual void OnCancel();
  322. virtual BOOL OnInitDialog();
  323. virtual DWORD OnOtherCommand(WPARAM wParam, LPARAM lParam );
  324. protected:
  325. ArgsStruct *m_pArgs;
  326. };
  327. inline CCallbackNumberDlg::CCallbackNumberDlg(ArgsStruct *pArgs) : CModalDlg()
  328. {
  329. MYDBGASSERT(pArgs);
  330. m_pArgs = pArgs;
  331. }
  332. //+---------------------------------------------------------------------------
  333. //
  334. // class CRetryAuthenticationDlg
  335. //
  336. // Description: Emulation of the RAS Retry authentication dialog
  337. //
  338. // History: nickball Created 3/1/00
  339. //
  340. //----------------------------------------------------------------------------
  341. class CRetryAuthenticationDlg : public CModalDlg
  342. {
  343. public:
  344. CRetryAuthenticationDlg(ArgsStruct *pArgs);
  345. virtual void OnOK();
  346. virtual void OnCancel();
  347. virtual BOOL OnInitDialog();
  348. virtual DWORD OnOtherCommand(WPARAM wParam, LPARAM lParam );
  349. virtual UINT GetDlgTemplate();
  350. protected:
  351. ArgsStruct *m_pArgs;
  352. BOOL m_fInetCredentials;
  353. static const DWORD m_dwHelp[]; // help id pairs
  354. };
  355. inline CRetryAuthenticationDlg::CRetryAuthenticationDlg(ArgsStruct *pArgs)
  356. : CModalDlg(m_dwHelp, pArgs->pszHelpFile)
  357. {
  358. MYDBGASSERT(pArgs);
  359. m_pArgs = pArgs;
  360. if (m_pArgs)
  361. {
  362. //
  363. // If the phone number calls for a tunnel, and we're not using
  364. // UseSameUserName and we're not actively dialing the tunnel,
  365. // then we must be dialing the Inet portion of the connection.
  366. //
  367. m_fInetCredentials = (!m_pArgs->fUseSameUserName &&
  368. !IsDialingTunnel(m_pArgs) &&
  369. UseTunneling(m_pArgs, m_pArgs->nDialIdx));
  370. }
  371. }
  372. //+---------------------------------------------------------------------------
  373. //
  374. // class CNewAccessPointDlg
  375. //
  376. // Description: Dialog to get the name of a new Access Point from the user
  377. //
  378. // History: t-urama Created 8/2/00
  379. //
  380. //----------------------------------------------------------------------------
  381. class CNewAccessPointDlg : public CModalDlg
  382. {
  383. public:
  384. CNewAccessPointDlg(ArgsStruct *pArgs, LPTSTR *ppAPName);
  385. virtual void OnOK();
  386. virtual BOOL OnInitDialog();
  387. virtual DWORD OnOtherCommand(WPARAM wParam, LPARAM lParam );
  388. protected:
  389. LPTSTR *m_ppszAPName;
  390. ArgsStruct *m_pArgs;
  391. static LRESULT CALLBACK SubClassEditProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  392. static WNDPROC m_pfnOrgEditWndProc; // the original edit control window proc for subclassing
  393. };
  394. inline CNewAccessPointDlg::CNewAccessPointDlg(ArgsStruct *pArgs, LPTSTR *ppszAPName) : CModalDlg()
  395. {
  396. MYDBGASSERT(pArgs);
  397. m_pArgs = pArgs;
  398. m_ppszAPName = ppszAPName;
  399. }