Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5100 lines
147 KiB

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