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.

4974 lines
139 KiB

  1. #include "stdafx.h"
  2. #include "Callback.h"
  3. #ifndef IADsContainerPtr
  4. _COM_SMARTPTR_TYPEDEF(IADsContainer, IID_IADsContainer);
  5. #endif
  6. extern BOOL GetDomainAndUserFromUPN(WCHAR const * UPNname,CString& domainNetbios, CString& user);
  7. INT_PTR CALLBACK
  8. IntServiceInfoButtonProc(
  9. IN HWND hwndDlg,
  10. IN UINT uMsg,
  11. IN WPARAM wParam,
  12. IN LPARAM lParam
  13. )
  14. {
  15. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  16. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  17. switch (uMsg)
  18. {
  19. case WM_INITDIALOG :
  20. {
  21. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  22. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  23. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  24. HWND hLC6= GetDlgItem(hwndDlg,IDC_LIST_SERVICE);
  25. m_serviceBox.Attach(hLC6);
  26. CString column;
  27. column.LoadString(IDS_COLUMN_COMPUTER); m_serviceBox.InsertColumn( 1, column,LVCFMT_LEFT,100,1);
  28. column.LoadString(IDS_COLUMN_SERVICE); m_serviceBox.InsertColumn( 2, column,LVCFMT_LEFT,0,1);
  29. column.LoadString(IDS_COLUMN_ACCOUNT); m_serviceBox.InsertColumn( 3, column,LVCFMT_LEFT,100,1);
  30. column.LoadString(IDS_COLUMN_STATUS); m_serviceBox.InsertColumn( 4, column,LVCFMT_LEFT,85,1);
  31. //new
  32. column.LoadString(IDS_COLUMN_SERVICE_DISPLAY); m_serviceBox.InsertColumn( 5, column,LVCFMT_LEFT,75,1);
  33. getService();
  34. break;
  35. }
  36. case WM_COMMAND:
  37. {
  38. switch(LOWORD (wParam))
  39. {
  40. case IDC_TOGGLE:
  41. {
  42. OnTOGGLE();
  43. break;
  44. }
  45. case IDC_UPDATE:
  46. {
  47. OnUPDATE(hwndDlg);
  48. break;
  49. }
  50. default :
  51. break;
  52. }
  53. break;
  54. }
  55. case WM_NOTIFY :
  56. {
  57. LPNMHDR lpnm = (LPNMHDR) lParam;
  58. switch (lpnm->code)
  59. {
  60. case LVN_COLUMNCLICK:
  61. {
  62. LPNMLISTVIEW pnmv = (NM_LISTVIEW FAR *) lParam;
  63. pdata->sort[pnmv->iSubItem] = !pdata->sort[pnmv->iSubItem];
  64. sort(m_serviceBox,pnmv->iSubItem,pdata->sort[pnmv->iSubItem] );
  65. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  66. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  67. break;
  68. }
  69. case NM_SETFOCUS :
  70. case NM_KILLFOCUS :
  71. case NM_CLICK:
  72. {
  73. activateServiceButtons(hwndDlg);
  74. break;
  75. }
  76. case PSN_SETACTIVE :
  77. disable(hwndDlg,IDC_UPDATE);
  78. disable(hwndDlg,IDC_TOGGLE);
  79. if (migration==w_service && (pdata->refreshing && !alreadyRefreshed))
  80. {
  81. refreshDB(hwndDlg);
  82. alreadyRefreshed = true;
  83. getService();
  84. }
  85. if (pdata->refreshing)
  86. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT);
  87. else
  88. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
  89. break;
  90. case PSN_WIZNEXT :
  91. {
  92. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  93. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  94. CString computer ,service,account,c;
  95. CString skip,include;
  96. skip.LoadString(IDS_SKIP); include.LoadString(IDS_INCLUDE);
  97. for (int i=0;i<m_serviceBox.GetItemCount();i++)
  98. {
  99. computer = m_serviceBox.GetItemText(i,0);
  100. service = m_serviceBox.GetItemText(i,1);
  101. account = m_serviceBox.GetItemText(i,2);
  102. c = m_serviceBox.GetItemText(i,3);
  103. if (c== skip)
  104. {
  105. db->SetServiceAcctEntryStatus(_bstr_t(computer), _bstr_t(service), _bstr_t(account),SvcAcctStatus_DoNotUpdate);
  106. }
  107. else if (c==include)
  108. {
  109. db->SetServiceAcctEntryStatus(_bstr_t(computer), _bstr_t(service), _bstr_t(account), SvcAcctStatus_NotMigratedYet);
  110. }
  111. }
  112. //find and remove from varset
  113. break;
  114. }
  115. case PSN_WIZBACK :
  116. if (!pdata->refreshing && migration==w_service)
  117. {
  118. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_SA_REFRESH);
  119. return TRUE;
  120. }
  121. break;
  122. case PSN_QUERYCANCEL :
  123. GetError(0); //clear any old com errors
  124. break;
  125. case PSN_RESET :
  126. break;
  127. case PSN_HELP :
  128. {
  129. helpWrapper(hwndDlg,IDH_WINDOW_SERVICE_ACCOUNT_INFO );
  130. break;
  131. }
  132. default :
  133. break;
  134. }
  135. break;
  136. }
  137. case WM_HELP :
  138. {
  139. helpWrapper(hwndDlg,IDH_WINDOW_SERVICE_ACCOUNT_INFO );
  140. break;
  141. }
  142. default:
  143. break;
  144. }
  145. return 0;
  146. }
  147. INT_PTR CALLBACK
  148. IntServiceInfoProc(
  149. IN HWND hwndDlg,
  150. IN UINT uMsg,
  151. IN WPARAM wParam,
  152. IN LPARAM lParam
  153. )
  154. {
  155. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  156. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  157. switch (uMsg)
  158. {
  159. case WM_INITDIALOG :
  160. {
  161. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  162. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  163. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  164. CheckRadioButton(hwndDlg,IDC_UPDATE,IDC_SKIP,IDC_UPDATE);
  165. HWND hLC6= GetDlgItem(hwndDlg,IDC_LIST_SERVICE);
  166. m_serviceBox.Attach(hLC6);
  167. CString column;
  168. column.LoadString(IDS_COLUMN_COMPUTER); m_serviceBox.InsertColumn( 1, column,LVCFMT_LEFT,100,1);
  169. column.LoadString(IDS_COLUMN_SERVICE); m_serviceBox.InsertColumn( 2, column,LVCFMT_LEFT,0,1);
  170. column.LoadString(IDS_COLUMN_ACCOUNT); m_serviceBox.InsertColumn( 3, column,LVCFMT_LEFT,100,1);
  171. column.LoadString(IDS_COLUMN_STATUS); m_serviceBox.InsertColumn( 4, column,LVCFMT_LEFT,85,1);
  172. //new
  173. column.LoadString(IDS_COLUMN_SERVICE_DISPLAY); m_serviceBox.InsertColumn( 5, column,LVCFMT_LEFT,75,1);
  174. getService();
  175. break;
  176. }
  177. case WM_COMMAND:
  178. {
  179. switch(LOWORD (wParam))
  180. {
  181. case IDC_TOGGLE:
  182. {
  183. OnTOGGLE();
  184. break;
  185. }
  186. case IDC_SKIP:
  187. {
  188. disable(hwndDlg,IDC_TOGGLE);
  189. disable(hwndDlg,IDC_LIST_SERVICE);
  190. break;
  191. }
  192. case IDC_UPDATE:
  193. {
  194. enable(hwndDlg,IDC_LIST_SERVICE);
  195. break;
  196. }
  197. default :
  198. break;
  199. }
  200. break;
  201. }
  202. case WM_NOTIFY :
  203. {
  204. LPNMHDR lpnm = (LPNMHDR) lParam;
  205. switch (lpnm->code)
  206. {
  207. case LVN_COLUMNCLICK:
  208. {
  209. LPNMLISTVIEW pnmv = (NM_LISTVIEW FAR *) lParam;
  210. pdata->sort[pnmv->iSubItem] = !pdata->sort[pnmv->iSubItem];
  211. sort(m_serviceBox,pnmv->iSubItem,pdata->sort[pnmv->iSubItem] );
  212. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  213. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  214. break;
  215. }
  216. case NM_SETFOCUS :
  217. case NM_KILLFOCUS :
  218. case NM_CLICK:
  219. {
  220. activateServiceButtons2(hwndDlg);
  221. break;
  222. }
  223. case PSN_SETACTIVE :
  224. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
  225. disable(hwndDlg,IDC_TOGGLE);
  226. if (pdata->refreshing && !alreadyRefreshed)
  227. {
  228. put(DCTVS_Options_Wizard, L"service");
  229. refreshDB(hwndDlg);
  230. put(DCTVS_Options_Wizard, L"user");
  231. alreadyRefreshed = true;
  232. }
  233. getService();
  234. break;
  235. case PSN_WIZNEXT :
  236. {
  237. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  238. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  239. if(IsDlgButtonChecked(hwndDlg,IDC_SKIP))
  240. {
  241. setDBStatusSkip();
  242. }
  243. else if(IsDlgButtonChecked(hwndDlg,IDC_UPDATE))
  244. {
  245. if (setDBStatusInclude(hwndDlg))
  246. {
  247. CString message,title;
  248. message.LoadString(IDS_MSG_LOCAL);title.LoadString(IDS_MSG_WARNING);
  249. MessageBox(hwndDlg,message,title,MB_OK|MB_ICONINFORMATION);
  250. }
  251. }
  252. break;
  253. }
  254. case PSN_WIZBACK :
  255. break;
  256. case PSN_QUERYCANCEL :
  257. GetError(0); //clear any old com errors
  258. break;
  259. case PSN_RESET :
  260. break;
  261. case PSN_HELP :
  262. {
  263. helpWrapper(hwndDlg,IDH_WINDOW_SERVICE_ACCOUNT_INFO );
  264. break;
  265. }
  266. default :
  267. break;
  268. }
  269. break;
  270. }
  271. case WM_HELP :
  272. {
  273. helpWrapper(hwndDlg,IDH_WINDOW_SERVICE_ACCOUNT_INFO );
  274. break;
  275. }
  276. default:
  277. break;
  278. }
  279. return 0;
  280. }
  281. INT_PTR CALLBACK
  282. IntServiceRefreshProc(
  283. IN HWND hwndDlg,
  284. IN UINT uMsg,
  285. IN WPARAM wParam,
  286. IN LPARAM lParam
  287. )
  288. {
  289. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  290. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  291. switch (uMsg)
  292. {
  293. case WM_INITDIALOG :
  294. {
  295. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  296. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  297. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  298. IUnknown * pUnk;
  299. pVarSetService->QueryInterface(IID_IUnknown, (void**) &pUnk);
  300. db->GetServiceAccount(L"",&pUnk);
  301. pUnk->Release();
  302. _bstr_t text;
  303. text = pVarSetService->get(L"ServiceAccountEntries");
  304. int numItems=_ttoi((WCHAR const *)text);
  305. if (numItems==0 )
  306. {
  307. CheckRadioButton(hwndDlg,IDC_REFRESH,IDC_NO_REFRESH,IDC_REFRESH) ;
  308. disable(hwndDlg,IDC_NO_REFRESH);
  309. }
  310. else
  311. CheckRadioButton(hwndDlg,IDC_REFRESH,IDC_NO_REFRESH,IDC_NO_REFRESH);
  312. break;
  313. }
  314. case WM_NOTIFY :
  315. {
  316. LPNMHDR lpnm = (LPNMHDR) lParam;
  317. switch (lpnm->code)
  318. {
  319. case PSN_SETACTIVE :
  320. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
  321. break;
  322. case PSN_WIZNEXT :
  323. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  324. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  325. if (IsDlgButtonChecked(hwndDlg,IDC_REFRESH) )
  326. {
  327. pdata->refreshing = true;
  328. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  329. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  330. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_SELECTION1);
  331. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_SELECTION1);
  332. return TRUE;
  333. }
  334. else
  335. {
  336. pdata->refreshing = false;
  337. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_SA_INFO_BUTTON);
  338. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_SA_INFO_BUTTON);
  339. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  340. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  341. return TRUE;
  342. }
  343. break;
  344. case PSN_WIZBACK :
  345. break;
  346. case PSN_QUERYCANCEL :
  347. GetError(0); //clear any old com errors
  348. break;
  349. case PSN_HELP :
  350. {
  351. helpWrapper(hwndDlg,IDH_WINDOW_REFRESH_INFO);
  352. break;
  353. }
  354. case PSN_RESET :
  355. break;
  356. default :
  357. break;
  358. }
  359. break;
  360. }
  361. case WM_HELP :
  362. {
  363. helpWrapper(hwndDlg,IDH_WINDOW_REFRESH_INFO);
  364. break;
  365. }
  366. default:
  367. break;
  368. }
  369. return 0;
  370. }
  371. //this function is no longer used
  372. INT_PTR CALLBACK
  373. IntOptionsFromUserProc(
  374. IN HWND hwndDlg,
  375. IN UINT uMsg,
  376. IN WPARAM wParam,
  377. IN LPARAM lParam
  378. )
  379. {
  380. CString editHeader;
  381. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  382. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  383. switch (uMsg)
  384. {
  385. case WM_INITDIALOG :
  386. {
  387. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  388. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  389. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  390. CString toformat;
  391. toformat.LoadString(IDS_30);
  392. calculateDate(hwndDlg,toformat);
  393. SetDlgItemText(hwndDlg,IDC_yo,toformat);
  394. disable(hwndDlg,IDC_yo);
  395. disable(hwndDlg,IDC_DATE);
  396. disable(hwndDlg,IDC_TEXT);
  397. initcheckbox( hwndDlg,IDC_TRANSLATE_ROAMING_PROFILES,DCTVS_AccountOptions_TranslateRoamingProfiles);
  398. // initdisablebox(hwndDlg,IDC_DISABLE_SOURCE_ACCOUNTS,IDC_DISABLE_COPIED_ACCOUNTS,IDC_DISABLE_NEITHER_ACCOUNT,
  399. // L"AccountOptions.DisableSourceAccounts",L"AccountOptions.DisableCopiedAccounts");
  400. if (IsDlgButtonChecked(hwndDlg,IDC_DISABLE_SOURCE_ACCOUNTS))
  401. {
  402. disable(hwndDlg,IDC_SET_EXPIRATION);
  403. disable(hwndDlg,IDC_yo);
  404. }
  405. else
  406. {
  407. enable(hwndDlg,IDC_SET_EXPIRATION);
  408. if (IsDlgButtonChecked(hwndDlg,IDC_SET_EXPIRATION))
  409. enable(hwndDlg,IDC_yo);
  410. }
  411. break;
  412. }
  413. case WM_COMMAND:
  414. {
  415. switch(LOWORD (wParam))
  416. {
  417. case IDC_SET_EXPIRATION :
  418. {
  419. if (IsDlgButtonChecked(hwndDlg,IDC_SET_EXPIRATION))
  420. {
  421. enable(hwndDlg,IDC_yo);
  422. enable(hwndDlg,IDC_DATE);
  423. enable(hwndDlg,IDC_TEXT);
  424. }
  425. else
  426. {
  427. disable(hwndDlg,IDC_yo);
  428. disable(hwndDlg,IDC_DATE);
  429. disable(hwndDlg,IDC_TEXT);
  430. }
  431. break;
  432. }
  433. case IDC_DISABLE_SOURCE_ACCOUNTS :
  434. {
  435. disable(hwndDlg,IDC_SET_EXPIRATION);
  436. disable(hwndDlg,IDC_yo);
  437. break;
  438. }
  439. case IDC_DISABLE_COPIED_ACCOUNTS :
  440. {
  441. enable(hwndDlg,IDC_SET_EXPIRATION);
  442. if (IsDlgButtonChecked(hwndDlg,IDC_SET_EXPIRATION))
  443. enable(hwndDlg,IDC_yo);
  444. break;
  445. }
  446. case IDC_DISABLE_NEITHER_ACCOUNT :
  447. {
  448. enable(hwndDlg,IDC_SET_EXPIRATION);
  449. if (IsDlgButtonChecked(hwndDlg,IDC_SET_EXPIRATION))
  450. enable(hwndDlg,IDC_yo);
  451. break;
  452. }
  453. default :
  454. break;
  455. }
  456. switch(HIWORD (wParam)){
  457. case EN_SETFOCUS :
  458. bChangeOnFly=true;
  459. break;
  460. case EN_KILLFOCUS :
  461. bChangeOnFly=false;
  462. break;
  463. case EN_CHANGE:
  464. {
  465. if ((!bChangeOnFly) || (LOWORD(wParam) != IDC_yo))
  466. break;
  467. CString s;
  468. GetDlgItemText(hwndDlg,IDC_yo,s.GetBuffer(1000),1000);
  469. s.ReleaseBuffer();
  470. //make sure all chars are digits
  471. bool bInvalid = false;
  472. int ndx=0;
  473. while ((ndx < s.GetLength()) && (!bInvalid))
  474. {
  475. if (!iswdigit(s[ndx]))
  476. bInvalid = true;
  477. ndx++;
  478. }
  479. if (bInvalid)
  480. {
  481. //for invalid days, blank out the date
  482. SetDlgItemText(hwndDlg,IDC_DATE,L"");
  483. }
  484. else //else continue checking for validity
  485. {
  486. long ndays = _wtol(s);
  487. if (((ndays <= THREE_YEARS) && (ndays >= 1)) ||
  488. (!UStrICmp(s,L"0")))
  489. calculateDate(hwndDlg,s);
  490. else
  491. {
  492. //for invalid days, blank out the date
  493. SetDlgItemText(hwndDlg,IDC_DATE,L"");
  494. }
  495. }
  496. break;
  497. }
  498. default :
  499. break;
  500. }
  501. break;
  502. }
  503. case WM_NOTIFY :
  504. {
  505. LPNMHDR lpnm = (LPNMHDR) lParam;
  506. switch (lpnm->code)
  507. {
  508. case PSN_SETACTIVE :
  509. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
  510. break;
  511. case PSN_WIZNEXT :
  512. {
  513. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  514. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  515. checkbox( hwndDlg,IDC_DISABLE_SOURCE_ACCOUNTS,DCTVS_AccountOptions_DisableSourceAccounts);
  516. checkbox( hwndDlg,IDC_DISABLE_COPIED_ACCOUNTS,DCTVS_AccountOptions_DisableCopiedAccounts);
  517. _variant_t varX;
  518. if ((IsWindowEnabled(GetDlgItem(hwndDlg, IDC_SET_EXPIRATION))) &&
  519. (IsDlgButtonChecked( hwndDlg,IDC_SET_EXPIRATION)))
  520. {
  521. time_t t;
  522. if (timeInABox(hwndDlg,t))
  523. {
  524. varX =t;
  525. put(DCTVS_AccountOptions_ExpireSourceAccounts,varX);
  526. }
  527. else
  528. {
  529. MessageBoxWrapper(hwndDlg,IDS_MSG_TIME,IDS_MSG_ERROR);
  530. // SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_DISABLE);
  531. SetFocus(GetDlgItem(hwndDlg, IDC_yo));
  532. SendDlgItemMessage(hwndDlg, IDC_yo, EM_SETSEL,
  533. (WPARAM)0, (LPARAM)-1);
  534. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,-1);
  535. return TRUE;
  536. }
  537. }
  538. else
  539. {
  540. varX = L"";
  541. put(DCTVS_AccountOptions_ExpireSourceAccounts,varX);
  542. }
  543. checkbox( hwndDlg,IDC_TRANSLATE_ROAMING_PROFILES,DCTVS_AccountOptions_TranslateRoamingProfiles);
  544. if (someServiceAccounts(pdata->accounts,hwndDlg))
  545. {
  546. pdata->someService=true;
  547. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  548. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  549. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_SA_INFO);
  550. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_SA_INFO);
  551. return TRUE;
  552. }
  553. else
  554. {
  555. pdata->someService=false;
  556. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  557. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  558. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_END_GROUP);
  559. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_END_GROUP);
  560. return TRUE;
  561. }
  562. break;
  563. }
  564. case PSN_WIZBACK :
  565. break;
  566. case PSN_QUERYCANCEL :
  567. GetError(0); //clear any old com errors
  568. break;
  569. case PSN_HELP :
  570. {
  571. helpWrapper(hwndDlg,IDH_WINDOW_GROUP_MEMBER_OPTION);
  572. break;
  573. }
  574. case PSN_RESET :
  575. break;
  576. default :
  577. break;
  578. }
  579. break;
  580. } case WM_HELP :
  581. {
  582. helpWrapper(hwndDlg,IDH_WINDOW_GROUP_MEMBER_OPTION);
  583. break;
  584. }
  585. default:
  586. break;
  587. }
  588. return 0;
  589. }
  590. INT_PTR CALLBACK
  591. IntOptionsProc(
  592. IN HWND hwndDlg,
  593. IN UINT uMsg,
  594. IN WPARAM wParam,
  595. IN LPARAM lParam
  596. ){
  597. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  598. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  599. switch (uMsg)
  600. {
  601. case WM_INITDIALOG :
  602. {
  603. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  604. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  605. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  606. initnoncollisionrename(hwndDlg);
  607. initcheckbox( hwndDlg,IDC_TRANSLATE_ROAMING_PROFILES,DCTVS_AccountOptions_TranslateRoamingProfiles);
  608. initcheckbox( hwndDlg,IDC_UPDATE_USER_RIGHTS,DCTVS_AccountOptions_UpdateUserRights);
  609. initcheckbox( hwndDlg,IDC_MIGRATE_GROUPS_OF_USERS,DCTVS_AccountOptions_CopyMemberOf);
  610. initcheckbox( hwndDlg,IDC_REMIGRATE_OBJECTS,DCTVS_AccountOptions_IncludeMigratedAccts);
  611. initcheckbox( hwndDlg,IDC_FIX_MEMBERSHIP,DCTVS_AccountOptions_FixMembership);
  612. if (IsDlgButtonChecked(hwndDlg,IDC_MIGRATE_GROUPS_OF_USERS))
  613. {
  614. pdata->memberSwitch=true;
  615. enable(hwndDlg,IDC_REMIGRATE_OBJECTS);
  616. // CheckDlgButton(hwndDlg,IDC_FIX_MEMBERSHIP,true);
  617. }
  618. else
  619. disable(hwndDlg,IDC_REMIGRATE_OBJECTS);
  620. if (pdata->sameForest)
  621. {
  622. CheckDlgButton(hwndDlg,IDC_FIX_MEMBERSHIP,true);
  623. disable(hwndDlg,IDC_FIX_MEMBERSHIP);
  624. }
  625. break;
  626. }
  627. case WM_COMMAND:
  628. {
  629. switch(LOWORD (wParam))
  630. {
  631. case IDC_MIGRATE_GROUPS_OF_USERS:
  632. {
  633. pdata->memberSwitch=(!pdata->memberSwitch);
  634. pdata->memberSwitch ? enable(hwndDlg,IDC_REMIGRATE_OBJECTS):disable(hwndDlg,IDC_REMIGRATE_OBJECTS);
  635. // CheckDlgButton(hwndDlg,IDC_FIX_MEMBERSHIP,true);
  636. bChangedMigrationTypes=true;
  637. break;
  638. }
  639. case IDC_RADIO_NONE :
  640. {
  641. disable(hwndDlg,IDC_PRE);
  642. disable(hwndDlg,IDC_SUF);
  643. CheckDlgButton(hwndDlg,IDC_RADIO_PRE,false);
  644. CheckDlgButton(hwndDlg,IDC_RADIO_SUF,false);
  645. break;
  646. }
  647. case IDC_RADIO_PRE :
  648. {
  649. enable(hwndDlg,IDC_PRE);
  650. disable(hwndDlg,IDC_SUF);
  651. CheckDlgButton(hwndDlg,IDC_RADIO_NONE,false);
  652. CheckDlgButton(hwndDlg,IDC_RADIO_SUF,false);
  653. SetFocus(GetDlgItem(hwndDlg, IDC_PRE));
  654. SendDlgItemMessage(hwndDlg, IDC_PRE, EM_SETSEL,
  655. (WPARAM)0, (LPARAM)-1);
  656. break;
  657. }
  658. case IDC_RADIO_SUF :
  659. {
  660. disable(hwndDlg,IDC_PRE);
  661. enable(hwndDlg,IDC_SUF);
  662. CheckDlgButton(hwndDlg,IDC_RADIO_PRE,false);
  663. CheckDlgButton(hwndDlg,IDC_RADIO_NONE,false);
  664. SetFocus(GetDlgItem(hwndDlg, IDC_SUF));
  665. SendDlgItemMessage(hwndDlg, IDC_SUF, EM_SETSEL,
  666. (WPARAM)0, (LPARAM)-1);
  667. break;
  668. }
  669. default :
  670. break;
  671. }
  672. break;
  673. }
  674. case WM_NOTIFY :
  675. {
  676. LPNMHDR lpnm = (LPNMHDR) lParam;
  677. switch (lpnm->code)
  678. {
  679. case PSN_SETACTIVE :
  680. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
  681. break;
  682. case PSN_WIZNEXT :
  683. {
  684. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  685. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  686. checkbox( hwndDlg,IDC_TRANSLATE_ROAMING_PROFILES,DCTVS_AccountOptions_TranslateRoamingProfiles);
  687. checkbox( hwndDlg,IDC_UPDATE_USER_RIGHTS,DCTVS_AccountOptions_UpdateUserRights);
  688. checkbox( hwndDlg,IDC_MIGRATE_GROUPS_OF_USERS,DCTVS_AccountOptions_CopyMemberOf);
  689. checkbox( hwndDlg,IDC_MIGRATE_GROUPS_OF_USERS,DCTVS_AccountOptions_CopyLocalGroups);
  690. checkbox( hwndDlg,IDC_FIX_MEMBERSHIP,DCTVS_AccountOptions_FixMembership);
  691. if (IsDlgButtonChecked(hwndDlg,IDC_MIGRATE_GROUPS_OF_USERS))
  692. checkbox( hwndDlg,IDC_REMIGRATE_OBJECTS,DCTVS_AccountOptions_IncludeMigratedAccts);
  693. else if (pdata->sameForest)
  694. {
  695. CString yo;
  696. yo.LoadString(IDS_GRATUITIOUS_MESSAGE);
  697. CString warning;
  698. warning.LoadString(IDS_MSG_WARNING);
  699. MessageBox(hwndDlg,yo,warning,MB_OK| MB_ICONINFORMATION);
  700. }
  701. if ( !noncollisionrename(hwndDlg))
  702. {
  703. int nID = IDC_PRE;
  704. MessageBoxWrapperFormat1(hwndDlg,IDS_MSG_INVALIDCHARS,IDS_INVALID_STRING,IDS_MSG_INPUT);
  705. // SetWindowLong(hwndDlg,DWL_MSGRESULT,IDD_OPTIONS);
  706. //set focus on invalid string
  707. if (IsDlgButtonChecked(hwndDlg,IDC_RADIO_SUF))
  708. nID = IDC_SUF;
  709. SetFocus(GetDlgItem(hwndDlg, nID));
  710. SendDlgItemMessage(hwndDlg, nID, EM_SETSEL,
  711. (WPARAM)0, (LPARAM)-1);
  712. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,-1);
  713. return TRUE;
  714. }
  715. if ((pdata->sourceIsNT4))
  716. {
  717. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT,IDD_RENAMING);
  718. return TRUE;
  719. }
  720. if (pdata->sameForest && migration==w_account)
  721. {
  722. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_RENAMING);
  723. return TRUE;
  724. }
  725. break;
  726. }
  727. case PSN_WIZBACK :
  728. if (pdata->sameForest && migration==w_account)
  729. {
  730. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CREDENTIALS);
  731. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_CREDENTIALS);
  732. return TRUE;
  733. }
  734. else
  735. {
  736. if (pdata->IsSidHistoryChecked)
  737. {
  738. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CREDENTIALS);
  739. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_CREDENTIALS);
  740. return TRUE;
  741. }
  742. else
  743. {
  744. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_DISABLE);
  745. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_DISABLE);
  746. return TRUE;
  747. }
  748. }
  749. break;
  750. case PSN_QUERYCANCEL :
  751. GetError(0); //clear any old com errors
  752. break;
  753. case PSN_HELP :
  754. {
  755. helpWrapper(hwndDlg,IDH_WINDOW_USER_OPTION);
  756. break;
  757. }
  758. case PSN_RESET :
  759. break;
  760. default :
  761. break;
  762. }
  763. break;
  764. } case WM_HELP :
  765. {
  766. helpWrapper(hwndDlg,IDH_WINDOW_USER_OPTION);
  767. break;
  768. }
  769. default:
  770. break;
  771. }
  772. return 0;
  773. }
  774. INT_PTR CALLBACK
  775. IntOptionsReportingProc(
  776. IN HWND hwndDlg,
  777. IN UINT uMsg,
  778. IN WPARAM wParam,
  779. IN LPARAM lParam
  780. )
  781. {
  782. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  783. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  784. switch (uMsg)
  785. {
  786. case WM_INITDIALOG :
  787. {
  788. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  789. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  790. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  791. HWND hLC7= GetDlgItem(hwndDlg,IDC_LIST_REPORTING);
  792. m_reportingBox.Attach(hLC7);
  793. CString column;
  794. column.LoadString(IDS_COLUMN_REPORT); m_reportingBox.InsertColumn( 1, column,LVCFMT_LEFT,150,1);
  795. column.LoadString(IDS_COLUMN_LASTGENERATEDON); m_reportingBox.InsertColumn( 2,column,LVCFMT_LEFT,280,1);
  796. getReporting();
  797. break;
  798. }
  799. case WM_NOTIFY :
  800. {
  801. LPNMHDR lpnm = (LPNMHDR) lParam;
  802. switch (lpnm->code)
  803. {
  804. case PSN_SETACTIVE :
  805. // (m_reportingBox.GetFirstSelectedItemPosition())?
  806. (m_reportingBox.GetNextItem(-1, LVNI_SELECTED) != -1)?
  807. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT):
  808. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK);
  809. break;
  810. case NM_SETFOCUS :
  811. case NM_KILLFOCUS :
  812. case NM_CLICK :
  813. {
  814. // (m_reportingBox.GetFirstSelectedItemPosition())?
  815. (m_reportingBox.GetNextItem(-1, LVNI_SELECTED) != -1)?
  816. PostMessage(GetParent(hwndDlg), PSM_SETWIZBUTTONS, 0, PSWIZB_BACK|PSWIZB_NEXT):
  817. PostMessage(GetParent(hwndDlg), PSM_SETWIZBUTTONS, 0, PSWIZB_BACK);
  818. break;
  819. }
  820. case PSN_WIZNEXT :
  821. {
  822. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  823. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  824. putReporting();
  825. _bstr_t text= get(DCTVS_Reports_AccountReferences);
  826. if (!UStrICmp(text ,(WCHAR const *) yes))
  827. {
  828. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_SELECTION1);
  829. return TRUE;
  830. }
  831. else
  832. {
  833. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_END_REPORTING);
  834. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_END_REPORTING);
  835. return TRUE;
  836. }
  837. break;
  838. }
  839. case PSN_WIZBACK :
  840. break;
  841. case PSN_QUERYCANCEL :
  842. GetError(0); //clear any old com errors
  843. break;
  844. case PSN_HELP :
  845. {
  846. helpWrapper(hwndDlg,IDH_WINDOW_REPORT_SELECTION);
  847. break;
  848. }
  849. case PSN_RESET :
  850. break;
  851. default :
  852. break;
  853. }
  854. break;
  855. } case WM_HELP :
  856. {
  857. helpWrapper(hwndDlg,IDH_WINDOW_REPORT_SELECTION);
  858. break;
  859. }
  860. default:
  861. break;
  862. }
  863. return 0;
  864. }
  865. INT_PTR CALLBACK
  866. IntRetryProc(
  867. IN HWND hwndDlg,
  868. IN UINT uMsg,
  869. IN WPARAM wParam,
  870. IN LPARAM lParam
  871. )
  872. {
  873. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  874. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  875. switch (uMsg)
  876. {
  877. case WM_INITDIALOG :
  878. {
  879. CWaitCursor w;
  880. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  881. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  882. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  883. HWND hLC= GetDlgItem(hwndDlg,IDC_LIST_RETRY);
  884. m_cancelBox.Attach(hLC);
  885. CString column;
  886. column.LoadString(IDS_COLUMN_SERVER); m_cancelBox.InsertColumn( 1, column,LVCFMT_LEFT,90,1);
  887. column.LoadString(IDS_COLUMN_JOBFILE); m_cancelBox.InsertColumn( 2, column,LVCFMT_LEFT,0,1);
  888. column.LoadString(IDS_COLUMN_STATUS); m_cancelBox.InsertColumn( 3, column,LVCFMT_LEFT,140,1);
  889. column.LoadString(IDS_COLUMN_ACTION); m_cancelBox.InsertColumn( 4, column,LVCFMT_LEFT,115,1);
  890. column.LoadString(IDS_COLUMN_ACTIONID); m_cancelBox.InsertColumn( 5, column,LVCFMT_LEFT,0,1);
  891. column.LoadString(IDS_COLUMN_SKIPINCLUDE); m_cancelBox.InsertColumn( 6, column,LVCFMT_LEFT,80,1);
  892. getFailed(hwndDlg);
  893. disable(hwndDlg,IDC_CANCEL);
  894. disable(hwndDlg,IDC_TOGGLE);
  895. break;
  896. }
  897. case WM_COMMAND:
  898. {
  899. switch(LOWORD (wParam))
  900. {
  901. case IDC_CANCEL :
  902. {
  903. CWaitCursor w;
  904. CString toggleWarning,title;
  905. title.LoadString(IDS_MSG_WARNING);
  906. toggleWarning.LoadString(IDS_MSG_PERMANENT_REMOVE);
  907. if (MessageBox(hwndDlg,toggleWarning,title,MB_OKCANCEL|MB_ICONEXCLAMATION)==IDOK)
  908. {
  909. handleCancel(hwndDlg);
  910. if (m_cancelBox.GetItemCount()==0) PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK);
  911. }
  912. !SomethingToRetry() ?
  913. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK ):
  914. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
  915. break;
  916. }
  917. case IDC_TOGGLE :
  918. {
  919. OnRetryToggle();
  920. !SomethingToRetry() ?
  921. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK ):
  922. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
  923. break;
  924. }
  925. default :
  926. break;
  927. }
  928. activateCancelIfNecessary(hwndDlg);
  929. break;
  930. }
  931. case WM_NOTIFY :
  932. {
  933. LPNMHDR lpnm = (LPNMHDR) lParam;
  934. switch (lpnm->code)
  935. {
  936. case LVN_COLUMNCLICK:
  937. {
  938. LPNMLISTVIEW pnmv = (NM_LISTVIEW FAR *) lParam;
  939. pdata->sort[pnmv->iSubItem] = !pdata->sort[pnmv->iSubItem];
  940. //sort(m_cancelBox,pnmv->iSubItem,pdata->sort[pnmv->iSubItem] );
  941. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  942. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  943. break;
  944. }
  945. case NM_SETFOCUS :
  946. case NM_KILLFOCUS :
  947. case NM_CLICK:
  948. {
  949. activateCancelIfNecessary(hwndDlg);
  950. break;
  951. }
  952. case PSN_SETACTIVE :
  953. !SomethingToRetry() ?
  954. PostMessage(GetParent(hwndDlg), PSM_SETWIZBUTTONS, 0, PSWIZB_BACK):
  955. PostMessage(GetParent(hwndDlg), PSM_SETWIZBUTTONS, 0, PSWIZB_BACK|PSWIZB_NEXT);
  956. break;
  957. case PSN_WIZNEXT :
  958. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  959. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  960. if (!SomethingToRetry())
  961. {
  962. MessageBoxWrapper(hwndDlg,IDS_MSG_CANCEL,IDS_MSG_ERROR);
  963. // SetWindowLong(hwndDlg,DWL_MSGRESULT,IDD_RETRY);
  964. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,IDD_RETRY);
  965. return TRUE;
  966. }
  967. else
  968. OnRETRY();
  969. break;
  970. case PSN_WIZBACK :
  971. break;
  972. case PSN_QUERYCANCEL :
  973. GetError(0); //clear any old com errors
  974. break;
  975. case PSN_HELP :
  976. {
  977. helpWrapper(hwndDlg,IDH_WINDOW_TASK_SELECTION);
  978. break;
  979. }
  980. case PSN_RESET :
  981. break;
  982. default :
  983. break;
  984. }
  985. break;
  986. } case WM_HELP :
  987. {
  988. helpWrapper(hwndDlg,IDH_WINDOW_TASK_SELECTION);
  989. break;
  990. }
  991. default:
  992. break;
  993. }
  994. return 0;
  995. }
  996. INT_PTR CALLBACK
  997. IntPasswordProc(
  998. IN HWND hwndDlg,
  999. IN UINT uMsg,
  1000. IN WPARAM wParam,
  1001. IN LPARAM lParam
  1002. )
  1003. {
  1004. CString editHeader;
  1005. bool bPopulated = true;
  1006. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  1007. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  1008. switch (uMsg)
  1009. {
  1010. case WM_INITDIALOG :
  1011. {
  1012. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  1013. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  1014. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  1015. initpasswordbox(hwndDlg,IDC_GENERATE_STRONG_PASSWORDS,IDC_GENERATE_STRONG_PASSWORDS_NOT, IDC_MIG_PASSWORDS,
  1016. L"AccountOptions.GenerateStrongPasswords", L"AccountOptions.CopyPasswords");
  1017. bPopulated = populatePasswordDCs(hwndDlg, IDC_PASSWORD_DC, pdata->sourceIsNT4);
  1018. if (IsDlgButtonChecked(hwndDlg,IDC_MIG_PASSWORDS))
  1019. {
  1020. disable(hwndDlg,IDC_BROWSE);
  1021. switchboxes(hwndDlg, IDC_PASSWORD_FILE, IDC_PASSWORD_DC);
  1022. editHeader.LoadString(IDS_PASSWORD_DC_HDR);
  1023. SetDlgItemText(hwndDlg,IDC_PASSWORD_EDIT,editHeader);
  1024. if (!bPopulated)
  1025. addStringToComboBox(hwndDlg,IDC_PASSWORD_DC,sourceDC);
  1026. initDCcombobox( hwndDlg,IDC_PASSWORD_DC,DCTVS_AccountOptions_PasswordDC);
  1027. }
  1028. else
  1029. {
  1030. enable(hwndDlg,IDC_BROWSE);
  1031. switchboxes(hwndDlg, IDC_PASSWORD_DC, IDC_PASSWORD_FILE);
  1032. editHeader.LoadString(IDS_PASSWORD_FILE_HDR);
  1033. SetDlgItemText(hwndDlg,IDC_PASSWORD_EDIT,editHeader);
  1034. initeditbox( hwndDlg,IDC_PASSWORD_FILE,DCTVS_AccountOptions_PasswordFile);
  1035. if (IsDlgItemEmpty(hwndDlg,IDC_PASSWORD_FILE))
  1036. {
  1037. CString toinsert;
  1038. GetDirectory(toinsert.GetBuffer(1000));
  1039. toinsert.ReleaseBuffer();
  1040. toinsert+="Logs\\passwords.txt";
  1041. SetDlgItemText(hwndDlg,IDC_PASSWORD_FILE,toinsert);
  1042. }
  1043. }
  1044. break;
  1045. }
  1046. case WM_COMMAND:
  1047. {
  1048. switch(LOWORD (wParam))
  1049. {
  1050. case IDC_BROWSE :
  1051. OnFileBrowse(hwndDlg,IDC_PASSWORD_FILE);
  1052. break;
  1053. case IDC_MIG_PASSWORDS :
  1054. disable(hwndDlg,IDC_BROWSE);
  1055. switchboxes(hwndDlg, IDC_PASSWORD_FILE, IDC_PASSWORD_DC);
  1056. editHeader.LoadString(IDS_PASSWORD_DC_HDR);
  1057. SetDlgItemText(hwndDlg,IDC_PASSWORD_EDIT,editHeader);
  1058. if (!populatePasswordDCs(hwndDlg, IDC_PASSWORD_DC, pdata->sourceIsNT4))
  1059. addStringToComboBox(hwndDlg,IDC_PASSWORD_DC,sourceDC);
  1060. initDCcombobox( hwndDlg,IDC_PASSWORD_DC,DCTVS_AccountOptions_PasswordDC);
  1061. break;
  1062. case IDC_GENERATE_STRONG_PASSWORDS :
  1063. case IDC_GENERATE_STRONG_PASSWORDS_NOT :
  1064. enable(hwndDlg,IDC_BROWSE);
  1065. switchboxes(hwndDlg, IDC_PASSWORD_DC, IDC_PASSWORD_FILE);
  1066. editHeader.LoadString(IDS_PASSWORD_FILE_HDR);
  1067. SetDlgItemText(hwndDlg,IDC_PASSWORD_EDIT,editHeader);
  1068. initeditbox( hwndDlg,IDC_PASSWORD_FILE,DCTVS_AccountOptions_PasswordFile);
  1069. if (IsDlgItemEmpty(hwndDlg,IDC_PASSWORD_FILE))
  1070. {
  1071. CString toinsert;
  1072. GetDirectory(toinsert.GetBuffer(1000));
  1073. toinsert.ReleaseBuffer();
  1074. toinsert+="Logs\\passwords.txt";
  1075. SetDlgItemText(hwndDlg,IDC_PASSWORD_FILE,toinsert);
  1076. }
  1077. break;
  1078. default:
  1079. break;
  1080. }
  1081. break;
  1082. }
  1083. case WM_NOTIFY :
  1084. {
  1085. LPNMHDR lpnm = (LPNMHDR) lParam;
  1086. switch (lpnm->code)
  1087. {
  1088. case PSN_SETACTIVE :
  1089. bPopulated = populatePasswordDCs(hwndDlg, IDC_PASSWORD_DC, pdata->sourceIsNT4);
  1090. initDCcombobox( hwndDlg,IDC_PASSWORD_DC,DCTVS_AccountOptions_PasswordDC);
  1091. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
  1092. break;
  1093. case PSN_WIZNEXT :
  1094. {
  1095. BOOL bMigPwd = FALSE;
  1096. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  1097. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  1098. checkbox( hwndDlg,IDC_GENERATE_STRONG_PASSWORDS,DCTVS_AccountOptions_GenerateStrongPasswords);
  1099. checkbox( hwndDlg,IDC_MIG_PASSWORDS,DCTVS_AccountOptions_CopyPasswords);
  1100. if (IsDlgButtonChecked(hwndDlg,IDC_MIG_PASSWORDS))
  1101. {
  1102. _variant_t varX = yes;
  1103. pVarSet->put(GET_BSTR(DCTVS_AccountOptions_GenerateStrongPasswords), varX);
  1104. bMigPwd = TRUE;
  1105. }
  1106. if ((!bMigPwd) && (!checkFile(hwndDlg)))
  1107. {
  1108. MessageBoxWrapper(hwndDlg,IDS_MSG_FILE,IDS_MSG_INPUT);
  1109. // SetWindowLong(hwndDlg,DWL_MSGRESULT,IDD_PASSWORD);
  1110. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,IDD_PASSWORD);
  1111. return TRUE;
  1112. }
  1113. if (IsDlgButtonChecked(hwndDlg,IDC_MIG_PASSWORDS))
  1114. editbox( hwndDlg,IDC_PASSWORD_DC,DCTVS_AccountOptions_PasswordDC);
  1115. else
  1116. editbox( hwndDlg,IDC_PASSWORD_FILE,DCTVS_AccountOptions_PasswordFile);
  1117. //check to see if the password DC has the DLL installed and ready
  1118. if (bMigPwd)
  1119. {
  1120. CString msg, title;
  1121. UINT msgtype;
  1122. _bstr_t sTemp;
  1123. sTemp = _bstr_t(get(DCTVS_AccountOptions_PasswordDC));
  1124. CString srcSvr = (WCHAR*)sTemp;
  1125. if (!IsPasswordDCReady(srcSvr, msg, title, &msgtype))
  1126. {
  1127. if (MessageBox(hwndDlg, msg, title, msgtype) != IDNO)
  1128. {
  1129. SetFocus(GetDlgItem(hwndDlg, IDC_PASSWORD_DC));
  1130. SendDlgItemMessage(hwndDlg, IDC_PASSWORD_DC, EM_SETSEL,
  1131. (WPARAM)0, (LPARAM)-1);
  1132. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,-1);
  1133. return TRUE;
  1134. }
  1135. }
  1136. else //else, store this tgtDC used in this check for use during the migration
  1137. pVarSet->put(GET_BSTR(DCTVS_Options_TargetServerOverride), _bstr_t(targetServer));
  1138. }
  1139. if (IsDlgButtonChecked(hwndDlg,IDC_GENERATE_STRONG_PASSWORDS_NOT))
  1140. {
  1141. ShowWarning(hwndDlg);
  1142. }
  1143. break;
  1144. }
  1145. case PSN_WIZBACK :
  1146. break;
  1147. case PSN_QUERYCANCEL :
  1148. GetError(0); //clear any old com errors
  1149. break;
  1150. case PSN_HELP :
  1151. {
  1152. helpWrapper(hwndDlg,IDH_WINDOW_PASSWORD_OPTION);
  1153. break;
  1154. }
  1155. case PSN_RESET :
  1156. break;
  1157. default :
  1158. break;
  1159. }
  1160. break;
  1161. } case WM_HELP :
  1162. {
  1163. helpWrapper(hwndDlg,IDH_WINDOW_PASSWORD_OPTION);
  1164. break;
  1165. }
  1166. default:
  1167. break;
  1168. }
  1169. return 0;
  1170. }
  1171. INT_PTR CALLBACK
  1172. IntTargetGroupProc(
  1173. IN HWND hwndDlg,
  1174. IN UINT uMsg,
  1175. IN WPARAM wParam,
  1176. IN LPARAM lParam
  1177. )
  1178. {
  1179. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  1180. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  1181. switch (uMsg)
  1182. {
  1183. case WM_INITDIALOG :
  1184. {
  1185. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  1186. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  1187. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  1188. break;
  1189. }
  1190. case WM_COMMAND:
  1191. {
  1192. switch(LOWORD (wParam))
  1193. {
  1194. case IDC_BROWSE:
  1195. {
  1196. HRESULT hr = pDsObjectPicker2->InvokeDialog(hwndDlg, &pdo2);
  1197. if (FAILED(hr)) return 0;
  1198. if (hr == S_OK) {
  1199. ProcessSelectedObjects2(pdo2,hwndDlg);
  1200. pdo2->Release();
  1201. }
  1202. break;
  1203. }
  1204. default :
  1205. break;
  1206. }
  1207. switch(HIWORD(wParam))
  1208. {
  1209. case EN_CHANGE :
  1210. enableNextIfNecessary(hwndDlg,IDC_TARGET_GROUP);
  1211. break;
  1212. default:
  1213. break;
  1214. }
  1215. break;
  1216. }
  1217. case WM_NOTIFY :
  1218. {
  1219. LPNMHDR lpnm = (LPNMHDR) lParam;
  1220. switch (lpnm->code)
  1221. {
  1222. case PSN_SETACTIVE :
  1223. enableNextIfNecessary(hwndDlg,IDC_TARGET_GROUP);
  1224. break;
  1225. case PSN_WIZNEXT :
  1226. {
  1227. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  1228. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  1229. _bstr_t text = get(DCTVS_Accounts_NumItems);
  1230. int count = _ttoi((WCHAR * const) text);
  1231. CString base=L"",toadd;
  1232. _variant_t varX;
  1233. for (int i = 0;i<count;i++)
  1234. {
  1235. base.Format(L"Accounts.%ld.TargetName",i);
  1236. GetDlgItemText(hwndDlg,IDC_TARGET_GROUP,toadd.GetBuffer(1000),1000);
  1237. toadd.ReleaseBuffer();
  1238. varX = toadd;
  1239. pVarSet->put(_bstr_t(base),varX);
  1240. }
  1241. break;
  1242. }
  1243. case PSN_WIZBACK :
  1244. break;
  1245. case PSN_QUERYCANCEL :
  1246. GetError(0); //clear any old com errors
  1247. break;
  1248. case PSN_HELP :
  1249. {
  1250. helpWrapper(hwndDlg,IDH_WINDOW_TARGET_GROUP_SELECTION);
  1251. break;
  1252. }
  1253. case PSN_RESET :
  1254. break;
  1255. default :
  1256. break;
  1257. }
  1258. break;
  1259. } case WM_HELP :
  1260. {
  1261. helpWrapper(hwndDlg,IDH_WINDOW_TARGET_GROUP_SELECTION);
  1262. break;
  1263. }
  1264. default:
  1265. break;
  1266. }
  1267. return 0;
  1268. }
  1269. INT_PTR CALLBACK
  1270. IntTrustProc(
  1271. IN HWND hwndDlg,
  1272. IN UINT uMsg,
  1273. IN WPARAM wParam,
  1274. IN LPARAM lParam
  1275. )
  1276. {
  1277. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  1278. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  1279. switch (uMsg)
  1280. {
  1281. case WM_INITDIALOG :
  1282. {CWaitCursor w;
  1283. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  1284. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  1285. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  1286. HWND hLC= GetDlgItem(hwndDlg,IDC_LIST_SERVICE);
  1287. m_trustBox.Attach(hLC);
  1288. CString column;
  1289. column.LoadString(IDS_COLUMN_DOMAIN); m_trustBox.InsertColumn( 1, column,LVCFMT_LEFT,155,1);
  1290. column.LoadString(IDS_COLUMN_DIRECTION); m_trustBox.InsertColumn( 2, column,LVCFMT_LEFT,80,1);
  1291. column.LoadString(IDS_COLUMN_ATTRIBUTES); m_trustBox.InsertColumn( 3, column,LVCFMT_LEFT,80,1);
  1292. column.LoadString(IDS_COLUMN_EXISTSFORTARGET); m_trustBox.InsertColumn( 4, column,LVCFMT_LEFT,90,1);
  1293. disable(hwndDlg,IDC_MIGRATE);
  1294. if (pdata->newSource)
  1295. {
  1296. m_trustBox.DeleteAllItems();
  1297. getTrust();
  1298. pdata->newSource=false;
  1299. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  1300. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  1301. }
  1302. break;
  1303. }
  1304. case WM_COMMAND:
  1305. {
  1306. switch(LOWORD (wParam))
  1307. {
  1308. case IDC_MIGRATE:
  1309. {
  1310. bool atleast1succeeded=false;
  1311. HRESULT hr = MigrateTrusts(hwndDlg,atleast1succeeded);
  1312. if (SUCCEEDED(hr))
  1313. {
  1314. if (atleast1succeeded)
  1315. {
  1316. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
  1317. pdata->proceed= true;
  1318. }
  1319. }
  1320. else
  1321. {
  1322. ErrorWrapper(hwndDlg,hr);
  1323. }
  1324. activateTrustButton(hwndDlg);
  1325. break;
  1326. }
  1327. default :
  1328. break;
  1329. }
  1330. break;
  1331. }
  1332. case WM_NOTIFY :
  1333. {
  1334. LPNMHDR lpnm = (LPNMHDR) lParam;
  1335. switch (lpnm->code)
  1336. {
  1337. case LVN_COLUMNCLICK:
  1338. {
  1339. LPNMLISTVIEW pnmv = (NM_LISTVIEW FAR *) lParam;
  1340. pdata->sort[pnmv->iSubItem] = !pdata->sort[pnmv->iSubItem];
  1341. //sort(m_trustBox,pnmv->iSubItem,pdata->sort[pnmv->iSubItem] );
  1342. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  1343. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  1344. break;
  1345. }
  1346. case NM_SETFOCUS :
  1347. case NM_KILLFOCUS :
  1348. case NM_CLICK:
  1349. {
  1350. activateTrustButton(hwndDlg);
  1351. break;
  1352. }
  1353. case PSN_SETACTIVE :
  1354. if (pdata->newSource)
  1355. {
  1356. m_trustBox.DeleteAllItems();
  1357. getTrust();
  1358. pdata->newSource=false;
  1359. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  1360. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  1361. }
  1362. pdata->proceed ?
  1363. PostMessage(GetParent(hwndDlg), PSM_SETWIZBUTTONS, 0, PSWIZB_BACK|PSWIZB_NEXT):
  1364. PostMessage(GetParent(hwndDlg), PSM_SETWIZBUTTONS, 0, PSWIZB_BACK);
  1365. break;
  1366. case PSN_WIZNEXT :
  1367. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  1368. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  1369. if (!pdata->proceed)
  1370. {
  1371. MessageBoxWrapper(hwndDlg,IDS_MSG_SELECT_TRUST,IDS_MSG_INPUT);
  1372. // SetWindowLong(hwndDlg,DWL_MSGRESULT,IDD_TRUST_INFO);
  1373. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,IDD_TRUST_INFO);
  1374. return TRUE;
  1375. }
  1376. break;
  1377. case PSN_WIZBACK :
  1378. break;
  1379. case PSN_QUERYCANCEL :
  1380. GetError(0); //clear any old com errors
  1381. break;
  1382. case PSN_HELP :
  1383. {
  1384. helpWrapper(hwndDlg,IDH_WINDOW_TRUST_INFO);
  1385. break;
  1386. }
  1387. case PSN_RESET :
  1388. break;
  1389. default :
  1390. break;
  1391. }
  1392. break;
  1393. } case WM_HELP :
  1394. {
  1395. helpWrapper(hwndDlg,IDH_WINDOW_TRUST_INFO);
  1396. break;
  1397. }
  1398. default:
  1399. break;
  1400. }
  1401. return 0;
  1402. }
  1403. INT_PTR CALLBACK
  1404. IntRebootProc(
  1405. IN HWND hwndDlg,
  1406. IN UINT uMsg,
  1407. IN WPARAM wParam,
  1408. IN LPARAM lParam
  1409. )
  1410. {
  1411. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  1412. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  1413. switch (uMsg)
  1414. {
  1415. case WM_INITDIALOG :
  1416. {
  1417. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  1418. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  1419. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  1420. initnoncollisionrename(hwndDlg);
  1421. addrebootValues(hwndDlg);
  1422. initeditbox(hwndDlg,IDC_COMBO2,DCTVS_Options_GuiOnlyRebootSaver);
  1423. if (IsDlgItemEmpty(hwndDlg,IDC_COMBO2))
  1424. {
  1425. CString s;
  1426. s.LoadString(IDS_FIVE);
  1427. SetDlgItemText(hwndDlg,IDC_COMBO2,s);
  1428. }
  1429. break;
  1430. }
  1431. case WM_COMMAND :
  1432. {
  1433. switch(LOWORD(wParam))
  1434. {
  1435. case IDC_RADIO_NONE :
  1436. {
  1437. disable(hwndDlg,IDC_PRE);
  1438. disable(hwndDlg,IDC_SUF);
  1439. CheckDlgButton(hwndDlg,IDC_RADIO_PRE,false);
  1440. CheckDlgButton(hwndDlg,IDC_RADIO_SUF,false);
  1441. break;
  1442. }
  1443. case IDC_RADIO_PRE :
  1444. {
  1445. enable(hwndDlg,IDC_PRE);
  1446. disable(hwndDlg,IDC_SUF);
  1447. CheckDlgButton(hwndDlg,IDC_RADIO_NONE,false);
  1448. CheckDlgButton(hwndDlg,IDC_RADIO_SUF,false);
  1449. SetFocus(GetDlgItem(hwndDlg, IDC_PRE));
  1450. SendDlgItemMessage(hwndDlg, IDC_PRE, EM_SETSEL,
  1451. (WPARAM)0, (LPARAM)-1);
  1452. break;
  1453. }
  1454. case IDC_RADIO_SUF :
  1455. {
  1456. disable(hwndDlg,IDC_PRE);
  1457. enable(hwndDlg,IDC_SUF);
  1458. CheckDlgButton(hwndDlg,IDC_RADIO_NONE,false);
  1459. CheckDlgButton(hwndDlg,IDC_RADIO_PRE,false);
  1460. SetFocus(GetDlgItem(hwndDlg, IDC_SUF));
  1461. SendDlgItemMessage(hwndDlg, IDC_SUF, EM_SETSEL,
  1462. (WPARAM)0, (LPARAM)-1);
  1463. break;
  1464. }
  1465. default:
  1466. {
  1467. break;
  1468. }
  1469. }
  1470. break;
  1471. }
  1472. case WM_NOTIFY :
  1473. {
  1474. LPNMHDR lpnm = (LPNMHDR) lParam;
  1475. switch (lpnm->code)
  1476. {
  1477. case PSN_SETACTIVE :
  1478. enableNextIfNecessary(hwndDlg,IDC_COMBO2);
  1479. break;
  1480. case PSN_WIZNEXT :
  1481. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  1482. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  1483. if (validReboot(hwndDlg,IDC_COMBO2))
  1484. {
  1485. editbox(hwndDlg,IDC_COMBO2,DCTVS_Options_GuiOnlyRebootSaver);
  1486. pdata->rebootDelay=rebootbox( hwndDlg,IDC_COMBO2);
  1487. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  1488. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  1489. }
  1490. else
  1491. {
  1492. MessageBoxWrapper(hwndDlg,IDS_MSG_REBOOT,IDS_MSG_INPUT);
  1493. // SetWindowLong(hwndDlg,DWL_MSGRESULT,IDD_REBOOT);
  1494. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,IDD_REBOOT);
  1495. return TRUE;
  1496. }
  1497. if ( !noncollisionrename(hwndDlg))
  1498. {
  1499. int nID = IDC_PRE;
  1500. MessageBoxWrapperFormat1(hwndDlg,IDS_MSG_INVALIDCHARS,IDS_INVALID_STRING,IDS_MSG_INPUT);
  1501. //set focus on invalid string
  1502. if (IsDlgButtonChecked(hwndDlg,IDC_RADIO_SUF))
  1503. nID = IDC_SUF;
  1504. SetFocus(GetDlgItem(hwndDlg, nID));
  1505. SendDlgItemMessage(hwndDlg, nID, EM_SETSEL,
  1506. (WPARAM)0, (LPARAM)-1);
  1507. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,-1);
  1508. return TRUE;
  1509. // SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,IDD_REBOOT);
  1510. }
  1511. if (pdata->sourceIsNT4)
  1512. {
  1513. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_RENAMING);
  1514. return TRUE;
  1515. }
  1516. break;
  1517. case PSN_WIZBACK :
  1518. {
  1519. if (migration==w_computer)
  1520. {
  1521. if (!pdata->translateObjects)
  1522. {
  1523. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_TRANSLATION);
  1524. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_TRANSLATION);
  1525. return TRUE;
  1526. }
  1527. else
  1528. {
  1529. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_TRANSLATION_MODE);
  1530. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_TRANSLATION_MODE);
  1531. return TRUE;
  1532. }
  1533. }
  1534. }
  1535. break;
  1536. case PSN_QUERYCANCEL :
  1537. GetError(0); //clear any old com errors
  1538. break;
  1539. case PSN_HELP :
  1540. {
  1541. helpWrapper(hwndDlg,IDH_WINDOW_COMPUTER_OPTION);
  1542. break;
  1543. }
  1544. case PSN_RESET :
  1545. break;
  1546. default :
  1547. break;
  1548. }
  1549. break;
  1550. } case WM_HELP :
  1551. {
  1552. helpWrapper(hwndDlg,IDH_WINDOW_COMPUTER_OPTION);
  1553. break;
  1554. }
  1555. default:
  1556. break;
  1557. }
  1558. return 0;
  1559. }
  1560. INT_PTR CALLBACK
  1561. IntTranslationProc(
  1562. IN HWND hwndDlg,
  1563. IN UINT uMsg,
  1564. IN WPARAM wParam,
  1565. IN LPARAM lParam
  1566. )
  1567. {
  1568. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  1569. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  1570. switch (uMsg)
  1571. {
  1572. case WM_INITDIALOG :
  1573. {
  1574. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  1575. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  1576. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  1577. initcheckbox( hwndDlg,IDC_FILES,DCTVS_Security_TranslateFiles);
  1578. initcheckbox( hwndDlg,IDC_SHARES,DCTVS_Security_TranslateShares);
  1579. initcheckbox( hwndDlg,IDC_PRINTERS,DCTVS_Security_TranslatePrinters);
  1580. initcheckbox( hwndDlg,IDC_USER_RIGHTS,DCTVS_Security_TranslateUserRights);
  1581. initcheckbox( hwndDlg,IDC_LOCAL_GROUPS,DCTVS_Security_TranslateLocalGroups);
  1582. initcheckbox( hwndDlg,IDC_USER_PROFILES,DCTVS_Security_TranslateUserProfiles);
  1583. initcheckbox( hwndDlg,IDC_REGISTRY,DCTVS_Security_TranslateRegistry);
  1584. if ((IsDlgButtonChecked(hwndDlg,IDC_FILES)) ||
  1585. (IsDlgButtonChecked(hwndDlg,IDC_SHARES)) ||
  1586. (IsDlgButtonChecked(hwndDlg,IDC_PRINTERS)) ||
  1587. (IsDlgButtonChecked(hwndDlg,IDC_USER_RIGHTS)) ||
  1588. (IsDlgButtonChecked(hwndDlg,IDC_LOCAL_GROUPS)) ||
  1589. (IsDlgButtonChecked(hwndDlg,IDC_USER_PROFILES)) ||
  1590. (IsDlgButtonChecked(hwndDlg,IDC_REGISTRY)) ||
  1591. (migration==w_computer))
  1592. {
  1593. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
  1594. }
  1595. else
  1596. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK);
  1597. break;
  1598. }
  1599. case WM_COMMAND:
  1600. {
  1601. bool bCheck = false;
  1602. switch(LOWORD (wParam))
  1603. {
  1604. case IDC_FILES :
  1605. bCheck = true;
  1606. break;
  1607. case IDC_SHARES :
  1608. bCheck = true;
  1609. break;
  1610. case IDC_PRINTERS :
  1611. bCheck = true;
  1612. break;
  1613. case IDC_USER_RIGHTS :
  1614. bCheck = true;
  1615. break;
  1616. case IDC_LOCAL_GROUPS :
  1617. bCheck = true;
  1618. break;
  1619. case IDC_USER_PROFILES :
  1620. bCheck = true;
  1621. break;
  1622. case IDC_REGISTRY :
  1623. bCheck = true;
  1624. break;
  1625. default:
  1626. break;
  1627. }
  1628. if (bCheck)
  1629. {
  1630. if ((IsDlgButtonChecked(hwndDlg,IDC_FILES)) ||
  1631. (IsDlgButtonChecked(hwndDlg,IDC_SHARES)) ||
  1632. (IsDlgButtonChecked(hwndDlg,IDC_PRINTERS)) ||
  1633. (IsDlgButtonChecked(hwndDlg,IDC_USER_RIGHTS)) ||
  1634. (IsDlgButtonChecked(hwndDlg,IDC_LOCAL_GROUPS)) ||
  1635. (IsDlgButtonChecked(hwndDlg,IDC_USER_PROFILES)) ||
  1636. (IsDlgButtonChecked(hwndDlg,IDC_REGISTRY)) ||
  1637. (migration==w_computer))
  1638. {
  1639. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
  1640. }
  1641. else
  1642. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK);
  1643. }
  1644. break;
  1645. }
  1646. case WM_NOTIFY :
  1647. {
  1648. LPNMHDR lpnm = (LPNMHDR) lParam;
  1649. switch (lpnm->code)
  1650. {
  1651. case PSN_SETACTIVE :
  1652. if ((IsDlgButtonChecked(hwndDlg,IDC_FILES)) ||
  1653. (IsDlgButtonChecked(hwndDlg,IDC_SHARES)) ||
  1654. (IsDlgButtonChecked(hwndDlg,IDC_PRINTERS)) ||
  1655. (IsDlgButtonChecked(hwndDlg,IDC_USER_RIGHTS)) ||
  1656. (IsDlgButtonChecked(hwndDlg,IDC_LOCAL_GROUPS)) ||
  1657. (IsDlgButtonChecked(hwndDlg,IDC_USER_PROFILES)) ||
  1658. (IsDlgButtonChecked(hwndDlg,IDC_REGISTRY)) ||
  1659. (migration==w_computer))
  1660. {
  1661. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
  1662. }
  1663. else
  1664. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK);
  1665. break;
  1666. case PSN_WIZNEXT :
  1667. checkbox( hwndDlg,IDC_FILES,DCTVS_Security_TranslateFiles);
  1668. checkbox( hwndDlg,IDC_SHARES,DCTVS_Security_TranslateShares);
  1669. checkbox( hwndDlg,IDC_PRINTERS,DCTVS_Security_TranslatePrinters);
  1670. checkbox( hwndDlg,IDC_USER_RIGHTS,DCTVS_Security_TranslateUserRights);
  1671. checkbox( hwndDlg,IDC_LOCAL_GROUPS,DCTVS_Security_TranslateLocalGroups);
  1672. checkbox( hwndDlg,IDC_USER_PROFILES,DCTVS_Security_TranslateUserProfiles);
  1673. checkbox( hwndDlg,IDC_REGISTRY,DCTVS_Security_TranslateRegistry);
  1674. if (IsDlgButtonChecked(hwndDlg,IDC_FILES) ||
  1675. (IsDlgButtonChecked(hwndDlg,IDC_SHARES) ||
  1676. (IsDlgButtonChecked(hwndDlg,IDC_PRINTERS) ||
  1677. (IsDlgButtonChecked(hwndDlg,IDC_USER_RIGHTS) ||
  1678. (IsDlgButtonChecked(hwndDlg,IDC_LOCAL_GROUPS) ||
  1679. (IsDlgButtonChecked(hwndDlg,IDC_USER_PROFILES) ||
  1680. (IsDlgButtonChecked(hwndDlg,IDC_REGISTRY))))))))
  1681. {
  1682. if (IsDlgButtonChecked(hwndDlg,IDC_USER_PROFILES))
  1683. {
  1684. _variant_t varX = L"{0EB9FBE9-397D-4D09-A65E-ABF1790CC470}";
  1685. pVarSet->put(L"PlugIn.0",varX);
  1686. }
  1687. pdata->translateObjects=true;
  1688. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_TRANSLATION_MODE);
  1689. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_TRANSLATION_MODE);
  1690. return TRUE;
  1691. }
  1692. else
  1693. {
  1694. pdata->translateObjects=false;
  1695. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_REBOOT);
  1696. return TRUE;
  1697. }
  1698. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  1699. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  1700. break;
  1701. case PSN_WIZBACK :
  1702. break;
  1703. case PSN_QUERYCANCEL :
  1704. GetError(0); //clear any old com errors
  1705. break;
  1706. case PSN_HELP :
  1707. {
  1708. helpWrapper(hwndDlg,IDH_WINDOW_OBJECTTYPE_SELECTION);
  1709. break;
  1710. }
  1711. case PSN_RESET :
  1712. break;
  1713. default :
  1714. break;
  1715. }
  1716. break;
  1717. } case WM_HELP :
  1718. {
  1719. helpWrapper(hwndDlg,IDH_WINDOW_OBJECTTYPE_SELECTION);
  1720. break;
  1721. }
  1722. default:
  1723. break;
  1724. }
  1725. return 0;
  1726. }
  1727. INT_PTR CALLBACK
  1728. IntUndoProc(
  1729. IN HWND hwndDlg,
  1730. IN UINT uMsg,
  1731. IN WPARAM wParam,
  1732. IN LPARAM lParam
  1733. )
  1734. {
  1735. IPerformMigrationTaskPtr w;
  1736. HRESULT hr = w.CreateInstance(CLSID_Migrator);
  1737. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  1738. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  1739. switch (uMsg)
  1740. {
  1741. case WM_INITDIALOG :
  1742. {
  1743. CString s;
  1744. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  1745. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  1746. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  1747. BSTR desc = NULL;
  1748. w->GetTaskDescription(IUnknownPtr(pVarSetUndo), &desc);
  1749. s = desc;
  1750. SysFreeString(desc);
  1751. SetDlgItemText(hwndDlg, IDC_UNDO_TASK,s);
  1752. break;
  1753. }
  1754. case WM_HELP :
  1755. {
  1756. helpWrapper(hwndDlg,IDH_WINDOW_UNDO);
  1757. break;
  1758. }
  1759. case WM_NOTIFY :
  1760. {
  1761. LPNMHDR lpnm = (LPNMHDR) lParam;
  1762. switch (lpnm->code)
  1763. {
  1764. case PSN_SETACTIVE :
  1765. {
  1766. PostMessage(GetParent(hwndDlg), PSM_SETWIZBUTTONS, 0, PSWIZB_BACK|PSWIZB_NEXT);
  1767. break;
  1768. }
  1769. case PSN_WIZNEXT :
  1770. {
  1771. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  1772. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  1773. //set up the undo task
  1774. IUnknownPtr pUnk;
  1775. w->GetUndoTask(IUnknownPtr(pVarSetUndo), &pUnk);
  1776. if (pVarSet)
  1777. {
  1778. pVarSet->Release();
  1779. pVarSet = NULL;
  1780. }
  1781. pUnk->QueryInterface(IID_IVarSet,(void**)&pVarSet);
  1782. put(DCTVS_Options_AppendToLogs,yes);
  1783. _bstr_t s1=get(DCTVS_Options_SourceDomainDns);
  1784. _bstr_t t1=get(DCTVS_Options_TargetDomainDns);
  1785. CString s= (WCHAR const*) s1;
  1786. CString t= (WCHAR const*) t1;
  1787. HRESULT hr=S_OK;
  1788. _bstr_t text=get(DCTVS_Options_Wizard);
  1789. pdata->sameForest=CheckSameForest(t,s,hr);
  1790. if (!SUCCEEDED(hr))
  1791. {
  1792. ErrorWrapper4(hwndDlg,hr,s);
  1793. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_UNDO);
  1794. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_UNDO);
  1795. return TRUE;
  1796. }
  1797. else
  1798. {
  1799. if (pdata->sameForest)
  1800. {
  1801. CString yo,title;
  1802. yo.LoadString(IDS_MSG_MESSAGE8);title.LoadString(IDS_MSG_WARNING);
  1803. MessageBox(hwndDlg,yo,title,MB_OK|MB_ICONINFORMATION);
  1804. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CREDENTIALS);
  1805. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_CREDENTIALS);
  1806. return TRUE;
  1807. }
  1808. //* else if (!UStrICmp(text,(WCHAR const *)GET_BSTR1(IDS_WIZARD_COMPUTER)))
  1809. // else if (!UStrICmp(text, L"computer"))
  1810. // {
  1811. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CREDENTIALS2);
  1812. // SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_CREDENTIALS2);
  1813. // return TRUE;
  1814. // }
  1815. else
  1816. {
  1817. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_END_UNDO);
  1818. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_END_UNDO);
  1819. return TRUE;
  1820. }
  1821. }
  1822. break;
  1823. }
  1824. case PSN_WIZBACK :
  1825. break;
  1826. case PSN_QUERYCANCEL :
  1827. GetError(0); //clear any old com errors
  1828. break;
  1829. case PSN_HELP :
  1830. {
  1831. helpWrapper(hwndDlg,IDH_WINDOW_UNDO);
  1832. break;
  1833. }
  1834. case PSN_RESET :
  1835. break;
  1836. default :
  1837. break;
  1838. }
  1839. break;
  1840. }
  1841. default:
  1842. break;
  1843. }
  1844. return 0;
  1845. }
  1846. INT_PTR CALLBACK EndDlgProc (
  1847. HWND hwndDlg,
  1848. UINT uMsg,
  1849. WPARAM wParam,
  1850. LPARAM lParam
  1851. )
  1852. {
  1853. IPerformMigrationTaskPtr w;
  1854. CString s;
  1855. HRESULT hr = w.CreateInstance(CLSID_Migrator);
  1856. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  1857. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  1858. switch (uMsg)
  1859. {
  1860. case WM_INITDIALOG :
  1861. { pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  1862. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  1863. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  1864. HWND hwndControl = GetDlgItem(hwndDlg, IDC_END_TITLE);
  1865. SetWindowFont(hwndControl,pdata->hTitleFont, TRUE);
  1866. break;
  1867. }
  1868. case WM_HELP :
  1869. {
  1870. helpWrapper(hwndDlg,IDH_WINDOW_CONFIRMATION);
  1871. break;
  1872. }
  1873. case WM_NOTIFY :
  1874. {
  1875. LPNMHDR lpnm = (LPNMHDR) lParam;
  1876. switch (lpnm->code)
  1877. {
  1878. case PSN_SETACTIVE :
  1879. {
  1880. BSTR desc = NULL;
  1881. w->GetTaskDescription(IUnknownPtr(pVarSet), &desc);
  1882. s= desc;
  1883. SysFreeString(desc);
  1884. SetDlgItemText(hwndDlg,IDC_SETTINGS,s);
  1885. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_FINISH);
  1886. break;
  1887. }
  1888. case PSN_WIZBACK :{
  1889. if (migration==w_reporting)
  1890. {
  1891. _bstr_t text= get(DCTVS_Reports_AccountReferences);
  1892. if (!UStrICmp(text ,(WCHAR const *) yes))
  1893. {
  1894. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_SELECTION1);
  1895. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_SELECTION1);
  1896. return TRUE;
  1897. }
  1898. else
  1899. {
  1900. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_OPTIONS_REPORTING);
  1901. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_OPTIONS_REPORTING);
  1902. return TRUE;
  1903. }
  1904. }
  1905. else if (migration==w_account)
  1906. {
  1907. if (pdata->someService)
  1908. {
  1909. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_SA_INFO);
  1910. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_SA_INFO);
  1911. return TRUE;
  1912. }
  1913. else
  1914. {
  1915. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_RENAMING);
  1916. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_RENAMING);
  1917. return TRUE;
  1918. }
  1919. }
  1920. else if (migration==w_security)
  1921. {
  1922. if (pdata->translateObjects)
  1923. {
  1924. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_TRANSLATION_MODE);
  1925. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_TRANSLATION_MODE);
  1926. return TRUE;
  1927. }
  1928. else
  1929. {
  1930. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_TRANSLATION);
  1931. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_TRANSLATION);
  1932. return TRUE;
  1933. }
  1934. }
  1935. else if (migration==w_groupmapping)
  1936. {
  1937. if (!pdata->IsSidHistoryChecked)
  1938. {
  1939. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_OPTIONS_GROUPMAPPING);
  1940. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_OPTIONS_GROUPMAPPING);
  1941. return TRUE;
  1942. }
  1943. }
  1944. else if (migration==w_group)
  1945. {
  1946. if (pdata->migratingGroupMembers && !pdata->sameForest)
  1947. {
  1948. if (pdata->someService)
  1949. {
  1950. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_SA_INFO);
  1951. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_SA_INFO);
  1952. return TRUE;
  1953. }
  1954. else
  1955. {
  1956. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_DISABLE);
  1957. return TRUE;
  1958. }
  1959. }
  1960. else
  1961. {
  1962. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_RENAMING);
  1963. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_RENAMING);
  1964. return TRUE;
  1965. }
  1966. }
  1967. else if (migration==w_undo)
  1968. {
  1969. if (!pdata->sameForest)
  1970. {
  1971. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_UNDO);
  1972. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_UNDO);
  1973. return TRUE;
  1974. }
  1975. else
  1976. {
  1977. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CREDENTIALS);
  1978. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_CREDENTIALS);
  1979. return TRUE;
  1980. }
  1981. }
  1982. break;
  1983. }
  1984. case PSN_WIZFINISH :
  1985. {
  1986. if (migration == w_computer)
  1987. populateTime(pdata->rebootDelay,pdata->servers);
  1988. if (migration == w_reporting)
  1989. populateReportingTime();
  1990. if (migration!=w_service)
  1991. {
  1992. try
  1993. {CWaitCursor w2;
  1994. // pVarSet->DumpToFile(L"C:\\FINAL.out");
  1995. w->PerformMigrationTask(IUnknownPtr(pVarSet),(LONG_PTR)hwndDlg);
  1996. }
  1997. catch (const _com_error &e)
  1998. {
  1999. if (e.Error() == MIGRATOR_E_PROCESSES_STILL_RUNNING)
  2000. {
  2001. CString str;
  2002. str.LoadString(IDS_ADMT_PROCESSES_STILL_RUNNING);
  2003. ::AfxMessageBox(str);
  2004. }
  2005. else
  2006. {
  2007. ::AfxMessageBox(e.ErrorMessage());
  2008. }
  2009. break;
  2010. }
  2011. }
  2012. if (migration!=w_undo)
  2013. handleDB();
  2014. break;
  2015. }
  2016. case PSN_QUERYCANCEL :
  2017. GetError(0); //clear any old com errors
  2018. break;
  2019. case PSN_RESET :
  2020. break;
  2021. case PSN_HELP :
  2022. {
  2023. helpWrapper(hwndDlg,IDH_WINDOW_CONFIRMATION);
  2024. break;
  2025. }
  2026. default :
  2027. break;
  2028. }
  2029. break;
  2030. }
  2031. default:
  2032. break;
  2033. }
  2034. return 0;
  2035. }
  2036. INT_PTR CALLBACK IntroDlgProc (
  2037. HWND hwndDlg,
  2038. UINT uMsg,
  2039. WPARAM wParam,
  2040. LPARAM lParam
  2041. )
  2042. { IPerformMigrationTaskPtr w;
  2043. CString s;
  2044. HRESULT hr = w.CreateInstance(CLSID_Migrator);
  2045. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  2046. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  2047. switch (uMsg)
  2048. {
  2049. case WM_INITDIALOG :
  2050. {
  2051. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  2052. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  2053. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  2054. HWND hwndControl = GetDlgItem(hwndDlg, IDC_BEGIN_TITLE);
  2055. SetWindowFont(hwndControl,pdata->hTitleFont, TRUE);
  2056. break;
  2057. }
  2058. case WM_HELP :
  2059. {
  2060. helpWrapper(hwndDlg,IDH_WINDOW_WELCOME);
  2061. break;
  2062. }
  2063. case WM_NOTIFY :
  2064. {
  2065. LPNMHDR lpnm = (LPNMHDR) lParam;
  2066. switch (lpnm->code)
  2067. {
  2068. case PSN_SETACTIVE :
  2069. {
  2070. BSTR desc = NULL;
  2071. w->GetTaskDescription(IUnknownPtr(pVarSet), &desc);
  2072. s= desc;
  2073. SysFreeString(desc);
  2074. SetDlgItemText(hwndDlg,IDC_SETTINGS,s);
  2075. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT);
  2076. break;
  2077. }
  2078. case PSN_WIZNEXT :
  2079. {
  2080. if (migration==w_undo)
  2081. {
  2082. _bstr_t b=pVarSetUndo->get(GET_BSTR(DCTVS_Options_SourceDomain));
  2083. CString s=(WCHAR *) b;
  2084. CString sourceDomainController;
  2085. PDOMAIN_CONTROLLER_INFOW pdomc;
  2086. HRESULT res = DsGetDcNameW(NULL,(LPCTSTR const)s,NULL,NULL, DS_DIRECTORY_SERVICE_PREFERRED,&pdomc);
  2087. if (res!=NO_ERROR)
  2088. {
  2089. NetApiBufferFree(pdomc);
  2090. ErrorWrapper3(hwndDlg,res,sourceNetbios);
  2091. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_INTRO_UNDO);
  2092. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_INTRO_UNDO);
  2093. return TRUE;
  2094. }
  2095. else
  2096. {
  2097. sourceDomainController = pdomc->DomainControllerName;
  2098. NetApiBufferFree(pdomc);
  2099. }
  2100. bool isNt4;
  2101. hr =validDomain(sourceDomainController,isNt4);
  2102. if (!SUCCEEDED(hr))
  2103. {
  2104. ErrorWrapper4(hwndDlg,hr,s);
  2105. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_INTRO_UNDO);
  2106. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_INTRO_UNDO);
  2107. return TRUE;
  2108. }
  2109. if(!isNt4)
  2110. {HRESULT hr;
  2111. if (!targetNativeMode(b,hr))
  2112. {
  2113. MessageBoxWrapper(hwndDlg,IDS_MSG_MESSAGE9,IDS_MSG_ERROR);
  2114. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_INTRO_UNDO);
  2115. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_INTRO_UNDO);
  2116. return TRUE;
  2117. }
  2118. }
  2119. }
  2120. break;
  2121. }
  2122. case PSN_QUERYCANCEL :
  2123. GetError(0); //clear any old com errors
  2124. break;
  2125. case PSN_RESET :
  2126. break;
  2127. case PSN_HELP :
  2128. {
  2129. helpWrapper(hwndDlg,IDH_WINDOW_WELCOME);
  2130. break;
  2131. }
  2132. default :
  2133. break;
  2134. }
  2135. break;
  2136. }
  2137. default:
  2138. break;
  2139. }
  2140. return 0;
  2141. }
  2142. INT_PTR CALLBACK IntDomainSelectionProc (
  2143. HWND hwndDlg,
  2144. UINT uMsg,
  2145. WPARAM wParam,
  2146. LPARAM lParam
  2147. )
  2148. {
  2149. HRESULT hr;
  2150. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  2151. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  2152. //TRACE1("Message:%ld\n",uMsg);
  2153. switch (uMsg)
  2154. {
  2155. case WM_INITDIALOG :
  2156. {
  2157. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  2158. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  2159. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  2160. HWND hLC4= GetDlgItem(hwndDlg,IDC_EDIT_DOMAIN);
  2161. sourceDrop.Attach(hLC4);
  2162. HWND hLC5= GetDlgItem(hwndDlg,IDC_EDIT_DOMAIN2);
  2163. targetDrop.Attach(hLC5);
  2164. populateList(sourceDrop);
  2165. populateList(targetDrop);
  2166. initeditbox( hwndDlg,IDC_EDIT_DOMAIN,DCTVS_Options_SourceDomainDns);
  2167. initeditbox( hwndDlg, IDC_EDIT_DOMAIN2,DCTVS_Options_TargetDomainDns );
  2168. // SetDlgItemText(hwndDlg,IDC_EDIT_DOMAIN,L"MCSDEV");
  2169. // SetDlgItemText(hwndDlg,IDC_EDIT_DOMAIN2,L"DEVRAPTORW2K");
  2170. break;
  2171. }
  2172. case WM_NOTIFY :
  2173. {
  2174. LPNMHDR lpnm = (LPNMHDR) lParam;
  2175. switch (lpnm->code)
  2176. {
  2177. case PSN_SETACTIVE :
  2178. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
  2179. break;
  2180. case PSN_WIZNEXT :
  2181. {
  2182. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  2183. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  2184. CString sourceDomainController=L"";
  2185. CString targetDomainController=L"";
  2186. if (IsDlgItemEmpty(hwndDlg,IDC_EDIT_DOMAIN) ||
  2187. IsDlgItemEmpty(hwndDlg,IDC_EDIT_DOMAIN2) )
  2188. {
  2189. MessageBoxWrapper(hwndDlg,IDS_MSG_DOMAIN,IDS_MSG_INPUT);
  2190. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_DOMAIN_SELECTION);
  2191. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_DOMAIN_SELECTION);
  2192. return TRUE;
  2193. }
  2194. else if ((migration!=w_security) && (!verifyprivs(hwndDlg,sourceDomainController,targetDomainController,pdata)))
  2195. {
  2196. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  2197. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  2198. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_DOMAIN_SELECTION);
  2199. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_DOMAIN_SELECTION);
  2200. return TRUE;
  2201. }
  2202. else if ((migration==w_security) && (!verifyprivsSTW(hwndDlg,sourceDomainController,targetDomainController,pdata)))
  2203. {
  2204. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  2205. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  2206. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_DOMAIN_SELECTION);
  2207. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_DOMAIN_SELECTION);
  2208. return TRUE;
  2209. }
  2210. else
  2211. {
  2212. if (sourceDC != sourceDomainController)
  2213. {
  2214. sourceDC = sourceDomainController;
  2215. DCList.RemoveAll();
  2216. }
  2217. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  2218. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  2219. if (migration==w_groupmapping && pdata->sameForest)
  2220. {
  2221. MessageBoxWrapper(hwndDlg,IDS_MSG_GROUPMAPPING,IDS_MSG_ERROR);
  2222. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_DOMAIN_SELECTION);
  2223. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_DOMAIN_SELECTION);
  2224. return TRUE;
  2225. }
  2226. put(DCTVS_Options_SourceDomain, (LPCTSTR)sourceNetbios);
  2227. put(DCTVS_Options_TargetDomain, (LPCTSTR)targetNetbios);
  2228. put(DCTVS_Options_SourceDomainDns, (LPCTSTR)sourceDNS);
  2229. put(DCTVS_Options_TargetDomainDns, (LPCTSTR)targetDNS);
  2230. clearCredentialsName = pdata->newSource;
  2231. if (migration!=w_trust &&
  2232. (migration!=w_retry &&
  2233. (migration!=w_undo &&
  2234. (migration!=w_exchangeDir &&
  2235. (migration!=w_exchangeSrv)))))
  2236. {
  2237. if ((migration==w_service) || (migration==w_reporting))
  2238. {
  2239. hr =InitObjectPicker2(pDsObjectPicker,true,sourceDomainController,pdata->sourceIsNT4);
  2240. }
  2241. else if (migration==w_security)
  2242. {
  2243. hr =InitObjectPicker2(pDsObjectPicker,true,targetDomainController,false);
  2244. }
  2245. else
  2246. {
  2247. hr =InitObjectPicker(pDsObjectPicker,true,sourceDomainController,pdata->sourceIsNT4);
  2248. }
  2249. if (FAILED(hr))
  2250. {
  2251. MessageBoxWrapper(hwndDlg,IDS_MSG_OBJECTPICKER_SOURCE,IDS_MSG_ERROR);
  2252. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_DOMAIN_SELECTION);
  2253. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_DOMAIN_SELECTION);
  2254. return TRUE;
  2255. }
  2256. if (migration==w_groupmapping)
  2257. {
  2258. hr = InitObjectPicker(pDsObjectPicker2,false,targetDomainController,pdata->sourceIsNT4);
  2259. if (FAILED(hr))
  2260. {
  2261. MessageBoxWrapper(hwndDlg,IDS_MSG_OBJECTPICKER_TARGET,IDS_MSG_ERROR);
  2262. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_DOMAIN_SELECTION);
  2263. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_DOMAIN_SELECTION);
  2264. return TRUE;
  2265. }
  2266. }
  2267. }
  2268. }
  2269. break;
  2270. }
  2271. case PSN_WIZBACK :
  2272. break;
  2273. case PSN_QUERYCANCEL :
  2274. GetError(0); //clear any old com errors
  2275. break;
  2276. case PSN_HELP :
  2277. {
  2278. helpWrapper(hwndDlg,IDH_WINDOW_DOMAIN_SELECTION);
  2279. break;
  2280. }
  2281. case PSN_RESET :
  2282. break;
  2283. default :
  2284. break;
  2285. }
  2286. break;
  2287. } case WM_HELP :
  2288. {
  2289. helpWrapper(hwndDlg,IDH_WINDOW_DOMAIN_SELECTION);
  2290. break;
  2291. }
  2292. default:
  2293. break;
  2294. }
  2295. return 0;
  2296. }
  2297. INT_PTR CALLBACK IntDisableProc (
  2298. HWND hwndDlg,
  2299. UINT uMsg,
  2300. WPARAM wParam,
  2301. LPARAM lParam
  2302. )
  2303. {
  2304. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  2305. switch (uMsg)
  2306. {
  2307. case WM_INITDIALOG :
  2308. {
  2309. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  2310. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  2311. //init the sidhistory checkbox
  2312. if (migration==w_account)
  2313. {
  2314. CString toformat;
  2315. toformat.LoadString(IDS_SIDHISTORY_CTRL_TEXT);
  2316. SetDlgItemText(hwndDlg,IDC_ROAMING_OR_SIDHISTORY,toformat);
  2317. initcheckbox( hwndDlg,IDC_ROAMING_OR_SIDHISTORY,DCTVS_AccountOptions_AddSidHistory);
  2318. if (pdata->sameForest)
  2319. {
  2320. CheckDlgButton(hwndDlg,IDC_ROAMING_OR_SIDHISTORY,true);
  2321. disable(hwndDlg,IDC_ROAMING_OR_SIDHISTORY);
  2322. }
  2323. }
  2324. else //else init the box for roaming profile
  2325. {
  2326. CString toformat;
  2327. toformat.LoadString(IDS_ROAMING_PROFILE_CTRL_TEXT);
  2328. SetDlgItemText(hwndDlg,IDC_ROAMING_OR_SIDHISTORY,toformat);
  2329. initcheckbox( hwndDlg,IDC_ROAMING_OR_SIDHISTORY,DCTVS_AccountOptions_TranslateRoamingProfiles);
  2330. }
  2331. initdisablesrcbox(hwndDlg);
  2332. inittgtstatebox(hwndDlg);
  2333. break;
  2334. }
  2335. case WM_COMMAND:
  2336. {
  2337. switch(LOWORD (wParam))
  2338. {
  2339. case IDC_SRC_EXPIRE_ACCOUNTS :
  2340. {
  2341. if (IsDlgButtonChecked(hwndDlg,IDC_SRC_EXPIRE_ACCOUNTS))
  2342. {
  2343. enable(hwndDlg,IDC_yo);
  2344. enable(hwndDlg,IDC_DATE);
  2345. enable(hwndDlg,IDC_TEXT);
  2346. }
  2347. else
  2348. {
  2349. disable(hwndDlg,IDC_yo);
  2350. disable(hwndDlg,IDC_DATE);
  2351. disable(hwndDlg,IDC_TEXT);
  2352. }
  2353. break;
  2354. }
  2355. default :
  2356. break;
  2357. }
  2358. switch(HIWORD (wParam)){
  2359. case EN_SETFOCUS :
  2360. bChangeOnFly=true;
  2361. break;
  2362. case EN_KILLFOCUS :
  2363. bChangeOnFly=false;
  2364. break;
  2365. case EN_CHANGE:
  2366. {
  2367. if ((!bChangeOnFly) || (LOWORD(wParam) != IDC_yo))
  2368. break;
  2369. CString s;
  2370. GetDlgItemText(hwndDlg,IDC_yo,s.GetBuffer(1000),1000);
  2371. s.ReleaseBuffer();
  2372. //make sure all chars are digits
  2373. bool bInvalid = false;
  2374. int ndx=0;
  2375. while ((ndx < s.GetLength()) && (!bInvalid))
  2376. {
  2377. if (!iswdigit(s[ndx]))
  2378. bInvalid = true;
  2379. ndx++;
  2380. }
  2381. if (bInvalid)
  2382. {
  2383. //for invalid days, blank out the date
  2384. SetDlgItemText(hwndDlg,IDC_DATE,L"");
  2385. }
  2386. else //else continue checking for validity
  2387. {
  2388. long ndays = _wtol(s);
  2389. if (((ndays <= THREE_YEARS) && (ndays >= 1)) ||
  2390. (!UStrICmp(s,L"0")))
  2391. calculateDate(hwndDlg,s);
  2392. else
  2393. {
  2394. //for invalid days, blank out the date
  2395. SetDlgItemText(hwndDlg,IDC_DATE,L"");
  2396. }
  2397. }
  2398. break;
  2399. }
  2400. default :
  2401. break;
  2402. }
  2403. break;
  2404. }
  2405. case WM_NOTIFY :
  2406. {
  2407. LPNMHDR lpnm = (LPNMHDR) lParam;
  2408. switch (lpnm->code)
  2409. {
  2410. case PSN_SETACTIVE :
  2411. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
  2412. break;
  2413. case PSN_WIZNEXT :
  2414. {
  2415. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  2416. checkbox(hwndDlg,IDC_SRC_DISABLE_ACCOUNTS,DCTVS_AccountOptions_DisableSourceAccounts);
  2417. checkbox(hwndDlg,IDC_TGT_DISABLE_ACCOUNTS,DCTVS_AccountOptions_DisableCopiedAccounts);
  2418. checkbox(hwndDlg,IDC_TGT_SAME_AS_SOURCE,DCTVS_AccountOptions_TgtStateSameAsSrc);
  2419. _variant_t varX;
  2420. if (IsDlgButtonChecked(hwndDlg,IDC_SRC_EXPIRE_ACCOUNTS))
  2421. {
  2422. CString s;
  2423. GetDlgItemText(hwndDlg,IDC_yo,s.GetBuffer(1000),1000);
  2424. s.ReleaseBuffer();
  2425. //make sure all chars are digits
  2426. int ndx=0;
  2427. while (ndx < s.GetLength())
  2428. {
  2429. if (!iswdigit(s[ndx]))
  2430. {
  2431. MessageBoxWrapper(hwndDlg,IDS_MSG_TIME,IDS_MSG_ERROR);
  2432. SetFocus(GetDlgItem(hwndDlg, IDC_yo));
  2433. SendDlgItemMessage(hwndDlg, IDC_yo, EM_SETSEL,
  2434. (WPARAM)0, (LPARAM)-1);
  2435. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,-1);
  2436. return TRUE;
  2437. }
  2438. ndx++;
  2439. }
  2440. long ndays = _wtol(s);
  2441. if (((ndays <= THREE_YEARS) && (ndays >= 1)) ||
  2442. (!UStrICmp(s,L"0")))
  2443. {
  2444. varX = (LPCTSTR)s;
  2445. put(DCTVS_AccountOptions_ExpireSourceAccounts,varX);
  2446. }
  2447. else
  2448. {
  2449. MessageBoxWrapper(hwndDlg,IDS_MSG_TIME,IDS_MSG_ERROR);
  2450. SetFocus(GetDlgItem(hwndDlg, IDC_yo));
  2451. SendDlgItemMessage(hwndDlg, IDC_yo, EM_SETSEL,
  2452. (WPARAM)0, (LPARAM)-1);
  2453. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,-1);
  2454. return TRUE;
  2455. }
  2456. }
  2457. else
  2458. {
  2459. varX = L"";
  2460. put(DCTVS_AccountOptions_ExpireSourceAccounts,varX);
  2461. }
  2462. if (migration==w_account)
  2463. {
  2464. if (IsDlgButtonChecked(hwndDlg,IDC_ROAMING_OR_SIDHISTORY) && !pdata->sameForest)
  2465. {
  2466. HRESULT hr = doSidHistory(hwndDlg);
  2467. if (!SUCCEEDED(hr) && hr!=E_ABORT)
  2468. {
  2469. ErrorWrapper(hwndDlg,hr);
  2470. CheckDlgButton(hwndDlg,IDC_ROAMING_OR_SIDHISTORY,false);
  2471. }
  2472. else if (hr==E_ABORT)
  2473. CheckDlgButton(hwndDlg,IDC_ROAMING_OR_SIDHISTORY,false);
  2474. }
  2475. checkbox(hwndDlg,IDC_ROAMING_OR_SIDHISTORY,DCTVS_AccountOptions_AddSidHistory);
  2476. pdata->IsSidHistoryChecked =(IsDlgButtonChecked( hwndDlg,IDC_ROAMING_OR_SIDHISTORY)==BST_CHECKED)?true:false;
  2477. if (pdata->IsSidHistoryChecked )
  2478. {
  2479. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_CREDENTIALS);
  2480. return TRUE;
  2481. }
  2482. else
  2483. {
  2484. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT,IDD_OPTIONS);
  2485. return TRUE;
  2486. }
  2487. }//end if user migration
  2488. else //else set or clear the translate roaming profile key
  2489. checkbox( hwndDlg,IDC_ROAMING_OR_SIDHISTORY,DCTVS_AccountOptions_TranslateRoamingProfiles);
  2490. if (someServiceAccounts(pdata->accounts,hwndDlg))
  2491. {
  2492. pdata->someService=true;
  2493. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  2494. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_SA_INFO);
  2495. return TRUE;
  2496. }
  2497. else
  2498. {
  2499. pdata->someService=false;
  2500. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  2501. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_END_GROUP);
  2502. return TRUE;
  2503. }
  2504. break;
  2505. }
  2506. case PSN_WIZBACK :
  2507. break;
  2508. case PSN_QUERYCANCEL :
  2509. {
  2510. GetError(0); //clear any old com errors
  2511. break;
  2512. }
  2513. case PSN_HELP :
  2514. {
  2515. helpWrapper(hwndDlg,IDH_WINDOW_ACCOUNTTRANSITION_OPTION);
  2516. break;
  2517. }
  2518. case PSN_RESET :
  2519. break;
  2520. default :
  2521. break;
  2522. }
  2523. break;
  2524. } case WM_HELP :
  2525. {
  2526. helpWrapper(hwndDlg,IDH_WINDOW_ACCOUNTTRANSITION_OPTION);
  2527. break;
  2528. }
  2529. default:
  2530. break;
  2531. }
  2532. return 0;
  2533. }
  2534. INT_PTR CALLBACK IntTranslationModeProc (
  2535. HWND hwndDlg,
  2536. UINT uMsg,
  2537. WPARAM wParam,
  2538. LPARAM lParam
  2539. )
  2540. {
  2541. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  2542. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  2543. switch (uMsg)
  2544. {
  2545. case WM_INITDIALOG :
  2546. {
  2547. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  2548. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  2549. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  2550. inittranslationbox( hwndDlg,
  2551. IDC_TRANSLATION_MODE_REPLACE,IDC_TRANSLATION_MODE_ADD,IDC_TRANSLATION_MODE_REMOVE,
  2552. DCTVS_Security_TranslationMode,pdata->sameForest);
  2553. break;
  2554. }
  2555. case WM_NOTIFY :
  2556. {
  2557. LPNMHDR lpnm = (LPNMHDR) lParam;
  2558. switch (lpnm->code)
  2559. {
  2560. case PSN_SETACTIVE :
  2561. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
  2562. break;
  2563. case PSN_WIZNEXT :
  2564. {
  2565. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  2566. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  2567. translationbox( hwndDlg,
  2568. IDC_TRANSLATION_MODE_REPLACE,IDC_TRANSLATION_MODE_ADD,IDC_TRANSLATION_MODE_REMOVE,
  2569. DCTVS_Security_TranslationMode);
  2570. //if not add mode and user rights translation selected previously, them
  2571. //post an informational message
  2572. _bstr_t TransUserRights = get(DCTVS_Security_TranslateUserRights);
  2573. if ((!IsDlgButtonChecked( hwndDlg, IDC_TRANSLATION_MODE_ADD)) &&
  2574. (!UStrCmp(TransUserRights,(WCHAR const *) yes)))
  2575. {
  2576. CString message;
  2577. CString title;
  2578. message.LoadString(IDS_MSG_TRANSUR_ADDONLY);
  2579. title.LoadString(IDS_MSG_TRANSUR_TITLE);
  2580. MessageBox(hwndDlg,message,title,MB_OK | MB_ICONINFORMATION);
  2581. }
  2582. break;
  2583. }
  2584. case PSN_WIZBACK :
  2585. break;
  2586. case PSN_QUERYCANCEL :
  2587. GetError(0); //clear any old com errors
  2588. break;
  2589. case PSN_HELP :
  2590. {
  2591. helpWrapper(hwndDlg,IDH_WINDOW_SECURITY_OPTION);
  2592. break;
  2593. }
  2594. case PSN_RESET :
  2595. break;
  2596. default :
  2597. break;
  2598. }
  2599. break;
  2600. } case WM_HELP :
  2601. {
  2602. helpWrapper(hwndDlg,IDH_WINDOW_SECURITY_OPTION);
  2603. break;
  2604. }
  2605. default:
  2606. break;
  2607. }
  2608. return 0;
  2609. }
  2610. INT_PTR CALLBACK IntOptionsGroupMappingProc(
  2611. HWND hwndDlg,
  2612. UINT uMsg,
  2613. WPARAM wParam,
  2614. LPARAM lParam
  2615. )
  2616. {
  2617. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  2618. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  2619. switch (uMsg)
  2620. {
  2621. case WM_INITDIALOG :
  2622. {
  2623. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  2624. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  2625. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  2626. initcheckbox( hwndDlg,IDC_COPY_USER_RIGHTS,DCTVS_AccountOptions_UpdateUserRights);
  2627. initcheckbox( hwndDlg,IDC_ADD_SID_HISTORY,DCTVS_AccountOptions_AddSidHistory);
  2628. if (pdata->sameForest)
  2629. {
  2630. CheckDlgButton(hwndDlg,IDC_ADD_SID_HISTORY,true);
  2631. disable(hwndDlg,IDC_ADD_SID_HISTORY);
  2632. }
  2633. break;
  2634. }
  2635. case WM_NOTIFY :
  2636. {
  2637. LPNMHDR lpnm = (LPNMHDR) lParam;
  2638. switch (lpnm->code)
  2639. {
  2640. case PSN_SETACTIVE :
  2641. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
  2642. break;
  2643. case PSN_WIZNEXT :
  2644. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  2645. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  2646. checkbox( hwndDlg,IDC_COPY_USER_RIGHTS,DCTVS_AccountOptions_UpdateUserRights);
  2647. if (IsDlgButtonChecked(hwndDlg,IDC_ADD_SID_HISTORY) && !pdata->sameForest)
  2648. {
  2649. HRESULT hr = doSidHistory(hwndDlg);
  2650. if (!SUCCEEDED(hr)&& hr!=E_ABORT)
  2651. {
  2652. ErrorWrapper(hwndDlg,hr);
  2653. CheckDlgButton(hwndDlg,IDC_ADD_SID_HISTORY,false);
  2654. }
  2655. else if (hr==E_ABORT)
  2656. CheckDlgButton(hwndDlg,IDC_ADD_SID_HISTORY,false);
  2657. }
  2658. checkbox( hwndDlg,IDC_ADD_SID_HISTORY,DCTVS_AccountOptions_AddSidHistory);
  2659. pdata->IsSidHistoryChecked =(IsDlgButtonChecked( hwndDlg,IDC_ADD_SID_HISTORY)==BST_CHECKED)?true:false;
  2660. if (pdata->IsSidHistoryChecked )
  2661. {
  2662. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CREDENTIALS);
  2663. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_CREDENTIALS);
  2664. return TRUE;
  2665. }
  2666. else
  2667. {
  2668. // SetWindowLong(hwndDlg, DWL_MSGRESULT,IDD_END_GROUPMAPPING);
  2669. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT,IDD_END_GROUPMAPPING);
  2670. return TRUE;
  2671. }
  2672. break;
  2673. case PSN_WIZBACK :
  2674. break;
  2675. case PSN_QUERYCANCEL :
  2676. GetError(0); //clear any old com errors
  2677. break;
  2678. case PSN_HELP :
  2679. {
  2680. helpWrapper(hwndDlg,IDH_WINDOW_GROUP_OPTION);
  2681. break;
  2682. }
  2683. case PSN_RESET :
  2684. break;
  2685. default :
  2686. break;
  2687. }
  2688. break;
  2689. } case WM_HELP :
  2690. {
  2691. helpWrapper(hwndDlg,IDH_WINDOW_GROUP_OPTION);
  2692. break;
  2693. }
  2694. default:
  2695. break;
  2696. }
  2697. return 0;
  2698. }
  2699. INT_PTR CALLBACK IntGroupOptionsProc (
  2700. HWND hwndDlg,
  2701. UINT uMsg,
  2702. WPARAM wParam,
  2703. LPARAM lParam
  2704. )
  2705. {
  2706. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  2707. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  2708. switch (uMsg)
  2709. {
  2710. case WM_INITDIALOG :
  2711. {
  2712. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  2713. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  2714. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  2715. initnoncollisionrename(hwndDlg);
  2716. initcheckbox( hwndDlg,IDC_COPY_GROUP_MEMBERS,DCTVS_AccountOptions_CopyContainerContents);
  2717. initcheckbox( hwndDlg,IDC_COPY_USER_RIGHTS,DCTVS_AccountOptions_UpdateUserRights);
  2718. initcheckbox( hwndDlg,IDC_ADD_SID_HISTORY,DCTVS_AccountOptions_AddSidHistory);
  2719. initcheckbox( hwndDlg,IDC_REMIGRATE_OBJECTS,DCTVS_AccountOptions_IncludeMigratedAccts);
  2720. initcheckbox( hwndDlg,IDC_FIX_MEMBERSHIP,DCTVS_AccountOptions_FixMembership);
  2721. if (IsDlgButtonChecked(hwndDlg,IDC_COPY_GROUP_MEMBERS))
  2722. {
  2723. pdata->memberSwitch=true;
  2724. enable(hwndDlg,IDC_REMIGRATE_OBJECTS);
  2725. // CheckDlgButton(hwndDlg,IDC_FIX_MEMBERSHIP,true);
  2726. }
  2727. else
  2728. {
  2729. disable(hwndDlg,IDC_REMIGRATE_OBJECTS);
  2730. }
  2731. if (pdata->sameForest)
  2732. {
  2733. CheckDlgButton(hwndDlg,IDC_ADD_SID_HISTORY,true);
  2734. disable(hwndDlg,IDC_ADD_SID_HISTORY);
  2735. CheckDlgButton(hwndDlg,IDC_FIX_MEMBERSHIP,true);
  2736. disable(hwndDlg,IDC_FIX_MEMBERSHIP);
  2737. }
  2738. if (migration==w_group && pdata->sameForest)
  2739. {
  2740. CheckDlgButton(hwndDlg,IDC_REMIGRATE_OBJECTS,false);
  2741. disable(hwndDlg,IDC_REMIGRATE_OBJECTS);
  2742. }
  2743. break;
  2744. }
  2745. case WM_COMMAND:
  2746. {
  2747. switch(LOWORD (wParam))
  2748. {
  2749. case IDC_COPY_GROUP_MEMBERS:
  2750. {
  2751. pdata->memberSwitch=(!pdata->memberSwitch);
  2752. if (migration!=w_group)
  2753. pdata->memberSwitch ? enable(hwndDlg,IDC_REMIGRATE_OBJECTS):disable(hwndDlg,IDC_REMIGRATE_OBJECTS);
  2754. else if (migration==w_group && !pdata->sameForest)
  2755. pdata->memberSwitch ? enable(hwndDlg,IDC_REMIGRATE_OBJECTS):disable(hwndDlg,IDC_REMIGRATE_OBJECTS);
  2756. // CheckDlgButton(hwndDlg,IDC_FIX_MEMBERSHIP,true);
  2757. bChangedMigrationTypes=true;
  2758. break;
  2759. }
  2760. case IDC_RADIO_NONE :
  2761. {
  2762. disable(hwndDlg,IDC_PRE);
  2763. disable(hwndDlg,IDC_SUF);
  2764. break;
  2765. }
  2766. case IDC_RADIO_PRE :
  2767. {
  2768. enable(hwndDlg,IDC_PRE);
  2769. disable(hwndDlg,IDC_SUF);
  2770. CheckDlgButton(hwndDlg,IDC_RADIO_NONE,false);
  2771. CheckDlgButton(hwndDlg,IDC_RADIO_SUF,false);
  2772. SetFocus(GetDlgItem(hwndDlg, IDC_PRE));
  2773. SendDlgItemMessage(hwndDlg, IDC_PRE, EM_SETSEL,
  2774. (WPARAM)0, (LPARAM)-1);
  2775. break;
  2776. }
  2777. case IDC_RADIO_SUF :
  2778. {
  2779. disable(hwndDlg,IDC_PRE);
  2780. enable(hwndDlg,IDC_SUF);
  2781. CheckDlgButton(hwndDlg,IDC_RADIO_NONE,false);
  2782. CheckDlgButton(hwndDlg,IDC_RADIO_PRE,false);
  2783. SetFocus(GetDlgItem(hwndDlg, IDC_SUF));
  2784. SendDlgItemMessage(hwndDlg, IDC_SUF, EM_SETSEL,
  2785. (WPARAM)0, (LPARAM)-1);
  2786. break;
  2787. }
  2788. default :
  2789. break;
  2790. }
  2791. break;
  2792. }
  2793. case WM_NOTIFY :
  2794. {
  2795. LPNMHDR lpnm = (LPNMHDR) lParam;
  2796. switch (lpnm->code)
  2797. {
  2798. case PSN_SETACTIVE :
  2799. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
  2800. break;
  2801. case PSN_WIZNEXT :
  2802. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  2803. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  2804. checkbox( hwndDlg,IDC_COPY_GROUP_MEMBERS,DCTVS_AccountOptions_CopyContainerContents);
  2805. checkbox( hwndDlg,IDC_COPY_GROUP_MEMBERS,DCTVS_AccountOptions_CopyUsers);
  2806. checkbox( hwndDlg,IDC_COPY_USER_RIGHTS,DCTVS_AccountOptions_UpdateUserRights);
  2807. checkbox( hwndDlg,IDC_FIX_MEMBERSHIP,DCTVS_AccountOptions_FixMembership);
  2808. if (IsDlgButtonChecked(hwndDlg,IDC_COPY_GROUP_MEMBERS) && pdata->sameForest)
  2809. {
  2810. CString yo;
  2811. yo.LoadString(IDS_GRATUITIOUS_MESSAGE2);
  2812. CString warning;
  2813. warning.LoadString(IDS_MSG_WARNING);
  2814. MessageBox(hwndDlg,yo,warning,MB_OK| MB_ICONINFORMATION);
  2815. }
  2816. if (IsDlgButtonChecked(hwndDlg,IDC_ADD_SID_HISTORY) && !pdata->sameForest)
  2817. {
  2818. HRESULT hr = doSidHistory(hwndDlg);
  2819. if (!SUCCEEDED(hr) && hr!=E_ABORT)
  2820. {
  2821. ErrorWrapper(hwndDlg,hr);
  2822. CheckDlgButton(hwndDlg,IDC_ADD_SID_HISTORY,false);
  2823. }
  2824. else if (hr==E_ABORT)
  2825. CheckDlgButton(hwndDlg,IDC_ADD_SID_HISTORY,false);
  2826. }
  2827. checkbox( hwndDlg,IDC_ADD_SID_HISTORY,DCTVS_AccountOptions_AddSidHistory);
  2828. pdata->IsSidHistoryChecked =(IsDlgButtonChecked( hwndDlg,IDC_ADD_SID_HISTORY)==BST_CHECKED)?true:false;
  2829. if (IsDlgButtonChecked(hwndDlg,IDC_COPY_GROUP_MEMBERS))
  2830. {
  2831. checkbox( hwndDlg,IDC_REMIGRATE_OBJECTS,DCTVS_AccountOptions_IncludeMigratedAccts);
  2832. pdata->migratingGroupMembers=true;
  2833. }
  2834. else
  2835. {
  2836. pdata->migratingGroupMembers=false;
  2837. }
  2838. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  2839. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  2840. if ( !noncollisionrename(hwndDlg))
  2841. {
  2842. int nID = IDC_PRE;
  2843. MessageBoxWrapperFormat1(hwndDlg,IDS_MSG_INVALIDCHARS,IDS_INVALID_STRING,IDS_MSG_INPUT);
  2844. // SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,IDD_OPTIONS_GROUP);
  2845. //set focus on invalid string
  2846. if (IsDlgButtonChecked(hwndDlg,IDC_RADIO_SUF))
  2847. nID = IDC_SUF;
  2848. SetFocus(GetDlgItem(hwndDlg, nID));
  2849. SendDlgItemMessage(hwndDlg, nID, EM_SETSEL,
  2850. (WPARAM)0, (LPARAM)-1);
  2851. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,-1);
  2852. return TRUE;
  2853. }
  2854. if (pdata->sourceIsNT4 || pdata->sameForest)
  2855. {
  2856. if (pdata->IsSidHistoryChecked )
  2857. {
  2858. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_CREDENTIALS);
  2859. return TRUE;
  2860. }
  2861. else
  2862. {
  2863. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT,IDD_RENAMING);
  2864. return TRUE;
  2865. }
  2866. }
  2867. break;
  2868. case PSN_WIZBACK :
  2869. break;
  2870. case PSN_QUERYCANCEL :
  2871. GetError(0); //clear any old com errors
  2872. break;
  2873. case PSN_HELP :
  2874. {
  2875. helpWrapper(hwndDlg,IDH_WINDOW_GROUP_OPTION);
  2876. break;
  2877. }
  2878. case PSN_RESET :
  2879. break;
  2880. default :
  2881. break;
  2882. }
  2883. break;
  2884. } case WM_HELP :
  2885. {
  2886. helpWrapper(hwndDlg,IDH_WINDOW_GROUP_OPTION);
  2887. break;
  2888. }
  2889. default:
  2890. break;
  2891. }
  2892. return 0;
  2893. }
  2894. INT_PTR CALLBACK IntExchangeSelectionProc (
  2895. HWND hwndDlg,
  2896. UINT uMsg,
  2897. WPARAM wParam,
  2898. LPARAM lParam
  2899. )
  2900. {
  2901. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  2902. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  2903. switch (uMsg)
  2904. {
  2905. case WM_INITDIALOG :
  2906. {
  2907. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  2908. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  2909. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  2910. initeditbox( hwndDlg,IDC_EXCHANGE_SERVER,DCTVS_Security_TranslateContainers);
  2911. break;
  2912. }
  2913. case WM_COMMAND:
  2914. {
  2915. switch(HIWORD(wParam))
  2916. {
  2917. case EN_CHANGE :
  2918. {
  2919. enableNextIfNecessary(hwndDlg,IDC_EXCHANGE_SERVER);
  2920. break;
  2921. }
  2922. default:
  2923. break;
  2924. }
  2925. break;
  2926. }
  2927. case WM_NOTIFY :
  2928. {
  2929. LPNMHDR lpnm = (LPNMHDR) lParam;
  2930. switch (lpnm->code)
  2931. {
  2932. case PSN_SETACTIVE :
  2933. IsDlgItemEmpty(hwndDlg,IDC_EXCHANGE_SERVER) ?
  2934. PostMessage(GetParent(hwndDlg), PSM_SETWIZBUTTONS, 0, PSWIZB_BACK):
  2935. PostMessage(GetParent(hwndDlg), PSM_SETWIZBUTTONS, 0, PSWIZB_BACK|PSWIZB_NEXT);
  2936. break;
  2937. case PSN_WIZNEXT :
  2938. {
  2939. CWaitCursor ex;
  2940. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  2941. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  2942. CString so;GetDlgItemText(hwndDlg,IDC_EXCHANGE_SERVER,so.GetBuffer(1000),1000);so.ReleaseBuffer();
  2943. SERVER_INFO_100 * servInfo = NULL;
  2944. so.TrimLeft();so.TrimRight();
  2945. if (NetServerGetInfo(so.GetBuffer(1000),100,(LPBYTE *)&servInfo)!=NERR_Success)
  2946. {
  2947. so.ReleaseBuffer();
  2948. MessageBoxWrapper(hwndDlg,IDS_MSG_INVALIDEXCHANGE,IDS_MSG_ERROR);
  2949. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_EXCHANGE_SELECTION);
  2950. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_EXCHANGE_SELECTION);
  2951. if ( servInfo )
  2952. {
  2953. NetApiBufferFree(servInfo);
  2954. }
  2955. return TRUE;
  2956. }
  2957. else
  2958. so.ReleaseBuffer();
  2959. if ( servInfo )
  2960. {
  2961. NetApiBufferFree(servInfo);
  2962. }
  2963. editbox( hwndDlg,IDC_EXCHANGE_SERVER,DCTVS_Security_TranslateContainers);
  2964. break;
  2965. }
  2966. case PSN_WIZBACK :
  2967. break;
  2968. case PSN_QUERYCANCEL :
  2969. GetError(0); //clear any old com errors
  2970. break;
  2971. case PSN_HELP :
  2972. {
  2973. helpWrapper(hwndDlg,IDH_WINDOW_EXCHANGE_SERVER_SELECTION);
  2974. break;
  2975. }
  2976. case PSN_RESET :
  2977. break;
  2978. default :
  2979. break;
  2980. }
  2981. break;
  2982. } case WM_HELP :
  2983. {
  2984. helpWrapper(hwndDlg,IDH_WINDOW_EXCHANGE_SERVER_SELECTION);
  2985. break;
  2986. }
  2987. default:
  2988. break;
  2989. }
  2990. return 0;
  2991. }
  2992. INT_PTR CALLBACK IntCommitProc (
  2993. HWND hwndDlg,
  2994. UINT uMsg,
  2995. WPARAM wParam,
  2996. LPARAM lParam
  2997. )
  2998. {
  2999. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  3000. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  3001. switch (uMsg)
  3002. {
  3003. case WM_INITDIALOG :
  3004. {
  3005. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  3006. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  3007. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  3008. CheckRadioButton(hwndDlg,IDC_CHANGEIT,IDC_DONTCHANGE,IDC_DONTCHANGE);
  3009. break;
  3010. }
  3011. case WM_NOTIFY :
  3012. {
  3013. LPNMHDR lpnm = (LPNMHDR) lParam;
  3014. switch (lpnm->code)
  3015. {
  3016. case PSN_SETACTIVE :
  3017. PostMessage(GetParent(hwndDlg), PSM_SETWIZBUTTONS, 0, PSWIZB_BACK|PSWIZB_NEXT);
  3018. break;
  3019. case PSN_WIZNEXT :
  3020. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  3021. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  3022. checkbox( hwndDlg,IDC_DONTCHANGE,DCTVS_Options_NoChange);
  3023. break;
  3024. case PSN_WIZBACK :
  3025. break;
  3026. case PSN_QUERYCANCEL :
  3027. GetError(0); //clear any old com errors
  3028. break;
  3029. case PSN_HELP :
  3030. {
  3031. helpWrapper(hwndDlg,IDH_WINDOW_COMMIT);
  3032. break;
  3033. }
  3034. case PSN_RESET :
  3035. break;
  3036. default :
  3037. break;
  3038. }
  3039. break;
  3040. } case WM_HELP :
  3041. {
  3042. helpWrapper(hwndDlg,IDH_WINDOW_COMMIT);
  3043. break;
  3044. }
  3045. default:
  3046. break;
  3047. }
  3048. return 0;
  3049. }
  3050. INT_PTR CALLBACK IntOuSelectionProc (
  3051. HWND hwndDlg,
  3052. UINT uMsg,
  3053. WPARAM wParam,
  3054. LPARAM lParam
  3055. )
  3056. {
  3057. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  3058. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  3059. switch (uMsg)
  3060. {
  3061. case WM_INITDIALOG :
  3062. {
  3063. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  3064. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  3065. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  3066. break;
  3067. }
  3068. case WM_COMMAND:
  3069. {
  3070. switch(LOWORD (wParam))
  3071. {
  3072. case IDC_BROWSE :
  3073. {
  3074. HMODULE hMod = NULL;
  3075. hMod = LoadLibrary(L"dsuiext.dll");
  3076. if ( hMod )
  3077. {
  3078. WCHAR sDomPath[255];
  3079. wsprintf(sDomPath, L"LDAP://%s", (LPCTSTR)targetDNS);
  3080. DsBrowseForContainerX = (DSBROWSEFORCONTAINER)GetProcAddress(hMod, "DsBrowseForContainerW");
  3081. WCHAR * sContPath, * sContName;
  3082. if ( !BrowseForContainer(hwndDlg, sDomPath, &sContPath, &sContName) )
  3083. {
  3084. SetDlgItemText(hwndDlg, IDC_TARGET_OU, sContPath);
  3085. CoTaskMemFree(sContPath);
  3086. CoTaskMemFree(sContName);
  3087. }
  3088. FreeLibrary(hMod);
  3089. }
  3090. break;
  3091. }
  3092. default:
  3093. break;
  3094. }
  3095. switch(HIWORD(wParam))
  3096. {
  3097. case EN_CHANGE :
  3098. {
  3099. enableNextIfNecessary(hwndDlg,IDC_TARGET_OU);
  3100. break;
  3101. }
  3102. default:
  3103. break;
  3104. }
  3105. break;
  3106. }
  3107. case WM_NOTIFY :
  3108. {
  3109. LPNMHDR lpnm = (LPNMHDR) lParam;
  3110. switch (lpnm->code)
  3111. {
  3112. case PSN_SETACTIVE :
  3113. pdata->resetOUPATH ? SetDlgItemText( hwndDlg,IDC_TARGET_OU,L""): initeditbox( hwndDlg,IDC_TARGET_OU,DCTVS_Options_OuPath);
  3114. pdata->resetOUPATH =false;
  3115. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  3116. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  3117. enableNextIfNecessary(hwndDlg,IDC_TARGET_OU);
  3118. break;
  3119. case PSN_WIZNEXT :
  3120. {CWaitCursor ex;
  3121. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  3122. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  3123. IADsContainerPtr pCont;
  3124. //since group, user, and computer migrations only bring up this dialog, we will
  3125. //use this occasion to clear the exclude properties flag if the source
  3126. //domain is NT 4.0
  3127. if (pdata->sourceIsNT4)
  3128. put(DCTVS_AccountOptions_ExcludeProps, no);
  3129. CString c,d,toenter;
  3130. GetDlgItemText(hwndDlg,IDC_TARGET_OU,c.GetBuffer(1000),1000);
  3131. c.ReleaseBuffer();
  3132. d=c.Left(7);d.TrimLeft();d.TrimRight();
  3133. if (!d.CompareNoCase(L"LDAP://"))
  3134. {
  3135. toenter=c;
  3136. }
  3137. else
  3138. {
  3139. toenter.Format(L"LDAP://%s/%s",targetDNS,c);
  3140. SetDlgItemText(hwndDlg, IDC_TARGET_OU, (LPCTSTR)toenter);
  3141. }
  3142. if (ADsGetObject(toenter,IID_IADsContainer,(void**)&pCont)!=S_OK)
  3143. {
  3144. //if buffer was big enough, say invalid OU
  3145. long len = toenter.GetLength();
  3146. if (len < 999)
  3147. {
  3148. MessageBoxWrapper(hwndDlg,IDS_MSG_INVALIDOU,IDS_MSG_ERROR);
  3149. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_OU_SELECTION);
  3150. pdata->resetOUPATH =true;
  3151. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  3152. return TRUE;
  3153. }
  3154. else //else if buffer too small, tell user OU path too long
  3155. {
  3156. MessageBoxWrapper(hwndDlg,IDS_OU_TOO_LONG,IDS_MSG_ERROR);
  3157. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_OU_SELECTION);
  3158. pdata->resetOUPATH =true;
  3159. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  3160. return TRUE;
  3161. }
  3162. }
  3163. editbox( hwndDlg,IDC_TARGET_OU,DCTVS_Options_OuPath);
  3164. if (pdata->sameForest&& migration==w_account)
  3165. {
  3166. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CREDENTIALS);
  3167. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_CREDENTIALS);
  3168. return TRUE;
  3169. }
  3170. break;
  3171. }
  3172. case PSN_WIZBACK :
  3173. editbox( hwndDlg,IDC_TARGET_OU,DCTVS_Options_OuPath);
  3174. break;
  3175. case PSN_QUERYCANCEL :
  3176. GetError(0); //clear any old com errors
  3177. break;
  3178. case PSN_HELP :
  3179. {
  3180. helpWrapper(hwndDlg,IDH_WINDOW_OU_SELECTION);
  3181. break;
  3182. }
  3183. case PSN_RESET :
  3184. break;
  3185. default :
  3186. break;
  3187. }
  3188. break;
  3189. } case WM_HELP :
  3190. {
  3191. helpWrapper(hwndDlg,IDH_WINDOW_OU_SELECTION);
  3192. break;
  3193. }
  3194. default:
  3195. break;
  3196. }
  3197. return 0;
  3198. }
  3199. INT_PTR CALLBACK IntCredentials2Proc (
  3200. HWND hwndDlg,
  3201. UINT uMsg,
  3202. WPARAM wParam,
  3203. LPARAM lParam
  3204. )
  3205. {
  3206. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  3207. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  3208. switch (uMsg)
  3209. {
  3210. case WM_INITDIALOG :
  3211. {
  3212. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  3213. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  3214. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  3215. initeditbox( hwndDlg,IDC_CREDENTIALS_DOMAIN2,DCTVS_Options_Credentials_Domain);
  3216. if (!clearCredentialsName)
  3217. initeditbox( hwndDlg, IDC_CREDENTIALS_USERNAME2,DCTVS_Options_Credentials_UserName );
  3218. initeditbox( hwndDlg, IDC_CREDENTIALS_PASSWORD2,DCTVS_Options_Credentials_Password );
  3219. SetDlgItemText(hwndDlg,IDC_CREDENTIALS_DOMAIN2,sourceNetbios);
  3220. if (migration ==w_reporting)
  3221. {
  3222. CString yo;
  3223. yo.LoadString(IDS_SEC_CRED2);
  3224. SetDlgItemText(hwndDlg,IDC_STATIC_ID,yo);
  3225. }
  3226. else if(migration ==w_security)
  3227. {
  3228. CString yo;
  3229. yo.LoadString(IDS_SEC_CRED2);
  3230. SetDlgItemText(hwndDlg,IDC_STATIC_ID,yo);
  3231. SetDlgItemText(hwndDlg,IDC_CREDENTIALS_DOMAIN2,targetNetbios);
  3232. }
  3233. HWND h=GetDlgItem(hwndDlg,IDC_CREDENTIALS_DOMAIN2);
  3234. break;
  3235. }
  3236. case WM_COMMAND:
  3237. {
  3238. switch(HIWORD(wParam))
  3239. {
  3240. case EN_CHANGE :
  3241. {
  3242. if (enableNextIfNecessary(hwndDlg,IDC_CREDENTIALS_DOMAIN2))
  3243. enableNextIfNecessary(hwndDlg,IDC_CREDENTIALS_USERNAME2);
  3244. break;
  3245. }
  3246. case EN_KILLFOCUS:
  3247. {
  3248. if (GetDlgItem(hwndDlg,IDC_CREDENTIALS_USERNAME) == (HWND)lParam)
  3249. {
  3250. CString aUPNName, aUser=L"", aDomain=L"";
  3251. int index;
  3252. GetDlgItemText(hwndDlg,IDC_CREDENTIALS_USERNAME,aUPNName.GetBuffer(1000),1000);
  3253. aUPNName.ReleaseBuffer();
  3254. //if possibly listed in UPN format, extract username and domain from that UPN
  3255. //and convert to DNS domain name to its netbios name
  3256. if ((index = aUPNName.Find(L'@')) != -1)
  3257. {
  3258. if (GetDomainAndUserFromUPN(&*aUPNName, aDomain, aUser))
  3259. {
  3260. SetDlgItemText(hwndDlg,IDC_CREDENTIALS_DOMAIN,aDomain);
  3261. SetDlgItemText(hwndDlg,IDC_CREDENTIALS_USERNAME,aUser);
  3262. }
  3263. }
  3264. }
  3265. break;
  3266. }
  3267. default:
  3268. break;
  3269. }
  3270. break;
  3271. }
  3272. case WM_NOTIFY :
  3273. {
  3274. LPNMHDR lpnm = (LPNMHDR) lParam;
  3275. switch (lpnm->code)
  3276. {
  3277. case PSN_SETACTIVE :
  3278. if (enableNextIfNecessary(hwndDlg,IDC_CREDENTIALS_DOMAIN2))
  3279. enableNextIfNecessary(hwndDlg,IDC_CREDENTIALS_USERNAME2);
  3280. break;
  3281. case PSN_WIZNEXT :
  3282. {
  3283. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  3284. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  3285. CString dom,user,pass;
  3286. GetDlgItemText(hwndDlg,IDC_CREDENTIALS_DOMAIN2,dom.GetBuffer(1000),1000);
  3287. GetDlgItemText(hwndDlg,IDC_CREDENTIALS_USERNAME2,user.GetBuffer(1000),1000);
  3288. GetDlgItemText(hwndDlg,IDC_CREDENTIALS_PASSWORD2,pass.GetBuffer(1000),1000);
  3289. dom.ReleaseBuffer(); user.ReleaseBuffer(); pass.ReleaseBuffer();
  3290. DWORD returncode= VerifyPassword(user.GetBuffer(1000),pass.GetBuffer(1000),dom.GetBuffer(1000));
  3291. dom.ReleaseBuffer(); user.ReleaseBuffer(); pass.ReleaseBuffer();
  3292. if (returncode!=ERROR_LOGON_FAILURE)
  3293. {
  3294. editbox( hwndDlg,IDC_CREDENTIALS_DOMAIN2,DCTVS_Options_Credentials_Domain);
  3295. editbox( hwndDlg,IDC_CREDENTIALS_USERNAME2,DCTVS_Options_Credentials_UserName);
  3296. editbox( hwndDlg,IDC_CREDENTIALS_PASSWORD2,DCTVS_Options_Credentials_Password);
  3297. }
  3298. else
  3299. {
  3300. ErrorWrapper(hwndDlg,returncode);
  3301. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CREDENTIALS2);
  3302. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_CREDENTIALS2);
  3303. return TRUE;
  3304. }
  3305. break;
  3306. }
  3307. case PSN_WIZBACK :
  3308. {
  3309. if (migration==w_security && !pdata->translateObjects)
  3310. {
  3311. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_TRANSLATION);
  3312. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_TRANSLATION);
  3313. return TRUE;
  3314. }
  3315. if (migration==w_security && pdata->translateObjects)
  3316. {
  3317. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_TRANSLATION_MODE);
  3318. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_TRANSLATION_MODE);
  3319. return TRUE;
  3320. }
  3321. else if (migration==w_computer)
  3322. {
  3323. if (!pdata->translateObjects)
  3324. {
  3325. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_TRANSLATION);
  3326. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_TRANSLATION);
  3327. return TRUE;
  3328. }
  3329. else
  3330. {
  3331. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_TRANSLATION_MODE);
  3332. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_TRANSLATION_MODE);
  3333. return TRUE;
  3334. }
  3335. }
  3336. if (migration==w_undo &&pdata->sameForest)
  3337. {
  3338. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CREDENTIALS);
  3339. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_CREDENTIALS);
  3340. return TRUE;
  3341. }
  3342. else if (migration==w_undo &&!pdata->sameForest)
  3343. {
  3344. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_UNDO);
  3345. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_UNDO);
  3346. return TRUE;
  3347. }
  3348. break;
  3349. }
  3350. case PSN_QUERYCANCEL :
  3351. GetError(0); //clear any old com errors
  3352. break;
  3353. case PSN_HELP :
  3354. {
  3355. int id;
  3356. if (migration==w_reporting)
  3357. id =IDH_WINDOW_REPORT_CREDENTIALS;
  3358. else
  3359. id =IDH_WINDOW_SECURITY_CREDENTIALS;
  3360. helpWrapper(hwndDlg,id);
  3361. break;
  3362. }
  3363. case PSN_RESET :
  3364. break;
  3365. default :
  3366. break;
  3367. }
  3368. break;
  3369. }
  3370. case WM_HELP :
  3371. {
  3372. int id;
  3373. if (migration==w_reporting)
  3374. id =IDH_WINDOW_REPORT_CREDENTIALS;
  3375. else
  3376. id =IDH_WINDOW_SECURITY_CREDENTIALS;
  3377. helpWrapper(hwndDlg,id);
  3378. break;
  3379. }
  3380. default:
  3381. break;
  3382. }
  3383. return 0;
  3384. }
  3385. INT_PTR CALLBACK IntCredentialsProc (
  3386. HWND hwndDlg,
  3387. UINT uMsg,
  3388. WPARAM wParam,
  3389. LPARAM lParam
  3390. )
  3391. {
  3392. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  3393. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  3394. switch (uMsg)
  3395. {
  3396. case WM_INITDIALOG :
  3397. {
  3398. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  3399. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  3400. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  3401. initeditbox( hwndDlg,IDC_CREDENTIALS_DOMAIN,DCTVS_AccountOptions_SidHistoryCredentials_Domain);
  3402. if (!clearCredentialsName) initeditbox( hwndDlg, IDC_CREDENTIALS_USERNAME,DCTVS_AccountOptions_SidHistoryCredentials_UserName );
  3403. initeditbox( hwndDlg, IDC_CREDENTIALS_PASSWORD,DCTVS_AccountOptions_SidHistoryCredentials_Password );
  3404. enable(hwndDlg,IDC_CREDENTIALS_DOMAIN);
  3405. enable(hwndDlg,IDC_CREDENTIALS_USERNAME);
  3406. enable(hwndDlg,IDC_CREDENTIALS_PASSWORD);
  3407. SetDlgItemText(hwndDlg,IDC_CREDENTIALS_DOMAIN,sourceNetbios);
  3408. if (pdata->sameForest)
  3409. {
  3410. SetDlgItemText(hwndDlg,IDC_MYTITLE,GET_CSTRING(IDS_MYTITLE2));
  3411. SetDlgItemText(hwndDlg,IDC_CREDENTIALS_DOMAIN,targetNetbios);
  3412. }
  3413. if (migration==w_exchangeDir)
  3414. SetDlgItemText(hwndDlg,IDC_MYTITLE,GET_CSTRING(IDS_MYTITLE3));
  3415. break;
  3416. }
  3417. case WM_COMMAND:
  3418. {
  3419. switch(HIWORD(wParam))
  3420. {
  3421. case EN_CHANGE :
  3422. {
  3423. if (enableNextIfNecessary(hwndDlg,IDC_CREDENTIALS_DOMAIN))
  3424. enableNextIfNecessary(hwndDlg,IDC_CREDENTIALS_USERNAME);
  3425. break;
  3426. }
  3427. case EN_KILLFOCUS:
  3428. {
  3429. if (GetDlgItem(hwndDlg,IDC_CREDENTIALS_USERNAME) == (HWND)lParam)
  3430. {
  3431. CString aUPNName, aUser=L"", aDomain=L"";
  3432. int index;
  3433. GetDlgItemText(hwndDlg,IDC_CREDENTIALS_USERNAME,aUPNName.GetBuffer(1000),1000);
  3434. aUPNName.ReleaseBuffer();
  3435. //if possibly listed in UPN format, extract username and domain from that UPN
  3436. //and convert to DNS domain name to its netbios name
  3437. if ((index = aUPNName.Find(L'@')) != -1)
  3438. {
  3439. if (GetDomainAndUserFromUPN(&*aUPNName, aDomain, aUser))
  3440. {
  3441. SetDlgItemText(hwndDlg,IDC_CREDENTIALS_DOMAIN,aDomain);
  3442. SetDlgItemText(hwndDlg,IDC_CREDENTIALS_USERNAME,aUser);
  3443. }
  3444. }
  3445. }
  3446. break;
  3447. }
  3448. default:
  3449. break;
  3450. }
  3451. break;
  3452. }
  3453. case WM_NOTIFY :
  3454. {
  3455. LPNMHDR lpnm = (LPNMHDR) lParam;
  3456. switch (lpnm->code)
  3457. {
  3458. case PSN_SETACTIVE :
  3459. if (enableNextIfNecessary(hwndDlg,IDC_CREDENTIALS_DOMAIN))
  3460. enableNextIfNecessary(hwndDlg,IDC_CREDENTIALS_USERNAME);
  3461. break;
  3462. case PSN_WIZNEXT :
  3463. {
  3464. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  3465. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  3466. CString dom,user,pass;
  3467. GetDlgItemText(hwndDlg,IDC_CREDENTIALS_DOMAIN,dom.GetBuffer(1000),1000);
  3468. GetDlgItemText(hwndDlg,IDC_CREDENTIALS_USERNAME,user.GetBuffer(1000),1000);
  3469. GetDlgItemText(hwndDlg,IDC_CREDENTIALS_PASSWORD,pass.GetBuffer(1000),1000);
  3470. dom.ReleaseBuffer(); user.ReleaseBuffer(); pass.ReleaseBuffer();
  3471. DWORD returncode = VerifyPassword(user.GetBuffer(1000),pass.GetBuffer(1000),dom.GetBuffer(1000));
  3472. dom.ReleaseBuffer(); user.ReleaseBuffer(); pass.ReleaseBuffer();
  3473. if (returncode!=ERROR_LOGON_FAILURE)
  3474. {
  3475. editbox( hwndDlg,IDC_CREDENTIALS_DOMAIN,DCTVS_AccountOptions_SidHistoryCredentials_Domain);
  3476. editbox( hwndDlg, IDC_CREDENTIALS_USERNAME,DCTVS_AccountOptions_SidHistoryCredentials_UserName );
  3477. editbox( hwndDlg, IDC_CREDENTIALS_PASSWORD,DCTVS_AccountOptions_SidHistoryCredentials_Password );
  3478. }
  3479. else
  3480. {
  3481. ErrorWrapper(hwndDlg,returncode);
  3482. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CREDENTIALS);
  3483. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_CREDENTIALS);
  3484. return TRUE;
  3485. }
  3486. if (migration==w_undo)
  3487. {
  3488. // _bstr_t text=get(DCTVS_Options_Wizard);
  3489. //
  3490. //* if (!UStrICmp(text,(WCHAR const *)GET_BSTR1(IDS_WIZARD_COMPUTER)))
  3491. // if (!UStrICmp(text, L"computer"))
  3492. // {
  3493. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CREDENTIALS2);
  3494. // SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_CREDENTIALS2);
  3495. // return TRUE;
  3496. // }
  3497. // else
  3498. // {
  3499. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_END_UNDO);
  3500. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_END_UNDO);
  3501. return TRUE;
  3502. // }
  3503. }
  3504. break;
  3505. }
  3506. case PSN_WIZBACK :
  3507. {
  3508. if (pdata->sameForest && migration==w_account)
  3509. {
  3510. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_OU_SELECTION);
  3511. return TRUE;
  3512. }
  3513. else if (migration==w_account)
  3514. {
  3515. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_DISABLE);
  3516. return TRUE;
  3517. }
  3518. else if (pdata->sourceIsNT4 || pdata->sameForest && migration==w_group)
  3519. {
  3520. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT,IDD_OPTIONS_GROUP);
  3521. return TRUE;
  3522. }
  3523. break;
  3524. }
  3525. case PSN_QUERYCANCEL :
  3526. GetError(0); //clear any old com errors
  3527. break;
  3528. case PSN_HELP :
  3529. {
  3530. helpWrapper(hwndDlg,IDH_WINDOW_SIDHISTORY_CREDENTIALS);
  3531. break;
  3532. }
  3533. case PSN_RESET :
  3534. break;
  3535. default :
  3536. break;
  3537. }
  3538. break;
  3539. } case WM_HELP :
  3540. {
  3541. helpWrapper(hwndDlg,IDH_WINDOW_SIDHISTORY_CREDENTIALS);
  3542. break;
  3543. }
  3544. default:
  3545. break;
  3546. }
  3547. return 0;
  3548. }
  3549. INT_PTR CALLBACK IntRenameProc (
  3550. HWND hwndDlg,
  3551. UINT uMsg,
  3552. WPARAM wParam,
  3553. LPARAM lParam
  3554. )
  3555. {
  3556. //find out if copy user's groups are being copied. If not then disable the
  3557. //replace existing group member checkbox
  3558. bool bCopyGroups = true;
  3559. _bstr_t strCopyGroups = get(DCTVS_AccountOptions_CopyMemberOf);
  3560. if (((!UStrCmp(strCopyGroups,(WCHAR const *) yes)) && (migration==w_account)) ||
  3561. (migration==w_group))
  3562. bCopyGroups = true;
  3563. else
  3564. bCopyGroups = false;
  3565. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  3566. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  3567. switch (uMsg)
  3568. {
  3569. case WM_INITDIALOG :
  3570. {
  3571. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  3572. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  3573. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  3574. /**/ handleInitRename(hwndDlg, pdata->sameForest, bCopyGroups);
  3575. if (migration==w_computer)
  3576. {
  3577. CString yo;
  3578. yo.LoadString(IDS_COMPUTER_RENAME_TITLE);
  3579. SetDlgItemText(hwndDlg,IDC_THERENAMINGTITLE,yo);
  3580. }
  3581. if (IsDlgButtonChecked(hwndDlg, IDC_SKIP_CONFLICTING_ACCOUNTS))
  3582. {
  3583. pdata->renameSwitch=1;
  3584. disable(hwndDlg,IDC_REMOVE_EXISTING_USER_RIGHTS);
  3585. disable(hwndDlg,IDC_REPLACE_EXISTING_GROUP_MEMBERS);
  3586. disable(hwndDlg,IDC_REMOVE_EXISTING_LOCATION);
  3587. disable(hwndDlg,IDC_PREFIX);
  3588. disable(hwndDlg,IDC_SUFFIX);
  3589. disable(hwndDlg,IDC_RADIO_PREFIX);
  3590. disable(hwndDlg,IDC_RADIO_SUFFIX);
  3591. }
  3592. else if (IsDlgButtonChecked(hwndDlg, IDC_REPLACE_CONFLICTING_ACCOUNTS))
  3593. {
  3594. pdata->renameSwitch=2;
  3595. enable(hwndDlg,IDC_REMOVE_EXISTING_USER_RIGHTS);
  3596. enable(hwndDlg,IDC_REMOVE_EXISTING_LOCATION);
  3597. if ((migration!=w_computer) && (bCopyGroups))
  3598. enable(hwndDlg,IDC_REPLACE_EXISTING_GROUP_MEMBERS);
  3599. else
  3600. {
  3601. disable(hwndDlg,IDC_REPLACE_EXISTING_GROUP_MEMBERS);
  3602. CheckDlgButton( hwndDlg,IDC_REPLACE_EXISTING_GROUP_MEMBERS,false);
  3603. }
  3604. disable(hwndDlg,IDC_PREFIX);
  3605. disable(hwndDlg,IDC_SUFFIX);
  3606. disable(hwndDlg,IDC_RADIO_PREFIX);
  3607. disable(hwndDlg,IDC_RADIO_SUFFIX);
  3608. }
  3609. else
  3610. {
  3611. CheckDlgButton( hwndDlg,IDC_RENAME_CONFLICTING_ACCOUNTS,true);
  3612. pdata->renameSwitch=3;
  3613. disable(hwndDlg,IDC_REMOVE_EXISTING_USER_RIGHTS);
  3614. disable(hwndDlg,IDC_REPLACE_EXISTING_GROUP_MEMBERS);
  3615. disable(hwndDlg,IDC_REMOVE_EXISTING_LOCATION);
  3616. enable(hwndDlg,IDC_RADIO_PREFIX);
  3617. enable(hwndDlg,IDC_RADIO_SUFFIX);
  3618. _bstr_t text2 = get(DCTVS_AccountOptions_Prefix);
  3619. _bstr_t text3 = get(DCTVS_AccountOptions_Suffix);
  3620. if (UStrICmp(text3,L""))
  3621. {
  3622. disable(hwndDlg,IDC_PREFIX);
  3623. enable(hwndDlg,IDC_SUFFIX);
  3624. CheckRadioButton(hwndDlg,IDC_RADIO_PREFIX,IDC_RADIO_SUFFIX,IDC_RADIO_SUFFIX);
  3625. }
  3626. else
  3627. {
  3628. enable(hwndDlg,IDC_PREFIX);
  3629. disable(hwndDlg,IDC_SUFFIX);
  3630. CheckRadioButton(hwndDlg,IDC_RADIO_PREFIX,IDC_RADIO_SUFFIX,IDC_RADIO_PREFIX);
  3631. }
  3632. }
  3633. break;
  3634. }
  3635. case WM_COMMAND:
  3636. {
  3637. switch(LOWORD (wParam))
  3638. {
  3639. /* case IDC_REPLACE_EXISTING_GROUP_MEMBERS:
  3640. if (IsDlgButtonChecked(hwndDlg,IDC_REPLACE_EXISTING_GROUP_MEMBERS) && migration==w_account)
  3641. {
  3642. _bstr_t text = get(DCTVS_AccountOptions_CopyMemberOf);
  3643. if (UStrCmp(text,(WCHAR const *) yes))
  3644. {
  3645. MessageBoxWrapper(hwndDlg,IDC_MSG_SELECT_COPY_MEMBER,IDS_MSG_ERROR);
  3646. CheckDlgButton( hwndDlg,IDC_REPLACE_EXISTING_GROUP_MEMBERS,false);
  3647. }
  3648. }
  3649. break;
  3650. */ case IDC_SKIP_CONFLICTING_ACCOUNTS :
  3651. pdata->renameSwitch=1;
  3652. disable(hwndDlg,IDC_REMOVE_EXISTING_USER_RIGHTS);
  3653. disable(hwndDlg,IDC_REPLACE_EXISTING_GROUP_MEMBERS);
  3654. disable(hwndDlg,IDC_REMOVE_EXISTING_LOCATION);
  3655. disable(hwndDlg,IDC_PREFIX);
  3656. disable(hwndDlg,IDC_SUFFIX);
  3657. disable(hwndDlg,IDC_RADIO_PREFIX);
  3658. disable(hwndDlg,IDC_RADIO_SUFFIX);
  3659. break;
  3660. case IDC_REPLACE_CONFLICTING_ACCOUNTS :
  3661. pdata->renameSwitch=2;
  3662. enable(hwndDlg,IDC_REMOVE_EXISTING_USER_RIGHTS);
  3663. enable(hwndDlg,IDC_REMOVE_EXISTING_LOCATION);
  3664. if ((migration!=w_computer) && (bCopyGroups))
  3665. enable(hwndDlg,IDC_REPLACE_EXISTING_GROUP_MEMBERS);
  3666. else
  3667. {
  3668. disable(hwndDlg,IDC_REPLACE_EXISTING_GROUP_MEMBERS);
  3669. CheckDlgButton( hwndDlg,IDC_REPLACE_EXISTING_GROUP_MEMBERS,false);
  3670. }
  3671. disable(hwndDlg,IDC_PREFIX);
  3672. disable(hwndDlg,IDC_SUFFIX);
  3673. disable(hwndDlg,IDC_RADIO_PREFIX);
  3674. disable(hwndDlg,IDC_RADIO_SUFFIX);
  3675. break;
  3676. case IDC_RENAME_CONFLICTING_ACCOUNTS :
  3677. pdata->renameSwitch=3;
  3678. disable(hwndDlg,IDC_REMOVE_EXISTING_USER_RIGHTS);
  3679. disable(hwndDlg,IDC_REPLACE_EXISTING_GROUP_MEMBERS);
  3680. disable(hwndDlg,IDC_REMOVE_EXISTING_LOCATION);
  3681. enable(hwndDlg,IDC_RADIO_PREFIX);
  3682. enable(hwndDlg,IDC_RADIO_SUFFIX);
  3683. if (IsDlgButtonChecked(hwndDlg,IDC_RADIO_SUFFIX))
  3684. {
  3685. enable(hwndDlg,IDC_SUFFIX);
  3686. CheckRadioButton(hwndDlg,IDC_RADIO_PREFIX,IDC_RADIO_SUFFIX,IDC_RADIO_SUFFIX);
  3687. }
  3688. else
  3689. {
  3690. enable(hwndDlg,IDC_PREFIX);
  3691. CheckRadioButton(hwndDlg,IDC_RADIO_PREFIX,IDC_RADIO_SUFFIX,IDC_RADIO_PREFIX);
  3692. }
  3693. break;
  3694. case IDC_RADIO_SUFFIX :
  3695. enable(hwndDlg,IDC_SUFFIX);
  3696. disable(hwndDlg,IDC_PREFIX);
  3697. CheckDlgButton(hwndDlg,IDC_RADIO_PREFIX,false);
  3698. SetFocus(GetDlgItem(hwndDlg, IDC_SUFFIX));
  3699. SendDlgItemMessage(hwndDlg, IDC_SUFFIX, EM_SETSEL,
  3700. (WPARAM)0, (LPARAM)-1);
  3701. break;
  3702. case IDC_RADIO_PREFIX :
  3703. enable(hwndDlg,IDC_PREFIX);
  3704. disable(hwndDlg,IDC_SUFFIX);
  3705. CheckDlgButton(hwndDlg,IDC_RADIO_SUFFIX,false);
  3706. SetFocus(GetDlgItem(hwndDlg, IDC_PREFIX));
  3707. SendDlgItemMessage(hwndDlg, IDC_PREFIX, EM_SETSEL,
  3708. (WPARAM)0, (LPARAM)-1);
  3709. break;
  3710. default:
  3711. break;
  3712. }
  3713. break;
  3714. }
  3715. case WM_NOTIFY :
  3716. {
  3717. LPNMHDR lpnm = (LPNMHDR) lParam;
  3718. switch (lpnm->code)
  3719. {
  3720. case PSN_SETACTIVE :
  3721. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
  3722. if (IsDlgButtonChecked(hwndDlg, IDC_REPLACE_CONFLICTING_ACCOUNTS))
  3723. {
  3724. if ((migration==w_computer) || (!bCopyGroups))
  3725. {
  3726. disable(hwndDlg,IDC_REPLACE_EXISTING_GROUP_MEMBERS);
  3727. CheckDlgButton( hwndDlg,IDC_REPLACE_EXISTING_GROUP_MEMBERS,false);
  3728. }
  3729. else
  3730. {
  3731. enable(hwndDlg,IDC_REPLACE_EXISTING_GROUP_MEMBERS);
  3732. initcheckbox(hwndDlg,IDC_REPLACE_EXISTING_GROUP_MEMBERS,DCTVS_AccountOptions_ReplaceExistingGroupMembers);
  3733. }
  3734. }
  3735. break;
  3736. case PSN_WIZNEXT :
  3737. {
  3738. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  3739. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  3740. if (IsDlgButtonChecked (hwndDlg,IDC_SKIP_CONFLICTING_ACCOUNTS))
  3741. {
  3742. put(DCTVS_AccountOptions_Prefix,L"");
  3743. put(DCTVS_AccountOptions_Suffix,L"");
  3744. put(DCTVS_AccountOptions_ReplaceExistingAccounts,L"");
  3745. put(DCTVS_AccountOptions_RemoveExistingUserRights,L"");
  3746. put(DCTVS_AccountOptions_ReplaceExistingGroupMembers,L"");
  3747. put(DCTVS_AccountOptions_MoveReplacedAccounts,L"");
  3748. }
  3749. else if (IsDlgButtonChecked (hwndDlg,IDC_REPLACE_CONFLICTING_ACCOUNTS))
  3750. {
  3751. put(DCTVS_AccountOptions_Prefix,L"");
  3752. put(DCTVS_AccountOptions_Suffix,L"");
  3753. put(DCTVS_AccountOptions_ReplaceExistingAccounts,yes);
  3754. checkbox( hwndDlg,IDC_REMOVE_EXISTING_USER_RIGHTS,DCTVS_AccountOptions_RemoveExistingUserRights);
  3755. checkbox( hwndDlg,IDC_REMOVE_EXISTING_LOCATION,DCTVS_AccountOptions_MoveReplacedAccounts);
  3756. if (IsDlgButtonChecked(hwndDlg,IDC_REPLACE_EXISTING_GROUP_MEMBERS) && (migration==w_account))
  3757. {
  3758. if (!bCopyGroups)
  3759. {
  3760. // MessageBoxWrapper(hwndDlg,IDC_MSG_SELECT_COPY_MEMBER,IDS_MSG_ERROR);
  3761. CheckDlgButton( hwndDlg,IDC_REPLACE_EXISTING_GROUP_MEMBERS,false);
  3762. }
  3763. }
  3764. if (migration!=w_computer)
  3765. checkbox( hwndDlg,IDC_REPLACE_EXISTING_GROUP_MEMBERS,DCTVS_AccountOptions_ReplaceExistingGroupMembers);
  3766. }
  3767. else if (IsDlgButtonChecked (hwndDlg,IDC_RENAME_CONFLICTING_ACCOUNTS) &&
  3768. IsDlgButtonChecked (hwndDlg,IDC_RADIO_PREFIX))
  3769. {
  3770. if (!validString(hwndDlg,IDC_PREFIX))
  3771. {
  3772. MessageBoxWrapperFormat1(hwndDlg,IDS_MSG_INVALIDCHARS,IDS_INVALID_STRING,IDS_MSG_INPUT);
  3773. // SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,IDD_RENAMING);
  3774. SetFocus(GetDlgItem(hwndDlg, IDC_PREFIX));
  3775. SendDlgItemMessage(hwndDlg, IDC_PREFIX, EM_SETSEL,
  3776. (WPARAM)0, (LPARAM)-1);
  3777. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,-1);
  3778. return TRUE;
  3779. }
  3780. else if (IsDlgItemEmpty(hwndDlg,IDC_PREFIX))
  3781. {
  3782. MessageBoxWrapper(hwndDlg,IDS_MSG_BLANK,IDS_MSG_INPUT);
  3783. // SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,IDD_RENAMING);
  3784. SetFocus(GetDlgItem(hwndDlg, IDC_PREFIX));
  3785. SendDlgItemMessage(hwndDlg, IDC_PREFIX, EM_SETSEL,
  3786. (WPARAM)0, (LPARAM)-1);
  3787. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,-1);
  3788. return TRUE;
  3789. }
  3790. else if (findInVarSet(hwndDlg,IDC_PREFIX,L"Options.Prefix"))
  3791. {
  3792. MessageBoxWrapper(hwndDlg,IDS_MSG_EXTENSION_PREFIX,IDS_MSG_INPUT);
  3793. // SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,IDD_RENAMING);
  3794. SetFocus(GetDlgItem(hwndDlg, IDC_PREFIX));
  3795. SendDlgItemMessage(hwndDlg, IDC_PREFIX, EM_SETSEL,
  3796. (WPARAM)0, (LPARAM)-1);
  3797. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,-1);
  3798. return TRUE;
  3799. }
  3800. else if (tooManyChars(hwndDlg,IDC_PREFIX))
  3801. {
  3802. MessageBoxWrapper(hwndDlg,IDS_MSG_EXTENSION_MAX_PRE,IDS_MSG_INPUT);
  3803. // SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,IDD_RENAMING);
  3804. SetFocus(GetDlgItem(hwndDlg, IDC_PREFIX));
  3805. SendDlgItemMessage(hwndDlg, IDC_PREFIX, EM_SETSEL,
  3806. (WPARAM)0, (LPARAM)-1);
  3807. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,-1);
  3808. return TRUE;
  3809. }
  3810. else
  3811. {
  3812. editbox( hwndDlg, IDC_PREFIX,DCTVS_AccountOptions_Prefix );
  3813. put(DCTVS_AccountOptions_Suffix,L"");
  3814. put(DCTVS_AccountOptions_ReplaceExistingAccounts,L"");
  3815. put(DCTVS_AccountOptions_RemoveExistingUserRights,L"");
  3816. put(DCTVS_AccountOptions_ReplaceExistingGroupMembers,L"");
  3817. put(DCTVS_AccountOptions_MoveReplacedAccounts,L"");
  3818. }
  3819. }
  3820. else if (IsDlgButtonChecked (hwndDlg,IDC_RENAME_CONFLICTING_ACCOUNTS) &&
  3821. IsDlgButtonChecked (hwndDlg,IDC_RADIO_SUFFIX))
  3822. {
  3823. if (!validString(hwndDlg,IDC_SUFFIX))
  3824. {
  3825. MessageBoxWrapperFormat1(hwndDlg,IDS_MSG_INVALIDCHARS,IDS_INVALID_STRING,IDS_MSG_INPUT);
  3826. // SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,IDD_RENAMING);
  3827. SetFocus(GetDlgItem(hwndDlg, IDC_SUFFIX));
  3828. SendDlgItemMessage(hwndDlg, IDC_SUFFIX, EM_SETSEL,
  3829. (WPARAM)0, (LPARAM)-1);
  3830. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,-1);
  3831. return TRUE;
  3832. }
  3833. else if (IsDlgItemEmpty(hwndDlg,IDC_SUFFIX))
  3834. {
  3835. MessageBoxWrapper(hwndDlg,IDS_MSG_BLANK,IDS_MSG_INPUT);
  3836. // SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,IDD_RENAMING);
  3837. SetFocus(GetDlgItem(hwndDlg, IDC_SUFFIX));
  3838. SendDlgItemMessage(hwndDlg, IDC_SUFFIX, EM_SETSEL,
  3839. (WPARAM)0, (LPARAM)-1);
  3840. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,-1);
  3841. return TRUE;
  3842. }
  3843. else if (findInVarSet(hwndDlg,IDC_SUFFIX,L"Options.Suffix"))
  3844. {
  3845. MessageBoxWrapper(hwndDlg,IDS_MSG_EXTENSION_SUFFIX,IDS_MSG_INPUT);
  3846. // SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,IDD_RENAMING);
  3847. SetFocus(GetDlgItem(hwndDlg, IDC_SUFFIX));
  3848. SendDlgItemMessage(hwndDlg, IDC_SUFFIX, EM_SETSEL,
  3849. (WPARAM)0, (LPARAM)-1);
  3850. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,-1);
  3851. return TRUE;
  3852. }
  3853. else if (tooManyChars(hwndDlg,IDC_SUFFIX))
  3854. {
  3855. MessageBoxWrapper(hwndDlg,IDS_MSG_EXTENSION_MAX_SUF,IDS_MSG_INPUT);
  3856. // SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,IDD_RENAMING);
  3857. SetFocus(GetDlgItem(hwndDlg, IDC_SUFFIX));
  3858. SendDlgItemMessage(hwndDlg, IDC_SUFFIX, EM_SETSEL,
  3859. (WPARAM)0, (LPARAM)-1);
  3860. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,-1);
  3861. return TRUE;
  3862. }
  3863. else
  3864. {
  3865. editbox( hwndDlg, IDC_SUFFIX,DCTVS_AccountOptions_Suffix );
  3866. put(DCTVS_AccountOptions_Prefix,L"");
  3867. put(DCTVS_AccountOptions_ReplaceExistingAccounts,L"");
  3868. put(DCTVS_AccountOptions_RemoveExistingUserRights,L"");
  3869. put(DCTVS_AccountOptions_ReplaceExistingGroupMembers,L"");
  3870. put(DCTVS_AccountOptions_MoveReplacedAccounts,L"");
  3871. }
  3872. }
  3873. if (migration==w_account)
  3874. {
  3875. if (someServiceAccounts(pdata->accounts,hwndDlg))
  3876. {
  3877. pdata->someService=true;
  3878. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  3879. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  3880. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_SA_INFO);
  3881. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_SA_INFO);
  3882. return TRUE;
  3883. }
  3884. else
  3885. {
  3886. pdata->someService=false;
  3887. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  3888. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  3889. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_END_ACCOUNT);
  3890. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_END_ACCOUNT);
  3891. return TRUE;
  3892. }
  3893. }
  3894. else if (migration==w_group)
  3895. {
  3896. if (pdata->migratingGroupMembers && !pdata->sameForest)
  3897. {
  3898. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_PASSWORD);
  3899. return TRUE;
  3900. }
  3901. else
  3902. {
  3903. pdata->someService=false;
  3904. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  3905. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  3906. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_END_GROUP);
  3907. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_END_GROUP);
  3908. return TRUE;
  3909. }
  3910. }
  3911. break;
  3912. }
  3913. case PSN_WIZBACK :
  3914. {
  3915. if (pdata->IsSidHistoryChecked && migration==w_group)
  3916. {
  3917. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CREDENTIALS);
  3918. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_CREDENTIALS);
  3919. return TRUE;
  3920. }
  3921. if (!pdata->sourceIsNT4 && !pdata->sameForest && migration==w_account)
  3922. {
  3923. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_PROP_EXCLUSION);
  3924. return TRUE;
  3925. }
  3926. else if (migration==w_account)
  3927. {
  3928. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_OPTIONS);
  3929. return TRUE;
  3930. }
  3931. else if (migration==w_computer && pdata->sourceIsNT4)
  3932. {
  3933. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_REBOOT);
  3934. return TRUE;
  3935. }
  3936. else if (pdata->sourceIsNT4 || pdata->sameForest && migration==w_group)
  3937. {
  3938. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_OPTIONS_GROUP);
  3939. return TRUE;
  3940. }
  3941. else if (migration==w_group)
  3942. {
  3943. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_PROP_EXCLUSION);
  3944. return TRUE;
  3945. }
  3946. break;
  3947. }
  3948. case PSN_QUERYCANCEL :
  3949. GetError(0); //clear any old com errors
  3950. break;
  3951. case PSN_HELP :
  3952. {
  3953. helpWrapper(hwndDlg,IDH_WINDOW_NAME_CONFLICT);
  3954. break;
  3955. }
  3956. case PSN_RESET :
  3957. break;
  3958. default :
  3959. break;
  3960. }
  3961. break;
  3962. } case WM_HELP :
  3963. {
  3964. helpWrapper(hwndDlg,IDH_WINDOW_NAME_CONFLICT);
  3965. break;
  3966. }
  3967. default:
  3968. break;
  3969. }
  3970. return 0;
  3971. }
  3972. INT_PTR CALLBACK IntSelectionSecurityProc (
  3973. HWND hwndDlg,
  3974. UINT uMsg,
  3975. WPARAM wParam,
  3976. LPARAM lParam
  3977. )
  3978. {
  3979. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  3980. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  3981. switch (uMsg)
  3982. {
  3983. case WM_INITDIALOG :
  3984. {
  3985. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  3986. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  3987. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  3988. HWND hLC= GetDlgItem(hwndDlg,IDC_LIST_MEMBERS1);
  3989. m_listBox.Attach(hLC);
  3990. setupColumns(pdata->sourceIsNT4);
  3991. m_listBox.DeleteAllItems();
  3992. disable(hwndDlg,IDC_REMOVE_BUTTON);
  3993. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK);
  3994. HWND hLC4= GetDlgItem(hwndDlg,IDC_ADDITIONAL_TRUSTING_DOMAIN);
  3995. additionalDrop.Attach(hLC4);
  3996. if ((migration==w_security) && (pdata->secWithMapFile))
  3997. { //get the netbios name of the machine we are running on
  3998. WCHAR sTempName[MAX_PATH];
  3999. DWORD lenName = MAX_PATH;
  4000. if (GetComputerName(sTempName, &lenName))
  4001. {
  4002. PDOMAIN_CONTROLLER_INFOW pdomc;
  4003. CString sTempUPN, aDomain, aUser;
  4004. HRESULT res = DsGetDcNameW((LPCTSTR)sTempName,NULL,NULL,NULL,DS_DIRECTORY_SERVICE_PREFERRED,&pdomc);
  4005. if (res==NO_ERROR)
  4006. {
  4007. targetDNS = pdomc->DomainName;
  4008. sTempUPN = L"administrator@" + targetDNS;
  4009. if (GetDomainAndUserFromUPN(&*sTempUPN, aDomain, aUser))
  4010. targetNetbios = aDomain;
  4011. NetApiBufferFree(pdomc);
  4012. }
  4013. }
  4014. }
  4015. else if ((migration==w_security) && (!pdata->secWithMapFile))
  4016. lastInitializedTo=targetNetbios;
  4017. else
  4018. lastInitializedTo=sourceNetbios;
  4019. populateList(additionalDrop);
  4020. break;
  4021. }
  4022. case WM_HELP :
  4023. {
  4024. int id =IDH_WINDOW_COMPUTER_SELECTION;
  4025. helpWrapper(hwndDlg,id);
  4026. break;
  4027. }
  4028. case WM_COMMAND :
  4029. {
  4030. switch(LOWORD (wParam))
  4031. {
  4032. case IDC_ADD_BUTTON :
  4033. {CWaitCursor w;
  4034. HRESULT hr=S_OK;
  4035. CString tempTrustingDomain;
  4036. PDOMAIN_CONTROLLER_INFOW pdomc;
  4037. GetDlgItemText(hwndDlg,IDC_ADDITIONAL_TRUSTING_DOMAIN,tempTrustingDomain.GetBuffer(1000),1000);
  4038. tempTrustingDomain.ReleaseBuffer();
  4039. tempTrustingDomain.TrimLeft();tempTrustingDomain.TrimRight();
  4040. if (tempTrustingDomain.IsEmpty() && (lastInitializedTo.CompareNoCase(sourceNetbios)) && (migration!=w_security))
  4041. {
  4042. CString temp;
  4043. HRESULT res = DsGetDcNameW(NULL,(LPCTSTR const)sourceNetbios,NULL,NULL, DS_DIRECTORY_SERVICE_PREFERRED,&pdomc);
  4044. temp=pdomc->DomainControllerName;
  4045. if (res==NO_ERROR)
  4046. {
  4047. lastInitializedTo=sourceNetbios;
  4048. hr =InitObjectPicker2(pDsObjectPicker,true,temp,false);
  4049. }else
  4050. hr=E_UNEXPECTED;
  4051. }
  4052. // else if (tempTrustingDomain.IsEmpty() && (lastInitializedTo.CompareNoCase(targetNetbios)) && (migration==w_security))
  4053. else if (tempTrustingDomain.IsEmpty() && (migration==w_security))
  4054. {
  4055. CString temp;
  4056. HRESULT res = DsGetDcNameW(NULL,(LPCTSTR const)targetNetbios,NULL,NULL, DS_DIRECTORY_SERVICE_PREFERRED,&pdomc);
  4057. temp=pdomc->DomainControllerName;
  4058. if (res==NO_ERROR)
  4059. {
  4060. lastInitializedTo=targetNetbios;
  4061. hr =InitObjectPicker2(pDsObjectPicker,true,temp,pdata->sourceIsNT4);
  4062. }else
  4063. hr=E_UNEXPECTED;
  4064. }
  4065. else if (lastInitializedTo.CompareNoCase(tempTrustingDomain) && !tempTrustingDomain.IsEmpty())
  4066. {
  4067. CString additionalDomainController;
  4068. if (!verifyprivs2(hwndDlg,additionalDomainController,tempTrustingDomain))
  4069. {
  4070. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  4071. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  4072. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_SELECTION4);
  4073. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_SELECTION4);
  4074. return TRUE;
  4075. }
  4076. lastInitializedTo=tempTrustingDomain;
  4077. hr =ReInitializeObjectPicker(pDsObjectPicker,true,additionalDomainController,pdata->sourceIsNT4);
  4078. }
  4079. if (FAILED(hr))
  4080. {
  4081. MessageBoxWrapper(hwndDlg,IDS_MSG_OBJECTPICKER_SOURCE2,IDS_MSG_ERROR);
  4082. SetDlgItemText(hwndDlg,IDC_ADDITIONAL_TRUSTING_DOMAIN,L"");
  4083. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_SELECTION4);
  4084. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_SELECTION4);
  4085. return TRUE;
  4086. }
  4087. // if (migration==w_security)
  4088. // OnADD(hwndDlg,false);
  4089. // else
  4090. OnADD(hwndDlg,pdata->sourceIsNT4);
  4091. sort(m_listBox,0,pdata->sort[0]);
  4092. enableNextIfObjectsSelected(hwndDlg);
  4093. break;
  4094. }
  4095. case IDC_REMOVE_BUTTON :
  4096. OnREMOVE(hwndDlg);
  4097. enableNextIfObjectsSelected(hwndDlg);
  4098. break;
  4099. default :
  4100. break;
  4101. }
  4102. enableRemoveIfNecessary(hwndDlg);
  4103. break;
  4104. }
  4105. case WM_NOTIFY :
  4106. {
  4107. LPNMHDR lpnm = (LPNMHDR) lParam;
  4108. switch (lpnm->code)
  4109. {
  4110. case PSN_SETACTIVE :
  4111. {
  4112. if (pdata->newSource)
  4113. {
  4114. m_listBox.DeleteAllItems();
  4115. pdata->newSource=false;
  4116. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  4117. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  4118. }
  4119. if (m_listBox.GetItemCount()==0)
  4120. PostMessage(GetParent(hwndDlg), PSM_SETWIZBUTTONS, 0, PSWIZB_BACK);
  4121. else
  4122. PostMessage(GetParent(hwndDlg), PSM_SETWIZBUTTONS, 0, PSWIZB_BACK|PSWIZB_NEXT);
  4123. break;
  4124. }
  4125. case LVN_COLUMNCLICK:
  4126. {
  4127. LPNMLISTVIEW pnmv = (NM_LISTVIEW FAR *) lParam;
  4128. pdata->sort[pnmv->iSubItem] = !pdata->sort[pnmv->iSubItem];
  4129. sort(m_listBox,pnmv->iSubItem,pdata->sort[pnmv->iSubItem] );
  4130. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  4131. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  4132. break;
  4133. }
  4134. case NM_SETFOCUS :
  4135. case NM_KILLFOCUS :
  4136. case NM_CLICK:
  4137. {
  4138. enableRemoveIfNecessary(hwndDlg);
  4139. break;
  4140. }
  4141. case PSN_WIZNEXT :
  4142. {CWaitCursor w;
  4143. if (m_listBox.GetItemCount()==0)
  4144. {
  4145. MessageBoxWrapper(hwndDlg,IDS_MSG_OBJECT,IDS_MSG_INPUT);
  4146. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_SELECTION1);
  4147. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_SELECTION1);
  4148. return TRUE;
  4149. }
  4150. OnMIGRATE(hwndDlg,pdata->accounts,pdata->servers);
  4151. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  4152. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  4153. break;
  4154. }
  4155. case PSN_WIZBACK :
  4156. {
  4157. if (migration==w_security)
  4158. {
  4159. _bstr_t text= get(DCTVS_AccountOptions_SecurityInputMOT);
  4160. if (UStrICmp(text ,(WCHAR const *) yes))
  4161. {
  4162. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_TRANSLATION_SRC);
  4163. return TRUE;
  4164. }
  4165. }
  4166. break;
  4167. }
  4168. case PSN_QUERYCANCEL :
  4169. GetError(0); //clear any old com errors
  4170. break;
  4171. case PSN_HELP :
  4172. {
  4173. int id=IDH_WINDOW_COMPUTER_SELECTION;
  4174. helpWrapper(hwndDlg,id);
  4175. break;
  4176. }
  4177. case PSN_RESET :
  4178. break;
  4179. default :
  4180. break;
  4181. }
  4182. break;
  4183. }
  4184. default:
  4185. break;
  4186. }
  4187. return 0;
  4188. }
  4189. INT_PTR CALLBACK IntSelectionProc (
  4190. HWND hwndDlg,
  4191. UINT uMsg,
  4192. WPARAM wParam,
  4193. LPARAM lParam
  4194. )
  4195. {
  4196. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  4197. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  4198. switch (uMsg)
  4199. {
  4200. case WM_INITDIALOG :
  4201. {
  4202. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  4203. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  4204. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  4205. HWND hLC= GetDlgItem(hwndDlg,IDC_LIST_MEMBERS1);
  4206. m_listBox.Attach(hLC);
  4207. setupColumns(pdata->sourceIsNT4);
  4208. m_listBox.DeleteAllItems();
  4209. disable(hwndDlg,IDC_REMOVE_BUTTON);
  4210. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK);
  4211. break;
  4212. }
  4213. case WM_HELP :
  4214. {
  4215. int id=0;
  4216. if (migration==w_computer || (migration==w_security || migration==w_reporting))
  4217. id =IDH_WINDOW_COMPUTER_SELECTION;
  4218. else if (migration==w_account)
  4219. id =IDH_WINDOW_USER_SELECTION;
  4220. else if (migration==w_group || migration==w_groupmapping)
  4221. id =IDH_WINDOW_GROUP_SELECTION;
  4222. else if (migration==w_service)
  4223. id =IDH_WINDOW_SERVICE_ACCOUNT_SELECTION;
  4224. helpWrapper(hwndDlg,id);
  4225. break;
  4226. }
  4227. case WM_COMMAND :
  4228. {
  4229. switch(LOWORD (wParam))
  4230. {
  4231. case IDC_ADD_BUTTON :
  4232. OnADD(hwndDlg,pdata->sourceIsNT4);
  4233. //sort(m_listBox,0,pdata->sort[0]);
  4234. enableNextIfObjectsSelected(hwndDlg);
  4235. break;
  4236. case IDC_REMOVE_BUTTON :
  4237. OnREMOVE(hwndDlg);
  4238. enableNextIfObjectsSelected(hwndDlg);
  4239. break;
  4240. default :
  4241. break;
  4242. }
  4243. enableRemoveIfNecessary(hwndDlg);
  4244. break;
  4245. }
  4246. case WM_NOTIFY :
  4247. {
  4248. LPNMHDR lpnm = (LPNMHDR) lParam;
  4249. switch (lpnm->code)
  4250. {
  4251. case PSN_SETACTIVE :
  4252. {
  4253. if (pdata->newSource)
  4254. {
  4255. m_listBox.DeleteAllItems();
  4256. pdata->newSource=false;
  4257. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  4258. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  4259. }PostMessage(GetParent(hwndDlg), PSM_SETWIZBUTTONS, 0, PSWIZB_BACK|PSWIZB_NEXT);
  4260. if (m_listBox.GetItemCount()==0)
  4261. PostMessage(GetParent(hwndDlg), PSM_SETWIZBUTTONS, 0, PSWIZB_BACK);
  4262. else
  4263. PostMessage(GetParent(hwndDlg), PSM_SETWIZBUTTONS, 0, PSWIZB_BACK|PSWIZB_NEXT);
  4264. break;
  4265. }
  4266. case LVN_COLUMNCLICK:
  4267. {
  4268. LPNMLISTVIEW pnmv = (NM_LISTVIEW FAR *) lParam;
  4269. pdata->sort[pnmv->iSubItem] = !pdata->sort[pnmv->iSubItem];
  4270. //sort(m_listBox,pnmv->iSubItem,pdata->sort[pnmv->iSubItem] );
  4271. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  4272. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  4273. break;
  4274. }
  4275. case NM_SETFOCUS :
  4276. case NM_KILLFOCUS :
  4277. case NM_CLICK:
  4278. {
  4279. enableRemoveIfNecessary(hwndDlg);
  4280. break;
  4281. }
  4282. case PSN_WIZNEXT :
  4283. {CWaitCursor w;
  4284. if (m_listBox.GetItemCount()==0)
  4285. {
  4286. MessageBoxWrapper(hwndDlg,IDS_MSG_OBJECT,IDS_MSG_INPUT);
  4287. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_SELECTION1);
  4288. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_SELECTION1);
  4289. return TRUE;
  4290. }
  4291. OnMIGRATE(hwndDlg,pdata->accounts,pdata->servers);
  4292. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  4293. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  4294. break;
  4295. }
  4296. case PSN_WIZBACK :
  4297. break;
  4298. case PSN_QUERYCANCEL :
  4299. GetError(0); //clear any old com errors
  4300. break;
  4301. case PSN_HELP :
  4302. {
  4303. int id=0;
  4304. if (migration==w_computer || (migration==w_security || migration==w_reporting))
  4305. id =IDH_WINDOW_COMPUTER_SELECTION;
  4306. else if (migration==w_account)
  4307. id =IDH_WINDOW_USER_SELECTION;
  4308. else if (migration==w_group || migration==w_groupmapping)
  4309. id =IDH_WINDOW_GROUP_SELECTION;
  4310. else if (migration==w_service)
  4311. id =IDH_WINDOW_SERVICE_ACCOUNT_SELECTION;
  4312. helpWrapper(hwndDlg,id);
  4313. break;
  4314. }
  4315. case PSN_RESET :
  4316. break;
  4317. default :
  4318. break;
  4319. }
  4320. break;
  4321. }
  4322. default:
  4323. break;
  4324. }
  4325. return 0;
  4326. }
  4327. INT_PTR CALLBACK
  4328. IntHTMLLocationProc(
  4329. IN HWND hwndDlg,
  4330. IN UINT uMsg,
  4331. IN WPARAM wParam,
  4332. IN LPARAM lParam
  4333. )
  4334. {
  4335. // LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLong(hwndDlg, GWL_USERDATA);
  4336. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  4337. switch (uMsg)
  4338. {
  4339. case WM_INITDIALOG :
  4340. {
  4341. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  4342. // SetWindowLong(hwndDlg, GWL_USERDATA, (long) pdata);
  4343. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  4344. initeditbox( hwndDlg,IDC_HTML_TARGET,DCTVS_Reports_Directory);
  4345. if (IsDlgItemEmpty(hwndDlg,IDC_HTML_TARGET))
  4346. {
  4347. CString toinsert;
  4348. GetDirectory(toinsert.GetBuffer(1000));
  4349. toinsert.ReleaseBuffer();
  4350. toinsert+="Reports";
  4351. SetDlgItemText(hwndDlg,IDC_HTML_TARGET,toinsert);
  4352. }
  4353. //load the data from the database and display in the listbox.
  4354. break;
  4355. }
  4356. case WM_COMMAND:
  4357. {
  4358. switch(LOWORD (wParam))
  4359. {
  4360. case IDC_BROWSE :
  4361. OnBROWSE(hwndDlg,IDC_HTML_TARGET);
  4362. break;
  4363. default:
  4364. break;
  4365. }
  4366. switch(HIWORD(wParam))
  4367. {
  4368. case EN_CHANGE :
  4369. enableNextIfNecessary(hwndDlg,IDC_HTML_TARGET);
  4370. break;
  4371. default:
  4372. break;
  4373. }
  4374. break;
  4375. }
  4376. case WM_NOTIFY :
  4377. {
  4378. LPNMHDR lpnm = (LPNMHDR) lParam;
  4379. switch (lpnm->code)
  4380. {
  4381. case PSN_SETACTIVE :
  4382. IsDlgItemEmpty(hwndDlg,IDC_HTML_TARGET) ?
  4383. PostMessage(GetParent(hwndDlg), PSM_SETWIZBUTTONS, 0, PSWIZB_BACK):
  4384. PostMessage(GetParent(hwndDlg), PSM_SETWIZBUTTONS, 0, PSWIZB_BACK|PSWIZB_NEXT);
  4385. break;
  4386. case PSN_WIZNEXT :
  4387. {
  4388. // SetWindowLong(hwndDlg, GWL_USERDATA, (long )pdata);
  4389. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  4390. if (IsDlgItemEmpty(hwndDlg,IDC_HTML_TARGET))
  4391. {
  4392. MessageBoxWrapper(hwndDlg,IDS_MSG_DIRECTORY,IDS_MSG_INPUT);
  4393. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_HTML_LOCATION);
  4394. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_HTML_LOCATION);
  4395. return TRUE;
  4396. }
  4397. else if (!validDirectoryString(hwndDlg,IDC_HTML_TARGET))
  4398. {
  4399. MessageBoxWrapper(hwndDlg,IDS_MSG_DIRECTORY,IDS_MSG_INPUT);
  4400. // SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_HTML_LOCATION);
  4401. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_HTML_LOCATION);
  4402. return TRUE;
  4403. }
  4404. else
  4405. {
  4406. editbox( hwndDlg,IDC_HTML_TARGET,DCTVS_Reports_Directory);
  4407. }
  4408. break;
  4409. }
  4410. case PSN_WIZBACK :
  4411. break;
  4412. case PSN_QUERYCANCEL :
  4413. GetError(0); //clear any old com errors
  4414. break;
  4415. case PSN_HELP :
  4416. {
  4417. helpWrapper(hwndDlg,IDH_WINDOW_DIRECTORY_SELECTION);
  4418. break;
  4419. }
  4420. case PSN_RESET :
  4421. break;
  4422. default :
  4423. break;
  4424. }
  4425. break;
  4426. }
  4427. case WM_HELP :
  4428. {
  4429. helpWrapper(hwndDlg,IDH_WINDOW_DIRECTORY_SELECTION);
  4430. break;
  4431. }
  4432. default:
  4433. break;
  4434. }
  4435. return 0;
  4436. }
  4437. /*********************************************************************
  4438. * *
  4439. * Written by: Paul Thompson *
  4440. * Date: 3 OCT 2000 *
  4441. * *
  4442. * This callback function is responsible for handling the windows*
  4443. * messages for the new Translation Input dialog. *
  4444. * *
  4445. *********************************************************************/
  4446. //BEGIN IntTranslationInputProc
  4447. INT_PTR CALLBACK
  4448. IntTranslationInputProc(
  4449. IN HWND hwndDlg,
  4450. IN UINT uMsg,
  4451. IN WPARAM wParam,
  4452. IN LPARAM lParam
  4453. )
  4454. {
  4455. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  4456. switch (uMsg)
  4457. {
  4458. case WM_INITDIALOG :
  4459. {
  4460. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  4461. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  4462. initsecinputbox(hwndDlg,IDC_TRANS_FROM_MOT,IDC_TRANS_FROM_FILE,DCTVS_AccountOptions_SecurityInputMOT);
  4463. if (IsDlgButtonChecked(hwndDlg,IDC_TRANS_FROM_MOT))
  4464. {
  4465. disable(hwndDlg,IDC_BROWSE);
  4466. disable(hwndDlg,IDC_MAPPING_FILE);
  4467. }
  4468. else
  4469. {
  4470. enable(hwndDlg,IDC_BROWSE);
  4471. enable(hwndDlg,IDC_MAPPING_FILE);
  4472. initeditbox( hwndDlg,IDC_MAPPING_FILE,DCTVS_AccountOptions_SecurityMapFile);
  4473. }
  4474. break;
  4475. }
  4476. case WM_COMMAND:
  4477. {
  4478. switch(LOWORD (wParam))
  4479. {
  4480. case IDC_BROWSE :
  4481. OnMapFileBrowse(hwndDlg,IDC_MAPPING_FILE);
  4482. break;
  4483. case IDC_TRANS_FROM_MOT :
  4484. disable(hwndDlg,IDC_BROWSE);
  4485. disable(hwndDlg,IDC_MAPPING_FILE);
  4486. break;
  4487. case IDC_TRANS_FROM_FILE :
  4488. enable(hwndDlg,IDC_BROWSE);
  4489. enable(hwndDlg,IDC_MAPPING_FILE);
  4490. initeditbox( hwndDlg,IDC_MAPPING_FILE,DCTVS_AccountOptions_SecurityMapFile);
  4491. break;
  4492. default:
  4493. break;
  4494. }
  4495. break;
  4496. }
  4497. case WM_NOTIFY :
  4498. {
  4499. LPNMHDR lpnm = (LPNMHDR) lParam;
  4500. switch (lpnm->code)
  4501. {
  4502. case PSN_SETACTIVE :
  4503. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
  4504. break;
  4505. case PSN_WIZNEXT :
  4506. {
  4507. //set some data fields since we don't know source or target domains
  4508. pdata->sameForest = false;
  4509. pdata->sourceIsNT4 = true;
  4510. checkbox( hwndDlg,IDC_TRANS_FROM_MOT,DCTVS_AccountOptions_SecurityInputMOT);
  4511. if (IsDlgButtonChecked(hwndDlg,IDC_TRANS_FROM_FILE))
  4512. {
  4513. pdata->secWithMapFile = true;
  4514. //check if a file is given
  4515. if (IsDlgItemEmpty(hwndDlg,IDC_MAPPING_FILE))
  4516. {
  4517. MessageBoxWrapper(hwndDlg,IDS_MAPFILE_EMPTY,IDS_MAPFILE_TITLE);
  4518. SetFocus(GetDlgItem(hwndDlg, IDC_MAPPING_FILE));
  4519. SendDlgItemMessage(hwndDlg, IDC_MAPPING_FILE, EM_SETSEL,
  4520. (WPARAM)0, (LPARAM)-1);
  4521. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,-1);
  4522. return TRUE;
  4523. }
  4524. //see if the given file exists
  4525. else if (!checkMapFile(hwndDlg))
  4526. {
  4527. MessageBoxWrapper(hwndDlg,IDS_MAPFILE_MISSING,IDS_MAPFILE_TITLE);
  4528. SetFocus(GetDlgItem(hwndDlg, IDC_MAPPING_FILE));
  4529. SendDlgItemMessage(hwndDlg, IDC_MAPPING_FILE, EM_SETSEL,
  4530. (WPARAM)0, (LPARAM)-1);
  4531. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,-1);
  4532. return TRUE;
  4533. }
  4534. else
  4535. {
  4536. //save sid mapping file specified
  4537. editbox(hwndDlg,IDC_MAPPING_FILE,DCTVS_AccountOptions_SecurityMapFile);
  4538. //if input from Sid mapping file, go to the security selection screen and do not
  4539. //retrieve domain information
  4540. SetWindowLongPtr(hwndDlg,DWLP_MSGRESULT,IDD_SELECTION4);
  4541. return TRUE;
  4542. }
  4543. }
  4544. else
  4545. pdata->secWithMapFile = false;
  4546. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)pdata);
  4547. break;
  4548. }
  4549. case PSN_WIZBACK :
  4550. break;
  4551. case PSN_QUERYCANCEL :
  4552. GetError(0); //clear any old com errors
  4553. break;
  4554. case PSN_HELP :
  4555. {
  4556. // helpWrapper(hwndDlg,IDH_WINDOW_PASSWORD_OPTION);
  4557. break;
  4558. }
  4559. case PSN_RESET :
  4560. break;
  4561. default :
  4562. break;
  4563. }
  4564. break;
  4565. } case WM_HELP :
  4566. {
  4567. // helpWrapper(hwndDlg,IDH_WINDOW_PASSWORD_OPTION);
  4568. break;
  4569. }
  4570. default:
  4571. break;
  4572. }
  4573. return 0;
  4574. }
  4575. //END IntTranslationInputProc
  4576. /*********************************************************************
  4577. * *
  4578. * Written by: Paul Thompson *
  4579. * Date: 25 OCT 2000 *
  4580. * *
  4581. * This callback function is responsible for handling the windows*
  4582. * messages for the new Object Property Exclusion dialog. This *
  4583. * dialog allows the user to exclude certain properties, on a W2K to *
  4584. * W2K inter-forest migration, from being copied to the target *
  4585. * account. *
  4586. * *
  4587. *********************************************************************/
  4588. //BEGIN IntPropExclusionProc
  4589. INT_PTR CALLBACK
  4590. IntPropExclusionProc(
  4591. IN HWND hwndDlg,
  4592. IN UINT uMsg,
  4593. IN WPARAM wParam,
  4594. IN LPARAM lParam
  4595. )
  4596. {
  4597. LPSHAREDWIZDATA pdata = (LPSHAREDWIZDATA) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
  4598. switch (uMsg)
  4599. {
  4600. case WM_INITDIALOG :
  4601. {
  4602. pdata = (LPSHAREDWIZDATA) ((LPPROPSHEETPAGE) lParam) -> lParam;
  4603. SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) pdata);
  4604. initpropdlg(hwndDlg);
  4605. }
  4606. case WM_COMMAND:
  4607. {
  4608. switch(LOWORD (wParam))
  4609. {
  4610. case IDC_EXCLUDEPROPS :
  4611. if (!IsDlgButtonChecked(hwndDlg,IDC_EXCLUDEPROPS))
  4612. {
  4613. disable(hwndDlg,IDC_OBJECTCMBO);
  4614. disable(hwndDlg,IDC_INCLUDELIST);
  4615. disable(hwndDlg,IDC_EXCLUDELIST);
  4616. disable(hwndDlg,IDC_EXCLUDEBTN);
  4617. disable(hwndDlg,IDC_INCLUDEBTN);
  4618. }
  4619. else
  4620. {
  4621. enable(hwndDlg,IDC_OBJECTCMBO);
  4622. enable(hwndDlg,IDC_INCLUDELIST);
  4623. enable(hwndDlg,IDC_EXCLUDELIST);
  4624. enable(hwndDlg,IDC_EXCLUDEBTN);
  4625. enable(hwndDlg,IDC_INCLUDEBTN);
  4626. }
  4627. break;
  4628. case IDC_EXCLUDEBTN :
  4629. moveproperties(hwndDlg, true);
  4630. break;
  4631. case IDC_INCLUDEBTN :
  4632. moveproperties(hwndDlg, false);
  4633. break;
  4634. default:
  4635. break;
  4636. }
  4637. switch(HIWORD (wParam))
  4638. {
  4639. case CBN_SELCHANGE :
  4640. if (LOWORD (wParam) == IDC_OBJECTCMBO)
  4641. listproperties(hwndDlg);
  4642. break;
  4643. case LBN_DBLCLK :
  4644. if (LOWORD (wParam) == IDC_INCLUDELIST)
  4645. moveproperties(hwndDlg, true);
  4646. else if (LOWORD (wParam) == IDC_EXCLUDELIST)
  4647. moveproperties(hwndDlg, false);
  4648. break;
  4649. default:
  4650. break;
  4651. }
  4652. break;
  4653. }
  4654. case WM_NOTIFY :
  4655. {
  4656. LPNMHDR lpnm = (LPNMHDR) lParam;
  4657. switch (lpnm->code)
  4658. {
  4659. case PSN_SETACTIVE :
  4660. PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
  4661. if (bChangedMigrationTypes)
  4662. {
  4663. initpropdlg(hwndDlg);
  4664. bChangedMigrationTypes=false;
  4665. }
  4666. break;
  4667. case PSN_WIZNEXT :
  4668. checkbox(hwndDlg,IDC_EXCLUDEPROPS,DCTVS_AccountOptions_ExcludeProps);
  4669. saveproperties(hwndDlg);
  4670. if (migration==w_account)
  4671. {
  4672. // SetWindowLong(hwndDlg, DWL_MSGRESULT,IDD_OPTIONS);
  4673. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT,IDD_RENAMING);
  4674. return TRUE;
  4675. }
  4676. else if (migration==w_group)
  4677. {
  4678. if (pdata->IsSidHistoryChecked )
  4679. {
  4680. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, IDD_CREDENTIALS);
  4681. return TRUE;
  4682. }
  4683. else
  4684. {
  4685. SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT,IDD_RENAMING);
  4686. return TRUE;
  4687. }
  4688. }
  4689. break;
  4690. case PSN_WIZBACK :
  4691. break;
  4692. case PSN_QUERYCANCEL :
  4693. GetError(0); //clear any old com errors
  4694. break;
  4695. case PSN_HELP :
  4696. {
  4697. // helpWrapper(hwndDlg,IDH_WINDOW_PASSWORD_OPTION);
  4698. break;
  4699. }
  4700. case PSN_RESET :
  4701. break;
  4702. default :
  4703. break;
  4704. }
  4705. break;
  4706. } case WM_HELP :
  4707. {
  4708. // helpWrapper(hwndDlg,IDH_WINDOW_PASSWORD_OPTION);
  4709. break;
  4710. }
  4711. default:
  4712. break;
  4713. }
  4714. return 0;
  4715. }
  4716. //END IntPropExclusionProc