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.

868 lines
31 KiB

  1. //Copyright (c) 1998 - 2001 Microsoft Corporation
  2. #include "precomp.h"
  3. #if !defined(_WIN32_WINNT)
  4. #define _WIN32_WINNT 0x0400
  5. #endif
  6. #include "wincrypt.h"
  7. #include "tlsapip.h"
  8. #include "lrwizapi.h"
  9. #include "wincrypt.h"
  10. #include "dlgproc.h"
  11. #include "propdlgs.h"
  12. #include "global.h"
  13. #include "utils.h"
  14. #include "fonts.h"
  15. #define ACTIVATIONMETHOD_KEY "ACTIVATIONMETHOD"
  16. CGlobal *g_CGlobal = NULL;
  17. BOOL WINAPI DllMain (HANDLE hInst,ULONG ul_reason_for_call,LPVOID lpReserved)
  18. {
  19. switch(ul_reason_for_call)
  20. {
  21. case DLL_PROCESS_ATTACH:
  22. if (g_CGlobal == NULL)
  23. {
  24. g_CGlobal = new CGlobal;
  25. if (g_CGlobal == NULL)
  26. {
  27. return FALSE;
  28. }
  29. SetInstanceHandle((HINSTANCE)hInst);
  30. }
  31. break;
  32. case DLL_PROCESS_DETACH:
  33. if (g_CGlobal != NULL)
  34. {
  35. delete g_CGlobal;
  36. g_CGlobal = NULL;
  37. }
  38. break;
  39. default:
  40. break;
  41. }
  42. return TRUE;
  43. }
  44. DWORD
  45. IsLicenseServerRegistered(HWND hWndParent,
  46. LPCTSTR pszLSName,
  47. PDWORD pdwServerStatus)
  48. {
  49. DWORD dwRetCode = ERROR_SUCCESS;
  50. GetGlobalContext()->SetLSName(pszLSName);
  51. if (!GetGlobalContext()->IsLSRunning())
  52. {
  53. dwRetCode = LRWIZ_ERROR_LS_NOT_RUNNING;
  54. goto done;
  55. }
  56. dwRetCode = GetGlobalContext()->IsLicenseServerRegistered(pdwServerStatus);
  57. if (dwRetCode == ERROR_SUCCESS && *pdwServerStatus == LSERVERSTATUS_UNREGISTER &&
  58. GetGlobalContext()->IsOnlineCertRequestCreated())
  59. {
  60. *pdwServerStatus = LSERVERSTATUS_WAITFORPIN;
  61. }
  62. GetGlobalContext()->FreeGlobal();
  63. done:
  64. return dwRetCode;
  65. }
  66. DWORD
  67. GetConnectionType(HWND hWndParent,
  68. LPCTSTR pszLSName,
  69. WIZCONNECTION* pConnectionType)
  70. {
  71. DWORD dwRetCode = ERROR_SUCCESS;
  72. TCHAR lpBuffer[64];
  73. *pConnectionType = CONNECTION_DEFAULT;
  74. // Connect to the given LS Registry & read the current ConnectionType.
  75. GetGlobalContext()->SetLSName(pszLSName);
  76. dwRetCode = GetGlobalContext()->GetFromRegistry(ACTIVATIONMETHOD_KEY, lpBuffer, TRUE);
  77. if (dwRetCode == ERROR_SUCCESS)
  78. {
  79. if (_tcslen(lpBuffer) != 0)
  80. {
  81. *pConnectionType = (WIZCONNECTION) _ttoi(lpBuffer);
  82. if (*pConnectionType == CONNECTION_FAX)
  83. *pConnectionType = CONNECTION_DEFAULT;
  84. }
  85. else
  86. dwRetCode = ERROR_FILE_NOT_FOUND;
  87. }
  88. GetGlobalContext()->FreeGlobal();
  89. return dwRetCode;
  90. }
  91. DWORD
  92. StartWizard(
  93. HWND hWndParent,
  94. WIZACTION WizAction,
  95. LPCTSTR pszLSName,
  96. PBOOL pbRefresh
  97. )
  98. {
  99. DWORD dwRetCode = LRWIZ_SUCCESS;
  100. BOOL bStatus = TRUE;
  101. PageInfo PageInfo = {0};
  102. PROPSHEETPAGE psp = {0};
  103. HPROPSHEETPAGE ahpsp[NO_OF_PAGES] = {0};
  104. PROPSHEETHEADER psh = {0};
  105. UINT i = 0;
  106. DWORD dwLSStatus = 0;
  107. GetGlobalContext()->SetWizAction(WizAction);
  108. GetGlobalContext()->SetLSName(pszLSName);
  109. if(!GetGlobalContext()->IsLSRunning())
  110. {
  111. LRMessageBox(hWndParent,IDS_ERR_LSCONNECT_FAILED,IDS_WIZARD_MESSAGE_TITLE);
  112. dwRetCode = LRWIZ_ERROR_LS_NOT_RUNNING;
  113. goto done;
  114. }
  115. dwRetCode = GetGlobalContext()->InitGlobal();
  116. if (dwRetCode != ERROR_SUCCESS)
  117. {
  118. LRMessageBox(hWndParent,dwRetCode,NULL,LRGetLastError());
  119. goto done;
  120. }
  121. dwRetCode = GetGlobalContext()->GetLSCertificates(&dwLSStatus);
  122. if (dwRetCode != ERROR_SUCCESS)
  123. {
  124. LRMessageBox(hWndParent,dwRetCode,NULL,LRGetLastError());
  125. goto done;
  126. }
  127. if (dwLSStatus == LSERVERSTATUS_UNREGISTER && GetGlobalContext()->IsOnlineCertRequestCreated())
  128. {
  129. dwLSStatus = LSERVERSTATUS_WAITFORPIN;
  130. }
  131. //
  132. // Show properties if WizAction is WIZACTION_SHOWPROPERTIES
  133. //
  134. if(WizAction == WIZACTION_SHOWPROPERTIES)
  135. {
  136. dwRetCode = ShowProperties(hWndParent);
  137. *pbRefresh = GetReFresh();
  138. return dwRetCode;
  139. }
  140. // verify the registry entries if the LS is already registered and the
  141. // connection method is Internet
  142. if ((GetGlobalContext()->GetActivationMethod() == CONNECTION_INTERNET ||
  143. GetGlobalContext()->GetActivationMethod() == CONNECTION_DEFAULT)
  144. && dwLSStatus == LSERVERSTATUS_REGISTER_INTERNET )
  145. {
  146. dwRetCode = GetGlobalContext()->CheckRequieredFields();
  147. if (dwRetCode != ERROR_SUCCESS)
  148. {
  149. LRMessageBox(hWndParent,dwRetCode,NULL,LRGetLastError());
  150. goto done;
  151. }
  152. }
  153. if (dwLSStatus == LSERVERSTATUS_WAITFORPIN)
  154. {
  155. GetGlobalContext()->SetWizAction(WIZACTION_CONTINUEREGISTERLS);
  156. }
  157. assert(dwLSStatus == LSERVERSTATUS_UNREGISTER ||
  158. dwLSStatus == LSERVERSTATUS_WAITFORPIN ||
  159. dwLSStatus == LSERVERSTATUS_REGISTER_INTERNET ||
  160. dwLSStatus == LSERVERSTATUS_REGISTER_OTHER);
  161. GetGlobalContext()->SetLSStatus(dwLSStatus);
  162. //Create All the pages here
  163. // New Welcome page which explains the process, etc.
  164. switch (WizAction)
  165. {
  166. case (WIZACTION_REGISTERLS):
  167. {
  168. psp.dwSize = sizeof( psp );
  169. psp.hInstance = GetInstanceHandle();
  170. psp.lParam = (LPARAM)&PageInfo;
  171. psp.pfnDlgProc = SimpleWelcomeDlgProc;
  172. psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
  173. psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOME_ACTIVATION);
  174. ahpsp[PG_NDX_WELCOME] = CreatePropertySheetPage( &psp );
  175. break;
  176. }
  177. case (WIZACTION_CONTINUEREGISTERLS):
  178. {
  179. psp.dwSize = sizeof( psp );
  180. psp.hInstance = GetInstanceHandle();
  181. psp.lParam = (LPARAM)&PageInfo;
  182. psp.pfnDlgProc = ComplexWelcomeDlgProc;
  183. psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
  184. psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOME_ACTIVATION);
  185. ahpsp[PG_NDX_WELCOME] = CreatePropertySheetPage( &psp );
  186. break;
  187. }
  188. case (WIZACTION_DOWNLOADLKP):
  189. case (WIZACTION_DOWNLOADLASTLKP):
  190. {
  191. psp.dwSize = sizeof( psp );
  192. psp.hInstance = GetInstanceHandle();
  193. psp.lParam = (LPARAM)&PageInfo;
  194. psp.pfnDlgProc = ComplexWelcomeDlgProc;
  195. psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
  196. psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOME_CLIENT_LICENSING);
  197. ahpsp[PG_NDX_WELCOME] = CreatePropertySheetPage( &psp );
  198. break;
  199. }
  200. case (WIZACTION_REREGISTERLS):
  201. {
  202. psp.dwSize = sizeof( psp );
  203. psp.hInstance = GetInstanceHandle();
  204. psp.lParam = (LPARAM)&PageInfo;
  205. psp.pfnDlgProc = ComplexWelcomeDlgProc;
  206. psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
  207. psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOME_REACTIVATION);
  208. ahpsp[PG_NDX_WELCOME] = CreatePropertySheetPage( &psp );
  209. break;
  210. }
  211. default:
  212. {
  213. psp.dwSize = sizeof( psp );
  214. psp.hInstance = GetInstanceHandle();
  215. psp.lParam = (LPARAM)&PageInfo;
  216. psp.pfnDlgProc = ComplexWelcomeDlgProc;
  217. psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
  218. psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOME);
  219. ahpsp[PG_NDX_WELCOME] = CreatePropertySheetPage( &psp );
  220. break;
  221. }
  222. }
  223. // New page for choosing the Mode of Registration
  224. psp.dwSize = sizeof( psp );
  225. psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
  226. psp.hInstance = GetInstanceHandle();
  227. psp.lParam = (LPARAM)&PageInfo;
  228. psp.pfnDlgProc = GetModeDlgProc;
  229. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE20 );
  230. psp.pszHeaderSubTitle = MAKEINTRESOURCE( IDS_SUBTITLE20 );
  231. psp.pszTemplate = MAKEINTRESOURCE( IDD_DLG_GETREGMODE );
  232. ahpsp[PG_NDX_GETREGMODE]= CreatePropertySheetPage( &psp );
  233. //
  234. //Customer Information(2) page for CA Request(Online/Offline)
  235. //
  236. memset(&psp,0,sizeof(psp));
  237. psp.dwSize = sizeof( psp );
  238. psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
  239. psp.hInstance = GetInstanceHandle();
  240. psp.lParam = (LPARAM)&PageInfo;
  241. psp.pfnDlgProc = ContactInfo1DlgProc;
  242. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE4 );
  243. psp.pszHeaderSubTitle = MAKEINTRESOURCE( IDS_SUBTITLE4 );
  244. psp.pszTemplate = MAKEINTRESOURCE( IDD_CONTACTINFO1 );
  245. ahpsp[PG_NDX_CONTACTINFO1] = CreatePropertySheetPage( &psp );
  246. //
  247. //Customer Information(1) page for CA Request(Online/Offline)
  248. //
  249. memset(&psp,0,sizeof(psp));
  250. psp.dwSize = sizeof( psp );
  251. psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
  252. psp.hInstance = GetInstanceHandle();
  253. psp.lParam = (LPARAM)&PageInfo;
  254. psp.pfnDlgProc = ContactInfo2DlgProc;
  255. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE3 );
  256. psp.pszHeaderSubTitle = MAKEINTRESOURCE( IDS_SUBTITLE3 );
  257. psp.pszTemplate = MAKEINTRESOURCE( IDD_CONTACTINFO2 );
  258. ahpsp[PG_NDX_CONTACTINFO2] = CreatePropertySheetPage( &psp );
  259. #ifdef XXX
  260. //
  261. //Processing Request page(Online)
  262. //
  263. memset(&psp,0,sizeof(psp));
  264. psp.dwSize = sizeof( psp );
  265. psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
  266. psp.hInstance = GetInstanceHandle();
  267. psp.lParam = (LPARAM)&PageInfo;
  268. psp.pfnDlgProc = ProcessingDlgProc;
  269. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE5 );
  270. psp.pszHeaderSubTitle = MAKEINTRESOURCE( IDS_SUBTITLE5 );
  271. psp.pszTemplate = MAKEINTRESOURCE( IDD_PROCESSING );
  272. ahpsp[PG_NDX_PROCESSING] = CreatePropertySheetPage( &psp );
  273. #endif
  274. //
  275. //Registration Complete page for CA Request(Online/Offline)
  276. //
  277. memset(&psp,0,sizeof(psp));
  278. psp.dwSize = sizeof( psp );
  279. psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
  280. psp.hInstance = GetInstanceHandle();
  281. psp.lParam = (LPARAM)&PageInfo;
  282. psp.pfnDlgProc = ProgressDlgProc;
  283. psp.pszTemplate = MAKEINTRESOURCE( IDD_PROGRESS );
  284. ahpsp[PG_NDX_PROGRESS] = CreatePropertySheetPage( &psp );
  285. memset(&psp,0,sizeof(psp));
  286. psp.dwSize = sizeof( psp );
  287. psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
  288. psp.hInstance = GetInstanceHandle();
  289. psp.lParam = (LPARAM)&PageInfo;
  290. psp.pfnDlgProc = Progress2DlgProc;
  291. psp.pszTemplate = MAKEINTRESOURCE( IDD_PROGRESS2 );
  292. ahpsp[PG_NDX_PROGRESS2] = CreatePropertySheetPage( &psp );
  293. //
  294. //Certificate PIN page for CA Request(Online)
  295. //
  296. memset(&psp,0,sizeof(psp));
  297. psp.dwSize = sizeof( psp );
  298. psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
  299. psp.hInstance = GetInstanceHandle();
  300. psp.lParam = (LPARAM)&PageInfo;
  301. psp.pfnDlgProc = PINDlgProc;
  302. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE9 );
  303. psp.pszHeaderSubTitle = MAKEINTRESOURCE( IDS_SUBTITLE9 );
  304. psp.pszTemplate = MAKEINTRESOURCE( IDD_DLG_PIN );
  305. ahpsp[PG_NDX_DLG_PIN] = CreatePropertySheetPage( &psp );
  306. //
  307. //Choose Program page for CH Request(Online/Offline)
  308. //
  309. memset(&psp,0,sizeof(psp));
  310. psp.dwSize = sizeof( psp );
  311. psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
  312. psp.hInstance = GetInstanceHandle();
  313. psp.lParam = (LPARAM)&PageInfo;
  314. psp.pfnDlgProc = CustInfoLicenseType;
  315. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE10 );
  316. psp.pszHeaderSubTitle = MAKEINTRESOURCE( IDS_SUBTITLE10 );
  317. psp.pszTemplate = MAKEINTRESOURCE( IDD_LICENSETYPE );
  318. ahpsp[PG_NDX_CH_REGISTER_1] = CreatePropertySheetPage( &psp );
  319. memset(&psp,0,sizeof(psp));
  320. psp.dwSize = sizeof( psp );
  321. psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
  322. psp.hInstance = GetInstanceHandle();
  323. psp.lParam = (LPARAM)&PageInfo;
  324. psp.pfnDlgProc = CHRegisterDlgProc;
  325. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE12 );
  326. psp.pszHeaderSubTitle = MAKEINTRESOURCE( IDS_SUBTITLE12 );
  327. psp.pszTemplate = MAKEINTRESOURCE( IDD_CH_REGISTER );
  328. ahpsp[PG_NDX_CH_REGISTER] = CreatePropertySheetPage( &psp );
  329. //
  330. // Options after registering
  331. //
  332. memset(&psp,0,sizeof(psp));
  333. psp.dwSize = sizeof( psp );
  334. psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
  335. psp.hInstance = GetInstanceHandle();
  336. psp.lParam = (LPARAM)&PageInfo;
  337. psp.pfnDlgProc = ContinueReg;
  338. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE18 );
  339. psp.pszHeaderSubTitle = MAKEINTRESOURCE( IDS_SUBTITLE18 );
  340. psp.pszTemplate = MAKEINTRESOURCE( IDD_CONTINUEREG );
  341. ahpsp[PG_NDX_CONTINUEREG] = CreatePropertySheetPage( &psp );
  342. // New Dialog Box to complete the Telephone Registration
  343. memset(&psp,0,sizeof(psp));
  344. psp.dwSize = sizeof( psp );
  345. psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
  346. psp.hInstance = GetInstanceHandle();
  347. psp.lParam = (LPARAM)&PageInfo;
  348. psp.pfnDlgProc = TelRegProc;
  349. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE19 );
  350. psp.pszHeaderSubTitle = MAKEINTRESOURCE( IDS_SUBTITLE19 );
  351. psp.pszTemplate = MAKEINTRESOURCE( IDD_DLG_TELREG);
  352. ahpsp[PG_NDX_TELREG] = CreatePropertySheetPage( &psp );
  353. // New Dialog Box to complete the Telephone LKP stuff
  354. memset(&psp,0,sizeof(psp));
  355. psp.dwSize = sizeof( psp );
  356. psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
  357. psp.hInstance = GetInstanceHandle();
  358. psp.lParam = (LPARAM)&PageInfo;
  359. psp.pfnDlgProc = TelLKPProc;
  360. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE21 );
  361. psp.pszHeaderSubTitle = MAKEINTRESOURCE( IDS_SUBTITLE21 );
  362. psp.pszTemplate = MAKEINTRESOURCE( IDD_DLG_TELLKP);
  363. ahpsp[PG_NDX_TELLKP] = CreatePropertySheetPage( &psp );
  364. // New Dialog Box to complete the Retail SPK Implementation
  365. memset(&psp,0,sizeof(psp));
  366. psp.dwSize = sizeof( psp );
  367. psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
  368. psp.hInstance = GetInstanceHandle();
  369. psp.lParam = (LPARAM)&PageInfo;
  370. psp.pfnDlgProc = RetailSPKProc;
  371. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE22 );
  372. psp.pszHeaderSubTitle = MAKEINTRESOURCE( IDS_SUBTITLE22 );
  373. psp.pszTemplate = MAKEINTRESOURCE( IDD_DLG_RETAILSPK );
  374. ahpsp[PG_NDX_RETAILSPK] = CreatePropertySheetPage( &psp );
  375. // New Dialog Box to complete the Cert Log Infor (before re-issuing/revoking certs)
  376. memset(&psp,0,sizeof(psp));
  377. psp.dwSize = sizeof( psp );
  378. psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
  379. psp.hInstance = GetInstanceHandle();
  380. psp.lParam = (LPARAM)&PageInfo;
  381. psp.pfnDlgProc = CertLogProc;
  382. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE24 );
  383. psp.pszHeaderSubTitle = MAKEINTRESOURCE( IDS_SUBTITLE24 );
  384. psp.pszTemplate = MAKEINTRESOURCE( IDD_DLG_CERTLOG_INFO );
  385. ahpsp[PG_NDX_CERTLOG] = CreatePropertySheetPage( &psp );
  386. // Telephone Revocation
  387. memset(&psp,0,sizeof(psp));
  388. psp.dwSize = sizeof( psp );
  389. psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
  390. psp.hInstance = GetInstanceHandle();
  391. psp.lParam = (LPARAM)&PageInfo;
  392. psp.pfnDlgProc = ConfRevokeProc;
  393. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE25 );
  394. psp.pszHeaderSubTitle = MAKEINTRESOURCE( IDS_SUBTITLE25 );
  395. psp.pszTemplate = MAKEINTRESOURCE( IDD_DLG_CONFREVOKE );
  396. ahpsp[PG_NDX_CONFREVOKE] = CreatePropertySheetPage( &psp );
  397. // Telephone re-issue
  398. memset(&psp,0,sizeof(psp));
  399. psp.dwSize = sizeof( psp );
  400. psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
  401. psp.hInstance = GetInstanceHandle();
  402. psp.lParam = (LPARAM)&PageInfo;
  403. psp.pfnDlgProc = TelReissueProc;
  404. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE26 );
  405. psp.pszHeaderSubTitle = MAKEINTRESOURCE( IDS_SUBTITLE26 );
  406. psp.pszTemplate = MAKEINTRESOURCE( IDD_DLG_TELREG_REISSUE );
  407. ahpsp[PG_NDX_TELREG_REISSUE] = CreatePropertySheetPage( &psp );
  408. // WWW re-issue
  409. memset(&psp,0,sizeof(psp));
  410. psp.dwSize = sizeof( psp );
  411. psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
  412. psp.hInstance = GetInstanceHandle();
  413. psp.lParam = (LPARAM)&PageInfo;
  414. psp.pfnDlgProc = WWWReissueProc;
  415. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE26 );
  416. psp.pszHeaderSubTitle = MAKEINTRESOURCE( IDS_SUBTITLE26 );
  417. psp.pszTemplate = MAKEINTRESOURCE( IDD_DLG_WWWREG_REISSUE );
  418. ahpsp[PG_NDX_WWWREG_REISSUE] = CreatePropertySheetPage( &psp );
  419. // Telephone Country/Region
  420. memset(&psp,0,sizeof(psp));
  421. psp.dwSize = sizeof( psp );
  422. psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
  423. psp.hInstance = GetInstanceHandle();
  424. psp.lParam = (LPARAM)&PageInfo;
  425. psp.pfnDlgProc = CountryRegionProc;
  426. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE27 );
  427. psp.pszHeaderSubTitle = MAKEINTRESOURCE( IDS_SUBTITLE27 );
  428. psp.pszTemplate = MAKEINTRESOURCE( IDD_DLG_COUNTRYREGION );
  429. ahpsp[PG_NDX_COUNTRYREGION] = CreatePropertySheetPage( &psp );
  430. // WWW Registration
  431. memset(&psp,0,sizeof(psp));
  432. psp.dwSize = sizeof( psp );
  433. psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
  434. psp.hInstance = GetInstanceHandle();
  435. psp.lParam = (LPARAM)&PageInfo;
  436. psp.pfnDlgProc = WWWRegProc;
  437. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE28 );
  438. psp.pszHeaderSubTitle = MAKEINTRESOURCE( IDS_SUBTITLE28 );
  439. psp.pszTemplate = MAKEINTRESOURCE( IDD_DLG_WWWREG);
  440. ahpsp[PG_NDX_WWWREG] = CreatePropertySheetPage( &psp );
  441. // WWW LKP Download
  442. memset(&psp,0,sizeof(psp));
  443. psp.dwSize = sizeof( psp );
  444. psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
  445. psp.hInstance = GetInstanceHandle();
  446. psp.lParam = (LPARAM)&PageInfo;
  447. psp.pfnDlgProc = WWWLKPProc;
  448. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE29 );
  449. psp.pszHeaderSubTitle = MAKEINTRESOURCE( IDS_SUBTITLE29 );
  450. psp.pszTemplate = MAKEINTRESOURCE( IDD_DLG_WWWLKP);
  451. ahpsp[PG_NDX_WWWLKP] = CreatePropertySheetPage( &psp );
  452. //Add the other welcome screens. Their order will differ depending
  453. //on the wiz action, because the relevant one will need to be the
  454. //first dialog of the wizard...the others will be added to the end
  455. switch (WizAction)
  456. {
  457. case (WIZACTION_REGISTERLS):
  458. case (WIZACTION_CONTINUEREGISTERLS):
  459. {
  460. memset(&psp,0,sizeof(psp));
  461. psp.dwSize = sizeof( psp );
  462. psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
  463. psp.hInstance = GetInstanceHandle();
  464. psp.lParam = (LPARAM)&PageInfo;
  465. psp.pfnDlgProc = ComplexWelcomeDlgProc;
  466. psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOME_CLIENT_LICENSING);
  467. ahpsp[PG_NDX_WELCOME_1] = CreatePropertySheetPage( &psp );
  468. memset(&psp,0,sizeof(psp));
  469. psp.dwSize = sizeof( psp );
  470. psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
  471. psp.hInstance = GetInstanceHandle();
  472. psp.lParam = (LPARAM)&PageInfo;
  473. psp.pfnDlgProc = ComplexWelcomeDlgProc;
  474. psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOME_REACTIVATION);
  475. ahpsp[PG_NDX_WELCOME_2] = CreatePropertySheetPage( &psp );
  476. memset(&psp,0,sizeof(psp));
  477. psp.dwSize = sizeof( psp );
  478. psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
  479. psp.hInstance = GetInstanceHandle();
  480. psp.lParam = (LPARAM)&PageInfo;
  481. psp.pfnDlgProc = ComplexWelcomeDlgProc;
  482. psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOME);
  483. ahpsp[PG_NDX_WELCOME_3] = CreatePropertySheetPage( &psp );
  484. break;
  485. }
  486. case (WIZACTION_DOWNLOADLKP):
  487. case (WIZACTION_DOWNLOADLASTLKP):
  488. {
  489. memset(&psp,0,sizeof(psp));
  490. psp.dwSize = sizeof( psp );
  491. psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
  492. psp.hInstance = GetInstanceHandle();
  493. psp.lParam = (LPARAM)&PageInfo;
  494. psp.pfnDlgProc = ComplexWelcomeDlgProc;
  495. psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOME_ACTIVATION);
  496. ahpsp[PG_NDX_WELCOME_1] = CreatePropertySheetPage( &psp );
  497. memset(&psp,0,sizeof(psp));
  498. psp.dwSize = sizeof( psp );
  499. psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
  500. psp.hInstance = GetInstanceHandle();
  501. psp.lParam = (LPARAM)&PageInfo;
  502. psp.pfnDlgProc = ComplexWelcomeDlgProc;
  503. psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOME_REACTIVATION);
  504. ahpsp[PG_NDX_WELCOME_2] = CreatePropertySheetPage( &psp );
  505. memset(&psp,0,sizeof(psp));
  506. psp.dwSize = sizeof( psp );
  507. psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
  508. psp.hInstance = GetInstanceHandle();
  509. psp.lParam = (LPARAM)&PageInfo;
  510. psp.pfnDlgProc = ComplexWelcomeDlgProc;
  511. psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOME);
  512. ahpsp[PG_NDX_WELCOME_3] = CreatePropertySheetPage( &psp );
  513. break;
  514. }
  515. case (WIZACTION_REREGISTERLS):
  516. {
  517. memset(&psp,0,sizeof(psp));
  518. psp.dwSize = sizeof( psp );
  519. psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
  520. psp.hInstance = GetInstanceHandle();
  521. psp.lParam = (LPARAM)&PageInfo;
  522. psp.pfnDlgProc = ComplexWelcomeDlgProc;
  523. psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOME_ACTIVATION);
  524. ahpsp[PG_NDX_WELCOME_1] = CreatePropertySheetPage( &psp );
  525. memset(&psp,0,sizeof(psp));
  526. psp.dwSize = sizeof( psp );
  527. psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
  528. psp.hInstance = GetInstanceHandle();
  529. psp.lParam = (LPARAM)&PageInfo;
  530. psp.pfnDlgProc = ComplexWelcomeDlgProc;
  531. psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOME_CLIENT_LICENSING);
  532. ahpsp[PG_NDX_WELCOME_2] = CreatePropertySheetPage( &psp );
  533. memset(&psp,0,sizeof(psp));
  534. psp.dwSize = sizeof( psp );
  535. psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
  536. psp.hInstance = GetInstanceHandle();
  537. psp.lParam = (LPARAM)&PageInfo;
  538. psp.pfnDlgProc = ComplexWelcomeDlgProc;
  539. psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOME);
  540. ahpsp[PG_NDX_WELCOME_3] = CreatePropertySheetPage( &psp );
  541. break;
  542. }
  543. default:
  544. {
  545. memset(&psp,0,sizeof(psp));
  546. psp.dwSize = sizeof( psp );
  547. psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
  548. psp.hInstance = GetInstanceHandle();
  549. psp.lParam = (LPARAM)&PageInfo;
  550. psp.pfnDlgProc = ComplexWelcomeDlgProc;
  551. psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOME_ACTIVATION);
  552. ahpsp[PG_NDX_WELCOME_1] = CreatePropertySheetPage( &psp );
  553. memset(&psp,0,sizeof(psp));
  554. psp.dwSize = sizeof( psp );
  555. psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
  556. psp.hInstance = GetInstanceHandle();
  557. psp.lParam = (LPARAM)&PageInfo;
  558. psp.pfnDlgProc = ComplexWelcomeDlgProc;
  559. psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOME_CLIENT_LICENSING);
  560. ahpsp[PG_NDX_WELCOME_2] = CreatePropertySheetPage( &psp );
  561. memset(&psp,0,sizeof(psp));
  562. psp.dwSize = sizeof( psp );
  563. psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
  564. psp.hInstance = GetInstanceHandle();
  565. psp.lParam = (LPARAM)&PageInfo;
  566. psp.pfnDlgProc = ComplexWelcomeDlgProc;
  567. psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOME_REACTIVATION);
  568. ahpsp[PG_NDX_WELCOME_3] = CreatePropertySheetPage( &psp );
  569. break;
  570. }
  571. }
  572. //
  573. // Enter license code (e.g. select type licenses)
  574. //
  575. memset(&psp,0,sizeof(psp));
  576. psp.dwSize = sizeof( psp );
  577. psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
  578. psp.hInstance = GetInstanceHandle();
  579. psp.lParam = (LPARAM)&PageInfo;
  580. psp.pfnDlgProc = EnterCustomLicenseProc;
  581. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_ENTER_LICENSE_WIZARD_HEADER );
  582. psp.pszHeaderSubTitle = MAKEINTRESOURCE( IDS_ENTER_LICENSE_WIZARD_SUBHEADER );
  583. psp.pszTemplate = MAKEINTRESOURCE( IDD_DLG_ENTER_LIC );
  584. ahpsp[PG_NDX_ENTERLICENSE] = CreatePropertySheetPage( &psp );
  585. psh.dwFlags = PSH_WIZARD | PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER;
  586. //psh.pszbmWatermark = 0;
  587. //psh.pszbmHeader = 0;
  588. psh.pszbmWatermark = MAKEINTRESOURCE(IDB_CLIENT_CONN);
  589. psh.pszbmHeader = MAKEINTRESOURCE(IDB_CLIENT_CONN_HDR);
  590. psh.dwSize = sizeof( psh );
  591. psh.hInstance = GetInstanceHandle();
  592. psh.hwndParent = hWndParent;
  593. psh.pszCaption = MAKEINTRESOURCE( IDS_TITLE4 );
  594. psh.phpage = ahpsp;
  595. psh.nStartPage = 0;
  596. psh.nPages = NO_OF_PAGES;
  597. PageInfo.TotalPages = NO_OF_PAGES;
  598. //
  599. // Create the bold fonts.
  600. //
  601. SetupFonts( GetInstanceHandle(), NULL, &PageInfo.hBigBoldFont, &PageInfo.hBoldFont );
  602. //
  603. // Validate all the pages.
  604. //
  605. for(i = 0; i < NO_OF_PAGES; i++ )
  606. {
  607. if( ahpsp[i] == 0 )
  608. {
  609. bStatus = FALSE;
  610. }
  611. }
  612. //
  613. // Display the wizard.
  614. //
  615. if( bStatus )
  616. {
  617. if( PropertySheet( &psh ) == -1 )
  618. {
  619. bStatus = FALSE;
  620. }
  621. }
  622. if( !bStatus )
  623. {
  624. //
  625. // Manually destroy the pages if something failed.
  626. //
  627. for(i = 0; i < psh.nPages; i++)
  628. {
  629. if( ahpsp[i] )
  630. {
  631. DestroyPropertySheetPage( ahpsp[i] );
  632. }
  633. }
  634. }
  635. //
  636. // Destroy the fonts that were created.
  637. //
  638. DestroyFonts( PageInfo.hBigBoldFont, PageInfo.hBoldFont );
  639. done:
  640. if(!bStatus)
  641. {
  642. LRMessageBox(hWndParent,IDS_ERR_CREATE_FAILED,IDS_WIZARD_MESSAGE_TITLE);
  643. dwRetCode = LRWIZ_ERROR_CREATE_FAILED;
  644. }
  645. if (dwRetCode == 0 || dwRetCode == LRWIZ_SUCCESS)
  646. {
  647. *pbRefresh = GetReFresh();
  648. }
  649. GetGlobalContext()->FreeGlobal();
  650. return dwRetCode;
  651. }
  652. DWORD ShowProperties(HWND hWndParent)
  653. {
  654. DWORD dwRetCode = ERROR_SUCCESS;
  655. BOOL bStatus = TRUE;
  656. PROPSHEETPAGE psp = {0};
  657. HPROPSHEETPAGE ahpsp[NO_OF_PROP_PAGES] = {0};
  658. PROPSHEETHEADER psh = {0};
  659. UINT i = 0;
  660. //
  661. //Create All the pages here
  662. //
  663. // Registration Mode Page
  664. memset(&psp,0,sizeof(psp));
  665. psp.dwSize = sizeof( psp );
  666. psp.dwFlags = PSP_DEFAULT | PSP_USETITLE | PSP_PREMATURE ;
  667. psp.hInstance = GetInstanceHandle();
  668. psp.lParam = NULL;
  669. psp.pfnDlgProc = PropModeDlgProc;
  670. psp.pszTitle = MAKEINTRESOURCE( IDS_TITLE36 );
  671. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE36 );
  672. psp.pszTemplate = MAKEINTRESOURCE( IDD_DLG_PROP_MODE);
  673. ahpsp[PG_NDX_PROP_MODE]= CreatePropertySheetPage( &psp );
  674. // Customer Information (I) page
  675. memset(&psp,0,sizeof(psp));
  676. psp.dwSize = sizeof( psp );
  677. psp.dwFlags = PSP_DEFAULT | PSP_USETITLE | PSP_PREMATURE;
  678. psp.hInstance = GetInstanceHandle();
  679. psp.lParam = NULL;
  680. psp.pfnDlgProc = PropCustInfoADlgProc;
  681. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE38 );
  682. psp.pszTitle = MAKEINTRESOURCE( IDS_TITLE38 );
  683. psp.pszTemplate = MAKEINTRESOURCE( IDD_DLG_PROP_CUSTINFO_a);
  684. ahpsp[PG_NDX_PROP_CUSTINFO_a] = CreatePropertySheetPage( &psp );
  685. // Customer Information (II) page
  686. memset(&psp,0,sizeof(psp));
  687. psp.dwSize = sizeof( psp );
  688. psp.dwFlags = PSP_DEFAULT | PSP_USETITLE | PSP_PREMATURE;
  689. psp.hInstance = GetInstanceHandle();
  690. psp.lParam = NULL;
  691. psp.pfnDlgProc = PropCustInfoBDlgProc;
  692. psp.pszHeaderTitle = MAKEINTRESOURCE( IDS_TITLE39 );
  693. psp.pszTitle = MAKEINTRESOURCE( IDS_TITLE39 );
  694. psp.pszTemplate = MAKEINTRESOURCE( IDD_DLG_PROP_CUSTINFO_b);
  695. ahpsp[PG_NDX_PROP_CUSTINFO_b] = CreatePropertySheetPage( &psp );
  696. psh.dwFlags = PSH_DEFAULT | PSH_PROPTITLE | PSH_NOAPPLYNOW| PSH_NOCONTEXTHELP;
  697. psh.dwSize = sizeof( psh );
  698. psh.hInstance = GetInstanceHandle();
  699. psh.hwndParent = hWndParent;
  700. psh.pszCaption = MAKEINTRESOURCE( IDS_PROPERTIES_TITLE );
  701. psh.phpage = ahpsp;
  702. psh.nStartPage = 0;
  703. psh.nPages = NO_OF_PROP_PAGES;
  704. //
  705. // Validate all the pages.
  706. //
  707. for( i = 0; i < NO_OF_PROP_PAGES; i++ )
  708. {
  709. if( ahpsp[i] == 0 )
  710. {
  711. bStatus = FALSE;
  712. }
  713. }
  714. //
  715. // Display the wizard.
  716. //
  717. if( bStatus )
  718. {
  719. if( PropertySheet( &psh ) == -1 )
  720. {
  721. bStatus = FALSE;
  722. }
  723. }
  724. if( !bStatus )
  725. {
  726. //
  727. // Manually destroy the pages if something failed.
  728. //
  729. for(i = 0; i < psh.nPages; i++)
  730. {
  731. if( ahpsp[i] )
  732. {
  733. DestroyPropertySheetPage( ahpsp[i] );
  734. }
  735. }
  736. }
  737. if(!bStatus)
  738. {
  739. LRMessageBox(hWndParent,IDS_ERR_CREATE_FAILED,IDS_WIZARD_MESSAGE_TITLE);
  740. dwRetCode = LRWIZ_ERROR_CREATE_FAILED;
  741. }
  742. return dwRetCode;
  743. }