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.

341 lines
14 KiB

  1. #ifndef _INC_ICWWIZ_H
  2. #define _INC_ICWWIZ_H
  3. #include "ids.h"
  4. class CICWApprentice;
  5. interface IAccountImport;
  6. interface IAccountImport2;
  7. interface INewsGroupImport;
  8. class CAccount;
  9. class CAccountManager;
  10. interface IUserIdentity;
  11. #define WM_POSTSETFOCUS (WM_USER + 1)
  12. #define WM_ENABLENEXT (WM_USER + 2)
  13. #define WM_AUTODISCOVERY_FINISHED (WM_USER + 3)
  14. #define WM_AUTODISCOVERY_STATUSMSG (WM_USER + 4)
  15. // AutoDiscovery reserves (WM_USER+3) thru (WM_USER+13)
  16. #define WM_AUTODISCOVERY_RANGEEND (WM_USER + 13)
  17. #define CONNECT_DLG ((UINT)-3)
  18. #define EXTERN_DLG ((UINT)-2)
  19. #define INNER_DLG ((UINT)-1)
  20. #define NAME_PAGE 0x0001
  21. #define ADDR_PAGE 0x0002
  22. #define SRV_PAGE 0x0004
  23. #define LOGON_PAGE 0x0008
  24. #define RESOLVE_PAGE 0x0010
  25. #define CONNECT_PAGE 0x0020
  26. #define CONFIRM_PAGE 0x0040
  27. #define ALL_PAGE 0x007f
  28. #define SELECT_PAGE 0x0100
  29. #define NOSEL -2
  30. #define CREATENEW -1
  31. typedef struct tagACCTDATA
  32. {
  33. BOOL fLogon;
  34. BOOL fSPA;
  35. BOOL fResolve; // ldap only
  36. DWORD fServerTypes; // SRV_NNTP | SRV_IMAP | SRV_POP3 | SRV_SMTP | SRV_LDAP | SRV_HTTPMAIL
  37. char szAcctOrig[CCHMAX_ACCOUNT_NAME];
  38. char szAcct[CCHMAX_ACCOUNT_NAME];
  39. char szName[CCHMAX_DISPLAY_NAME];
  40. char szEmail[CCHMAX_EMAIL_ADDRESS];
  41. char szSvr1[CCHMAX_SERVER_NAME]; // pop3/imap, nntp, ldap
  42. char szSvr2[CCHMAX_SERVER_NAME]; // smtp
  43. char szUsername[CCHMAX_USERNAME];
  44. char szPassword[CCHMAX_PASSWORD];
  45. DWORD fAlwaysPromptPassword; // "Always Prompt for Password" option
  46. DWORD dwConnect;
  47. char szConnectoid[MAX_PATH];
  48. CAccount *pAcct;
  49. BOOL fCreateNewAccount;
  50. char szFriendlyServiceName[CCHMAX_ACCOUNT_NAME];
  51. BOOL fDomainMSN;
  52. int iServiceIndex;
  53. int iNewServiceIndex;
  54. } ACCTDATA;
  55. // CICWApprentice::m_dwFlags
  56. // these shouldn't conflict with the ACCT_WIZ_ flags from imnact.h
  57. #define ACCT_WIZ_IN_ICW 0x0100 // we are within the ICW (in apprentice mode)
  58. // if this isn't on, we own the wizard and ICW is within us
  59. #define ACCT_WIZ_IMPORT_CLIENT 0x0200 // we are importing acct from specific client
  60. // outlook uses this (passes in clsid for desired client)
  61. #define SZ_REGKEY_AUTODISCOVERY TEXT("SOFTWARE\\Microsoft\\Outlook Express\\5.0")
  62. #define SZ_REGKEY_AUTODISCOVERY_POLICY TEXT("SOFTWARE\\Policies\\Microsoft\\Windows")
  63. #define SZ_REGVALUE_AUTODISCOVERY TEXT("AutoDiscovery")
  64. #define SZ_REGVALUE_AUTODISCOVERY_POLICY TEXT("AutoDiscovery Policy")
  65. #define SZ_REGVALUE_AUTODISCOVERY_PASSIFIER TEXT("ADInform")
  66. #define SZ_REGVALUE_AUTODISCOVERY_OEMANUAL TEXT("OEManuallyConfigure")
  67. HRESULT CreateNewsObject(void **ppNews);
  68. typedef BOOL (CALLBACK* INITPROC)(CICWApprentice *,HWND,BOOL);
  69. typedef BOOL (CALLBACK* OKPROC)(CICWApprentice *,HWND,BOOL,UINT *);
  70. typedef BOOL (CALLBACK* CMDPROC)(CICWApprentice *,HWND,WPARAM,LPARAM);
  71. typedef BOOL (CALLBACK* WMUSERPROC)(CICWApprentice *,HWND,UINT,WPARAM,LPARAM);
  72. typedef BOOL (CALLBACK* CANCELPROC)(CICWApprentice *,HWND);
  73. typedef struct tagPAGEINFO
  74. {
  75. UINT uDlgID;
  76. UINT uHdrID; // string id for title
  77. // handler procedures for each page-- any of these can be
  78. // NULL in which case the default behavior is used
  79. INITPROC InitProc;
  80. OKPROC OKProc;
  81. CMDPROC CmdProc;
  82. WMUSERPROC WMUserProc;
  83. CANCELPROC CancelProc;
  84. DWORD dwHelp;
  85. } PAGEINFO;
  86. typedef struct tagDLGINITINFO
  87. {
  88. CICWApprentice *pApp;
  89. int ord;
  90. } DLGINITINFO;
  91. typedef struct tagMIGRATEINFO
  92. {
  93. IAccountImport *pImp;
  94. IAccountImport2 *pImp2;
  95. int cAccts;
  96. TCHAR szDisplay[MAX_PATH];
  97. } MIGRATEINFO;
  98. #define CCHMAX_SERVICENAME 255
  99. typedef struct tagHTTPMAILSERVICEINFO
  100. {
  101. TCHAR szFriendlyName[CCHMAX_SERVICENAME];
  102. TCHAR szDomain[CCHMAX_SERVICENAME];
  103. TCHAR szRootUrl[MAX_PATH];
  104. TCHAR szSignupUrl[MAX_PATH];
  105. BOOL fDomainMSN;
  106. BOOL fHTTPEnabled;
  107. BOOL fUseWizard;
  108. } HTTPMAILSERVICE;
  109. class CICWApprentice : public IICWApprentice, public IICWExtension
  110. {
  111. private:
  112. ULONG m_cRef;
  113. BOOL m_fInit;
  114. BOOL m_fReboot;
  115. IICWExtension *m_pExt;
  116. const PAGEINFO *m_pPageInfo;
  117. DLGINITINFO *m_pInitInfo;
  118. UINT m_cPages;
  119. UINT m_idPrevPage;
  120. UINT m_idNextPage;
  121. UINT m_iCurrentPage;
  122. UINT m_iPageHistory[NUM_WIZARD_PAGES];
  123. UINT m_cPagesCompleted;
  124. HWND m_hDlg;
  125. UINT m_cPageBuf;
  126. HPROPSHEETPAGE *m_rgPage;
  127. UINT m_extFirstPage;
  128. UINT m_extLastPage;
  129. CAccountManager *m_pAcctMgr;
  130. DWORD m_dwFlags;
  131. IICWApprentice *m_pICW;
  132. ACCTTYPE m_acctType;
  133. BOOL m_fSave;
  134. BOOL m_fSkipICW;
  135. DWORD m_dwReload;
  136. int m_iSel;
  137. BOOL m_fComplete;
  138. ACCTDATA *m_pData;
  139. HTTPMAILSERVICE *m_pHttpServices;
  140. UINT m_cHttpServices;
  141. HTTPMAILSERVICE *m_pServices;
  142. UINT m_cServices;
  143. void InitializeICW(ACCTTYPE type, UINT uPrev, UINT uNext);
  144. HRESULT InitializeMigration(DWORD dwFlags);
  145. HRESULT InitializeImport(CLSID clsid, DWORD dwFlags);
  146. public:
  147. MIGRATEINFO *m_pMigInfo;
  148. int m_cMigInfo;
  149. int m_iMigInfo;
  150. BOOL m_fMigrate;
  151. CAccount *m_pAcct;
  152. BOOL m_fUseAutoDiscovery; // Use AutoDiscovery to streamline the wizard
  153. CICWApprentice(void);
  154. ~CICWApprentice(void);
  155. STDMETHODIMP QueryInterface(REFIID, LPVOID *);
  156. STDMETHODIMP_(ULONG) AddRef(void);
  157. STDMETHODIMP_(ULONG) Release(void);
  158. // IICWApprentice
  159. HRESULT STDMETHODCALLTYPE Initialize(IICWExtension *pExt);
  160. HRESULT STDMETHODCALLTYPE AddWizardPages(DWORD dwFlags);
  161. HRESULT STDMETHODCALLTYPE GetConnectionInformation(CONNECTINFO *pInfo);
  162. HRESULT STDMETHODCALLTYPE SetConnectionInformation(CONNECTINFO *pInfo);
  163. HRESULT STDMETHODCALLTYPE Save(HWND hwnd, DWORD *pdwError);
  164. HRESULT STDMETHODCALLTYPE SetPrevNextPage(UINT uPrevPage, UINT uNextPage);
  165. // IICWExtension
  166. BOOL STDMETHODCALLTYPE AddExternalPage(HPROPSHEETPAGE hPage, UINT uDlgID);
  167. BOOL STDMETHODCALLTYPE RemoveExternalPage(HPROPSHEETPAGE hPage, UINT uDlgID);
  168. BOOL STDMETHODCALLTYPE ExternalCancel(CANCELTYPE type);
  169. BOOL STDMETHODCALLTYPE SetFirstLastPage(UINT uFirstPageDlgID, UINT uLastPageDlgID);
  170. HRESULT Initialize(CAccountManager *pAcctMgr, CAccount *pAcct);
  171. HRESULT DoWizard(HWND hwnd, CLSID *pclsid, DWORD dwFlags);
  172. UINT GetNextWizSection(void);
  173. HRESULT InitAccountData(CAccount *pAcct, IMPCONNINFO *pConnInfo, BOOL fMigrate);
  174. HRESULT SaveAccountData(CAccount *pAcct, BOOL fSetAsDefault);
  175. HRESULT HandleMigrationSelection(int index, UINT *puNextPage, HWND hDlg);
  176. HRESULT InitializeImportAccount(HWND hwnd, DWORD_PTR dwCookie);
  177. HRESULT InitHTTPMailServices();
  178. inline CAccountManager *GetAccountManager(void) {return(m_pAcctMgr);}
  179. inline ACCTTYPE GetAccountType(void) {return(m_acctType);}
  180. inline ACCTDATA *GetAccountData(void) {return(m_pData);}
  181. inline DWORD GetFlags(void) {return(m_dwFlags);}
  182. inline BOOL GetComplete(void) {return(m_fComplete);}
  183. inline UINT GetMigrateCount(void) {return(m_cMigInfo);}
  184. inline IICWApprentice *GetICW(void) {return(m_pICW);}
  185. inline BOOL GetSave(void) {return(m_fSave);}
  186. inline void SetSave(BOOL fSave) {m_fSave = fSave;}
  187. inline int GetSelection(void) {return(m_iSel);}
  188. inline void SetSelection(int iSel) {m_iSel = iSel;}
  189. inline BOOL NeedToReloadPage(DWORD dwPage) {return(!!(m_dwReload & dwPage));}
  190. inline void SetPageReloaded(DWORD dwPage) {m_dwReload &= ~dwPage;}
  191. inline void SetPageUnloaded(DWORD dwPage) {m_dwReload |= dwPage;}
  192. inline BOOL GetSkipICW(void) {return(m_fSkipICW);}
  193. inline void SetSkipICW(BOOL fSkip) {m_fSkipICW = fSkip;}
  194. inline DWORD CountHTTPMailServers(void) {return(m_cHttpServices);}
  195. inline HTTPMAILSERVICE *GetHTTPMailServices(void) {return(m_pHttpServices);}
  196. inline DWORD CountMailServers(void) {return(m_cServices);}
  197. inline HTTPMAILSERVICE *GetMailServices(void) {return(m_pServices);}
  198. friend INT_PTR CALLBACK GenDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  199. friend HRESULT GetMessageParams(HWND hDlg, CICWApprentice ** ppApp, LONG * pOrd, const PAGEINFO ** ppPageInfo);
  200. BOOLEAN IsInternetConnection(void)
  201. {
  202. BOOLEAN retval;
  203. ((m_dwFlags & ACCT_WIZ_INTERNETCONNECTION) == 0) ? (retval = FALSE) : (retval = TRUE);
  204. return retval;
  205. }
  206. };
  207. typedef HRESULT (*PFNSUBNEWSGROUP)(IUserIdentity *, IImnAccount *, LPCSTR);
  208. class CNewsGroupImport : public INewsGroupImport
  209. {
  210. private:
  211. IImnAccount *m_pAcct;
  212. ULONG m_cRef;
  213. public:
  214. CNewsGroupImport(void);
  215. ~CNewsGroupImport(void);
  216. // IUnknown methods.
  217. STDMETHODIMP QueryInterface(REFIID, LPVOID *);
  218. STDMETHODIMP_(ULONG) AddRef(void);
  219. STDMETHODIMP_(ULONG) Release(void);
  220. //INewsAccountImport methods
  221. HRESULT STDMETHODCALLTYPE Initialize(IImnAccount *pAcct);
  222. HRESULT STDMETHODCALLTYPE ImportSubList(LPCSTR pListGroups);
  223. };
  224. INT_PTR CALLBACK GenDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  225. BOOL CALLBACK MailPromptInitProc(CICWApprentice *pApp,HWND hDlg,BOOL fFirstInit);
  226. BOOL CALLBACK MailPromptOKProc(CICWApprentice *pApp,HWND hDlg,BOOL fForward,UINT * puNextPage);
  227. BOOL CALLBACK AcctInitProc(CICWApprentice *pApp,HWND hDlg,BOOL fFirstInit);
  228. BOOL CALLBACK AcctOKProc(CICWApprentice *pApp,HWND hDlg,BOOL fForward,UINT * puNextPage);
  229. BOOL CALLBACK AcctCmdProc(CICWApprentice *pApp,HWND hDlg,WPARAM wParam,LPARAM lParam);
  230. BOOL CALLBACK NameInitProc(CICWApprentice *pApp,HWND hDlg,BOOL fFirstInit);
  231. BOOL CALLBACK NameOKProc(CICWApprentice *pApp,HWND hDlg,BOOL fForward,UINT* puNextPage);
  232. BOOL CALLBACK NameCmdProc(CICWApprentice *pApp,HWND hDlg,WPARAM wParam,LPARAM lParam);
  233. BOOL CALLBACK AddressInitProc(CICWApprentice *pApp,HWND hDlg,BOOL fFirstInit);
  234. BOOL CALLBACK AddressOKProc(CICWApprentice *pApp,HWND hDlg,BOOL fForward,UINT* puNextPage);
  235. BOOL CALLBACK AddressCmdProc(CICWApprentice *pApp,HWND hDlg,WPARAM wParam,LPARAM lParam);
  236. BOOL CALLBACK ServerInitProc(CICWApprentice *pApp,HWND hDlg,BOOL fFirstInit);
  237. BOOL CALLBACK ServerOKProc(CICWApprentice *pApp,HWND hDlg,BOOL fForward,UINT* puNextPage);
  238. BOOL CALLBACK ServerCmdProc(CICWApprentice *pApp,HWND hDlg,WPARAM wParam,LPARAM lParam);
  239. BOOL CALLBACK LogonInitProc(CICWApprentice *pApp,HWND hDlg,BOOL fFirstInit);
  240. BOOL CALLBACK LogonOKProc(CICWApprentice *pApp,HWND hDlg,BOOL fForward,UINT* puNextPage);
  241. BOOL CALLBACK LogonCmdProc(CICWApprentice *pApp,HWND hDlg,WPARAM wParam,LPARAM lParam);
  242. BOOL CALLBACK ResolveInitProc(CICWApprentice *pApp,HWND hDlg,BOOL fFirstInit );
  243. BOOL CALLBACK ResolveOKProc(CICWApprentice *pApp,HWND hDlg,BOOL fForward,UINT * puNextPage);
  244. BOOL CALLBACK ResolveCmdProc(CICWApprentice *pApp,HWND hDlg,WPARAM wParam,LPARAM lParam);
  245. BOOL CALLBACK ConnectInitProc(CICWApprentice *pApp,HWND hDlg,BOOL fFirstInit);
  246. BOOL CALLBACK ConnectOKProc(CICWApprentice *pApp,HWND hDlg,BOOL fForward,UINT* puNextPage);
  247. BOOL CALLBACK ConnectCmdProc(CICWApprentice *pApp,HWND hDlg,WPARAM wParam,LPARAM lParam);
  248. BOOL CALLBACK CompleteInitProc(CICWApprentice *pApp,HWND hDlg,BOOL fFirstInit );
  249. BOOL CALLBACK CompleteOKProc(CICWApprentice *pApp,HWND hDlg,BOOL fForward,UINT * puNextPage);
  250. BOOL CALLBACK MigrateInitProc(CICWApprentice *pApp,HWND hDlg,BOOL fFirstInit);
  251. BOOL CALLBACK MigrateOKProc(CICWApprentice *pApp,HWND hDlg,BOOL fForward,UINT* puNextPage);
  252. BOOL CALLBACK SelectInitProc(CICWApprentice *pApp,HWND hDlg,BOOL fFirstInit );
  253. BOOL CALLBACK SelectOKProc(CICWApprentice *pApp,HWND hDlg,BOOL fForward,UINT * puNextPage);
  254. BOOL CALLBACK ConfirmInitProc(CICWApprentice *pApp,HWND hDlg,BOOL fFirstInit );
  255. BOOL CALLBACK ConfirmOKProc(CICWApprentice *pApp,HWND hDlg,BOOL fForward,UINT * puNextPage);
  256. BOOL CALLBACK AutoDiscoveryInitProc(CICWApprentice *pApp, HWND hDlg, BOOL fFirstInit);
  257. BOOL CALLBACK AutoDiscoveryOKProc(CICWApprentice *pApp, HWND hDlg, BOOL fForward, UINT *puNextPage);
  258. BOOL CALLBACK AutoDiscoveryCmdProc(CICWApprentice *pApp, HWND hDlg, WPARAM wParam, LPARAM lParam);
  259. BOOL CALLBACK AutoDiscoveryWMUserProc(CICWApprentice *pApp, HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  260. BOOL CALLBACK AutoDiscoveryCancelProc(CICWApprentice *pApp, HWND hDlg);
  261. BOOL CALLBACK UseWebMailInitProc(CICWApprentice *pApp,HWND hDlg,BOOL fFirstInit);
  262. BOOL CALLBACK UseWebMailOKProc(CICWApprentice *pApp,HWND hDlg,BOOL fForward,UINT* puNextPage);
  263. BOOL CALLBACK UseWebMailCmdProc(CICWApprentice *pApp,HWND hDlg,WPARAM wParam,LPARAM lParam);
  264. BOOL CALLBACK GotoServerInfoInitProc(CICWApprentice *pApp,HWND hDlg,BOOL fFirstInit);
  265. BOOL CALLBACK GotoServerInfoOKProc(CICWApprentice *pApp,HWND hDlg,BOOL fForward,UINT* puNextPage);
  266. BOOL CALLBACK GotoServerInfoCmdProc(CICWApprentice *pApp,HWND hDlg,WPARAM wParam,LPARAM lParam);
  267. BOOL CALLBACK PassifierInitProc(CICWApprentice *pApp,HWND hDlg,BOOL fFirstInit);
  268. BOOL CALLBACK PassifierOKProc(CICWApprentice *pApp,HWND hDlg,BOOL fForward,UINT* puNextPage);
  269. BOOL CALLBACK PassifierCmdProc(CICWApprentice *pApp,HWND hDlg,WPARAM wParam,LPARAM lParam);
  270. DWORD CommctrlMajor(void);
  271. HRESULT CreateAccountName(CICWApprentice *pApp, ACCTDATA * pData);
  272. #endif // _INC_ICWWIZ_H