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.

4275 lines
142 KiB

  1. // This file contains dead code we dont use in the WAB but which we dont want
  2. // to lose as it may be useful someday ...
  3. //
  4. #ifdef IMPORT_WAB
  5. /***************************************************************************
  6. Name : HrImportWABFile
  7. Purpose : Merges an external WAB file with the current on
  8. Parameters: hwnd = hwnd
  9. lpIAB -> IAddrBook object
  10. Returns : HRESULT
  11. Comment :
  12. ***************************************************************************/
  13. HRESULT HrImportWABFile(HWND hWnd, LPADRBOOK lpIAB)
  14. {
  15. HRESULT hResult = hrSuccess;
  16. OPENFILENAME ofn;
  17. LPTSTR lpFilter = FormatAllocFilter(idsWABImportString, TEXT("*.WAB"));
  18. TCHAR szFileName[MAX_PATH + 1] = "";
  19. HANDLE hPropertyStore = NULL;
  20. ofn.lStructSize = sizeof(ofn);
  21. ofn.hwndOwner = hWnd;
  22. ofn.hInstance = hinstMapiX;
  23. ofn.lpstrFilter = lpFilter;
  24. ofn.lpstrCustomFilter = NULL;
  25. ofn.nMaxCustFilter = 0;
  26. ofn.nFilterIndex = 0;
  27. ofn.lpstrFile = szFileName;
  28. ofn.nMaxFile = sizeof(szFileName);
  29. ofn.lpstrFileTitle = NULL;
  30. ofn.nMaxFileTitle = 0;
  31. ofn.lpstrInitialDir = NULL;
  32. ofn.lpstrTitle = TEXT("Select WAB File to Import");
  33. ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
  34. ofn.nFileOffset = 0;
  35. ofn.nFileExtension = 0;
  36. ofn.lpstrDefExt = "wab";
  37. ofn.lCustData = 0;
  38. ofn.lpfnHook = NULL;
  39. ofn.lpTemplateName = NULL;
  40. if (GetOpenFileName(&ofn))
  41. {
  42. ULONG ulEIDCount = 0;
  43. LPDWORD lpdwEntryIDs = NULL;
  44. ULONG i;
  45. SPropertyRestriction PropRes = {0};
  46. HCURSOR hOldCur = SetCursor(LoadCursor(NULL, IDC_WAIT));
  47. TCHAR szBuf[MAX_UI_STR];
  48. hResult = OpenPropertyStore(
  49. szFileName,
  50. AB_OPEN_EXISTING,
  51. hWnd,
  52. &hPropertyStore);
  53. if(HR_FAILED(hResult) || (!hPropertyStore))
  54. {
  55. ShowMessageBoxParam(hWnd, IDE_VCARD_IMPORT_FILE_ERROR, MB_ICONEXCLAMATION, szFileName);
  56. goto out;
  57. }
  58. PropRes.ulPropTag = PR_DISPLAY_NAME;
  59. PropRes.relop = RELOP_EQ;
  60. PropRes.lpProp = NULL;
  61. hResult = FindRecords(
  62. hPropertyStore,
  63. AB_MATCH_PROP_ONLY,
  64. TRUE,
  65. &PropRes,
  66. &ulEIDCount,
  67. &lpdwEntryIDs);
  68. if(HR_FAILED(hResult))
  69. {
  70. LocalFreeAndNull(&lpdwEntryIDs);
  71. goto out;
  72. }
  73. if (ulEIDCount > 0)
  74. {
  75. for(i=0;i<ulEIDCount;i++)
  76. {
  77. SBinary sb = {0};
  78. LPSPropValue lpPropArray = NULL;
  79. ULONG ulcValues = 0;
  80. ULONG cbEntryID = 0;
  81. LPENTRYID lpEntryID = NULL;
  82. ULONG j;
  83. LPTSTR lpszName;
  84. sb.cb = SIZEOF_WAB_ENTRYID;
  85. sb.lpb = (LPBYTE) &(lpdwEntryIDs[i]);
  86. hResult = ReadRecord(
  87. hPropertyStore,
  88. &sb,
  89. 0,
  90. &ulcValues,
  91. &lpPropArray);
  92. if(HR_FAILED(hResult))
  93. {
  94. if(lpPropArray)
  95. LocalFreePropArray(ulcValues,&lpPropArray);
  96. continue;
  97. }
  98. // can't import dist lists yet - they will be imported in a second pass
  99. for(j=0;j<ulcValues;j++)
  100. {
  101. if(lpPropArray[j].ulPropTag == PR_OBJECT_TYPE)
  102. {
  103. if(lpPropArray[j].Value.l != MAPI_MAILUSER)
  104. goto endloop;
  105. }
  106. if(lpPropArray[j].ulPropTag == PR_DISPLAY_NAME)
  107. {
  108. lpszName = lpPropArray[j].Value.LPSZ;
  109. }
  110. }
  111. // reset entryid
  112. for(j=0;j<ulcValues;j++)
  113. {
  114. if(lpPropArray[j].ulPropTag == PR_ENTRYID)
  115. {
  116. lpPropArray[j].Value.bin.cb = 0;
  117. LocalFreeAndNull(&lpPropArray[j].Value.bin.lpb);
  118. break;
  119. }
  120. }
  121. //Status bar messages out here
  122. // This is temp - TBD
  123. // Modify to use resource and Format Message
  124. wsprintf(szBuf,"Importing %s. Entry: '%s'.",szFileName,lpszName);
  125. StatusBarMessage(szBuf);
  126. hResult = HrCreateNewEntry(
  127. lpIAB,
  128. hWnd,
  129. MAPI_MAILUSER,
  130. CREATE_CHECK_DUP_STRICT,
  131. FALSE,
  132. ulcValues,
  133. lpPropArray,
  134. &cbEntryID,
  135. &lpEntryID );
  136. endloop:
  137. if(lpPropArray)
  138. LocalFreePropArray(ulcValues,&lpPropArray);
  139. if(lpEntryID)
  140. MAPIFreeBuffer(lpEntryID);
  141. } //for loop
  142. } // if
  143. out:
  144. if(hPropertyStore)
  145. ClosePropertyStore(hPropertyStore,AB_DONT_BACKUP);
  146. LocalFreeAndNull(&lpdwEntryIDs);
  147. SetCursor(hOldCur);
  148. }
  149. LocalFreeAndNull(&lpFilter);
  150. LocalFreeAndNull((LPVOID *)&(ofn.lpstrTitle));
  151. StatusBarMessage(szEmpty);
  152. return(hResult);
  153. }
  154. #endif
  155. #ifdef OLD_STUFF
  156. //$$//////////////////////////////////////////////////////////////////////
  157. // HrSendMailToContact
  158. //
  159. // Retrieves the contacts email address and shell executes a "mailto:"
  160. //
  161. // hWndLV - handle of List view. We look up the selected item in this list
  162. // view, get its lParam structure, then get its EntryID and
  163. // call details
  164. // lpIAB - handle to current AdrBook object - used for calling details
  165. //
  166. // Returns:S_OK
  167. // E_FAIL
  168. //
  169. //////////////////////////////////////////////////////////////////////////
  170. static const SizedSPropTagArray(1, ptaEmailAddress)=
  171. {
  172. 1,
  173. {
  174. PR_EMAIL_ADDRESS,
  175. }
  176. };
  177. HRESULT HrSendMailToContact(HWND hWndLV, LPADRBOOK lpIAB)
  178. {
  179. HRESULT hr = E_FAIL;
  180. int iItemIndex = ListView_GetSelectedCount(hWndLV);
  181. HWND hWndParent = GetParent(hWndLV);
  182. TCHAR szBuf[MAX_UI_STR];
  183. LPSPropValue lpspv = NULL;
  184. IF_WIN16(static const char cszMailClient[] = "MSIMN.EXE";)
  185. // Open props if only 1 item is selected
  186. if (iItemIndex == 1)
  187. {
  188. // Get index of selected item
  189. iItemIndex = ListView_GetNextItem(hWndLV,-1,LVNI_SELECTED);
  190. if (iItemIndex != -1)
  191. {
  192. LPRECIPIENT_INFO lpItem;
  193. LV_ITEM LVItem;
  194. LVItem.mask = LVIF_PARAM;
  195. LVItem.iItem = iItemIndex;
  196. LVItem.iSubItem = 0;
  197. LVItem.lParam = 0;
  198. // Get item lParam LPRECIPIENT_INFO structure
  199. if (ListView_GetItem(hWndLV,&LVItem))
  200. {
  201. lpItem = ((LPRECIPIENT_INFO) LVItem.lParam);
  202. if(lpItem->szEmailAddress && lstrlen(lpItem->szEmailAddress))
  203. {
  204. LPTSTR lpszMailTo = NULL;
  205. LPTSTR lpszEmail = NULL;
  206. ULONG cValues;
  207. LoadString(hinstMapiX, idsSendMailTo, szBuf, sizeof(szBuf));
  208. // Open the entry and read the email address.
  209. // NOTE: We can't just take the address out of the listbox
  210. // because it may be truncated!
  211. if (HR_FAILED(hr = HrGetPropArray(lpIAB,
  212. (LPSPropTagArray)&ptaEmailAddress,
  213. lpItem->cbEntryID,
  214. lpItem->lpEntryID,
  215. &cValues,
  216. &lpspv))) {
  217. goto out;
  218. }
  219. lpszEmail = lpspv[0].Value.LPSZ;
  220. if (FormatMessage( FORMAT_MESSAGE_FROM_STRING |
  221. FORMAT_MESSAGE_ALLOCATE_BUFFER |
  222. FORMAT_MESSAGE_ARGUMENT_ARRAY,
  223. szBuf,
  224. 0, // stringid
  225. 0, // dwLanguageId
  226. (LPTSTR)&lpszMailTo, // output buffer
  227. 0, //MAX_UI_STR
  228. (va_list *)&lpszEmail))
  229. {
  230. #ifndef WIN16
  231. ShellExecute(hWndParent, "open", lpszMailTo, NULL, NULL, SW_SHOWNORMAL);
  232. LocalFreeAndNull(&lpszMailTo);
  233. #else
  234. ShellExecute(hWndParent, NULL, cszMailClient, lpszMailTo, NULL, SW_SHOWNORMAL);
  235. FormatMessageFreeMem(lpszMailTo);
  236. #endif
  237. hr = S_OK;
  238. goto out;
  239. }
  240. }
  241. else
  242. {
  243. // the item has no email
  244. ShowMessageBox(GetParent(hWndLV), idsSendMailToNoEmail, MB_ICONEXCLAMATION | MB_OK);
  245. }
  246. }
  247. }
  248. }
  249. else
  250. {
  251. if (iItemIndex <= 0)
  252. {
  253. // nothing selected
  254. ShowMessageBox(GetParent(hWndLV), IDS_ADDRBK_MESSAGE_NO_ITEM, MB_ICONEXCLAMATION);
  255. }
  256. else
  257. {
  258. //multiple selected
  259. ShowMessageBox(GetParent(hWndLV), IDS_ADDRBK_MESSAGE_ACTION, MB_ICONEXCLAMATION);
  260. }
  261. }
  262. out:
  263. FreeBufferAndNull(&lpspv);
  264. return hr;
  265. }
  266. #endif
  267. #ifdef CERT_PROPS
  268. IDD_DIALOG_CERT_GENERAL DIALOG DISCARDABLE 0, 0, 212, 188
  269. STYLE DS_MODALFRAME | WS_POPUP
  270. #ifndef WIN16
  271. FONT 8, "MS Shell Dlg"
  272. #else
  273. FONT 8, "MS Sans Serif"
  274. #endif // !WIN16
  275. BEGIN
  276. ICON IDI_ICON_CERT,IDC_CERT_GENERAL_ICON,7,7,20,20
  277. LTEXT "John Smith <[email protected]>",
  278. IDC_CERT_GENERAL_LABEL_CERTFORDATA,56,12,149,8
  279. LTEXT "Serial Number:",IDC_CERT_GENERAL_LABEL_SERIALNUM,7,45,
  280. 47,8
  281. LTEXT "12 34 56 78 90 12 34 56 78 90 12 34 56 78 90 12 34 56 78 90 12 34 56 78 90 12 34 56 78 90 ",
  282. IDC_CERT_GENERAL_LABEL_SERIALNUMDATA,56,45,149,26
  283. LTEXT "Valid From:",IDC_CERT_GENERAL_LABEL_VALIDFROM,7,30,36,8
  284. LTEXT "September 19, 1996 to September 18, 1997",
  285. IDC_CERT_GENERAL_LABEL_VALIDFROMDATA,56,30,139,8
  286. GROUPBOX "Issued By:",IDC_CERT_GENERAL_FRAME_ISSUED,7,71,198,32
  287. LTEXT "Verisign, Inc.",IDC_CERT_GENERAL_LABEL_ISSUER,38,86,158,
  288. 8
  289. GROUPBOX "Status:",IDC_CERT_GENERAL_FRAME_STATUS,7,107,198,74
  290. ICON IDI_ICON_CHECK,IDC_CERT_GENERAL_ICON_CHECK,13,116,20,20
  291. ICON IDI_ICON_UNCHECK,IDC_CERT_GENERAL_ICON_UNCHECK,13,116,20,
  292. 20
  293. LTEXT "This ID is valid.",IDC_CERT_GENERAL_STATIC_STATUS,38,
  294. 120,150,10
  295. LTEXT "Revoked:",IDC_CERT_GENERAL_LABEL_REVOKED,40,135,32,8
  296. LTEXT "No.",IDC_CERT_GENERAL_LABEL_REVOKEDDATA,81,135,12,8
  297. LTEXT "Expired:",IDC_CERT_GENERAL_LABEL_EXPIRED,40,149,26,8
  298. LTEXT "No.",IDC_CERT_GENERAL_LABEL_EXPIREDDATA,81,149,12,8
  299. LTEXT "&Trusted:",IDC_CERT_GENERAL_LABEL_TRUST,39,163,27,8
  300. COMBOBOX IDC_CERT_GENERAL_COMBO_TRUST,109,161,89,43,
  301. CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
  302. LTEXT "Yes.",IDC_CERT_GENERAL_LABEL_TRUSTEDDATA,81,163,18,8
  303. END
  304. IDD_DIALOG_CERT_TRUST DIALOGEX 0, 0, 212, 188
  305. STYLE DS_MODALFRAME | WS_POPUP
  306. #ifndef WIN16
  307. FONT 8, "MS Shell Dlg", 0, 0, 0x1
  308. #else
  309. FONT 8, "MS Sans Serif"
  310. #endif // !WIN16
  311. BEGIN
  312. LTEXT "View the Chain of Trust for this digital ID here. ",
  313. IDC_CERT_TRUST_LABEL_EXPLAIN,36,12,169,8
  314. GROUPBOX "&Chain of Trust:",IDC_CERT_TRUST_FRAME_CHAIN,7,30,198,
  315. 151
  316. #ifndef WIN16
  317. CONTROL "Tree1",IDC_CERT_TRUST_TREE_CHAIN,"SysTreeView32",
  318. TVS_HASLINES | TVS_DISABLEDRAGDROP | WS_TABSTOP,14,46,
  319. 184,127,WS_EX_CLIENTEDGE
  320. #else
  321. CONTROL "Tree1",IDC_CERT_TRUST_TREE_CHAIN,"IE_SysTreeView",
  322. TVS_HASLINES | TVS_DISABLEDRAGDROP | WS_TABSTOP,14,46,
  323. 184,127
  324. #endif // !WIN16
  325. ICON IDI_ICON_CERT,IDC_CERT_GENERAL_ICON,7,7,18,20
  326. END
  327. IDD_DIALOG_CERT_ADVANCED DIALOGEX 0, 0, 212, 188
  328. STYLE DS_MODALFRAME | WS_POPUP
  329. #ifndef WIN16
  330. FONT 8, "MS Shell Dlg", 0, 0, 0x1
  331. #else
  332. FONT 8, "MS Sans Serif"
  333. #endif // !WIN16
  334. BEGIN
  335. LTEXT "View additional properties for this digital ID here.",
  336. IDC_CERT_ADVANCED_LABEL_EXPLAIN,36,12,169,11
  337. LTEXT "&Field:",IDC_CERT_ADVANCED_LABEL_FIELD,7,39,28,8
  338. #ifndef WIN16
  339. CONTROL "List1",IDC_CERT_ADVANCED_LIST_FIELD,"SysListView32",
  340. LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS |
  341. LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER |
  342. WS_BORDER | WS_TABSTOP,7,49,69,121,WS_EX_CLIENTEDGE
  343. #else
  344. CONTROL "List1",IDC_CERT_ADVANCED_LIST_FIELD,"IE_SysListView",
  345. LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS |
  346. LVS_AUTOARRANGE | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER |
  347. WS_BORDER | WS_TABSTOP,7,49,69,121
  348. #endif // !WIN16
  349. LTEXT "Details:",IDC_CERT_ADVANCED_LABEL_DETAILS,77,39,28,8
  350. #ifndef WIN16
  351. EDITTEXT IDC_CERT_ADVANCED_EDIT_DETAILS,78,49,127,121,
  352. ES_MULTILINE | ES_READONLY | WS_VSCROLL,WS_EX_CLIENTEDGE
  353. #else
  354. EDITTEXT IDC_CERT_ADVANCED_EDIT_DETAILS,78,49,127,121,
  355. ES_MULTILINE | ES_READONLY | WS_VSCROLL
  356. #endif // !WIN16
  357. ICON IDI_ICON_CERT,IDC_CERT_GENERAL_ICON,7,7,20,20
  358. END
  359. #endif //OLD_STUFF
  360. //#define IDC_CERT_GENERAL_LABEL_TRUSTEDDATA 2225
  361. /*
  362. #define IDC_CERT_GENERAL_FRAME_STATUS 2208
  363. #define IDC_CERT_GENERAL_ICON 2209
  364. #define IDC_CERT_GENERAL_FRAME_ISSUED 2210
  365. #define IDC_CERT_GENERAL_LABEL_CERTFOR 2211
  366. #define IDC_CERT_GENERAL_LABEL_SERIALNUM 2212
  367. #define IDC_CERT_GENERAL_LABEL_VALIDFROM 2213
  368. #define IDC_CERT_GENERAL_LABEL_CERTFORDATA 2214
  369. #define IDC_CERT_GENERAL_LABEL_SERIALNUMDATA 2215
  370. #define IDC_CERT_GENERAL_LABEL_VALIDFROMDATA 2216
  371. #define IDC_CERT_GENERAL_BUTTON_OPEN 2217
  372. #define IDC_CERT_GENERAL_LABEL_ISSUER 2218
  373. #define IDC_CERT_GENERAL_STATIC_STATUS 2219
  374. #define IDC_CERT_GENERAL_LABEL_EXPIRED 2220
  375. #define IDC_CERT_GENERAL_LABEL_REVOKED 2221
  376. #define IDC_CERT_GENERAL_LABEL_EXPIREDDATA 2222
  377. #define IDC_CERT_GENERAL_ICON_CHECK 2223
  378. #define IDC_CERT_GENERAL_LABEL_REVOKEDDATA 2227
  379. #define IDC_CERT_GENERAL_LABEL_TRUST 2228
  380. #define IDC_CERT_GENERAL_COMBO_TRUST 2229
  381. #define IDC_CERT_GENERAL_ICON_UNCHECK 2230
  382. #define IDC_CERT_TRUST_FRAME_CHAIN 2231
  383. #define IDC_CERT_TRUST_TREE_CHAIN 2232
  384. #define IDC_CERT_TRUST_LABEL_EXPLAIN 2233
  385. #define IDC_CERT_ADVANCED_LABEL_EXPLAIN 2234
  386. #define IDC_CERT_ADVANCED_LIST_FIELD 2235
  387. #define IDC_CERT_ADVANCED_EDIT_DETAILS 2236
  388. #define IDC_CERT_ADVANCED_LABEL_FIELD 2237
  389. #define IDC_CERT_ADVANCED_LABEL_DETAILS 2238
  390. */
  391. //#define IDD_DIALOG_CERT_GENERAL 120
  392. //#define IDD_DIALOG_CERT_TRUST 121
  393. //#define IDD_DIALOG_CERT_ADVANCED 122
  394. #endif // CERT_PROPS
  395. // LDAP_PROPS
  396. #ifdef OLD_STUFF
  397. IDD_DIALOG_LDAP_ADD DIALOGEX 0, 0, 212, 188
  398. STYLE DS_MODALFRAME | WS_POPUP
  399. #ifndef WIN16
  400. FONT 8, "MS Shell Dlg", 0, 0, 0x1
  401. #else
  402. FONT 8, "MS Sans Serif"
  403. #endif // !WIN16
  404. BEGIN
  405. LTEXT "Add, remove, and modify Internet directory services here. You will be able to search these directory services and check names against them.",
  406. IDC_LDAP_ADD_STATIC_CAPTION,7,7,198,24
  407. #ifndef WIN16
  408. CONTROL "",IDC_LDAP_ADD_STATIC_ETCHED2,"Static",SS_ETCHEDHORZ,7,
  409. 36,198,1
  410. #endif // !WIN16
  411. GROUPBOX "Directory services:",IDC_LDAP_ADD_STATIC_LABELLIST1,7,
  412. 43,198,138
  413. PUSHBUTTON "&Add",IDC_LDAP_ADD_BUTTON_ADD,16,61,48,14
  414. PUSHBUTTON "Remo&ve",IDC_LDAP_ADD_BUTTON_DELETE,16,80,48,14
  415. PUSHBUTTON "P&roperties",IDC_LDAP_ADD_BUTTON_PROPERTIES,16,99,48,14
  416. #ifndef WIN16
  417. CONTROL "List1",IDC_LDAP_ADD_LIST_ALL,"SysListView32",LVS_LIST |
  418. LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER |
  419. LVS_NOSORTHEADER | WS_TABSTOP,72,60,125,108,
  420. WS_EX_CLIENTEDGE
  421. #else
  422. CONTROL "List1",IDC_LDAP_ADD_LIST_ALL,"IE_SysListView",LVS_LIST |
  423. LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER |
  424. LVS_NOSORTHEADER | WS_TABSTOP,72,60,125,108
  425. #endif // !WIN16
  426. END
  427. IDD_DIALOG_LDAP_PROPERTIES DIALOG DISCARDABLE 0, 0, 212, 188
  428. STYLE DS_MODALFRAME | WS_POPUP
  429. #ifndef WIN16
  430. FONT 8, "MS Shell Dlg"
  431. #else
  432. FONT 8, "MS Sans Serif"
  433. #endif // !WIN16
  434. BEGIN
  435. LTEXT "&Friendly Name:",IDC_LDAP_PROPS_STATIC_NAME_FRIENDLY,7,
  436. 29,60,8
  437. EDITTEXT IDC_LDAP_PROPS_EDIT_NAME_FRIENDLY,80,27,125,14,
  438. ES_AUTOHSCROLL
  439. LTEXT "&Directory Server:",IDC_LDAP_PROPS_STATIC_NAME,7,46,65,
  440. 8
  441. EDITTEXT IDC_LDAP_PROPS_EDIT_NAME,80,43,125,14,ES_AUTOHSCROLL
  442. GROUPBOX "&Authentication Type:",IDC_LDAP_PROPS_FRAME,7,64,198,
  443. 100,WS_GROUP
  444. CONTROL "A&nonymous",IDC_LDAP_PROPS_RADIO_ANON,"Button",
  445. BS_AUTORADIOBUTTON | WS_TABSTOP,17,77,125,10
  446. CONTROL "&Secure Password (requires server support)",
  447. IDC_LDAP_PROPS_RADIO_SICILY,"Button",BS_AUTORADIOBUTTON,
  448. 17,88,181,10
  449. CONTROL "Pass&word",IDC_LDAP_PROPS_RADIO_USERPASS,"Button",
  450. BS_AUTORADIOBUTTON,17,99,125,10
  451. LTEXT "&User Name:",IDC_LDAP_PROPS_STATIC_USERNAME,17,116,40,8
  452. EDITTEXT IDC_LDAP_PROPS_EDIT_USERNAME,80,112,118,14,
  453. ES_AUTOHSCROLL
  454. LTEXT "&Password:",IDC_LDAP_PROPS_STATIC_PASSWORD,17,131,40,8
  455. EDITTEXT IDC_LDAP_PROPS_EDIT_PASSWORD,80,128,118,14,ES_PASSWORD |
  456. ES_AUTOHSCROLL
  457. LTEXT "&Confirm Password:",IDC_LDAP_PROPS_STATIC_PASSWORD2,17,
  458. 146,62,8
  459. EDITTEXT IDC_LDAP_PROPS_EDIT_CONFIRMPASSWORD,80,144,118,14,
  460. ES_PASSWORD | ES_AUTOHSCROLL
  461. CONTROL "Chec&k names against this server when sending mail.",
  462. IDC_LDAP_PROPS_CHECK_NAMES,"Button",BS_AUTOCHECKBOX |
  463. WS_TABSTOP,7,171,181,10
  464. LTEXT "Add or modify information about an LDAP directory service.",
  465. IDC_LDAP_PROPS_STATIC_CAPTION,7,7,198,10
  466. #ifndef WIN16
  467. CONTROL "",IDC_LDAP_PROPS_STATIC_ETCHED2,"Static",SS_ETCHEDHORZ,
  468. 8,21,197,1
  469. #endif // !WIN16
  470. END
  471. IDD_DIALOG_LDAP_PROPERTIES_ADVANCED DIALOG DISCARDABLE 0, 0, 212, 188
  472. STYLE DS_MODALFRAME | WS_POPUP
  473. #ifndef WIN16
  474. FONT 8, "MS Shell Dlg"
  475. #else
  476. FONT 8, "MS Sans Serif"
  477. #endif // !WIN16
  478. BEGIN
  479. GROUPBOX "Search Parameters:",IDC_LDAP_PROPS_FRAME2,7,7,198,71
  480. LTEXT "&Search time-out (in seconds):",
  481. IDC_LDAP_PROPS_STATIC_SEARCH,16,28,132,8
  482. EDITTEXT IDC_LDAP_PROPS_EDIT_SEARCH,162,26,35,14,ES_AUTOHSCROLL |
  483. ES_NUMBER
  484. LTEXT "&Maximum number of entries to return:",
  485. IDC_LDAP_PROPS_STATIC_NUMRESULTS,15,53,137,9
  486. EDITTEXT IDC_LDAP_PROPS_EDIT_NUMRESULTS,162,50,35,14,
  487. ES_AUTOHSCROLL | ES_NUMBER
  488. GROUPBOX "Search &Base for this directory service",
  489. IDC_LDAP_PROPS_FRAME_ROOT,7,88,198,43
  490. EDITTEXT IDC_LDAP_PROPS_EDIT_ROOT,15,106,182,14,ES_AUTOHSCROLL
  491. END
  492. #define IDC_LDAP_SEARCH_BUTTON_REMOVE 6470
  493. #define IDC_LDAP_SEARCH_LIST_SELECTED 6471
  494. #define IDC_LDAP_SEARCH_BUTTON_UP 6472
  495. #define IDC_LDAP_SEARCH_BUTTON_DOWN 6473
  496. #define IDC_LDAP_SEARCH_STATIC_COUNTRY 6474
  497. #define IDC_LDAP_SEARCH_COMBO_COUNTRY 6475
  498. #define IDC_LDAP_SEARCH_STATIC_ETCHED2 6476
  499. #define IDC_LDAP_SEARCH_STATIC_LABELLIST2 6477
  500. #define IDC_LDAP_SEARCH_FRAME 6478
  501. #define IDC_LDAP_SEARCH_STATIC_CAPTION 6479
  502. #define IDC_LDAP_SEARCH_STATIC_LABELLIST1 6480
  503. #define IDC_LDAP_SEARCH_LIST_DS 6481
  504. #define IDC_LDAP_SEARCH_BUTTON_SELECT 6482
  505. #define IDC_LDAP_ADD_BUTTON_ADD 5579
  506. #define IDC_LDAP_ADD_BUTTON_DELETE 5580
  507. #define IDC_LDAP_ADD_STATIC_CAPTION 5581
  508. #define IDC_LDAP_ADD_BUTTON_PROPERTIES 5582
  509. #define IDC_LDAP_ADD_STATIC_LABELLIST1 5583
  510. #define IDC_LDAP_ADD_STATIC_ETCHED2 5584
  511. #define IDC_LDAP_ADD_LIST_ALL 5585
  512. #define IDC_LDAP_PROPS_STATIC_PASSWORD 5586
  513. #define IDC_LDAP_PROPS_EDIT_CONNECTION 5587
  514. #define IDC_LDAP_PROPS_EDIT_SEARCH 5588
  515. #define IDC_LDAP_PROPS_EDIT_NAME 5589
  516. #define IDC_LDAP_PROPS_EDIT_NUMRESULTS 5590
  517. #define IDC_LDAP_PROPS_FRAME 5591
  518. #define IDC_LDAP_PROPS_FRAME2 5592
  519. #define IDC_LDAP_PROPS_STATIC_CONNECTION 5593
  520. #define IDC_LDAP_PROPS_STATIC_SEARCH 5594
  521. #define IDC_LDAP_PROPS_STATIC_NUMRESULTS 5595
  522. #define IDC_LDAP_PROPS_EDIT_USERNAME 5596
  523. #define IDC_LDAP_PROPS_EDIT_PASSWORD 5597
  524. #define IDC_LDAP_PROPS_STATIC_NAME 5598
  525. #define IDC_LDAP_PROPS_RADIO_ANON 5599
  526. #define IDC_LDAP_PROPS_RADIO_SICILY 5600
  527. #define IDC_LDAP_PROPS_RADIO_USERPASS 5601
  528. #define IDC_LDAP_PROPS_STATIC_USERNAME 5602
  529. #define IDC_LDAP_PROPS_FRAME_NUMRESULTS 5603
  530. #define IDC_LDAP_PROPS_STATIC_PASSWORD2 5604
  531. #define IDC_LDAP_PROPS_EDIT_CONFIRMPASSWORD 5605
  532. #define IDC_LDAP_PROPS_CHECK_NAMES 5606
  533. #define IDC_LDAP_PROPS_EDIT_ROOT 5608
  534. #define IDD_DIALOG_LDAP_PROPERTIES_ADVANCED 5609
  535. #define IDC_LDAP_PROPS_STATIC_NAME_FRIENDLY 5610
  536. #define IDC_LDAP_PROPS_EDIT_NAME_FRIENDLY 5611
  537. #define IDC_LDAP_PROPS_FRAME_ROOT 5612
  538. #define IDC_LDAP_PROPS_RADIO_DEFAULTBASE 5613
  539. #define IDC_LDAP_PROPS_RADIO_OTHERBASE 5614
  540. #define IDD_DIALOG_LDAP_PROPERTIES 5540
  541. #define IDD_DIALOG_LDAP_SEARCH 5541
  542. #define IDD_DIALOG_LDAP_ADD 5542
  543. #define IDC_LDAP_PROPS_STATIC_CAPTION 65
  544. #define IDC_LDAP_PROPS_STATIC_ETCHED2 66
  545. IDD_DIALOG_LDAP_SEARCH DIALOGEX 0, 0, 212, 188
  546. STYLE DS_MODALFRAME | WS_POPUP
  547. #ifndef WIN16
  548. FONT 8, "MS Shell Dlg", 0, 0, 0x1
  549. #else
  550. FONT 8, "MS Sans Serif"
  551. #endif // !WIN16
  552. BEGIN
  553. LTEXT "If you have chosen to check names against one or more directory services, the directory services will be accessed in the order shown in the list below. Use the up and down buttons to change this order.",
  554. IDC_LDAP_SEARCH_STATIC_CAPTION,16,21,181,35
  555. GROUPBOX "&Change check names order:",IDC_LDAP_SEARCH_FRAME,7,6,
  556. 198,162
  557. #ifndef WIN16
  558. CONTROL "List1",IDC_LDAP_SEARCH_LIST_SELECTED,"SysListView32",
  559. LVS_REPORT | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER |
  560. LVS_NOSORTHEADER | WS_TABSTOP,16,69,124,77,
  561. WS_EX_CLIENTEDGE
  562. #else
  563. CONTROL "List1",IDC_LDAP_SEARCH_LIST_SELECTED,"IE_SysListView",
  564. LVS_REPORT | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER |
  565. LVS_NOSORTHEADER | WS_TABSTOP,16,69,124,77
  566. #endif // !WIN16
  567. PUSHBUTTON "&Up",IDC_LDAP_SEARCH_BUTTON_UP,148,115,49,14
  568. PUSHBUTTON "&Down",IDC_LDAP_SEARCH_BUTTON_DOWN,148,132,49,14
  569. END
  570. #endif // OLD_STUFF
  571. // LDAP_PROPERTIES
  572. #ifdef OLD_LDAP_UI
  573. extern HINSTANCE ghCommCtrlDLLInst;
  574. extern LPPROPERTYSHEET gpfnPropertySheet;
  575. enum _Propsheets
  576. {
  577. propMain=0,
  578. propOptions,
  579. propMAX
  580. };
  581. enum _ReturnValues
  582. {
  583. DS_CANCEL=0,
  584. DS_OK,
  585. DS_ERROR
  586. };
  587. // Whenever we add a new server, we put it in a linked list so we'll be able to
  588. // regress if the user hits cancel after adding a couple of entries
  589. typedef struct _NewServer
  590. {
  591. TCHAR szName[MAX_UI_STR];
  592. struct _NewServer * lpNext;
  593. } NEW_SERVER, *LPNEW_SERVER;
  594. // Params passed to the property sheets
  595. typedef struct _DSUILV
  596. {
  597. HWND hWndMainLV;
  598. HWND hWndResolveOrderLV;
  599. int nRetVal;
  600. LPNEW_SERVER lpNewServerList; // if servers added and we hit cancel, we use this list to remove newly added servers
  601. LPNEW_SERVER lpOldServerList; // if servers modified and we hit ok, we use this list to remove old servers
  602. } DSUILV, * LPDSUILV;
  603. #define hlvM (lpdsuiLV->hWndMainLV)
  604. #define hlvR (lpdsuiLV->hWndResolveOrderLV)
  605. /*
  606. * Prototypes
  607. */
  608. HRESULT HrInitLDAPListView(HWND hWndLV);
  609. void LDAPListAddItem(HWND hWndLV, LPTSTR lpszItemText);
  610. BOOL ReadLDAPServers(HWND hWndLV, LPTSTR szValueName);
  611. void DeleteLDAPServers(HWND hDlg);
  612. void ProcessOKMessage(HWND hDlg, LPDSUILV lpdsuiLV, int nPropSheet);
  613. void MoveLDAPItemUpDown(HWND hDlg, BOOL bMoveUp);
  614. BOOL SetDSUI(HWND hDlg,int nPropSheet, LPDSUILV lpdsuiLV);
  615. BOOL FillDSUI(HWND hDlg,int nPropSheet, LPDSUILV lpdsuiLV);
  616. int CreateDSPropSheets(HWND hwndOwner, LPDSUILV lpdsuiLV);
  617. BOOL APIENTRY_16 fnDSMainProc(HWND hDlg,UINT message,UINT wParam,LPARAM lParam);
  618. BOOL APIENTRY_16 fnDSOptionsProc(HWND hDlg,UINT message,UINT wParam,LPARAM lParam);
  619. void SetUpDownButtons(HWND hDlg, HWND hWndLV);
  620. BOOL SynchronizeLVContentsForward(HWND hDlg, LPDSUILV lpdsuiLV);
  621. BOOL SynchronizeLVContentsBackward(HWND hDlg, LPDSUILV lpdsuiLV);
  622. void ShowDSProps(HWND hDlg, BOOL bAddNew, LPDSUILV lpdsuiLV);
  623. BOOL ReadLDAPServerKey(HWND hWndLV, LPTSTR szValueName);
  624. void WriteLDAPServerKey(HWND hWndLV, LPTSTR szValueName);
  625. // Help IDs
  626. static DWORD rgDsMainHelpIDs[] =
  627. {
  628. IDC_LDAP_ADD_STATIC_LABELLIST1, IDH_WABLDAP_DIR_SER_LIST,
  629. IDC_LDAP_ADD_LIST_ALL, IDH_WABLDAP_DIR_SER_LIST,
  630. IDC_LDAP_ADD_BUTTON_ADD, IDH_WABLDAP_GEN_ADD,
  631. IDC_LDAP_ADD_BUTTON_DELETE, IDH_WABLDAP_GEN_REMOVE,
  632. IDC_LDAP_ADD_BUTTON_PROPERTIES, IDH_WABLDAP_GEN_PROPERTIES,
  633. 0,0
  634. };
  635. static DWORD rgDsOptHelpIDs[] =
  636. {
  637. IDC_LDAP_SEARCH_STATIC_LABELLIST2, IDH_WABLDAP_OPT_DIRSERV_CHECK_AGAINST,
  638. IDC_LDAP_SEARCH_LIST_SELECTED, IDH_WABLDAP_OPT_DIRSERV_CHECK_AGAINST,
  639. IDC_LDAP_SEARCH_BUTTON_UP, IDH_WABLDAP_OPT_UP,
  640. IDC_LDAP_SEARCH_BUTTON_DOWN, IDH_WABLDAP_OPT_DOWN,
  641. 0,0
  642. };
  643. //$$///////////////////////////////////////////////////////////////////////////////
  644. //
  645. // HrShowDirectoryServiceModificationDlg - Shows the main dialog with the list
  646. // of directory services and with a prop sheet for changing check order
  647. //
  648. // hWndParent - Parent for this dialog
  649. /////////////////////////////////////////////////////////////////////////////////
  650. HRESULT HrShowDirectoryServiceModificationDlg(HWND hWndParent)
  651. {
  652. ACCTLISTINFO ali;
  653. HRESULT hr = hrSuccess;
  654. #ifdef OLD_LDAP_UI
  655. DSUILV dsuiLV = {0};
  656. #endif // OLD_LDAP_UI
  657. IImnAccountManager * lpAccountManager;
  658. #ifdef OLD_LDAP_UI
  659. if (NULL == ghCommCtrlDLLInst) {
  660. hr = ResultFromScode(MAPI_E_UNCONFIGURED);
  661. goto out;
  662. }
  663. #endif // OLD_LDAP_UI
  664. // Make sure there is an account manager
  665. if (hr = InitAccountManager(&lpAccountManager)) {
  666. ShowMessageBox(hWndParent, idsLDAPUnconfigured, MB_ICONEXCLAMATION | MB_OK);
  667. goto out;
  668. }
  669. ali.cbSize = sizeof(ACCTLISTINFO);
  670. ali.AcctTypeInit = (ACCTTYPE)-1;
  671. ali.dwAcctFlags = ACCT_FLAG_DIR_SERV;
  672. ali.dwFlags = 0;
  673. hr = lpAccountManager->lpVtbl->AccountListDialog(lpAccountManager,
  674. hWndParent,
  675. &ali);
  676. #ifdef OLD_LDAP_UI
  677. dsuiLV.nRetVal = DS_ERROR;
  678. dsuiLV.lpNewServerList = NULL;
  679. dsuiLV.lpOldServerList = NULL;
  680. // show dialog
  681. if(-1 == CreateDSPropSheets(hWndParent,&dsuiLV))
  682. {
  683. DebugPrintError(("Directory Service dialog failed\n"));
  684. hr = E_FAIL;
  685. goto out;
  686. }
  687. // Free any allocated memory
  688. while(dsuiLV.lpNewServerList)
  689. {
  690. LPNEW_SERVER lpTemp = dsuiLV.lpNewServerList;
  691. dsuiLV.lpNewServerList = lpTemp->lpNext;
  692. if(dsuiLV.nRetVal == DS_CANCEL)
  693. SetLDAPServerParams(lpTemp->szName, NULL);
  694. LocalFree(lpTemp);
  695. }
  696. // Free any allocated memory
  697. while(dsuiLV.lpOldServerList)
  698. {
  699. LPNEW_SERVER lpTemp = dsuiLV.lpOldServerList;
  700. dsuiLV.lpOldServerList = lpTemp->lpNext;
  701. if(dsuiLV.nRetVal == DS_OK)
  702. SetLDAPServerParams(lpTemp->szName, NULL);
  703. LocalFree(lpTemp);
  704. }
  705. switch(dsuiLV.nRetVal)
  706. {
  707. case DS_CANCEL:
  708. hr = MAPI_E_USER_CANCEL;
  709. break;
  710. case DS_OK:
  711. hr = S_OK;
  712. break;
  713. case DS_ERROR:
  714. hr = E_FAIL;
  715. break;
  716. }
  717. #endif // OLD_LDAP_UI
  718. out:
  719. return hr;
  720. }
  721. #ifdef OLD_LDAP_UI
  722. #define m_lpDSUILV ((LPDSUILV) pps->lParam)
  723. #define m_hWndMainLV (m_lpDSUILV->hWndMainLV)
  724. #define m_hWndResolveOrderLV (m_lpDSUILV->hWndResolveOrderLV)
  725. #define m_nRetVal (m_lpDSUILV->nRetVal)
  726. /*//$$***********************************************************************
  727. * FUNCTION: fnDSMainProc
  728. *
  729. * PURPOSE: Window proc for property sheet ...
  730. *
  731. ****************************************************************************/
  732. BOOL APIENTRY_16 fnDSMainProc(HWND hDlg,UINT message,UINT wParam,LPARAM lParam)
  733. {
  734. PROPSHEETPAGE * pps;
  735. BOOL bRet = FALSE;
  736. ULONG ulcPropCount = 0;
  737. pps = (PROPSHEETPAGE *) GetWindowLong(hDlg, DWL_USER);
  738. switch(message)
  739. {
  740. case WM_INITDIALOG:
  741. // Save the lparam for later use
  742. SetWindowLong(hDlg,DWL_USER,lParam);
  743. pps = (PROPSHEETPAGE *) lParam;
  744. // Setup the UI
  745. SetDSUI(hDlg,propMain,m_lpDSUILV);
  746. // Fill in the UI
  747. FillDSUI(hDlg,propMain,m_lpDSUILV);
  748. return TRUE;
  749. case WM_HELP:
  750. #ifndef WIN16
  751. WinHelp( ((LPHELPINFO)lParam)->hItemHandle,
  752. g_szWABHelpFileName,
  753. HELP_WM_HELP,
  754. (DWORD)(LPSTR) rgDsMainHelpIDs );
  755. #else
  756. WinHelp( hDlg,
  757. g_szWABHelpFileName,
  758. HELP_CONTENTS,
  759. 0L );
  760. #endif // !WIN16
  761. break;
  762. #ifndef WIN16
  763. case WM_CONTEXTMENU:
  764. WinHelp((HWND) wParam,
  765. g_szWABHelpFileName,
  766. HELP_CONTEXTMENU,
  767. (DWORD)(LPVOID) rgDsMainHelpIDs );
  768. break;
  769. #endif // !WIN16
  770. case WM_COMMAND:
  771. switch(GET_WM_COMMAND_ID(wParam,lParam))
  772. {
  773. case IDCANCEL:
  774. // This is a windows bug that prevents ESC canceling prop sheets
  775. // which have MultiLine Edit boxes KB: Q130765
  776. SendMessage(GetParent(hDlg),message,wParam,lParam);
  777. break;
  778. case IDC_LDAP_ADD_BUTTON_DELETE:
  779. DeleteLDAPServers(hDlg);
  780. break;
  781. case IDC_LDAP_ADD_BUTTON_ADD:
  782. ShowDSProps(hDlg, TRUE, m_lpDSUILV);
  783. break;
  784. case IDC_LDAP_ADD_BUTTON_PROPERTIES:
  785. ShowDSProps(hDlg, FALSE, m_lpDSUILV);
  786. break;
  787. }
  788. break;
  789. case WM_NOTIFY:
  790. switch(((NMHDR FAR *)lParam)->code)
  791. {
  792. case PSN_SETACTIVE: //initialize
  793. SynchronizeLVContentsBackward(hDlg, m_lpDSUILV);
  794. break;
  795. case PSN_APPLY: //ok
  796. ProcessOKMessage(hDlg,m_lpDSUILV,propMain);
  797. m_nRetVal = DS_OK;
  798. break;
  799. case PSN_KILLACTIVE: //Losing activation to another page
  800. break;
  801. case PSN_RESET: //cancel
  802. m_nRetVal = DS_CANCEL;
  803. break;
  804. }
  805. switch((int) wParam)
  806. {
  807. case IDC_LDAP_ADD_LIST_ALL:
  808. switch(((NM_LISTVIEW *)lParam)->hdr.code)
  809. {
  810. case LVN_KEYDOWN:
  811. switch(((LV_KEYDOWN FAR *) lParam)->wVKey)
  812. {
  813. case VK_DELETE:
  814. SendMessage (hDlg, WM_COMMAND, (WPARAM) IDC_LDAP_ADD_BUTTON_DELETE, 0);
  815. return 0;
  816. break;
  817. }
  818. break;
  819. case NM_DBLCLK:
  820. SendMessage (hDlg, WM_COMMAND, (WPARAM) IDC_LDAP_ADD_BUTTON_PROPERTIES, 0);
  821. return 0;
  822. break;
  823. }
  824. break;
  825. }
  826. return TRUE;
  827. }
  828. return bRet;
  829. }
  830. /*//$$***********************************************************************
  831. * FUNCTION: fnDSOptionsProc
  832. *
  833. * PURPOSE: Window proc for property sheet ...
  834. *
  835. ****************************************************************************/
  836. BOOL APIENTRY_16 fnDSOptionsProc(HWND hDlg,UINT message,UINT wParam,LPARAM lParam)
  837. {
  838. PROPSHEETPAGE * pps;
  839. BOOL bRet = FALSE;
  840. int CtlID = 0; //used to determine which required field in the UI has not been set
  841. pps = (PROPSHEETPAGE *) GetWindowLong(hDlg, DWL_USER);
  842. switch(message)
  843. {
  844. case WM_INITDIALOG:
  845. SetWindowLong(hDlg,DWL_USER,lParam);
  846. pps = (PROPSHEETPAGE *) lParam;
  847. SetDSUI(hDlg,propOptions,m_lpDSUILV);
  848. FillDSUI(hDlg,propOptions,m_lpDSUILV);
  849. return TRUE;
  850. case WM_HELP:
  851. #ifndef WIN16
  852. WinHelp( ((LPHELPINFO)lParam)->hItemHandle,
  853. g_szWABHelpFileName,
  854. HELP_WM_HELP,
  855. (DWORD)(LPSTR) rgDsOptHelpIDs );
  856. #else
  857. WinHelp( hDlg,
  858. g_szWABHelpFileName,
  859. HELP_CONTENTS,
  860. 0L );
  861. #endif // !WIN16
  862. break;
  863. #ifndef WIN16
  864. case WM_CONTEXTMENU:
  865. WinHelp((HWND) wParam,
  866. g_szWABHelpFileName,
  867. HELP_CONTEXTMENU,
  868. (DWORD)(LPVOID) rgDsOptHelpIDs );
  869. break;
  870. #endif // !WIN16
  871. case WM_COMMAND:
  872. switch(GET_WM_COMMAND_ID(wParam,lParam))
  873. {
  874. case IDCANCEL:
  875. // This is a windows bug that prevents ESC canceling prop sheets
  876. // which have MultiLine Edit boxes KB: Q130765
  877. SendMessage(GetParent(hDlg),message,wParam,lParam);
  878. break;
  879. case IDC_LDAP_SEARCH_BUTTON_UP:
  880. MoveLDAPItemUpDown(hDlg, TRUE);
  881. break;
  882. case IDC_LDAP_SEARCH_BUTTON_DOWN:
  883. MoveLDAPItemUpDown(hDlg, FALSE);
  884. break;
  885. }
  886. break;
  887. case WM_NOTIFY:
  888. switch(((NMHDR FAR *)lParam)->code)
  889. {
  890. case PSN_SETACTIVE: //initialize
  891. SynchronizeLVContentsForward(hDlg, m_lpDSUILV);
  892. break;
  893. case PSN_APPLY: //ok
  894. ProcessOKMessage(hDlg,m_lpDSUILV,propOptions);
  895. break;
  896. case PSN_KILLACTIVE: //Losing activation to another page
  897. break;
  898. case PSN_RESET: //cancel
  899. // lpLSP->nRetVal = DL_CANCEL;
  900. break;
  901. }
  902. return TRUE;
  903. }
  904. return bRet;
  905. }
  906. /*//$$***************************************************************************
  907. * FUNCTION: CreateDSPropSheets(HWND)
  908. *
  909. * PURPOSE: Creates the DL property sheet
  910. *
  911. ****************************************************************************/
  912. int CreateDSPropSheets( HWND hwndOwner, LPDSUILV lpdsuiLV )
  913. {
  914. PROPSHEETPAGE psp[propMAX];
  915. PROPSHEETHEADER psh;
  916. TCHAR szBuf[propMAX][MAX_UI_STR];
  917. TCHAR szBuf2[MAX_UI_STR];
  918. psp[propMain].dwSize = sizeof(PROPSHEETPAGE);
  919. psp[propMain].dwFlags = PSP_USETITLE;
  920. psp[propMain].hInstance = hinstMapiX;
  921. psp[propMain].pszTemplate = MAKEINTRESOURCE(IDD_DIALOG_LDAP_ADD);
  922. psp[propMain].pszIcon = NULL;
  923. psp[propMain].pfnDlgProc = (DLGPROC) fnDSMainProc;
  924. LoadString(hinstMapiX, idsGeneral, szBuf[propMain], sizeof(szBuf[propMain]));
  925. psp[propMain].pszTitle = szBuf[propMain];
  926. psp[propMain].lParam = (LPARAM) lpdsuiLV;
  927. psp[propOptions].dwSize = sizeof(PROPSHEETPAGE);
  928. psp[propOptions].dwFlags = PSP_USETITLE;
  929. psp[propOptions].hInstance = hinstMapiX;
  930. psp[propOptions].pszTemplate = MAKEINTRESOURCE(IDD_DIALOG_LDAP_SEARCH);
  931. psp[propOptions].pszIcon = NULL;
  932. psp[propOptions].pfnDlgProc = (DLGPROC) fnDSOptionsProc;
  933. LoadString(hinstMapiX, idsOptions, szBuf[propOptions], sizeof(szBuf[propMain]));
  934. psp[propOptions].pszTitle = szBuf[propOptions];
  935. psp[propOptions].lParam = (LPARAM) lpdsuiLV;
  936. psh.dwSize = sizeof(PROPSHEETHEADER);
  937. psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
  938. psh.hwndParent = hwndOwner;
  939. psh.hInstance = hinstMapiX;
  940. psh.pszIcon = NULL;
  941. LoadString(hinstMapiX, idsDirectoryServices, szBuf2, sizeof(szBuf2));
  942. psh.pszCaption = szBuf2;
  943. psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
  944. psh.nStartPage = propMain;
  945. psh.ppsp = (LPCPROPSHEETPAGE) &psp;
  946. return (gpfnPropertySheet(&psh));
  947. }
  948. //$$///////////////////////////////////////////////////////////////////////////////
  949. //
  950. // SetDSUI - Sets the prop sheet UI
  951. //
  952. // hDlg - Parent HWND
  953. // nPropSheet - Identifies the prop sheet being set
  954. // lpdsuiLV - Dialog param info
  955. //
  956. /////////////////////////////////////////////////////////////////////////////////
  957. BOOL SetDSUI(HWND hDlg,int nPropSheet,LPDSUILV lpdsuiLV)
  958. {
  959. ULONG i =0;
  960. // Set the font of all the children to the default GUI font
  961. EnumChildWindows( hDlg,
  962. SetChildDefaultGUIFont,
  963. (LPARAM) 0);
  964. switch(nPropSheet)
  965. {
  966. case propMain:
  967. lpdsuiLV->hWndMainLV = GetDlgItem(hDlg, IDC_LDAP_ADD_LIST_ALL);
  968. // Initialize the list view that displays the list of LDAP servers
  969. HrInitLDAPListView(lpdsuiLV->hWndMainLV);
  970. break;
  971. case propOptions:
  972. lpdsuiLV->hWndResolveOrderLV = GetDlgItem(hDlg, IDC_LDAP_SEARCH_LIST_SELECTED);
  973. // Initialize the list view that displays the list of LDAP servers
  974. HrInitLDAPListView(lpdsuiLV->hWndResolveOrderLV);
  975. break;
  976. }
  977. return TRUE;
  978. }
  979. //$$///////////////////////////////////////////////////////////////////////////////
  980. //
  981. // FillDSUI - Fills in the UI fields with the given data
  982. //
  983. // hDlg - HWND of parent
  984. // nPropSheet - identifies prop sheet being modified
  985. // lpdsuiLV - lParam from dialog
  986. //
  987. /////////////////////////////////////////////////////////////////////////////////
  988. BOOL FillDSUI(HWND hDlg,int nPropSheet,LPDSUILV lpdsuiLV)
  989. {
  990. HWND hWndLV = NULL;
  991. switch(nPropSheet)
  992. {
  993. case propMain:
  994. hWndLV = GetDlgItem(hDlg, IDC_LDAP_ADD_LIST_ALL);
  995. // Read all the registered LDAP servers from the registry into
  996. // this list view
  997. ReadLDAPServerKey(hWndLV, szAllLDAPServersValueName);
  998. if(ListView_GetItemCount(hWndLV) <= 0)
  999. {
  1000. EnableWindow(GetDlgItem(hDlg,IDC_LDAP_ADD_BUTTON_DELETE),FALSE);
  1001. EnableWindow(GetDlgItem(hDlg,IDC_LDAP_ADD_BUTTON_PROPERTIES),FALSE);
  1002. EnableWindow(hWndLV,FALSE);
  1003. }
  1004. else
  1005. {
  1006. EnableWindow(GetDlgItem(hDlg,IDC_LDAP_ADD_BUTTON_DELETE),TRUE);
  1007. EnableWindow(GetDlgItem(hDlg,IDC_LDAP_ADD_BUTTON_PROPERTIES),TRUE);
  1008. EnableWindow(hWndLV,TRUE);
  1009. }
  1010. SetFocus(GetNextDlgTabItem(hDlg, GetDlgItem(hDlg, IDC_LDAP_ADD_STATIC_CAPTION), FALSE));
  1011. break;
  1012. case propOptions:
  1013. break;
  1014. }
  1015. return TRUE;
  1016. }
  1017. #endif
  1018. #ifdef OLD_LDAP_UI
  1019. //$$///////////////////////////////////////////////////////////////////////////////
  1020. //
  1021. // DeleteLDAPServers - Deletes LDAP server entries form the Directory Services list
  1022. //
  1023. // hDlg - HWND of dialog
  1024. //
  1025. /////////////////////////////////////////////////////////////////////////////////
  1026. void DeleteLDAPServers(HWND hDlg)
  1027. {
  1028. HWND hWndLV = GetDlgItem(hDlg,IDC_LDAP_ADD_LIST_ALL);
  1029. TCHAR szBuf[MAX_UI_STR];
  1030. SendMessage(hWndLV, WM_SETREDRAW, (WPARAM) FALSE, 0);
  1031. if(ListView_GetSelectedCount(hWndLV) > 0)
  1032. {
  1033. int iItemIndex = 0;
  1034. if(IDYES == ShowMessageBox(hDlg, idsQuestionServerDeletion, MB_ICONEXCLAMATION | MB_YESNO))
  1035. {
  1036. while(ListView_GetSelectedCount(hWndLV) > 0)
  1037. {
  1038. iItemIndex = ListView_GetNextItem(hWndLV, -1, LVNI_SELECTED);
  1039. szBuf[0]='\0';
  1040. ListView_GetItemText(hWndLV,iItemIndex,0,szBuf,sizeof(szBuf));
  1041. // Delete the registry key corerspnding to this entry
  1042. if(lstrlen(szBuf))
  1043. SetLDAPServerParams(szBuf,NULL);
  1044. // Delete the item from the list view
  1045. ListView_DeleteItem(hWndLV, iItemIndex);
  1046. }
  1047. EnableWindow(GetDlgItem(GetParent(hDlg), IDCANCEL), FALSE);
  1048. }
  1049. if(ListView_GetItemCount(hWndLV) <= 0)
  1050. {
  1051. // no entries left
  1052. EnableWindow(GetDlgItem(hDlg,IDC_LDAP_ADD_BUTTON_DELETE),FALSE);
  1053. EnableWindow(GetDlgItem(hDlg,IDC_LDAP_ADD_BUTTON_PROPERTIES),FALSE);
  1054. EnableWindow(hWndLV,FALSE);
  1055. SendMessage(GetParent(hDlg), DM_SETDEFID, IDOK, 0);
  1056. SetFocus(GetDlgItem(GetParent(hDlg),IDOK));
  1057. }
  1058. else
  1059. {
  1060. // some entries left - select the one closest to the last deleted ...
  1061. if(ListView_GetSelectedCount(hWndLV) <= 0)
  1062. {
  1063. if(iItemIndex >= ListView_GetItemCount(hWndLV))
  1064. iItemIndex--;
  1065. LVSelectItem(hWndLV, iItemIndex);
  1066. }
  1067. }
  1068. }
  1069. else
  1070. ShowMessageBox(hDlg, idsSelectServersToDelete, MB_ICONEXCLAMATION | MB_OK);
  1071. SendMessage(hWndLV, WM_SETREDRAW, (WPARAM) TRUE, 0);
  1072. return;
  1073. }
  1074. //$$///////////////////////////////////////////////////////////////////////////////
  1075. //
  1076. // ProcessOKMessage - Processes the OK button being clicked
  1077. //
  1078. /////////////////////////////////////////////////////////////////////////////////
  1079. void ProcessOKMessage(HWND hDlg, LPDSUILV lpdsuiLV, int nPropSheet)
  1080. {
  1081. TCHAR szBuf[MAX_UI_STR];
  1082. switch(nPropSheet)
  1083. {
  1084. case propMain:
  1085. SynchronizeLVContentsBackward(hDlg, lpdsuiLV);
  1086. WriteLDAPServerKey(hlvM, szAllLDAPServersValueName);
  1087. break;
  1088. case propOptions:
  1089. break;
  1090. }
  1091. return;
  1092. }
  1093. //$$////////////////////////////////////////////////////////////////////
  1094. //
  1095. // MoveLDAPitemUpDown - moves a selected item up or down in the list
  1096. //
  1097. ////////////////////////////////////////////////////////////////////////
  1098. void MoveLDAPItemUpDown(HWND hDlg, BOOL bMoveUp)
  1099. {
  1100. HWND hWndLV = GetDlgItem(hDlg, IDC_LDAP_SEARCH_LIST_SELECTED);
  1101. int iItemIndex = ListView_GetSelectedCount(hWndLV);
  1102. int iListCount = ListView_GetItemCount(hWndLV);
  1103. SendMessage(hWndLV, WM_SETREDRAW, (WPARAM) FALSE, 0);
  1104. if( iItemIndex != 1)
  1105. {
  1106. ShowMessageBox(hDlg,idsSelectOneMoveUpDown,MB_ICONEXCLAMATION | MB_OK);
  1107. }
  1108. else
  1109. {
  1110. TCHAR szBufItem[MAX_UI_STR];
  1111. TCHAR szBufOtherItem[MAX_UI_STR];
  1112. int iMoveToIndex = 0;
  1113. iItemIndex = ListView_GetNextItem(hWndLV, -1, LVNI_SELECTED);
  1114. // Can't move beyond the first or last item
  1115. if( ((iItemIndex == 0) && bMoveUp) ||
  1116. ((iItemIndex == (iListCount-1)) && !bMoveUp) )
  1117. goto out;
  1118. iMoveToIndex = (bMoveUp) ? (iItemIndex - 1):(iItemIndex+1);
  1119. // Basically since these list view items have no parameters of interest
  1120. // other than the text, we can swap the text (looks cleaner)
  1121. // Get the selected item text
  1122. ListView_GetItemText(hWndLV, iItemIndex, 0, szBufItem, sizeof(szBufItem));
  1123. ListView_GetItemText(hWndLV, iMoveToIndex, 0, szBufOtherItem, sizeof(szBufOtherItem));
  1124. ListView_SetItemText(hWndLV, iMoveToIndex, 0, szBufItem);
  1125. ListView_SetItemText(hWndLV, iItemIndex, 0, szBufOtherItem);
  1126. LVSelectItem(hWndLV, iMoveToIndex);
  1127. SetUpDownButtons(hDlg, hWndLV);
  1128. }
  1129. out:
  1130. SendMessage(hWndLV, WM_SETREDRAW, (WPARAM) TRUE, 0);
  1131. return;
  1132. }
  1133. //$$////////////////////////////////////////////////////////////////////////////////
  1134. //
  1135. // SetUpDownButtons - Enables/Disables up and down buttons
  1136. //
  1137. ////////////////////////////////////////////////////////////////////////////////////////
  1138. void SetUpDownButtons(HWND hDlg, HWND hWndLV)
  1139. {
  1140. int iItemCount = ListView_GetItemCount(hWndLV);
  1141. int iSelectedItem = ListView_GetNextItem(hWndLV, -1, LVNI_SELECTED);
  1142. HWND hWndUp = GetDlgItem(hDlg, IDC_LDAP_SEARCH_BUTTON_UP);
  1143. HWND hWndDown = GetDlgItem(hDlg, IDC_LDAP_SEARCH_BUTTON_DOWN);
  1144. DebugPrintTrace(("--SetUpDownButtons--\n"));
  1145. if(iItemCount <= 0)
  1146. {
  1147. EnableWindow(hWndUp, FALSE);
  1148. EnableWindow(hWndDown, FALSE);
  1149. SetFocus(GetDlgItem(GetParent(hDlg),IDOK));
  1150. }
  1151. else
  1152. {
  1153. EnableWindow(hWndUp, TRUE);
  1154. EnableWindow(hWndDown, TRUE);
  1155. }
  1156. return;
  1157. }
  1158. //$$////////////////////////////////////////////////////////////////////////////////
  1159. //
  1160. // SynchronizeLVContentsForward - this funciton attempts to synhronize the
  1161. // List view contents between the various ListViews when going from main pane
  1162. // to Options pane
  1163. //
  1164. ////////////////////////////////////////////////////////////////////////////////////
  1165. BOOL SynchronizeLVContentsForward(HWND hDlg, LPDSUILV lpdsuiLV)
  1166. {
  1167. BOOL bRet = FALSE;
  1168. int iItemIndex=0;
  1169. // Basically we just want to enter all the entries with check names against them in
  1170. // this list view
  1171. SendMessage(hlvR, WM_SETREDRAW, (WPARAM) FALSE, 0);
  1172. ListView_DeleteAllItems(hlvR);
  1173. //
  1174. // if there are no items in the original, wipe out and leave
  1175. //
  1176. if(ListView_GetItemCount(hlvM) <= 0)
  1177. {
  1178. EnableWindow(hlvR, FALSE);
  1179. EnableWindow(GetDlgItem(hDlg, IDC_LDAP_SEARCH_BUTTON_UP), FALSE);
  1180. EnableWindow(GetDlgItem(hDlg, IDC_LDAP_SEARCH_BUTTON_DOWN), FALSE);
  1181. bRet = TRUE;
  1182. goto out;
  1183. }
  1184. else
  1185. {
  1186. // Look at all the items in the original one by one and if they have
  1187. // the check names flag, enter them into hlvR
  1188. int i,nIndex,nTotal;
  1189. TCHAR szBuf[MAX_PATH];
  1190. EnableWindow(hlvR, TRUE);
  1191. for(i = 0; i < ListView_GetItemCount(hlvM); i++)
  1192. {
  1193. ListView_GetItemText(hlvM, i, 0, szBuf, sizeof(szBuf));
  1194. if(lstrlen(szBuf))
  1195. {
  1196. LDAPSERVERPARAMS ldsp = {0};
  1197. GetLDAPServerParams(szBuf, &(ldsp));
  1198. if(ldsp.fResolve)
  1199. {
  1200. // This is selected for resolving so we should add it to
  1201. // the selected items list
  1202. LDAPListAddItem(hlvR, szBuf);
  1203. }
  1204. FreeLDAPServerParams(ldsp);
  1205. }
  1206. }
  1207. }
  1208. LVSelectItem(hlvR, 0);
  1209. SetUpDownButtons(hDlg, hlvR);
  1210. bRet = TRUE;
  1211. out:
  1212. SendMessage(hlvR, WM_SETREDRAW, (WPARAM) TRUE, 0);
  1213. return bRet;
  1214. }
  1215. //$$////////////////////////////////////////////////////////////////////////////////
  1216. //
  1217. // ShowDSProps(HWND hDlg, BOOL bAddNew);
  1218. //
  1219. // Displays properties of a Directory Service or creates and adds a new one
  1220. //
  1221. ////////////////////////////////////////////////////////////////////////////////////
  1222. void ShowDSProps(HWND hDlg, BOOL bAddNew, LPDSUILV lpdsuiLV)
  1223. {
  1224. TCHAR szBuf[MAX_UI_STR];
  1225. TCHAR szOldName[MAX_UI_STR];
  1226. int iItemIndex;
  1227. HWND hWndLV = GetDlgItem(hDlg,IDC_LDAP_ADD_LIST_ALL);
  1228. if(bAddNew)
  1229. {
  1230. szBuf[0]='\0';
  1231. }
  1232. else
  1233. {
  1234. int iItemCount = ListView_GetSelectedCount(hWndLV);
  1235. if (iItemCount > 1)
  1236. {
  1237. ShowMessageBox(hDlg, IDS_ADDRBK_MESSAGE_ACTION, MB_ICONINFORMATION | MB_OK);
  1238. goto out;
  1239. }
  1240. else if(iItemCount == 0)
  1241. {
  1242. ShowMessageBox(hDlg, IDS_ADDRBK_MESSAGE_NO_ITEM, MB_ICONINFORMATION | MB_OK);
  1243. goto out;
  1244. }
  1245. // by now we should only have 1 selection
  1246. iItemIndex = ListView_GetNextItem(hWndLV, -1, LVNI_SELECTED);
  1247. if(iItemIndex == -1)
  1248. goto out;
  1249. ListView_GetItemText(hWndLV, iItemIndex, 0, szBuf, sizeof(szBuf));
  1250. if(!lstrlen(szBuf))
  1251. goto out;
  1252. }
  1253. // Save the old name just in case we need it ... (eg. user modifies the name in the props)
  1254. lstrcpy(szOldName,szBuf);
  1255. if(!HR_FAILED(HrShowDSProps(hDlg,szBuf,bAddNew)))
  1256. {
  1257. if(bAddNew)
  1258. {
  1259. // Add this new string to the main list box
  1260. if(lstrlen(szBuf))
  1261. LDAPListAddItem(hWndLV, szBuf);
  1262. // At this point of time, the new entry has been saved in the
  1263. // registry. If the user now hits cancel, we want to remove
  1264. // the newly entered entry from the registry so that it doesnt
  1265. // show up later. To do this, we store a list of all newly added
  1266. // names.
  1267. {
  1268. LPNEW_SERVER lpTemp = LocalAlloc(LMEM_ZEROINIT, sizeof(NEW_SERVER));
  1269. if(lpTemp)
  1270. {
  1271. lpTemp->lpNext = lpdsuiLV->lpNewServerList;
  1272. lstrcpy(lpTemp->szName, szBuf);
  1273. lpdsuiLV->lpNewServerList = lpTemp;
  1274. }
  1275. }
  1276. }
  1277. else
  1278. {
  1279. if(lstrcmpi(szOldName, szBuf))
  1280. {
  1281. // update the old name in the list ...
  1282. ListView_SetItemText(hWndLV, iItemIndex, 0, szBuf);
  1283. // At this point of time, the old entry name has been modified and we
  1284. // have two keys in the registry - the old one and the new one
  1285. // If the user hits cancel we want to remove the new entries
  1286. // If the user hits ok, we want to remove the old entries
  1287. {
  1288. LPNEW_SERVER lpTemp = LocalAlloc(LMEM_ZEROINIT, sizeof(NEW_SERVER));
  1289. if(lpTemp)
  1290. {
  1291. lpTemp->lpNext = lpdsuiLV->lpOldServerList;
  1292. lstrcpy(lpTemp->szName, szOldName);
  1293. lpdsuiLV->lpOldServerList = lpTemp;
  1294. }
  1295. }
  1296. //
  1297. // Again, we also want the new name of the entry so that if the user
  1298. // hits cancel, we can revert back to the old name.
  1299. //
  1300. {
  1301. LPNEW_SERVER lpTemp = LocalAlloc(LMEM_ZEROINIT, sizeof(NEW_SERVER));
  1302. if(lpTemp)
  1303. {
  1304. lpTemp->lpNext = lpdsuiLV->lpNewServerList;
  1305. lstrcpy(lpTemp->szName, szBuf);
  1306. lpdsuiLV->lpNewServerList = lpTemp;
  1307. }
  1308. }
  1309. }
  1310. }
  1311. }
  1312. if(ListView_GetItemCount(hWndLV) > 0)
  1313. {
  1314. EnableWindow(GetDlgItem(hDlg,IDC_LDAP_ADD_BUTTON_DELETE),TRUE);
  1315. EnableWindow(GetDlgItem(hDlg,IDC_LDAP_ADD_BUTTON_PROPERTIES),TRUE);
  1316. EnableWindow(hWndLV,TRUE);
  1317. SendMessage(GetParent(hDlg), DM_SETDEFID, IDOK, 0);
  1318. }
  1319. out:
  1320. return;
  1321. }
  1322. #endif
  1323. #ifdef OLD_LDAP_UI
  1324. //$$////////////////////////////////////////////////////////////////////////////////
  1325. //
  1326. // SynchronizeLVContentsBackward(LPDSUILV lpdsuiLV) - this funciton attempts to synhronize the
  1327. // List view contents between the various ListViews when going from Options pane
  1328. // to main pane - basically what we want to do is to preserve the order of the
  1329. // resolveNames list views ... when modifications have been made in the resolvenames
  1330. // list view, we change the order of the main list view to reflect that change
  1331. //
  1332. ////////////////////////////////////////////////////////////////////////////////////
  1333. BOOL SynchronizeLVContentsBackward(HWND hDlg, LPDSUILV lpdsuiLV)
  1334. {
  1335. BOOL bRet = FALSE;
  1336. int i=0,iItemIndex=0;
  1337. TCHAR szBuf[MAX_PATH];
  1338. if(!hlvR)
  1339. {
  1340. // Didnt go to the options pane
  1341. // Leave things as they are
  1342. bRet = TRUE;
  1343. goto out;
  1344. }
  1345. //
  1346. // Easy way to do this ...
  1347. // Delete all the entries in hlvM that occur in hlvR and then add hlvR items one by one
  1348. //
  1349. SendMessage(hlvM, WM_SETREDRAW, (WPARAM) FALSE, 0);
  1350. for(i = 0; i < ListView_GetItemCount(hlvR); i++)
  1351. {
  1352. ListView_GetItemText(hlvR, i, 0, szBuf, sizeof(szBuf));
  1353. if(lstrlen(szBuf))
  1354. {
  1355. LV_FINDINFO lvfi = {0};
  1356. int iItemIndex;
  1357. lvfi.flags = LVFI_STRING;
  1358. lvfi.psz = szBuf;
  1359. iItemIndex = ListView_FindItem(hlvM, -1, &lvfi);
  1360. if(iItemIndex != -1)
  1361. {
  1362. ListView_DeleteItem(hlvM, iItemIndex);
  1363. }
  1364. }
  1365. }
  1366. for(i = 0; i < ListView_GetItemCount(hlvR); i++)
  1367. {
  1368. ListView_GetItemText(hlvR, i, 0, szBuf, sizeof(szBuf));
  1369. if(lstrlen(szBuf))
  1370. {
  1371. LDAPListAddItem(hlvM, szBuf);
  1372. }
  1373. }
  1374. LVSelectItem(hlvM, 0);
  1375. bRet = TRUE;
  1376. out:
  1377. SendMessage(hlvM, WM_SETREDRAW, (WPARAM) TRUE, 0);
  1378. return(bRet);
  1379. }
  1380. #endif // OLD_LDAP_UI
  1381. //$$///////////////////////////////////////////////////////////////////////////////
  1382. //
  1383. // LDAPListAddItem - adds an item to the LDAP list view controls
  1384. //
  1385. // hWndLV - HWND of List View
  1386. // lpszItemText - Name of item to add to list view
  1387. //
  1388. /////////////////////////////////////////////////////////////////////////////////
  1389. void LDAPListAddItem(HWND hWndLV, LPTSTR lpszItemText)
  1390. {
  1391. LV_ITEM lvi = {0};
  1392. lvi.mask = LVIF_TEXT | LVIF_IMAGE;
  1393. lvi.pszText = lpszItemText;
  1394. lvi.iImage = imageDirectoryServer;
  1395. lvi.iItem = ListView_GetItemCount(hWndLV);
  1396. lvi.iSubItem = 0;
  1397. ListView_InsertItem(hWndLV, &lvi);
  1398. LVSelectItem(hWndLV, lvi.iItem);
  1399. return;
  1400. }
  1401. /*************************************************************************
  1402. //$$
  1403. // HrInitLDAPListView - Initializes the two list views on this dialog
  1404. // so they look nice
  1405. //
  1406. // hWndLV - handle of list view
  1407. //
  1408. **************************************************************************/
  1409. HRESULT HrInitLDAPListView(HWND hWndLV)
  1410. {
  1411. HRESULT hr = hrSuccess;
  1412. LV_COLUMN lvC; // list view column structure
  1413. HIMAGELIST hSmall=NULL;
  1414. DWORD dwLVStyle;
  1415. ULONG nCols=0;
  1416. ULONG index=0;
  1417. if (!hWndLV)
  1418. {
  1419. hr = MAPI_E_INVALID_PARAMETER;
  1420. goto out;
  1421. }
  1422. ListView_SetExtendedListViewStyle(hWndLV, LVS_EX_FULLROWSELECT);
  1423. dwLVStyle = GetWindowLong(hWndLV,GWL_STYLE);
  1424. if(dwLVStyle & LVS_EDITLABELS)
  1425. SetWindowLong(hWndLV,GWL_STYLE,(dwLVStyle & ~LVS_EDITLABELS));
  1426. hSmall = gpfnImageList_LoadImage( hinstMapiX,
  1427. MAKEINTRESOURCE(IDB_BITMAP_SMALL),
  1428. S_BITMAP_WIDTH,
  1429. 0,
  1430. RGB_TRANSPARENT,
  1431. IMAGE_BITMAP,
  1432. 0);
  1433. ListView_SetImageList (hWndLV, hSmall, LVSIL_SMALL);
  1434. lvC.mask = LVCF_FMT | LVCF_WIDTH;
  1435. lvC.fmt = LVCFMT_LEFT; // left-align column
  1436. lvC.cx = 250; //<TBD> - change this hardcoding
  1437. lvC.pszText = NULL;
  1438. lvC.iSubItem = 0;
  1439. if (ListView_InsertColumn (hWndLV, 0, &lvC) == -1)
  1440. {
  1441. DebugPrintError(("ListView_InsertColumn Failed\n"));
  1442. hr = E_FAIL;
  1443. goto out;
  1444. }
  1445. out:
  1446. return hr;
  1447. }
  1448. #endif // OLD_LDAP_UI
  1449. #ifdef URL_CHAR_ESCAPING
  1450. // URLs are filled with escape characters, we need to replace these
  1451. // with regular characters ...
  1452. //
  1453. static const TCHAR szEsc1[]="%20";
  1454. static const TCHAR szEsc2[]="%3C";
  1455. static const TCHAR szEsc3[]="%3E";
  1456. static const TCHAR szEsc4[]="%23";
  1457. static const TCHAR szEsc5[]="%25";
  1458. static const TCHAR szEsc6[]="%7B";
  1459. static const TCHAR szEsc7[]="%7D";
  1460. static const TCHAR szEsc8[]="%7C";
  1461. static const TCHAR szEsc9[]="%74";
  1462. static const TCHAR szEsc10[]="%5E";
  1463. static const TCHAR szEsc11[]="%7E";
  1464. static const TCHAR szEsc12[]="%5B";
  1465. static const TCHAR szEsc13[]="%5D";
  1466. static const TCHAR szEsc14[]="%60";
  1467. #define MAX_ESC_CHAR 14
  1468. const TCHAR * szEsc[] =
  1469. { szEsc1, szEsc2, szEsc3,
  1470. szEsc4, szEsc5, szEsc6,
  1471. szEsc7, szEsc8, szEsc9,
  1472. szEsc10, szEsc11, szEsc12,
  1473. szEsc13, szEsc14
  1474. };
  1475. const char cEscChar[] =
  1476. {
  1477. ' ', '<', '>',
  1478. '#', '%', '{',
  1479. '}', '|', '\\',
  1480. '^', '~', '[',
  1481. ']', '`'
  1482. };
  1483. /*
  1484. -
  1485. - ReplaceURLIllegalChars
  1486. -
  1487. * Replaces illegal chars in a URL with escaped strings as per some RFC
  1488. * Makes a copy of the input string and then copies it back onto the input string
  1489. * Assumes that input string was big enough to handle all replacements
  1490. */
  1491. void ReplaceURLIllegalChars(LPTSTR lpURL)
  1492. {
  1493. LPTSTR lpTemp = NULL,lp=NULL, lp1=NULL;
  1494. int i = 0;
  1495. if(!lpURL)
  1496. return;
  1497. if(!(lpTemp = LocalAlloc(LMEM_ZEROINIT, 2*lstrlen(lpURL)+1)))
  1498. return;
  1499. lstrcpy(lpTemp, lpURL);
  1500. lp = lpURL;
  1501. lp1 = lpTemp;
  1502. while(lp && *lp)
  1503. {
  1504. for(i=0;i<MAX_ESC_CHAR;i++)
  1505. {
  1506. if(*lp == cEscChar[i])
  1507. {
  1508. lstrcpy(lp1, szEsc[i]);
  1509. lp1 += lstrlen(szEsc[i])-1;
  1510. lstrcat(lp1, CharNext(lp));
  1511. break;
  1512. }
  1513. }
  1514. lp=CharNext(lp);
  1515. lp1=CharNext(lp1);
  1516. }
  1517. lstrcpy(lpURL, lpTemp);
  1518. LocalFreeAndNull(&lpTemp);
  1519. }
  1520. /***************************************************************************
  1521. Name : StrICmpN
  1522. Purpose : Compare strings, ignore case, stop at N characters
  1523. Parameters: szString1 = first string
  1524. szString2 = second string
  1525. N = number of characters to compare
  1526. bCmpI - compare insensitive if TRUE, sensitive if false
  1527. Returns : 0 if first N characters of strings are equivalent.
  1528. Comment :
  1529. ***************************************************************************/
  1530. int StrICmpN(LPTSTR szString1, LPTSTR szString2, ULONG N, BOOL bCmpI) {
  1531. int Result = 0;
  1532. if (szString1 && szString2) {
  1533. if(bCmpI)
  1534. {
  1535. szString1 = CharUpper(szString1);
  1536. szString2 = CharUpper(szString2);
  1537. }
  1538. while (*szString1 && *szString2 && N)
  1539. {
  1540. N--;
  1541. if (*szString1 != *szString2)
  1542. {
  1543. Result = 1;
  1544. break;
  1545. }
  1546. szString1=CharNext(szString1);
  1547. szString2=CharNext(szString2);
  1548. }
  1549. } else {
  1550. Result = -1; // arbitrarily non-equal result
  1551. }
  1552. return(Result);
  1553. }
  1554. /************
  1555. //Fragment---
  1556. // Make a copy of our URL
  1557. lpsz = LocalAlloc(LMEM_ZEROINIT, lstrlen(szLDAPUrl)+1);
  1558. if(!lpsz)
  1559. goto exit;
  1560. lstrcpy(lpsz, szLDAPUrl);
  1561. // Since this is most likely a URL on an HTML page, we need to translate its escape
  1562. // characters to proper characters .. e.g. %20 becomes ' ' ..
  1563. {
  1564. lpszTmp = lpsz;
  1565. while(*lpszTmp)
  1566. {
  1567. if(*lpszTmp == '%')
  1568. {
  1569. int i;
  1570. for(i=0;i<MAX_ESC_CHAR;i++)
  1571. {
  1572. if(!StrICmpN(lpszTmp, (LPTSTR) szEsc[i], lstrlen(szEsc[i]), FALSE))
  1573. {
  1574. *lpszTmp = cEscChar[i];
  1575. lstrcpy(lpszTmp+1, lpszTmp+3);
  1576. break;
  1577. }
  1578. }
  1579. }
  1580. lpszTmp = CharNext(lpszTmp);
  1581. }
  1582. }
  1583. /*************/
  1584. #endif
  1585. #ifdef MIGRATELDAPACCTS
  1586. static const LPTSTR lpRegNewServer = TEXT("Software\\Microsoft\\WAB\\Server Properties");
  1587. static const LPTSTR lpNewServer = TEXT("NewServers");
  1588. //*******************************************************************
  1589. //
  1590. // FUNCTION: bNewServersAvailable
  1591. //
  1592. // PURPOSE: Checks if there are new servers to migrate
  1593. //
  1594. // RETURNS: BOOL
  1595. //
  1596. // COMMENTS: If new servers exist, resets the reg setting
  1597. //
  1598. //*******************************************************************
  1599. BOOL bNewServersAvailable()
  1600. {
  1601. HKEY hKey = NULL;
  1602. BOOL bRet = FALSE;
  1603. if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_CURRENT_USER, lpRegNewServer, 0, KEY_ALL_ACCESS, &hKey))
  1604. {
  1605. TCHAR szVal[16];
  1606. ULONG cbVal = 16;
  1607. DWORD dwType = 0;
  1608. if(ERROR_SUCCESS == RegQueryValueEx( hKey, lpNewServer, NULL, &dwType, (LPBYTE) szVal, &cbVal))
  1609. {
  1610. if(!lstrcmpi(szVal, "1"))
  1611. {
  1612. bRet = TRUE;
  1613. // Reset the FLAG
  1614. RegDeleteValue(hKey, lpNewServer);
  1615. }
  1616. }
  1617. }
  1618. if(hKey)
  1619. RegCloseKey(hKey);
  1620. return bRet;
  1621. }
  1622. if(bNewServersAvailable())
  1623. {
  1624. // Migrate the settings from the old WAB installation
  1625. MigrateOldLDAPAccounts(g_lpAccountManager, TRUE);
  1626. // Migrate the settings from the new Setup
  1627. // MigrateOldLDAPAccounts(g_lpAccountManager, FALSE);
  1628. }
  1629. //*******************************************************************
  1630. //
  1631. // FUNCTION: MigrateOldLDAPServer
  1632. //
  1633. // PURPOSE: Read in old WAB 3.0 LDAP account information, write
  1634. // it to the account manager and delete the old one.
  1635. //
  1636. // PARAMETERS: lpAccountManager -> initialized account manager object.
  1637. // hKeyServers = handle of old WAB/servers key
  1638. // lpszServer = name of server to migrate
  1639. //
  1640. // RETURNS: none
  1641. //
  1642. //*******************************************************************
  1643. void MigrateOldLDAPServer(IImnAccountManager * lpAccountManager,
  1644. HKEY hKeyServers, LPTSTR lpszServer) {
  1645. LDAPSERVERPARAMS spParams = {0};
  1646. DWORD dwErr, dwType, dwValue, dwSize;
  1647. HKEY hKey = NULL;
  1648. TCHAR szTemp[1];
  1649. LPBYTE lpbPassword = NULL;
  1650. // Set defaults for each value
  1651. spParams.dwSearchSizeLimit = LDAP_SEARCH_SIZE_LIMIT;
  1652. spParams.dwSearchTimeLimit = LDAP_SEARCH_TIME_LIMIT;
  1653. spParams.dwAuthMethod = LDAP_AUTH_METHOD_ANONYMOUS;
  1654. spParams.lpszUserName = NULL;
  1655. spParams.lpszPassword = NULL;
  1656. spParams.lpszURL = NULL;
  1657. spParams.lpszBase = NULL;
  1658. spParams.lpszName = NULL;
  1659. spParams.lpszLogoPath = NULL;
  1660. spParams.fResolve = FALSE;
  1661. spParams.dwID = 0xFFFFFFFF; // default to end
  1662. spParams.dwPort = LDAP_DEFAULT_PORT;
  1663. spParams.dwUseBindDN = 0;
  1664. spParams.fSimpleSearch = FALSE;
  1665. // Open the key for this LDAP server
  1666. if (dwErr = RegOpenKeyEx(hKeyServers,
  1667. lpszServer,
  1668. 0,
  1669. KEY_READ,
  1670. &hKey)) {
  1671. DebugTrace("Migrate couldn't open server key %s -> %u\n", lpszServer, dwErr);
  1672. return;
  1673. }
  1674. // Read server ID
  1675. dwErr = RegQueryValueExDWORD(hKey,
  1676. (LPTSTR)szLDAPServerID,
  1677. &dwValue);
  1678. if ((! dwErr) && dwValue) {
  1679. spParams.dwID = dwValue;
  1680. } else {
  1681. spParams.dwID = GetLDAPNextServerID(0);
  1682. }
  1683. // Read server search size limit
  1684. dwErr = RegQueryValueExDWORD(hKey,
  1685. (LPTSTR)szLDAPSearchSizeLimit,
  1686. &dwValue);
  1687. if ((! dwErr) && dwValue) {
  1688. spParams.dwSearchSizeLimit = dwValue;
  1689. }
  1690. // Read server search time limit
  1691. if (! RegQueryValueExDWORD(hKey,
  1692. (LPTSTR)szLDAPSearchTimeLimit,
  1693. &dwValue)) {
  1694. spParams.dwSearchTimeLimit = dwValue;
  1695. }
  1696. // Read the authentication type
  1697. if (! RegQueryValueExDWORD(hKey,
  1698. (LPTSTR)szLDAPAuthMethod,
  1699. &dwValue)) {
  1700. spParams.dwAuthMethod = dwValue;
  1701. }
  1702. // Read username and password if auth type is LDAP_AUTH_METHOD_SIMPLE
  1703. if (LDAP_AUTH_METHOD_SIMPLE == spParams.dwAuthMethod) {
  1704. // Read the user name
  1705. // BUGBUG: Should make a function out of this section for improved code size and readability!
  1706. dwSize = 1; // Expect ERROR_MORE_DATA
  1707. if (RegQueryValueEx(hKey,
  1708. (LPTSTR)szLDAPAuthUserName,
  1709. NULL,
  1710. &dwType,
  1711. szTemp,
  1712. &dwSize) == ERROR_MORE_DATA) {
  1713. // Allocate space for the string
  1714. if (spParams.lpszUserName = (LPTSTR)LocalAlloc(LPTR, dwSize + 1)) {
  1715. // Try again with sufficient buffer
  1716. RegQueryValueEx(hKey,
  1717. (LPTSTR)szLDAPAuthUserName,
  1718. NULL,
  1719. &dwType,
  1720. spParams.lpszUserName,
  1721. &dwSize);
  1722. }
  1723. }
  1724. // BUGBUG: END
  1725. // Read the password
  1726. dwSize = 1; // Expect ERROR_MORE_DATA
  1727. if (RegQueryValueEx(hKey,
  1728. (LPTSTR)szLDAPAuthPassword,
  1729. NULL,
  1730. &dwType,
  1731. szTemp,
  1732. &dwSize) == ERROR_MORE_DATA) {
  1733. // Allocate space for the string
  1734. if (lpbPassword = (LPBYTE)LocalAlloc(LPTR, dwSize + 1)) {
  1735. // Try again with sufficient buffer
  1736. if (! (dwErr = RegQueryValueEx(hKey,
  1737. (LPTSTR)szLDAPAuthPassword,
  1738. NULL,
  1739. &dwType,
  1740. lpbPassword,
  1741. &dwSize))) {
  1742. // Decrypt the password
  1743. EncryptDecryptText(lpbPassword, dwSize);
  1744. lpbPassword[dwSize] = '\0';
  1745. spParams.lpszPassword = (LPTSTR)lpbPassword;
  1746. }
  1747. }
  1748. }
  1749. // If user name is missing, use anonymous authentication.
  1750. if (NULL == spParams.lpszUserName) {
  1751. spParams.dwAuthMethod = LDAP_AUTH_METHOD_ANONYMOUS;
  1752. }
  1753. }
  1754. // Read Resolve flag
  1755. if (! RegQueryValueExDWORD(hKey,
  1756. (LPTSTR)szLDAPResolveFlag,
  1757. &dwValue)) {
  1758. spParams.fResolve = (BOOL)dwValue;
  1759. }
  1760. // Read the Search Base
  1761. dwSize = 1; // Expect ERROR_MORE_DATA
  1762. if (RegQueryValueEx(hKey,
  1763. (LPTSTR)szLDAPSearchBase,
  1764. NULL,
  1765. &dwType,
  1766. szTemp,
  1767. &dwSize) == ERROR_MORE_DATA) {
  1768. // Allocate space for the string
  1769. if (spParams.lpszBase = (LPTSTR)LocalAlloc(LPTR, dwSize + 1)) {
  1770. // Try again with sufficient buffer
  1771. RegQueryValueEx(hKey,
  1772. (LPTSTR)szLDAPSearchBase,
  1773. NULL,
  1774. &dwType,
  1775. spParams.lpszBase,
  1776. &dwSize);
  1777. }
  1778. }
  1779. // Read the Server Name
  1780. dwSize = 1; // Expect ERROR_MORE_DATA
  1781. if (RegQueryValueEx(hKey,
  1782. (LPTSTR)szLDAPServerName,
  1783. NULL,
  1784. &dwType,
  1785. szTemp,
  1786. &dwSize) == ERROR_MORE_DATA) {
  1787. // Allocate space for the string
  1788. if (spParams.lpszName = (LPTSTR)LocalAlloc(LPTR, dwSize + 1)) {
  1789. // Try again with sufficient buffer
  1790. RegQueryValueEx(hKey,
  1791. (LPTSTR)szLDAPServerName,
  1792. NULL,
  1793. &dwType,
  1794. spParams.lpszName,
  1795. &dwSize);
  1796. }
  1797. } else {
  1798. // use the given friendly name as the server name (this is for compatibility with when
  1799. // we didnt have friendly names ...
  1800. if (spParams.lpszName = (LPTSTR)LocalAlloc(LPTR, lstrlen(lpszServer) + 1)) {
  1801. lstrcpy(spParams.lpszName, lpszServer);
  1802. }
  1803. }
  1804. // Read the Server Info URL
  1805. dwSize = 1; // Expect ERROR_MORE_DATA
  1806. if (RegQueryValueEx(hKey,
  1807. (LPTSTR)szLDAPServerInfoURL,
  1808. NULL,
  1809. &dwType,
  1810. szTemp,
  1811. &dwSize) == ERROR_MORE_DATA) {
  1812. // Allocate space for the string
  1813. if (spParams.lpszURL = (LPTSTR)LocalAlloc(LPTR, dwSize)) {
  1814. // Try again with sufficient buffer
  1815. RegQueryValueEx(hKey,
  1816. (LPTSTR)szLDAPServerInfoURL,
  1817. NULL,
  1818. &dwType,
  1819. spParams.lpszURL,
  1820. &dwSize);
  1821. }
  1822. }
  1823. // Read the Advanced Search Attributes
  1824. dwSize = 1; // Expect ERROR_MORE_DATA
  1825. if (RegQueryValueEx(hKey,
  1826. (LPTSTR)szLDAPAdvancedSearchAttr,
  1827. NULL,
  1828. &dwType,
  1829. szTemp,
  1830. &dwSize) == ERROR_MORE_DATA) {
  1831. // Allocate space for the string
  1832. if (spParams.lpszAdvancedSearchAttr = (LPTSTR)LocalAlloc(LPTR, dwSize)) {
  1833. // Try again with sufficient buffer
  1834. RegQueryValueEx(hKey,
  1835. (LPTSTR)szLDAPAdvancedSearchAttr,
  1836. NULL,
  1837. &dwType,
  1838. spParams.lpszAdvancedSearchAttr,
  1839. &dwSize);
  1840. }
  1841. }
  1842. // Read the Server logo path
  1843. dwSize = 1; // Expect ERROR_MORE_DATA
  1844. if (RegQueryValueEx(hKey,
  1845. (LPTSTR)szLDAPServerLogoPath,
  1846. NULL,
  1847. &dwType,
  1848. szTemp,
  1849. &dwSize) == ERROR_MORE_DATA) {
  1850. // Allocate space for the string
  1851. if (spParams.lpszLogoPath = (LPTSTR)LocalAlloc(LPTR, dwSize)) {
  1852. // Try again with sufficient buffer
  1853. RegQueryValueEx(hKey,
  1854. (LPTSTR)szLDAPServerLogoPath,
  1855. NULL,
  1856. &dwType,
  1857. spParams.lpszLogoPath,
  1858. &dwSize);
  1859. }
  1860. }
  1861. // Read the LDAP port
  1862. if (! RegQueryValueExDWORD(hKey,
  1863. (LPTSTR)szLDAPPort,
  1864. &dwValue)) {
  1865. spParams.dwPort = dwValue;
  1866. }
  1867. // Read the use Bind DN setting
  1868. if (! RegQueryValueExDWORD(hKey,
  1869. (LPTSTR)szLDAPUseBindDN,
  1870. &dwValue)) {
  1871. spParams.dwUseBindDN = dwValue;
  1872. }
  1873. // Read the Simple Search setting
  1874. if (! RegQueryValueExDWORD(hKey,
  1875. (LPTSTR)szLDAPSimpleSearch,
  1876. &dwValue)) {
  1877. spParams.fSimpleSearch = (dwValue ? TRUE : FALSE);
  1878. }
  1879. RegCloseKey(hKey);
  1880. // Write it to the account manager
  1881. SetLDAPServerParams(
  1882. lpszServer,
  1883. &spParams);
  1884. // Delete the key
  1885. // BUGBUG: Won't work if key has sub-keys! (It shouldn't)
  1886. // IE4 - dont delete this setting as it is in HKLM
  1887. // RegDeleteKey(hKeyServers, lpszServer);
  1888. }
  1889. //*******************************************************************
  1890. //
  1891. // FUNCTION: MigrateOldLDAPAccounts
  1892. //
  1893. // PURPOSE: Read in old WAB 3.0 LDAP account information, write
  1894. // it to the account manager and delete it from the
  1895. // registry.
  1896. //
  1897. // PARAMETERS: lpAccountManager -> initialized account manager object.
  1898. // bMigrateOldWAB -> if TRUE migrates old wab settings from
  1899. // a v1 installation. if FALSE, migrates new
  1900. // accounts from HKLM setup during setup
  1901. // RETURNS: none
  1902. //
  1903. //*******************************************************************
  1904. void MigrateOldLDAPAccounts(IImnAccountManager * lpAccountManager,
  1905. BOOL bMigrateOldWAB)
  1906. {
  1907. BOOL bRet = FALSE;
  1908. HKEY hKeyWAB = NULL;
  1909. HKEY hKeyServers = NULL;
  1910. DWORD dwErr;
  1911. DWORD dwType;
  1912. DWORD dwSize;
  1913. TCHAR szBuffer[512];
  1914. ULONG cbBuffer;
  1915. DWORD dwValue = 0;
  1916. ULONG ulSize;
  1917. TCHAR szTemp[1];
  1918. LPBYTE lpbPassword;
  1919. DWORD cMigrated = 0;
  1920. LPTSTR szLDAPServers = NULL;
  1921. HRESULT hResult = hrSuccess;
  1922. DWORD dwIndex = 0;
  1923. // How many rows to migrate?
  1924. if (! (dwErr = RegOpenKeyEx((bMigrateOldWAB ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE),
  1925. szWABKey,
  1926. 0,
  1927. KEY_ALL_ACCESS,
  1928. &hKeyWAB))) {
  1929. if (! RegOpenKeyEx(hKeyWAB,
  1930. szLDAPServerPropsKey,
  1931. 0,
  1932. KEY_ALL_ACCESS,
  1933. &hKeyServers)) {
  1934. // There is a Servers key
  1935. // First, read in any servers which are "ordered"
  1936. ulSize = 1; // Expect ERROR_MORE_DATA
  1937. if (dwErr = RegQueryValueEx(hKeyWAB,
  1938. (LPTSTR)szAllLDAPServersValueName,
  1939. NULL,
  1940. &dwType,
  1941. szTemp,
  1942. &ulSize)) {
  1943. if (dwErr == ERROR_MORE_DATA) {
  1944. if (szLDAPServers = LocalAlloc(LPTR, ulSize)) {
  1945. szLDAPServers[0] = '\0'; // init to empty string
  1946. // Try again with sufficient buffer
  1947. if (! RegQueryValueEx(hKeyWAB,
  1948. szAllLDAPServersValueName,
  1949. NULL,
  1950. &dwType,
  1951. szLDAPServers,
  1952. &ulSize)) {
  1953. DebugTrace("Found LDAP server registry key\n");
  1954. #ifdef OLD_STUFF
  1955. switch (dwType) {
  1956. case REG_BINARY:
  1957. // Some thing (probably setup) has given us binary data.
  1958. case REG_MULTI_SZ:
  1959. break;
  1960. default:
  1961. // Ignore it
  1962. DebugTrace("Bad value of %s in registry\n", szAllLDAPServersValueName);
  1963. Assert(FALSE);
  1964. break;
  1965. }
  1966. #endif // OLD_STUFF
  1967. }
  1968. while (szLDAPServers && *szLDAPServers) {
  1969. MigrateOldLDAPServer(lpAccountManager, hKeyServers, szLDAPServers);
  1970. cMigrated++;
  1971. // move to next server in double null terminated string.
  1972. szLDAPServers += (lstrlen(szLDAPServers) + 1);
  1973. }
  1974. LocalFreeAndNull(&szLDAPServers);
  1975. // Get rid of the ordered servers key
  1976. // BUG - Dont delete v1 info
  1977. // RegDeleteValue(hKeyWAB, szAllLDAPServersValueName);
  1978. }
  1979. }
  1980. dwErr = 0;
  1981. }
  1982. dwIndex = 0;
  1983. // Then read in any extra servers
  1984. while (dwErr == 0) {
  1985. cbBuffer = sizeof(szBuffer);
  1986. if (dwErr = RegEnumKeyEx(hKeyServers,
  1987. dwIndex,
  1988. szBuffer, // put server name here
  1989. &cbBuffer,
  1990. NULL,
  1991. NULL,
  1992. 0,
  1993. NULL)) {
  1994. break; // done
  1995. }
  1996. // Got a name, migrate it
  1997. MigrateOldLDAPServer(lpAccountManager, hKeyServers, szBuffer);
  1998. cMigrated++;
  1999. dwIndex++;
  2000. }
  2001. if (cMigrated) {
  2002. DebugTrace("Migrated %u LDAP server names from registry\n", cMigrated);
  2003. }
  2004. RegCloseKey(hKeyServers);
  2005. }
  2006. RegCloseKey(hKeyWAB);
  2007. }
  2008. }
  2009. const LPTSTR szLDAPServersValueName = "LDAP Servers";
  2010. const LPTSTR szLDAPServerName = "Server Name";
  2011. const LPTSTR szLDAPServerInfoURL = "Server Information URL";
  2012. const LPTSTR szLDAPSearchBase = "Search Base";
  2013. const LPTSTR szLDAPServerPropsKey = "Server Properties";
  2014. const LPTSTR szLDAPSearchSizeLimit = "Search Size Limit";
  2015. const LPTSTR szLDAPSearchTimeLimit = "Search Time Limit";
  2016. const LPTSTR szLDAPServerLogoPath = "Logo";
  2017. const LPTSTR szLDAPClientSearchTimeout = "Client Search Timeout";
  2018. const LPTSTR szLDAPDefaultAuthMethod = "Default Authentication Method";
  2019. const LPTSTR szLDAPAuthMethod = "Authentication Method";
  2020. const LPTSTR szLDAPAuthUserName = "User Name";
  2021. const LPTSTR szLDAPAuthPassword = "Password";
  2022. const LPTSTR szLDAPResolveFlag = "Resolve";
  2023. const LPTSTR szLDAPServerID = "ServerID";
  2024. const LPTSTR szLDAPNextAvailableServerID = "Server ID";
  2025. const LPTSTR szLDAPPort = "Port";
  2026. const LPTSTR szLDAPUseBindDN = "Bind DN";
  2027. const LPTSTR szLDAPSimpleSearch = "Simple Search";
  2028. const LPTSTR szLDAPAdvancedSearchAttr = "Advanced Search Attributes";
  2029. extern const LPTSTR szLDAPServersValueName;
  2030. extern const LPTSTR szLDAPServerPropsKey;
  2031. extern const LPTSTR szLDAPSearchSizeLimit;
  2032. extern const LPTSTR szLDAPSearchTimeLimit;
  2033. extern const LPTSTR szLDAPClientSearchTimeout;
  2034. extern const LPTSTR szLDAPDefaultAuthMethod;
  2035. extern const LPTSTR szLDAPAuthMethod;
  2036. extern const LPTSTR szLDAPAuthUserName;
  2037. extern const LPTSTR szLDAPAuthPassword;
  2038. extern const LPTSTR szLDAPResolveFlag;
  2039. extern const LPTSTR szLDAPServerName;
  2040. extern const LPTSTR szLDAPServerInfoURL;
  2041. extern const LPTSTR szLDAPServerLogoPath;
  2042. extern const LPTSTR szLDAPSearchBase;
  2043. extern const LPTSTR szLDAPNextAvailableServerID;
  2044. extern const LPTSTR szLDAPServerID;
  2045. extern const LPTSTR szLDAPPort;
  2046. extern const LPTSTR szLDAPUseBindDN;
  2047. extern const LPTSTR szLDAPSimpleSearch;
  2048. extern const LPTSTR szLDAPAdvancedSearchAttr;
  2049. #endif
  2050. #ifdef mutil_c
  2051. #ifdef OLD_STUFF
  2052. /***************************************************************************
  2053. Name : ReleaseAndNull
  2054. Purpose : Releases an object and NULLs the pointer
  2055. Parameters: lppv = pointer to pointer to object to release
  2056. Returns : void
  2057. Comment : Remember to pass in the pointer to the pointer. The
  2058. compiler is not smart enough to tell if you are doing this
  2059. right or not, but you will know at runtime!
  2060. BUGBUG: Make this fastcall!
  2061. ***************************************************************************/
  2062. void __fastcall ReleaseAndNull(LPVOID * lppv) {
  2063. LPUNKNOWN * lppunk = (LPUNKNOWN *)lppv;
  2064. if (lppunk) {
  2065. if (*lppunk) {
  2066. HRESULT hResult;
  2067. if (hResult = (*lppunk)->lpVtbl->Release(*lppunk)) {
  2068. DebugTrace("Release(%x) -> %s\n", *lppunk, SzDecodeScode(GetScode(hResult)));
  2069. }
  2070. *lppunk = NULL;
  2071. }
  2072. }
  2073. }
  2074. /***************************************************************************
  2075. Name : MergeProblemArrays
  2076. Purpose : Merge a problem array into another
  2077. Parameters: lpPaDest -> destination problem array
  2078. lpPaSource -> source problem array
  2079. cDestMax = total number of problem slots in lpPaDest. This
  2080. includes those in use (lpPaDest->cProblem) and those not
  2081. yet in use.
  2082. Returns : none
  2083. Comment :
  2084. ***************************************************************************/
  2085. void MergeProblemArrays(LPSPropProblemArray lpPaDest,
  2086. LPSPropProblemArray lpPaSource, ULONG cDestMax) {
  2087. ULONG i, j;
  2088. ULONG cDest;
  2089. ULONG cDestRemaining;
  2090. cDest = lpPaDest->cProblem;
  2091. cDestRemaining = cDestMax - cDest;
  2092. // Loop through the source problems, copying the non-duplicates into dest
  2093. for (i = 0; i < lpPaSource->cProblem; i++) {
  2094. // Search the Dest problem array for the same property
  2095. for (j = 0; j < cDest; j++) {
  2096. // should just compare PROP_IDs here, since we may be overwriting
  2097. // some of the proptypes with PT_NULL elsewhere.
  2098. if (PROP_ID(lpPaSource->aProblem[i].ulPropTag) == PROP_ID(lpPaDest->aProblem[j].ulPropTag)) {
  2099. break; // Found a match, don't copy this one. Move along.
  2100. }
  2101. }
  2102. if (j == lpPaDest->cProblem) {
  2103. Assert(cDestRemaining);
  2104. if (cDestRemaining) {
  2105. // No matches, copy this problem from Source to Dest
  2106. lpPaDest->aProblem[lpPaDest->cProblem++] = lpPaSource->aProblem[i];
  2107. cDestRemaining--;
  2108. } else {
  2109. DebugTrace("MergeProblemArrays ran out of problem slots!\n");
  2110. }
  2111. }
  2112. }
  2113. }
  2114. /***************************************************************************
  2115. Name : MapObjectNamedProps
  2116. Purpose : Map the named properties WAB cares about into the object.
  2117. Parameters: lpmp -> IMAPIProp object
  2118. lppPropTags -> returned array of property tags. Note: Must
  2119. be MAPIFreeBuffer'd by caller.
  2120. Returns : none
  2121. Comment : What a pain in the butt!
  2122. We could conceivably improve performance here by caching the
  2123. returned table and comparing the object's PR_MAPPING_SIGNATURE
  2124. against the cache.
  2125. ***************************************************************************/
  2126. HRESULT MapObjectNamedProps(LPMAPIPROP lpmp, LPSPropTagArray * lppPropTags) {
  2127. static GUID guidWABProps = { /* efa29030-364e-11cf-a49b-00aa0047faa4 */
  2128. 0xefa29030,
  2129. 0x364e,
  2130. 0x11cf,
  2131. {0xa4, 0x9b, 0x00, 0xaa, 0x00, 0x47, 0xfa, 0xa4}
  2132. };
  2133. ULONG i;
  2134. LPMAPINAMEID lppmnid[eMaxNameIDs] = {NULL};
  2135. MAPINAMEID rgmnid[eMaxNameIDs] = {0};
  2136. HRESULT hResult = hrSuccess;
  2137. // Loop through each property, setting up the NAME ID structures
  2138. for (i = 0; i < eMaxNameIDs; i++) {
  2139. rgmnid[i].lpguid = &guidWABProps;
  2140. rgmnid[i].ulKind = MNID_STRING; // Unicode String
  2141. rgmnid[i].Kind.lpwstrName = rgPropNames[i];
  2142. lppmnid[i] = &rgmnid[i];
  2143. }
  2144. if (hResult = lpmp->lpVtbl->GetIDsFromNames(lpmp,
  2145. eMaxNameIDs, // how many?
  2146. lppmnid,
  2147. MAPI_CREATE, // create them if they don't already exist
  2148. lppPropTags)) {
  2149. if (HR_FAILED(hResult)) {
  2150. DebugTrace("GetIDsFromNames -> %s\n", SzDecodeScode(GetScode(hResult)));
  2151. goto exit;
  2152. } else {
  2153. DebugTrace("GetIDsFromNames -> %s\n", SzDecodeScode(GetScode(hResult)));
  2154. }
  2155. }
  2156. Assert((*lppPropTags)->cValues == eMaxNameIDs);
  2157. DebugTrace("PropTag\t\tType\tProp Name\n");
  2158. // Loop through the property tags, filling in their property types.
  2159. for (i = 0; i < eMaxNameIDs; i++) {
  2160. (*lppPropTags)->aulPropTag[i] = CHANGE_PROP_TYPE((*lppPropTags)->aulPropTag[i],
  2161. PROP_TYPE(rgulNamedPropTags[i]));
  2162. #ifdef DEBUG
  2163. {
  2164. TCHAR szBuffer[257];
  2165. WideCharToMultiByte(CP_ACP, 0, rgPropNames[i], -1, szBuffer, 257, NULL, NULL);
  2166. DebugTrace("%08x\t%s\t%s\n", (*lppPropTags)->aulPropTag[i],
  2167. PropTypeString(PROP_TYPE((*lppPropTags)->aulPropTag[i])), szBuffer);
  2168. }
  2169. #endif
  2170. }
  2171. exit:
  2172. return(hResult);
  2173. }
  2174. /***************************************************************************
  2175. Name : PreparePropTagArray
  2176. Purpose : Prepare a prop tag array by replacing placeholder props tags
  2177. with their named property tags.
  2178. Parameters: ptaStatic = static property tag array (input)
  2179. pptaReturn -> returned prop tag array (output)
  2180. pptaNamedProps -> returned array of named property tags
  2181. Three possibilities here:
  2182. + NULL pointer: no input PTA or output named
  2183. props PTA is returned. This is less efficient since
  2184. it must call MAPI to get the named props array.
  2185. + good pointer to NULL pointer: no input PTA, but
  2186. will return a good PTA of named props which can
  2187. be used in later calls on this object for faster
  2188. operation.
  2189. + good pointer to good pointer. Use the input PTA instead
  2190. of calling MAPI to map props. Returned contents must
  2191. be freed with MAPIFreeBuffer.
  2192. lpObject = object that the properties apply to. Required if
  2193. no input *pptaNamedProps is supplied, otherwise, NULL.
  2194. Returns : HRESULT
  2195. Comment :
  2196. ***************************************************************************/
  2197. HRESULT PreparePropTagArray(LPSPropTagArray ptaStatic, LPSPropTagArray * pptaReturn,
  2198. LPSPropTagArray * pptaNamedProps, LPMAPIPROP lpObject) {
  2199. HRESULT hResult = hrSuccess;
  2200. ULONG cbpta;
  2201. LPSPropTagArray ptaTemp = NULL;
  2202. LPSPropTagArray ptaNamedProps;
  2203. ULONG i;
  2204. if (pptaNamedProps) {
  2205. // input Named Props PTA
  2206. ptaNamedProps = *pptaNamedProps;
  2207. } else {
  2208. ptaNamedProps = NULL;
  2209. }
  2210. if (! ptaNamedProps) {
  2211. if (! lpObject) {
  2212. DebugTrace("PreoparePropTagArray both lpObject and ptaNamedProps are NULL\n");
  2213. hResult = ResultFromScode(E_INVALIDARG);
  2214. goto exit;
  2215. }
  2216. // Map the property names into the object
  2217. if (hResult = MapObjectNamedProps(lpObject, &ptaTemp)) {
  2218. DebugTrace("PreoparePropTagArray both lpObject and ptaNamedProps are NULL\n");
  2219. goto exit;
  2220. }
  2221. }
  2222. if (pptaReturn) {
  2223. // Allocate a return pta
  2224. cbpta = sizeof(SPropTagArray) + ptaStatic->cValues * sizeof(ULONG);
  2225. if ((*pptaReturn = WABAlloc(cbpta)) == NULL) {
  2226. DebugTrace("PreparePropTagArray WABAlloc(%u) failed\n", cbpta);
  2227. hResult = ResultFromScode(E_OUTOFMEMORY);
  2228. goto exit;
  2229. }
  2230. (*pptaReturn)->cValues = ptaStatic->cValues;
  2231. // Walk through the ptaStatic looking for named property placeholders.
  2232. for (i = 0; i < ptaStatic->cValues; i++) {
  2233. if (IS_PLACEHOLDER(ptaStatic->aulPropTag[i])) {
  2234. // Found a placeholder. Turn it into a true property tag
  2235. Assert(PLACEHOLDER_INDEX(ptaStatic->aulPropTag[i]) < ptaNamedProps->cValues);
  2236. (*pptaReturn)->aulPropTag[i] =
  2237. ptaNamedProps->aulPropTag[PLACEHOLDER_INDEX(ptaStatic->aulPropTag[i])];
  2238. } else {
  2239. (*pptaReturn)->aulPropTag[i] = ptaStatic->aulPropTag[i];
  2240. }
  2241. }
  2242. }
  2243. exit:
  2244. if (hResult || ! pptaNamedProps) {
  2245. FreeBufferAndNull(&ptaTemp);
  2246. } else {
  2247. // Client is responsible for freeing this.
  2248. *pptaNamedProps = ptaNamedProps;
  2249. }
  2250. return(hResult);
  2251. }
  2252. /***************************************************************************
  2253. Name : OpenCreateProperty
  2254. Purpose : Open an interface on a property or create if non-existent.
  2255. Parameters: lpmp -> IMAPIProp object to open prop on
  2256. ulPropTag = property tag to open
  2257. lpciid -> interface identifier
  2258. ulInterfaceOptions = interface specific flags
  2259. ulFlags = MAPI_MODIFY?
  2260. lppunk -> return the object here
  2261. Returns : HRESULT
  2262. Comment : Caller is responsible for Release'ing the returned object.
  2263. ***************************************************************************/
  2264. HRESULT OpenCreateProperty(LPMAPIPROP lpmp,
  2265. ULONG ulPropTag,
  2266. LPCIID lpciid,
  2267. ULONG ulInterfaceOptions,
  2268. ULONG ulFlags,
  2269. LPUNKNOWN * lppunk) {
  2270. HRESULT hResult;
  2271. if (hResult = lpmp->lpVtbl->OpenProperty(
  2272. lpmp,
  2273. ulPropTag,
  2274. lpciid,
  2275. ulInterfaceOptions,
  2276. ulFlags,
  2277. (LPUNKNOWN *)lppunk)) {
  2278. DebugTrace("OpenCreateProperty:OpenProperty(%s)-> %s\n", PropTagName(ulPropTag), SzDecodeScode(GetScode(hResult)));
  2279. // property doesn't exist... try to create it
  2280. if (hResult = lpmp->lpVtbl->OpenProperty(
  2281. lpmp,
  2282. ulPropTag,
  2283. lpciid,
  2284. ulInterfaceOptions,
  2285. MAPI_CREATE | ulFlags,
  2286. (LPUNKNOWN *)lppunk)) {
  2287. DebugTrace("OpenCreateProperty:OpenProperty(%s, MAPI_CREATE)-> %s\n", PropTagName(ulPropTag), SzDecodeScode(GetScode(hResult)));
  2288. }
  2289. }
  2290. return(hResult);
  2291. }
  2292. #endif // OLD_STUFF
  2293. #endif // mutil_c
  2294. #ifdef rk_c
  2295. #ifdef OLD_STUFF
  2296. //#ifdef OLDSTUFF_DBCS
  2297. #define chVoiced 0xde //Japanese specific
  2298. #define chVoiceless 0xdf //Japanese specific
  2299. #define chDbcsVoiced 0x814a //Japanese specific
  2300. #define chDbcsVoiceless 0x814b //Japanese specific
  2301. #define LangJPN 0x0411
  2302. /* =========================================================
  2303. * ulcbStrCount()
  2304. *
  2305. * Count the byte from szSource and ulChrLen
  2306. *
  2307. * usChrLen : Char Count not bytes count
  2308. */
  2309. ULONG
  2310. ulcbStrCount (LPTSTR szSource , ULONG ulChrLen, LANGID langID)
  2311. {
  2312. ULONG ulb = 0;
  2313. ULONG ulch = ulChrLen;
  2314. LPTSTR sz = szSource;
  2315. while(ulch && *sz)
  2316. {
  2317. if (IsDBCSLeadByte(*sz))
  2318. {
  2319. if (langID != LangJPN ||
  2320. ((*(UNALIGNED WORD*)sz != (WORD)chDbcsVoiced) && (*(UNALIGNED WORD*)sz != (WORD)chDbcsVoiceless)))
  2321. ulch--;
  2322. sz += 2;
  2323. ulb += 2;
  2324. }
  2325. else
  2326. {
  2327. if (langID != LangJPN ||
  2328. ((*sz != chVoiced) && (*sz != chVoiceless)))
  2329. ulch--;
  2330. sz++;
  2331. ulb++;
  2332. }
  2333. }
  2334. return ulb;
  2335. }
  2336. /* ========================================================
  2337. ulchStrCount
  2338. Count the Charctor from szSource and ulBLen
  2339. ulBLen is bytes counts
  2340. */
  2341. ULONG
  2342. ulchStrCount (LPTSTR szSource, ULONG ulBLen, LANGID langID)
  2343. {
  2344. ULONG ulb = ulBLen;
  2345. ULONG ulch = 0;
  2346. LPTSTR sz = szSource;
  2347. while(ulb && *sz)
  2348. {
  2349. if (IsDBCSLeadByte(*sz))
  2350. {
  2351. if (langID != LangJPN ||
  2352. ((*(UNALIGNED WORD*)sz != (WORD)chDbcsVoiced) && (*(UNALIGNED WORD*)sz != (WORD)chDbcsVoiceless)))
  2353. ulch++;
  2354. sz += 2;
  2355. ulb -= 2;
  2356. }
  2357. else
  2358. {
  2359. if (langID != LangJPN ||
  2360. ((*sz != chVoiced) && (*sz != chVoiceless)))
  2361. ulch++;
  2362. sz++;
  2363. ulb--;
  2364. }
  2365. }
  2366. return ulch;
  2367. }
  2368. /* =========================================================
  2369. * ulcbEndCount()
  2370. *
  2371. * Count the byte from szSource and ulChrLen
  2372. *
  2373. * usChrLen : Char Count not bytes count
  2374. */
  2375. ULONG
  2376. ulcbEndCount(LPSTR szTarget, ULONG cbTarget, ULONG cchPattern, LANGID langID)
  2377. {
  2378. LPBYTE szStart;
  2379. ULONG cbEndTarget = 0;
  2380. if (cbTarget < cchPattern)
  2381. return 0;
  2382. // This is to get the reasonable starting pointer of the string,
  2383. // so we can imporve the performance in the SzGPrev().
  2384. while(cbTarget > (cchPattern * 2))
  2385. {
  2386. if (IsDBCSLeadByte(*szTarget))
  2387. {
  2388. cbTarget -= 2;
  2389. szTarget += 2;
  2390. }
  2391. else
  2392. {
  2393. cbTarget --;
  2394. szTarget ++;
  2395. }
  2396. }
  2397. szStart = szTarget;
  2398. szTarget= szTarget + cbTarget;
  2399. while (cchPattern > 0)
  2400. {
  2401. const LPBYTE szTargetOrg = szTarget;
  2402. szTarget = SzGPrev(szStart, szTarget);
  2403. if(szTarget + 2 == szTargetOrg) // same as if (IsDBCSLeadByte(szTarget))
  2404. {
  2405. if (langID != LangJPN ||
  2406. ((*(UNALIGNED WORD*)szTarget != (WORD)chDbcsVoiced) && (*(UNALIGNED WORD*)szTarget != (WORD)chDbcsVoiceless)))
  2407. cchPattern --;
  2408. cbEndTarget++;
  2409. }
  2410. else if (*szTarget != chVoiced && *szTarget != chVoiceless)
  2411. {
  2412. cchPattern --;
  2413. }
  2414. cbEndTarget++;
  2415. }
  2416. return cbEndTarget;
  2417. }
  2418. //#endif // DBCS
  2419. #endif //OLD_STUFF
  2420. #ifdef OLD_STUFF
  2421. #if defined(WIN16)
  2422. #pragma warning(disable:4505) /* unreferenced local fuction removed */
  2423. #elif defined(WIN32)
  2424. #pragma warning(disable:4514) /* unreferenced inline function removed */
  2425. #endif // OLD_STUFF
  2426. #endif
  2427. #endif //rk_c
  2428. #ifdef _runt_h
  2429. #ifdef OLD_STUFF
  2430. // CRC-32 implementation (yet another)
  2431. ULONG UlCrc(UINT cb, LPBYTE pb);
  2432. #endif
  2433. #endif
  2434. #ifdef _runt_c
  2435. #ifdef OLD_STUFF
  2436. STDAPI_(LPTSTR)
  2437. SzFindCh(LPCTSTR sz, USHORT ch)
  2438. {
  2439. AssertSz(!IsBadStringPtr(sz, INFINITE), "SzFindCh: sz fails address check");
  2440. #ifdef OLDSTUFF_DBCS
  2441. return SzGFindCh(sz, ch);
  2442. #else
  2443. for (;;)
  2444. {
  2445. if (FIsNextCh(sz, ch))
  2446. return (LPTSTR) sz;
  2447. else if (!*sz)
  2448. return NULL;
  2449. else
  2450. sz = TCharNext(sz);
  2451. }
  2452. #endif
  2453. }
  2454. #endif // OLD_STUFF
  2455. #ifdef OLD_STUFF
  2456. STDAPI_(LPTSTR)
  2457. SzFindLastCh(LPCTSTR sz, USHORT ch)
  2458. {
  2459. LPTSTR szLast = NULL;
  2460. LPTSTR szNext = (LPTSTR) sz;
  2461. AssertSz(!IsBadStringPtr(sz, INFINITE), "SzFindLastCh: sz fails address check");
  2462. #ifdef OLDSTUFF_DBCS
  2463. szNext = sz + CbGSzLen(sz) - 2;
  2464. return SzGFindBackCh(sz, szNext, ch);
  2465. #else
  2466. do {
  2467. if (szNext = SzFindCh(szNext, ch)) {
  2468. szLast = szNext;
  2469. szNext = TCharNext(szNext);
  2470. }
  2471. } while (szNext);
  2472. return szLast;
  2473. #endif
  2474. }
  2475. #endif //OLD_STUFF
  2476. #ifdef OLD_STUFF
  2477. STDAPI_(LPTSTR)
  2478. SzFindSz(LPCTSTR sz, LPCTSTR szKey)
  2479. {
  2480. AssertSz(!IsBadStringPtr(sz, 0xFFFF), "SzFindSz: sz fails address check");
  2481. AssertSz(!IsBadStringPtr(szKey, 0xFFFF), "SzFindSz: szKey fails address check");
  2482. #ifdef OLDSTUFF_DBCS
  2483. return (LPTSTR)LpszRKFindSubpsz ((LPSTR)sz,
  2484. CchGSzLen(sz),
  2485. (LPSTR)szKey,
  2486. CchGSzLen(szKey),
  2487. 0);
  2488. #else
  2489. return (LPTSTR)LpszRKFindSubpsz ((LPSTR)sz,
  2490. lstrlen(sz),
  2491. (LPSTR)szKey,
  2492. lstrlen(szKey),
  2493. 0);
  2494. #endif
  2495. }
  2496. #endif // OLD_STUFF
  2497. #endif _runt_c
  2498. #ifdef structs_h
  2499. #ifdef OLD_STUFF
  2500. /************************ IABProvider ***********************************/
  2501. typedef struct _tagIABProvider_Shutdown_Params
  2502. {
  2503. LPVOID This;
  2504. ULONG FAR * lpulFlags;
  2505. } IABProvider_Shutdown_Params, FAR * LPIABProvider_Shutdown_Params;
  2506. typedef struct _tagIABProvider_Logon_Params
  2507. {
  2508. LPVOID This;
  2509. LPMAPISUP lpMAPISup;
  2510. ULONG ulUIParam;
  2511. LPTSTR lpszProfileName;
  2512. ULONG ulFlags;
  2513. ULONG FAR * lpulpcbSecurity;
  2514. LPBYTE FAR * lppbSecurity;
  2515. LPMAPIERROR FAR * lppMapiError;
  2516. LPABLOGON FAR * lppABLogon;
  2517. } IABProvider_Logon_Params, FAR * LPIABProvider_Logon_Params;
  2518. /************************* IABLogon *************************************/
  2519. typedef struct _tagIABLogon_GetLastError_Params
  2520. {
  2521. LPVOID This;
  2522. HRESULT hResult;
  2523. ULONG ulFlags;
  2524. LPMAPIERROR FAR * lppMAPIError;
  2525. } IABLogon_GetLastError_Params, FAR * LPIABLogon_GetLastError_Params;
  2526. typedef struct _tagIABLogon_Logoff_Params
  2527. {
  2528. LPVOID This;
  2529. ULONG ulFlags;
  2530. } IABLogon_Logoff_Params, FAR * LPIABLogon_Logoff_Params;
  2531. typedef struct _tagIABLogon_OpenEntry_Params
  2532. {
  2533. LPVOID This;
  2534. ULONG cbEntryID;
  2535. LPENTRYID lpEntryID;
  2536. LPIID lpInterface;
  2537. ULONG ulFlags;
  2538. ULONG FAR * lpulObjType;
  2539. LPUNKNOWN FAR * lppUnk;
  2540. } IABLogon_OpenEntry_Params, FAR * LPIABLogon_OpenEntry_Params;
  2541. typedef struct _tagIABLogon_CompareEntryIDs_Params
  2542. {
  2543. LPVOID This;
  2544. ULONG cbEntryID1;
  2545. LPENTRYID lpEntryID1;
  2546. ULONG cbEntryID2;
  2547. LPENTRYID lpEntryID2;
  2548. ULONG ulFlags;
  2549. ULONG FAR * lpulResult;
  2550. } IABLogon_CompareEntryIDs_Params, FAR * LPIABLogon_CompareEntryIDs_Params;
  2551. typedef struct _tagIABLogon_Advise_Params
  2552. {
  2553. LPVOID This;
  2554. ULONG cbEntryID;
  2555. LPENTRYID lpEntryID;
  2556. ULONG ulEventMask;
  2557. LPMAPIADVISESINK lpAdviseSink;
  2558. ULONG FAR * lpulConnection;
  2559. } IABLogon_Advise_Params, FAR * LPIABLogon_Advise_Params;
  2560. typedef struct _tagIABLogon_Unadvise_Params
  2561. {
  2562. LPVOID This;
  2563. ULONG ulConnection;
  2564. } IABLogon_Unadvise_Params, FAR * LPIABLogon_Unadvise_Params;
  2565. typedef struct _tagIABLogon_OpenStatusEntry_Params
  2566. {
  2567. LPVOID This;
  2568. LPIID lpInterface;
  2569. ULONG ulFlags;
  2570. ULONG FAR * lpulObjType;
  2571. LPMAPISTATUS FAR * lppEntry;
  2572. } IABLogon_OpenStatusEntry_Params, FAR * LPIABLogon_OpenStatusEntry_Params;
  2573. typedef struct _tagIABLogon_OpenTemplateID_Params
  2574. {
  2575. LPVOID This;
  2576. ULONG cbTemplateID;
  2577. LPENTRYID lpTemplateID;
  2578. ULONG ulTemplateFlags;
  2579. LPMAPIPROP lpMAPIPropData;
  2580. LPIID lpInterface;
  2581. LPMAPIPROP FAR * lppMAPIPropNew;
  2582. LPMAPIPROP lpMAPIPropSibling;
  2583. } IABLogon_OpenTemplateID_Params, FAR * LPIABLogon_OpenTemplateID_Params;
  2584. typedef struct _tagIABLogon_GetOneOffTable_Params
  2585. {
  2586. LPVOID This;
  2587. ULONG ulFlags;
  2588. LPMAPITABLE FAR * lppTable;
  2589. } IABLogon_GetOneOffTable_Params, FAR * LPIABLogon_GetOneOffTable_Params;
  2590. typedef struct _tagIABLogon_PrepareRecips_Params
  2591. {
  2592. LPVOID This;
  2593. ULONG ulFlags;
  2594. LPSPropTagArray lpPropTagArray;
  2595. LPADRLIST lpRecipList;
  2596. } IABLogon_PrepareRecips_Params, FAR * LPIABLogon_PrepareRecips_Params;
  2597. /*********************** IXPProvider ************************************/
  2598. typedef struct _tagIXPProvider_Shutdown_Params
  2599. {
  2600. LPVOID This;
  2601. ULONG FAR * lpulFlags;
  2602. } IXPProvider_Shutdown_Params, FAR * LPIXPProvider_Shutdown_Params;
  2603. typedef struct _tagIXPProvider_TransportLogon_Params
  2604. {
  2605. LPVOID This;
  2606. LPMAPISUP lpMAPISup;
  2607. ULONG ulUIParam;
  2608. LPTSTR lpszProfileName;
  2609. ULONG FAR * lpulFlags;
  2610. LPMAPIERROR FAR * lppMapiError;
  2611. LPXPLOGON FAR * lppXPLogon;
  2612. } IXPProvider_TransportLogon_Params, FAR * LPIXPProvider_TransportLogon_Params;
  2613. /************************ IXPLogon **************************************/
  2614. typedef struct _tagIXPLogon_AddressTypes_Params
  2615. {
  2616. LPVOID This;
  2617. ULONG FAR * lpulFlags;
  2618. ULONG FAR * lpcAdrType;
  2619. LPTSTR FAR * FAR * lpppAdrTypeArray;
  2620. ULONG FAR * lpcMAPIUID;
  2621. LPMAPIUID FAR * FAR * lpppUIDArray;
  2622. } IXPLogon_AddressTypes_Params, FAR * LPIXPLogon_AddressTypes_Params;
  2623. typedef struct _tagIXPLogon_RegisterOptions_Params
  2624. {
  2625. LPVOID This;
  2626. ULONG FAR * lpulFlags;
  2627. ULONG FAR * lpcOptions;
  2628. LPOPTIONDATA FAR * lppOptions;
  2629. } IXPLogon_RegisterOptions_Params, FAR * LPIXPLogon_RegisterOptions_Params;
  2630. typedef struct _tagIXPLogon_TransportNotify_Params
  2631. {
  2632. LPVOID This;
  2633. ULONG FAR * lpulFlags;
  2634. LPVOID FAR * lppvData;
  2635. } IXPLogon_TransportNotify_Params, FAR * LPIXPLogon_TransportNotify_Params;
  2636. typedef struct _tagIXPLogon_Idle_Params
  2637. {
  2638. LPVOID This;
  2639. ULONG ulFlags;
  2640. } IXPLogon_Idle_Params, FAR * LPIXPLogon_Idle_Params;
  2641. typedef struct _tagIXPLogon_TransportLogoff_Params
  2642. {
  2643. LPVOID This;
  2644. ULONG ulFlags;
  2645. } IXPLogon_TransportLogoff_Params, FAR * LPIXPLogon_TransportLogoff_Params;
  2646. typedef struct _tagIXPLogon_SubmitMessage_Params
  2647. {
  2648. LPVOID This;
  2649. ULONG ulFlags;
  2650. LPMESSAGE lpMessage;
  2651. ULONG FAR * lpulMsgRef;
  2652. ULONG FAR * lpulReturnParm;
  2653. } IXPLogon_SubmitMessage_Params, FAR * LPIXPLogon_SubmitMessage_Params;
  2654. typedef struct _tagIXPLogon_EndMessage_Params
  2655. {
  2656. LPVOID This;
  2657. ULONG ulMsgRef;
  2658. ULONG FAR * lpulFlags;
  2659. } IXPLogon_EndMessage_Params, FAR * LPIXPLogon_EndMessage_Params;
  2660. typedef struct _tagIXPLogon_Poll_Params
  2661. {
  2662. LPVOID This;
  2663. ULONG FAR * lpulIncoming;
  2664. } IXPLogon_Poll_Params, FAR * LPIXPLogon_Poll_Params;
  2665. typedef struct _tagIXPLogon_StartMessage_Params
  2666. {
  2667. LPVOID This;
  2668. ULONG ulFlags;
  2669. LPMESSAGE lpMessage;
  2670. ULONG FAR * lpulMsgRef;
  2671. } IXPLogon_StartMessage_Params, FAR * LPIXPLogon_StartMessage_Params;
  2672. typedef struct _tagIXPLogon_OpenStatusEntry_Params
  2673. {
  2674. LPVOID This;
  2675. LPIID lpInterface;
  2676. ULONG ulFlags;
  2677. ULONG FAR * lpulObjType;
  2678. LPMAPISTATUS FAR * lppEntry;
  2679. } IXPLogon_OpenStatusEntry_Params, FAR * LPIXPLogon_OpenStatusEntry_Params;
  2680. typedef struct _tagIXPLogon_ValidateState_Params
  2681. {
  2682. LPVOID This;
  2683. ULONG ulUIParam;
  2684. ULONG ulFlags;
  2685. } IXPLogon_ValidateState_Params, FAR * LPIXPLogon_ValidateState_Params;
  2686. typedef struct _tagIXPLogon_FlushQueues_Params
  2687. {
  2688. LPVOID This;
  2689. ULONG ulUIParam;
  2690. ULONG cbTargetTransport;
  2691. LPENTRYID lpTargetTransport;
  2692. ULONG ulFlags;
  2693. } IXPLogon_FlushQueues_Params, FAR * LPIXPLogon_FlushQueues_Params;
  2694. /*********************** IMSProvider ************************************/
  2695. typedef struct _tagIMSProvider_Shutdown_Params
  2696. {
  2697. LPVOID This;
  2698. ULONG FAR * lpulFlags;
  2699. } IMSProvider_Shutdown_Params, FAR * LPIMSProvider_Shutdown_Params;
  2700. typedef struct _tagIMSProvider_Logon_Params
  2701. {
  2702. LPVOID This;
  2703. LPMAPISUP lpMAPISup;
  2704. ULONG ulUIParam;
  2705. LPTSTR lpszProfileName;
  2706. ULONG cbEntryID;
  2707. LPENTRYID lpEntryID;
  2708. ULONG ulFlags;
  2709. LPIID lpInterface;
  2710. ULONG FAR * lpcbSpoolSecurity;
  2711. LPBYTE FAR * lppbSpoolSecurity;
  2712. LPMAPIERROR FAR * lppMapiError;
  2713. LPMSLOGON FAR * lppMSLogon;
  2714. LPMDB FAR * lppMDB;
  2715. } IMSProvider_Logon_Params, FAR * LPIMSProvider_Logon_Params;
  2716. typedef struct _tagIMSProvider_SpoolerLogon_Params
  2717. {
  2718. LPVOID This;
  2719. LPMAPISUP lpMAPISup;
  2720. ULONG ulUIParam;
  2721. LPTSTR lpszProfileName;
  2722. ULONG cbEntryID;
  2723. LPENTRYID lpEntryID;
  2724. ULONG ulFlags;
  2725. LPIID lpInterface;
  2726. ULONG cbSpoolSecurity;
  2727. LPBYTE lpbSpoolSecurity;
  2728. LPMAPIERROR FAR * lppMapiError;
  2729. LPMSLOGON FAR * lppMSLogon;
  2730. LPMDB FAR * lppMDB;
  2731. } IMSProvider_SpoolerLogon_Params, FAR * LPIMSProvider_SpoolerLogon_Params;
  2732. typedef struct _tagIMSProvider_CompareStoreIDs_Params
  2733. {
  2734. LPVOID This;
  2735. ULONG cbEntryID1;
  2736. LPENTRYID lpEntryID1;
  2737. ULONG cbEntryID2;
  2738. LPENTRYID lpEntryID2;
  2739. ULONG ulFlags;
  2740. ULONG FAR * lpulResult;
  2741. } IMSProvider_CompareStoreIDs_Params, FAR * LPIMSProvider_CompareStoreIDs_Params;
  2742. /*************************** IMSLogon **********************************/
  2743. typedef struct _tagIMSLogon_GetLastError_Params
  2744. {
  2745. LPVOID This;
  2746. HRESULT hResult;
  2747. ULONG ulFlags;
  2748. LPMAPIERROR FAR * lppMAPIError;
  2749. } IMSLogon_GetLastError_Params, FAR * LPIMSLogon_GetLastError_Params;
  2750. typedef struct _tagIMSLogon_Logoff_Params
  2751. {
  2752. LPVOID This;
  2753. ULONG FAR * lpulFlags;
  2754. } IMSLogon_Logoff_Params, FAR * LPIMSLogon_Logoff_Params;
  2755. typedef struct _tagIMSLogon_OpenEntry_Params
  2756. {
  2757. LPVOID This;
  2758. ULONG cbEntryID;
  2759. LPENTRYID lpEntryID;
  2760. LPIID lpInterface;
  2761. ULONG ulFlags;
  2762. ULONG FAR * lpulObjType;
  2763. LPUNKNOWN FAR * lppUnk;
  2764. } IMSLogon_OpenEntry_Params, FAR * LPIMSLogon_OpenEntry_Params;
  2765. typedef struct _tagIMSLogon_CompareEntryIDs_Params
  2766. {
  2767. LPVOID This;
  2768. ULONG cbEntryID1;
  2769. LPENTRYID lpEntryID1;
  2770. ULONG cbEntryID2;
  2771. LPENTRYID lpEntryID2;
  2772. ULONG ulFlags;
  2773. ULONG FAR * lpulResult;
  2774. } IMSLogon_CompareEntryIDs_Params, FAR * LPIMSLogon_CompareEntryIDs_Params;
  2775. typedef struct _tagIMSLogon_Advise_Params
  2776. {
  2777. LPVOID This;
  2778. ULONG cbEntryID;
  2779. LPENTRYID lpEntryID;
  2780. ULONG ulEventMask;
  2781. LPMAPIADVISESINK lpAdviseSink;
  2782. ULONG FAR * lpulConnection;
  2783. } IMSLogon_Advise_Params, FAR * LPIMSLogon_Advise_Params;
  2784. typedef struct _tagIMSLogon_Unadvise_Params
  2785. {
  2786. LPVOID This;
  2787. ULONG ulConnection;
  2788. } IMSLogon_Unadvise_Params, FAR * LPIMSLogon_Unadvise_Params;
  2789. typedef struct _tagIMSLogon_OpenStatusEntry_Params
  2790. {
  2791. LPVOID This;
  2792. LPIID lpInterface;
  2793. ULONG ulFlags;
  2794. ULONG FAR * lpulObjType;
  2795. LPVOID FAR * lppEntry;
  2796. } IMSLogon_OpenStatusEntry_Params, FAR * LPIMSLogon_OpenStatusEntry_Params;
  2797. /*************************** IMAPIControl ******************************/
  2798. typedef struct _tagIMAPIControl_GetLastError_Params
  2799. {
  2800. LPVOID This;
  2801. HRESULT hResult;
  2802. ULONG ulFlags;
  2803. LPMAPIERROR FAR * lppMAPIError;
  2804. } IMAPIControl_GetLastError_Params, FAR * LPIMAPIControl_GetLastError_Params;
  2805. typedef struct _tagIMAPIControl_Activate_Params
  2806. {
  2807. LPVOID This;
  2808. ULONG ulFlags;
  2809. ULONG ulUIParam;
  2810. } IMAPIControl_Activate_Params, FAR * LPIMAPIControl_Activate_Params;
  2811. typedef struct _tagIMAPIControl_GetState_Params
  2812. {
  2813. LPVOID This;
  2814. ULONG ulFlags;
  2815. ULONG FAR * lpulState;
  2816. } IMAPIControl_GetState_Params, FAR * LPIMAPIControl_GetState_Params;
  2817. #endif
  2818. #endif //structs_h
  2819. #ifdef wabval_h
  2820. #ifdef OLD_STUFF
  2821. /* IMsgStore */
  2822. #define Validate_IMsgStore_Advise( a1, a2, a3, a4, a5, a6 ) \
  2823. ValidateParameters6( IMsgStore_Advise, a1, a2, a3, a4, a5, a6 )
  2824. #define UlValidate_IMsgStore_Advise( a1, a2, a3, a4, a5, a6 ) \
  2825. UlValidateParameters6( IMsgStore_Advise, a1, a2, a3, a4, a5, a6 )
  2826. #define CheckParameters_IMsgStore_Advise( a1, a2, a3, a4, a5, a6 ) \
  2827. CheckParameters6( IMsgStore_Advise, a1, a2, a3, a4, a5, a6 )
  2828. #define Validate_IMsgStore_Unadvise( a1, a2 ) \
  2829. ValidateParameters2( IMsgStore_Unadvise, a1, a2 )
  2830. #define UlValidate_IMsgStore_Unadvise( a1, a2 ) \
  2831. UlValidateParameters2( IMsgStore_Unadvise, a1, a2 )
  2832. #define CheckParameters_IMsgStore_Unadvise( a1, a2 ) \
  2833. CheckParameters2( IMsgStore_Unadvise, a1, a2 )
  2834. #define Validate_IMsgStore_CompareEntryIDs( a1, a2, a3, a4, a5, a6, a7 ) \
  2835. ValidateParameters7( IMsgStore_CompareEntryIDs, a1, a2, a3, a4, a5, a6, a7 )
  2836. #define UlValidate_IMsgStore_CompareEntryIDs( a1, a2, a3, a4, a5, a6, a7 ) \
  2837. UlValidateParameters7( IMsgStore_CompareEntryIDs, a1, a2, a3, a4, a5, a6, a7 )
  2838. #define CheckParameters_IMsgStore_CompareEntryIDs( a1, a2, a3, a4, a5, a6, a7 ) \
  2839. CheckParameters7( IMsgStore_CompareEntryIDs, a1, a2, a3, a4, a5, a6, a7 )
  2840. #define Validate_IMsgStore_OpenEntry( a1, a2, a3, a4, a5, a6, a7 ) \
  2841. ValidateParameters7( IMsgStore_OpenEntry, a1, a2, a3, a4, a5, a6, a7 )
  2842. #define UlValidate_IMsgStore_OpenEntry( a1, a2, a3, a4, a5, a6, a7 ) \
  2843. UlValidateParameters7( IMsgStore_OpenEntry, a1, a2, a3, a4, a5, a6, a7 )
  2844. #define CheckParameters_IMsgStore_OpenEntry( a1, a2, a3, a4, a5, a6, a7 ) \
  2845. CheckParameters7( IMsgStore_OpenEntry, a1, a2, a3, a4, a5, a6, a7 )
  2846. #define Validate_IMsgStore_SetReceiveFolder( a1, a2, a3, a4, a5 ) \
  2847. ValidateParameters5( IMsgStore_SetReceiveFolder, a1, a2, a3, a4, a5 )
  2848. #define UlValidate_IMsgStore_SetReceiveFolder( a1, a2, a3, a4, a5 ) \
  2849. UlValidateParameters5( IMsgStore_SetReceiveFolder, a1, a2, a3, a4, a5 )
  2850. #define CheckParameters_IMsgStore_SetReceiveFolder( a1, a2, a3, a4, a5 ) \
  2851. CheckParameters5( IMsgStore_SetReceiveFolder, a1, a2, a3, a4, a5 )
  2852. #define Validate_IMsgStore_GetReceiveFolder( a1, a2, a3, a4, a5, a6 ) \
  2853. ValidateParameters6( IMsgStore_GetReceiveFolder, a1, a2, a3, a4, a5, a6 )
  2854. #define UlValidate_IMsgStore_GetReceiveFolder( a1, a2, a3, a4, a5, a6 ) \
  2855. UlValidateParameters6( IMsgStore_GetReceiveFolder, a1, a2, a3, a4, a5, a6 )
  2856. #define CheckParameters_IMsgStore_GetReceiveFolder( a1, a2, a3, a4, a5, a6 ) \
  2857. CheckParameters6( IMsgStore_GetReceiveFolder, a1, a2, a3, a4, a5, a6 )
  2858. #define Validate_IMsgStore_GetReceiveFolderTable( a1, a2, a3 ) \
  2859. ValidateParameters3( IMsgStore_GetReceiveFolderTable, a1, a2, a3 )
  2860. #define UlValidate_IMsgStore_GetReceiveFolderTable( a1, a2, a3 ) \
  2861. UlValidateParameters3( IMsgStore_GetReceiveFolderTable, a1, a2, a3 )
  2862. #define CheckParameters_IMsgStore_GetReceiveFolderTable( a1, a2, a3 ) \
  2863. CheckParameters3( IMsgStore_GetReceiveFolderTable, a1, a2, a3 )
  2864. #define Validate_IMsgStore_StoreLogoff( a1, a2 ) \
  2865. ValidateParameters2( IMsgStore_StoreLogoff, a1, a2 )
  2866. #define UlValidate_IMsgStore_StoreLogoff( a1, a2 ) \
  2867. UlValidateParameters2( IMsgStore_StoreLogoff, a1, a2 )
  2868. #define CheckParameters_IMsgStore_StoreLogoff( a1, a2 ) \
  2869. CheckParameters2( IMsgStore_StoreLogoff, a1, a2 )
  2870. #define Validate_IMsgStore_AbortSubmit( a1, a2, a3, a4 ) \
  2871. ValidateParameters4( IMsgStore_AbortSubmit, a1, a2, a3, a4 )
  2872. #define UlValidate_IMsgStore_AbortSubmit( a1, a2, a3, a4 ) \
  2873. UlValidateParameters4( IMsgStore_AbortSubmit, a1, a2, a3, a4 )
  2874. #define CheckParameters_IMsgStore_AbortSubmit( a1, a2, a3, a4 ) \
  2875. CheckParameters4( IMsgStore_AbortSubmit, a1, a2, a3, a4 )
  2876. #define Validate_IMsgStore_GetOutgoingQueue( a1, a2, a3 ) \
  2877. ValidateParameters3( IMsgStore_GetOutgoingQueue, a1, a2, a3 )
  2878. #define UlValidate_IMsgStore_GetOutgoingQueue( a1, a2, a3 ) \
  2879. UlValidateParameters3( IMsgStore_GetOutgoingQueue, a1, a2, a3 )
  2880. #define CheckParameters_IMsgStore_GetOutgoingQueue( a1, a2, a3 ) \
  2881. CheckParameters3( IMsgStore_GetOutgoingQueue, a1, a2, a3 )
  2882. #define Validate_IMsgStore_SetLockState( a1, a2, a3 ) \
  2883. ValidateParameters3( IMsgStore_SetLockState, a1, a2, a3 )
  2884. #define UlValidate_IMsgStore_SetLockState( a1, a2, a3 ) \
  2885. UlValidateParameters3( IMsgStore_SetLockState, a1, a2, a3 )
  2886. #define CheckParameters_IMsgStore_SetLockState( a1, a2, a3 ) \
  2887. CheckParameters3( IMsgStore_SetLockState, a1, a2, a3 )
  2888. #define Validate_IMsgStore_FinishedMsg( a1, a2, a3, a4 ) \
  2889. ValidateParameters4( IMsgStore_FinishedMsg, a1, a2, a3, a4 )
  2890. #define UlValidate_IMsgStore_FinishedMsg( a1, a2, a3, a4 ) \
  2891. UlValidateParameters4( IMsgStore_FinishedMsg, a1, a2, a3, a4 )
  2892. #define CheckParameters_IMsgStore_FinishedMsg( a1, a2, a3, a4 ) \
  2893. CheckParameters4( IMsgStore_FinishedMsg, a1, a2, a3, a4 )
  2894. #define Validate_IMsgStore_NotifyNewMail( a1, a2 ) \
  2895. ValidateParameters2( IMsgStore_NotifyNewMail, a1, a2 )
  2896. #define UlValidate_IMsgStore_NotifyNewMail( a1, a2 ) \
  2897. UlValidateParameters2( IMsgStore_NotifyNewMail, a1, a2 )
  2898. #define CheckParameters_IMsgStore_NotifyNewMail( a1, a2 ) \
  2899. CheckParameters2( IMsgStore_NotifyNewMail, a1, a2 )
  2900. /* IMessage */
  2901. #define Validate_IMessage_GetAttachmentTable( a1, a2, a3 ) \
  2902. ValidateParameters3( IMessage_GetAttachmentTable, a1, a2, a3 )
  2903. #define UlValidate_IMessage_GetAttachmentTable( a1, a2, a3 ) \
  2904. UlValidateParameters3( IMessage_GetAttachmentTable, a1, a2, a3 )
  2905. #define CheckParameters_IMessage_GetAttachmentTable( a1, a2, a3 ) \
  2906. CheckParameters3( IMessage_GetAttachmentTable, a1, a2, a3 )
  2907. #define Validate_IMessage_OpenAttach( a1, a2, a3, a4, a5 ) \
  2908. ValidateParameters5( IMessage_OpenAttach, a1, a2, a3, a4, a5 )
  2909. #define UlValidate_IMessage_OpenAttach( a1, a2, a3, a4, a5 ) \
  2910. UlValidateParameters5( IMessage_OpenAttach, a1, a2, a3, a4, a5 )
  2911. #define CheckParameters_IMessage_OpenAttach( a1, a2, a3, a4, a5 ) \
  2912. CheckParameters5( IMessage_OpenAttach, a1, a2, a3, a4, a5 )
  2913. #define Validate_IMessage_CreateAttach( a1, a2, a3, a4, a5 ) \
  2914. ValidateParameters5( IMessage_CreateAttach, a1, a2, a3, a4, a5 )
  2915. #define UlValidate_IMessage_CreateAttach( a1, a2, a3, a4, a5 ) \
  2916. UlValidateParameters5( IMessage_CreateAttach, a1, a2, a3, a4, a5 )
  2917. #define CheckParameters_IMessage_CreateAttach( a1, a2, a3, a4, a5 ) \
  2918. CheckParameters5( IMessage_CreateAttach, a1, a2, a3, a4, a5 )
  2919. #define Validate_IMessage_DeleteAttach( a1, a2, a3, a4, a5 ) \
  2920. ValidateParameters5( IMessage_DeleteAttach, a1, a2, a3, a4, a5 )
  2921. #define UlValidate_IMessage_DeleteAttach( a1, a2, a3, a4, a5 ) \
  2922. UlValidateParameters5( IMessage_DeleteAttach, a1, a2, a3, a4, a5 )
  2923. #define CheckParameters_IMessage_DeleteAttach( a1, a2, a3, a4, a5 ) \
  2924. CheckParameters5( IMessage_DeleteAttach, a1, a2, a3, a4, a5 )
  2925. #define Validate_IMessage_GetRecipientTable( a1, a2, a3 ) \
  2926. ValidateParameters3( IMessage_GetRecipientTable, a1, a2, a3 )
  2927. #define UlValidate_IMessage_GetRecipientTable( a1, a2, a3 ) \
  2928. UlValidateParameters3( IMessage_GetRecipientTable, a1, a2, a3 )
  2929. #define CheckParameters_IMessage_GetRecipientTable( a1, a2, a3 ) \
  2930. CheckParameters3( IMessage_GetRecipientTable, a1, a2, a3 )
  2931. #define Validate_IMessage_ModifyRecipients( a1, a2, a3 ) \
  2932. ValidateParameters3( IMessage_ModifyRecipients, a1, a2, a3 )
  2933. #define UlValidate_IMessage_ModifyRecipients( a1, a2, a3 ) \
  2934. UlValidateParameters3( IMessage_ModifyRecipients, a1, a2, a3 )
  2935. #define CheckParameters_IMessage_ModifyRecipients( a1, a2, a3 ) \
  2936. CheckParameters3( IMessage_ModifyRecipients, a1, a2, a3 )
  2937. #define Validate_IMessage_SubmitMessage( a1, a2 ) \
  2938. ValidateParameters2( IMessage_SubmitMessage, a1, a2 )
  2939. #define UlValidate_IMessage_SubmitMessage( a1, a2 ) \
  2940. UlValidateParameters2( IMessage_SubmitMessage, a1, a2 )
  2941. #define CheckParameters_IMessage_SubmitMessage( a1, a2 ) \
  2942. CheckParameters2( IMessage_SubmitMessage, a1, a2 )
  2943. #define Validate_IMessage_SetReadFlag( a1, a2 ) \
  2944. ValidateParameters2( IMessage_SetReadFlag, a1, a2 )
  2945. #define UlValidate_IMessage_SetReadFlag( a1, a2 ) \
  2946. UlValidateParameters2( IMessage_SetReadFlag, a1, a2 )
  2947. #define CheckParameters_IMessage_SetReadFlag( a1, a2 ) \
  2948. CheckParameters2( IMessage_SetReadFlag, a1, a2 )
  2949. /* IABProvider */
  2950. #define Validate_IABProvider_Shutdown( a1, a2 ) \
  2951. ValidateParameters2( IABProvider_Shutdown, a1, a2 )
  2952. #define UlValidate_IABProvider_Shutdown( a1, a2 ) \
  2953. UlValidateParameters2( IABProvider_Shutdown, a1, a2 )
  2954. #define CheckParameters_IABProvider_Shutdown( a1, a2 ) \
  2955. CheckParameters2( IABProvider_Shutdown, a1, a2 )
  2956. #define Validate_IABProvider_Logon( a1, a2, a3, a4, a5, a6, a7, a8, a9 ) \
  2957. ValidateParameters9( IABProvider_Logon, a1, a2, a3, a4, a5, a6, a7, a8, a9 )
  2958. #define UlValidate_IABProvider_Logon( a1, a2, a3, a4, a5, a6, a7, a8, a9 ) \
  2959. UlValidateParameters9( IABProvider_Logon, a1, a2, a3, a4, a5, a6, a7, a8, a9 )
  2960. #define CheckParameters_IABProvider_Logon( a1, a2, a3, a4, a5, a6, a7, a8, a9 ) \
  2961. CheckParameters9( IABProvider_Logon, a1, a2, a3, a4, a5, a6, a7, a8, a9 )
  2962. /* IABLogon */
  2963. #define Validate_IABLogon_GetLastError( a1, a2, a3, a4 ) \
  2964. ValidateParameters4( IABLogon_GetLastError, a1, a2, a3, a4 )
  2965. #define UlValidate_IABLogon_GetLastError( a1, a2, a3, a4 ) \
  2966. UlValidateParameters4( IABLogon_GetLastError, a1, a2, a3, a4 )
  2967. #define CheckParameters_IABLogon_GetLastError( a1, a2, a3, a4 ) \
  2968. CheckParameters4( IABLogon_GetLastError, a1, a2, a3, a4 )
  2969. #define Validate_IABLogon_Logoff( a1, a2 ) \
  2970. ValidateParameters2( IABLogon_Logoff, a1, a2 )
  2971. #define UlValidate_IABLogon_Logoff( a1, a2 ) \
  2972. UlValidateParameters2( IABLogon_Logoff, a1, a2 )
  2973. #define CheckParameters_IABLogon_Logoff( a1, a2 ) \
  2974. CheckParameters2( IABLogon_Logoff, a1, a2 )
  2975. #define Validate_IABLogon_OpenEntry( a1, a2, a3, a4, a5, a6, a7 ) \
  2976. ValidateParameters7( IABLogon_OpenEntry, a1, a2, a3, a4, a5, a6, a7 )
  2977. #define UlValidate_IABLogon_OpenEntry( a1, a2, a3, a4, a5, a6, a7 ) \
  2978. UlValidateParameters7( IABLogon_OpenEntry, a1, a2, a3, a4, a5, a6, a7 )
  2979. #define CheckParameters_IABLogon_OpenEntry( a1, a2, a3, a4, a5, a6, a7 ) \
  2980. CheckParameters7( IABLogon_OpenEntry, a1, a2, a3, a4, a5, a6, a7 )
  2981. #define Validate_IABLogon_CompareEntryIDs( a1, a2, a3, a4, a5, a6, a7 ) \
  2982. ValidateParameters7( IABLogon_CompareEntryIDs, a1, a2, a3, a4, a5, a6, a7 )
  2983. #define UlValidate_IABLogon_CompareEntryIDs( a1, a2, a3, a4, a5, a6, a7 ) \
  2984. UlValidateParameters7( IABLogon_CompareEntryIDs, a1, a2, a3, a4, a5, a6, a7 )
  2985. #define CheckParameters_IABLogon_CompareEntryIDs( a1, a2, a3, a4, a5, a6, a7 ) \
  2986. CheckParameters7( IABLogon_CompareEntryIDs, a1, a2, a3, a4, a5, a6, a7 )
  2987. #define Validate_IABLogon_Advise( a1, a2, a3, a4, a5, a6 ) \
  2988. ValidateParameters6( IABLogon_Advise, a1, a2, a3, a4, a5, a6 )
  2989. #define UlValidate_IABLogon_Advise( a1, a2, a3, a4, a5, a6 ) \
  2990. UlValidateParameters6( IABLogon_Advise, a1, a2, a3, a4, a5, a6 )
  2991. #define CheckParameters_IABLogon_Advise( a1, a2, a3, a4, a5, a6 ) \
  2992. CheckParameters6( IABLogon_Advise, a1, a2, a3, a4, a5, a6 )
  2993. #define Validate_IABLogon_Unadvise( a1, a2 ) \
  2994. ValidateParameters2( IABLogon_Unadvise, a1, a2 )
  2995. #define UlValidate_IABLogon_Unadvise( a1, a2 ) \
  2996. UlValidateParameters2( IABLogon_Unadvise, a1, a2 )
  2997. #define CheckParameters_IABLogon_Unadvise( a1, a2 ) \
  2998. CheckParameters2( IABLogon_Unadvise, a1, a2 )
  2999. #define Validate_IABLogon_OpenStatusEntry( a1, a2, a3, a4, a5 ) \
  3000. ValidateParameters5( IABLogon_OpenStatusEntry, a1, a2, a3, a4, a5 )
  3001. #define UlValidate_IABLogon_OpenStatusEntry( a1, a2, a3, a4, a5 ) \
  3002. UlValidateParameters5( IABLogon_OpenStatusEntry, a1, a2, a3, a4, a5 )
  3003. #define CheckParameters_IABLogon_OpenStatusEntry( a1, a2, a3, a4, a5 ) \
  3004. CheckParameters5( IABLogon_OpenStatusEntry, a1, a2, a3, a4, a5 )
  3005. #define Validate_IABLogon_OpenTemplateID( a1, a2, a3, a4, a5, a6, a7, a8 ) \
  3006. ValidateParameters8( IABLogon_OpenTemplateID, a1, a2, a3, a4, a5, a6, a7, a8 )
  3007. #define UlValidate_IABLogon_OpenTemplateID( a1, a2, a3, a4, a5, a6, a7, a8 ) \
  3008. UlValidateParameters8( IABLogon_OpenTemplateID, a1, a2, a3, a4, a5, a6, a7, a8 )
  3009. #define CheckParameters_IABLogon_OpenTemplateID( a1, a2, a3, a4, a5, a6, a7, a8 ) \
  3010. CheckParameters8( IABLogon_OpenTemplateID, a1, a2, a3, a4, a5, a6, a7, a8 )
  3011. #define Validate_IABLogon_GetOneOffTable( a1, a2, a3 ) \
  3012. ValidateParameters3( IABLogon_GetOneOffTable, a1, a2, a3 )
  3013. #define UlValidate_IABLogon_GetOneOffTable( a1, a2, a3 ) \
  3014. UlValidateParameters3( IABLogon_GetOneOffTable, a1, a2, a3 )
  3015. #define CheckParameters_IABLogon_GetOneOffTable( a1, a2, a3 ) \
  3016. CheckParameters3( IABLogon_GetOneOffTable, a1, a2, a3 )
  3017. #define Validate_IABLogon_PrepareRecips( a1, a2, a3, a4 ) \
  3018. ValidateParameters4( IABLogon_PrepareRecips, a1, a2, a3, a4 )
  3019. #define UlValidate_IABLogon_PrepareRecips( a1, a2, a3, a4 ) \
  3020. UlValidateParameters4( IABLogon_PrepareRecips, a1, a2, a3, a4 )
  3021. #define CheckParameters_IABLogon_PrepareRecips( a1, a2, a3, a4 ) \
  3022. CheckParameters4( IABLogon_PrepareRecips, a1, a2, a3, a4 )
  3023. /* IXPProvider */
  3024. #define Validate_IXPProvider_Shutdown( a1, a2 ) \
  3025. ValidateParameters2( IXPProvider_Shutdown, a1, a2 )
  3026. #define UlValidate_IXPProvider_Shutdown( a1, a2 ) \
  3027. UlValidateParameters2( IXPProvider_Shutdown, a1, a2 )
  3028. #define CheckParameters_IXPProvider_Shutdown( a1, a2 ) \
  3029. CheckParameters2( IXPProvider_Shutdown, a1, a2 )
  3030. #define Validate_IXPProvider_TransportLogon( a1, a2, a3, a4, a5, a6, a7 ) \
  3031. ValidateParameters7( IXPProvider_TransportLogon, a1, a2, a3, a4, a5, a6, a7 )
  3032. #define UlValidate_IXPProvider_TransportLogon( a1, a2, a3, a4, a5, a6, a7 ) \
  3033. UlValidateParameters7( IXPProvider_TransportLogon, a1, a2, a3, a4, a5, a6, a7 )
  3034. #define CheckParameters_IXPProvider_TransportLogon( a1, a2, a3, a4, a5, a6, a7 ) \
  3035. CheckParameters7( IXPProvider_TransportLogon, a1, a2, a3, a4, a5, a6, a7 )
  3036. /* IXPLogon */
  3037. #define Validate_IXPLogon_AddressTypes( a1, a2, a3, a4, a5, a6 ) \
  3038. ValidateParameters6( IXPLogon_AddressTypes, a1, a2, a3, a4, a5, a6 )
  3039. #define UlValidate_IXPLogon_AddressTypes( a1, a2, a3, a4, a5, a6 ) \
  3040. UlValidateParameters6( IXPLogon_AddressTypes, a1, a2, a3, a4, a5, a6 )
  3041. #define CheckParameters_IXPLogon_AddressTypes( a1, a2, a3, a4, a5, a6 ) \
  3042. CheckParameters6( IXPLogon_AddressTypes, a1, a2, a3, a4, a5, a6 )
  3043. #define Validate_IXPLogon_RegisterOptions( a1, a2, a3, a4 ) \
  3044. ValidateParameters4( IXPLogon_RegisterOptions, a1, a2, a3, a4 )
  3045. #define UlValidate_IXPLogon_RegisterOptions( a1, a2, a3, a4 ) \
  3046. UlValidateParameters4( IXPLogon_RegisterOptions, a1, a2, a3, a4 )
  3047. #define CheckParameters_IXPLogon_RegisterOptions( a1, a2, a3, a4 ) \
  3048. CheckParameters4( IXPLogon_RegisterOptions, a1, a2, a3, a4 )
  3049. #define Validate_IXPLogon_TransportNotify( a1, a2, a3 ) \
  3050. ValidateParameters3( IXPLogon_TransportNotify, a1, a2, a3 )
  3051. #define UlValidate_IXPLogon_TransportNotify( a1, a2, a3 ) \
  3052. UlValidateParameters3( IXPLogon_TransportNotify, a1, a2, a3 )
  3053. #define CheckParameters_IXPLogon_TransportNotify( a1, a2, a3 ) \
  3054. CheckParameters3( IXPLogon_TransportNotify, a1, a2, a3 )
  3055. #define Validate_IXPLogon_Idle( a1, a2 ) \
  3056. ValidateParameters2( IXPLogon_Idle, a1, a2 )
  3057. #define UlValidate_IXPLogon_Idle( a1, a2 ) \
  3058. UlValidateParameters2( IXPLogon_Idle, a1, a2 )
  3059. #define CheckParameters_IXPLogon_Idle( a1, a2 ) \
  3060. CheckParameters2( IXPLogon_Idle, a1, a2 )
  3061. #define Validate_IXPLogon_TransportLogoff( a1, a2 ) \
  3062. ValidateParameters2( IXPLogon_TransportLogoff, a1, a2 )
  3063. #define UlValidate_IXPLogon_TransportLogoff( a1, a2 ) \
  3064. UlValidateParameters2( IXPLogon_TransportLogoff, a1, a2 )
  3065. #define CheckParameters_IXPLogon_TransportLogoff( a1, a2 ) \
  3066. CheckParameters2( IXPLogon_TransportLogoff, a1, a2 )
  3067. #define Validate_IXPLogon_SubmitMessage( a1, a2, a3, a4, a5 ) \
  3068. ValidateParameters5( IXPLogon_SubmitMessage, a1, a2, a3, a4, a5 )
  3069. #define UlValidate_IXPLogon_SubmitMessage( a1, a2, a3, a4, a5 ) \
  3070. UlValidateParameters5( IXPLogon_SubmitMessage, a1, a2, a3, a4, a5 )
  3071. #define CheckParameters_IXPLogon_SubmitMessage( a1, a2, a3, a4, a5 ) \
  3072. CheckParameters5( IXPLogon_SubmitMessage, a1, a2, a3, a4, a5 )
  3073. #define Validate_IXPLogon_EndMessage( a1, a2, a3 ) \
  3074. ValidateParameters3( IXPLogon_EndMessage, a1, a2, a3 )
  3075. #define UlValidate_IXPLogon_EndMessage( a1, a2, a3 ) \
  3076. UlValidateParameters3( IXPLogon_EndMessage, a1, a2, a3 )
  3077. #define CheckParameters_IXPLogon_EndMessage( a1, a2, a3 ) \
  3078. CheckParameters3( IXPLogon_EndMessage, a1, a2, a3 )
  3079. #define Validate_IXPLogon_Poll( a1, a2 ) \
  3080. ValidateParameters2( IXPLogon_Poll, a1, a2 )
  3081. #define UlValidate_IXPLogon_Poll( a1, a2 ) \
  3082. UlValidateParameters2( IXPLogon_Poll, a1, a2 )
  3083. #define CheckParameters_IXPLogon_Poll( a1, a2 ) \
  3084. CheckParameters2( IXPLogon_Poll, a1, a2 )
  3085. #define Validate_IXPLogon_StartMessage( a1, a2, a3, a4 ) \
  3086. ValidateParameters4( IXPLogon_StartMessage, a1, a2, a3, a4 )
  3087. #define UlValidate_IXPLogon_StartMessage( a1, a2, a3, a4 ) \
  3088. UlValidateParameters4( IXPLogon_StartMessage, a1, a2, a3, a4 )
  3089. #define CheckParameters_IXPLogon_StartMessage( a1, a2, a3, a4 ) \
  3090. CheckParameters4( IXPLogon_StartMessage, a1, a2, a3, a4 )
  3091. #define Validate_IXPLogon_OpenStatusEntry( a1, a2, a3, a4, a5 ) \
  3092. ValidateParameters5( IXPLogon_OpenStatusEntry, a1, a2, a3, a4, a5 )
  3093. #define UlValidate_IXPLogon_OpenStatusEntry( a1, a2, a3, a4, a5 ) \
  3094. UlValidateParameters5( IXPLogon_OpenStatusEntry, a1, a2, a3, a4, a5 )
  3095. #define CheckParameters_IXPLogon_OpenStatusEntry( a1, a2, a3, a4, a5 ) \
  3096. CheckParameters5( IXPLogon_OpenStatusEntry, a1, a2, a3, a4, a5 )
  3097. #define Validate_IXPLogon_ValidateState( a1, a2, a3 ) \
  3098. ValidateParameters3( IXPLogon_ValidateState, a1, a2, a3 )
  3099. #define UlValidate_IXPLogon_ValidateState( a1, a2, a3 ) \
  3100. UlValidateParameters3( IXPLogon_ValidateState, a1, a2, a3 )
  3101. #define CheckParameters_IXPLogon_ValidateState( a1, a2, a3 ) \
  3102. CheckParameters3( IXPLogon_ValidateState, a1, a2, a3 )
  3103. #define Validate_IXPLogon_FlushQueues( a1, a2, a3, a4, a5 ) \
  3104. ValidateParameters5( IXPLogon_FlushQueues, a1, a2, a3, a4, a5 )
  3105. #define UlValidate_IXPLogon_FlushQueues( a1, a2, a3, a4, a5 ) \
  3106. UlValidateParameters5( IXPLogon_FlushQueues, a1, a2, a3, a4, a5 )
  3107. #define CheckParameters_IXPLogon_FlushQueues( a1, a2, a3, a4, a5 ) \
  3108. CheckParameters5( IXPLogon_FlushQueues, a1, a2, a3, a4, a5 )
  3109. /* IMSProvider */
  3110. #define Validate_IMSProvider_Shutdown( a1, a2 ) \
  3111. ValidateParameters2( IMSProvider_Shutdown, a1, a2 )
  3112. #define UlValidate_IMSProvider_Shutdown( a1, a2 ) \
  3113. UlValidateParameters2( IMSProvider_Shutdown, a1, a2 )
  3114. #define CheckParameters_IMSProvider_Shutdown( a1, a2 ) \
  3115. CheckParameters2( IMSProvider_Shutdown, a1, a2 )
  3116. #define Validate_IMSProvider_Logon( a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) \
  3117. ValidateParameters13( IMSProvider_Logon, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 )
  3118. #define UlValidate_IMSProvider_Logon( a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) \
  3119. UlValidateParameters13( IMSProvider_Logon, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 )
  3120. #define CheckParameters_IMSProvider_Logon( a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) \
  3121. CheckParameters13( IMSProvider_Logon, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 )
  3122. #define Validate_IMSProvider_SpoolerLogon( a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) \
  3123. ValidateParameters13( IMSProvider_SpoolerLogon, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 )
  3124. #define UlValidate_IMSProvider_SpoolerLogon( a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) \
  3125. UlValidateParameters13( IMSProvider_SpoolerLogon, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 )
  3126. #define CheckParameters_IMSProvider_SpoolerLogon( a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 ) \
  3127. CheckParameters13( IMSProvider_SpoolerLogon, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13 )
  3128. #define Validate_IMSProvider_CompareStoreIDs( a1, a2, a3, a4, a5, a6, a7 ) \
  3129. ValidateParameters7( IMSProvider_CompareStoreIDs, a1, a2, a3, a4, a5, a6, a7 )
  3130. #define UlValidate_IMSProvider_CompareStoreIDs( a1, a2, a3, a4, a5, a6, a7 ) \
  3131. UlValidateParameters7( IMSProvider_CompareStoreIDs, a1, a2, a3, a4, a5, a6, a7 )
  3132. #define CheckParameters_IMSProvider_CompareStoreIDs( a1, a2, a3, a4, a5, a6, a7 ) \
  3133. CheckParameters7( IMSProvider_CompareStoreIDs, a1, a2, a3, a4, a5, a6, a7 )
  3134. /* IMSLogon */
  3135. #define Validate_IMSLogon_GetLastError( a1, a2, a3, a4 ) \
  3136. ValidateParameters4( IMSLogon_GetLastError, a1, a2, a3, a4 )
  3137. #define UlValidate_IMSLogon_GetLastError( a1, a2, a3, a4 ) \
  3138. UlValidateParameters4( IMSLogon_GetLastError, a1, a2, a3, a4 )
  3139. #define CheckParameters_IMSLogon_GetLastError( a1, a2, a3, a4 ) \
  3140. CheckParameters4( IMSLogon_GetLastError, a1, a2, a3, a4 )
  3141. #define Validate_IMSLogon_Logoff( a1, a2 ) \
  3142. ValidateParameters2( IMSLogon_Logoff, a1, a2 )
  3143. #define UlValidate_IMSLogon_Logoff( a1, a2 ) \
  3144. UlValidateParameters2( IMSLogon_Logoff, a1, a2 )
  3145. #define CheckParameters_IMSLogon_Logoff( a1, a2 ) \
  3146. CheckParameters2( IMSLogon_Logoff, a1, a2 )
  3147. #define Validate_IMSLogon_OpenEntry( a1, a2, a3, a4, a5, a6, a7 ) \
  3148. ValidateParameters7( IMSLogon_OpenEntry, a1, a2, a3, a4, a5, a6, a7 )
  3149. #define UlValidate_IMSLogon_OpenEntry( a1, a2, a3, a4, a5, a6, a7 ) \
  3150. UlValidateParameters7( IMSLogon_OpenEntry, a1, a2, a3, a4, a5, a6, a7 )
  3151. #define CheckParameters_IMSLogon_OpenEntry( a1, a2, a3, a4, a5, a6, a7 ) \
  3152. CheckParameters7( IMSLogon_OpenEntry, a1, a2, a3, a4, a5, a6, a7 )
  3153. #define Validate_IMSLogon_CompareEntryIDs( a1, a2, a3, a4, a5, a6, a7 ) \
  3154. ValidateParameters7( IMSLogon_CompareEntryIDs, a1, a2, a3, a4, a5, a6, a7 )
  3155. #define UlValidate_IMSLogon_CompareEntryIDs( a1, a2, a3, a4, a5, a6, a7 ) \
  3156. UlValidateParameters7( IMSLogon_CompareEntryIDs, a1, a2, a3, a4, a5, a6, a7 )
  3157. #define CheckParameters_IMSLogon_CompareEntryIDs( a1, a2, a3, a4, a5, a6, a7 ) \
  3158. CheckParameters7( IMSLogon_CompareEntryIDs, a1, a2, a3, a4, a5, a6, a7 )
  3159. #define Validate_IMSLogon_Advise( a1, a2, a3, a4, a5, a6 ) \
  3160. ValidateParameters6( IMSLogon_Advise, a1, a2, a3, a4, a5, a6 )
  3161. #define UlValidate_IMSLogon_Advise( a1, a2, a3, a4, a5, a6 ) \
  3162. UlValidateParameters6( IMSLogon_Advise, a1, a2, a3, a4, a5, a6 )
  3163. #define CheckParameters_IMSLogon_Advise( a1, a2, a3, a4, a5, a6 ) \
  3164. CheckParameters6( IMSLogon_Advise, a1, a2, a3, a4, a5, a6 )
  3165. #define Validate_IMSLogon_Unadvise( a1, a2 ) \
  3166. ValidateParameters2( IMSLogon_Unadvise, a1, a2 )
  3167. #define UlValidate_IMSLogon_Unadvise( a1, a2 ) \
  3168. UlValidateParameters2( IMSLogon_Unadvise, a1, a2 )
  3169. #define CheckParameters_IMSLogon_Unadvise( a1, a2 ) \
  3170. CheckParameters2( IMSLogon_Unadvise, a1, a2 )
  3171. #define Validate_IMSLogon_OpenStatusEntry( a1, a2, a3, a4, a5 ) \
  3172. ValidateParameters5( IMSLogon_OpenStatusEntry, a1, a2, a3, a4, a5 )
  3173. #define UlValidate_IMSLogon_OpenStatusEntry( a1, a2, a3, a4, a5 ) \
  3174. UlValidateParameters5( IMSLogon_OpenStatusEntry, a1, a2, a3, a4, a5 )
  3175. #define CheckParameters_IMSLogon_OpenStatusEntry( a1, a2, a3, a4, a5 ) \
  3176. CheckParameters5( IMSLogon_OpenStatusEntry, a1, a2, a3, a4, a5 )
  3177. /* IMAPIControl */
  3178. #define Validate_IMAPIControl_GetLastError( a1, a2, a3, a4 ) \
  3179. ValidateParameters4( IMAPIControl_GetLastError, a1, a2, a3, a4 )
  3180. #define UlValidate_IMAPIControl_GetLastError( a1, a2, a3, a4 ) \
  3181. UlValidateParameters4( IMAPIControl_GetLastError, a1, a2, a3, a4 )
  3182. #define CheckParameters_IMAPIControl_GetLastError( a1, a2, a3, a4 ) \
  3183. CheckParameters4( IMAPIControl_GetLastError, a1, a2, a3, a4 )
  3184. #define Validate_IMAPIControl_Activate( a1, a2, a3 ) \
  3185. ValidateParameters3( IMAPIControl_Activate, a1, a2, a3 )
  3186. #define UlValidate_IMAPIControl_Activate( a1, a2, a3 ) \
  3187. UlValidateParameters3( IMAPIControl_Activate, a1, a2, a3 )
  3188. #define CheckParameters_IMAPIControl_Activate( a1, a2, a3 ) \
  3189. CheckParameters3( IMAPIControl_Activate, a1, a2, a3 )
  3190. #define Validate_IMAPIControl_GetState( a1, a2, a3 ) \
  3191. ValidateParameters3( IMAPIControl_GetState, a1, a2, a3 )
  3192. #define UlValidate_IMAPIControl_GetState( a1, a2, a3 ) \
  3193. UlValidateParameters3( IMAPIControl_GetState, a1, a2, a3 )
  3194. #define CheckParameters_IMAPIControl_GetState( a1, a2, a3 ) \
  3195. CheckParameters3( IMAPIControl_GetState, a1, a2, a3 )
  3196. /* IMAPIStatus */
  3197. #define Validate_IMAPIStatus_ValidateState( a1, a2, a3 ) \
  3198. ValidateParameters3( IMAPIStatus_ValidateState, a1, a2, a3 )
  3199. #define UlValidate_IMAPIStatus_ValidateState( a1, a2, a3 ) \
  3200. UlValidateParameters3( IMAPIStatus_ValidateState, a1, a2, a3 )
  3201. #define CheckParameters_IMAPIStatus_ValidateState( a1, a2, a3 ) \
  3202. CheckParameters3( IMAPIStatus_ValidateState, a1, a2, a3 )
  3203. #define Validate_IMAPIStatus_SettingsDialog( a1, a2, a3 ) \
  3204. ValidateParameters3( IMAPIStatus_SettingsDialog, a1, a2, a3 )
  3205. #define UlValidate_IMAPIStatus_SettingsDialog( a1, a2, a3 ) \
  3206. UlValidateParameters3( IMAPIStatus_SettingsDialog, a1, a2, a3 )
  3207. #define CheckParameters_IMAPIStatus_SettingsDialog( a1, a2, a3 ) \
  3208. CheckParameters3( IMAPIStatus_SettingsDialog, a1, a2, a3 )
  3209. #define Validate_IMAPIStatus_ChangePassword( a1, a2, a3, a4 ) \
  3210. ValidateParameters4( IMAPIStatus_ChangePassword, a1, a2, a3, a4 )
  3211. #define UlValidate_IMAPIStatus_ChangePassword( a1, a2, a3, a4 ) \
  3212. UlValidateParameters4( IMAPIStatus_ChangePassword, a1, a2, a3, a4 )
  3213. #define CheckParameters_IMAPIStatus_ChangePassword( a1, a2, a3, a4 ) \
  3214. CheckParameters4( IMAPIStatus_ChangePassword, a1, a2, a3, a4 )
  3215. #define Validate_IMAPIStatus_FlushQueues( a1, a2, a3, a4, a5 ) \
  3216. ValidateParameters5( IMAPIStatus_FlushQueues, a1, a2, a3, a4, a5 )
  3217. #define UlValidate_IMAPIStatus_FlushQueues( a1, a2, a3, a4, a5 ) \
  3218. UlValidateParameters5( IMAPIStatus_FlushQueues, a1, a2, a3, a4, a5 )
  3219. #define CheckParameters_IMAPIStatus_FlushQueues( a1, a2, a3, a4, a5 ) \
  3220. CheckParameters5( IMAPIStatus_FlushQueues, a1, a2, a3, a4, a5 )
  3221. #endif
  3222. #endif //wabval
  3223. #ifdef WAB_PROFILES
  3224. #ifdef OLD_STUFF
  3225. /*
  3226. - HrCreateNewProfileItem
  3227. -
  3228. * Creates a new Profile Item and adds the default shared profile to this item
  3229. *
  3230. */
  3231. HRESULT HrCreateNewProfileItem(LPWABPROFILEITEM * lppItem, LPTSTR lpszProfileID)
  3232. {
  3233. HRESULT hr = E_FAIL;
  3234. SCODE sc;
  3235. LPWABPROFILEITEM lpProfile = LocalAlloc(LMEM_ZEROINIT, sizeof(WABPROFILEITEM));
  3236. if(!lppItem)
  3237. goto out;
  3238. if(!lpProfile)
  3239. {
  3240. hr = MAPI_E_NOT_ENOUGH_MEMORY;
  3241. goto out;
  3242. }
  3243. lpProfile->lpszProfileID = LocalAlloc(LMEM_ZEROINIT, lstrlen(lpszProfileID)+1);
  3244. if(!lpProfile->lpszProfileID)
  3245. {
  3246. hr = MAPI_E_NOT_ENOUGH_MEMORY;
  3247. goto out;
  3248. }
  3249. lstrcpy(lpProfile->lpszProfileID, lpszProfileID);
  3250. //lpProfile->dwProfileID = dwEntryID;
  3251. sc = MAPIAllocateBuffer(sizeof(SPropValue), &(lpProfile->lpspvFolders));
  3252. if(sc)
  3253. {
  3254. hr = MAPI_E_NOT_ENOUGH_MEMORY;
  3255. goto out;
  3256. }
  3257. lpProfile->lpspvFolders[0].ulPropTag = PR_WAB_FOLDER_ENTRIES;
  3258. lpProfile->lpspvFolders[0].Value.MVbin.cValues = 0;
  3259. lpProfile->lpspvFolders[0].Value.MVbin.lpbin = NULL;
  3260. // The folder item corresponding to the Shared folder is a
  3261. // virtual item with NULL entryid .. so add this virtual item to
  3262. // the primary profile
  3263. //
  3264. AddPropToMVPBin(lpProfile->lpspvFolders, 0,
  3265. (LPVOID) NULL, 0, TRUE);
  3266. *lppItem = lpProfile;
  3267. hr = S_OK;
  3268. out:
  3269. if(HR_FAILED(hr) && lpProfile)
  3270. LocalFree(lpProfile);
  3271. return hr;
  3272. }
  3273. /*
  3274. - HrLoadPrimaryWABProfile
  3275. -
  3276. -
  3277. * Creates a primary profile which points to all existing folders in the
  3278. * store - this profile is used when no profile ID is supplied so that the
  3279. * UI can see everything
  3280. *
  3281. */
  3282. HRESULT HrLoadPrimaryWABProfile(LPIAB lpIAB)
  3283. {
  3284. SCODE sc;
  3285. HRESULT hr = E_FAIL;
  3286. SPropertyRestriction PropRes = {0};
  3287. SPropValue sp = {0};
  3288. ULONG ulCount = 0;
  3289. LPSBinary rgsbEntryIDs = NULL;
  3290. ULONG i = 0;
  3291. LPWABPROFILEITEM lpProfile = NULL;
  3292. // Now we will search the WAB for all objects of PR_OBJECT_TYPE = MAPI_ABCONT
  3293. //
  3294. sp.ulPropTag = PR_OBJECT_TYPE;
  3295. sp.Value.l = MAPI_ABCONT;
  3296. PropRes.ulPropTag = PR_OBJECT_TYPE;
  3297. PropRes.relop = RELOP_EQ;
  3298. PropRes.lpProp = &sp;
  3299. hr = FindRecords( lpIAB->lpPropertyStore->hPropertyStore,
  3300. NULL, 0,
  3301. TRUE,
  3302. &PropRes, &ulCount, &rgsbEntryIDs);
  3303. if (HR_FAILED(hr))
  3304. goto out;
  3305. // we'll always create a default item, whether it has anything in it or not ..
  3306. hr = HrCreateNewProfileItem(&lpProfile, szEmpty);
  3307. if(HR_FAILED(hr) || !lpProfile)
  3308. goto out;
  3309. //if(ulCount && rgsbEntryIDs)
  3310. {
  3311. for(i=0;i<ulCount;i++)
  3312. {
  3313. ULONG cb = 0;
  3314. LPENTRYID lpb = NULL;
  3315. if(!HR_FAILED(CreateWABEntryID( WAB_CONTAINER,
  3316. rgsbEntryIDs[i].lpb, NULL, NULL,
  3317. rgsbEntryIDs[i].cb, 0,
  3318. NULL, &cb, &lpb)))
  3319. {
  3320. // Add the entryids to this prop - ignore errors
  3321. AddPropToMVPBin(lpProfile->lpspvFolders, 0, (LPVOID) lpb, cb, TRUE);
  3322. #ifdef DEBUG
  3323. //////////////
  3324. {
  3325. LPTSTR lp = NULL;
  3326. SBinary sb;
  3327. sb.cb = cb;sb.lpb = (LPBYTE)lpb;
  3328. HrGetProfileFolderName(lpIAB, &sb, &lp);
  3329. if(lp)
  3330. {
  3331. DebugTrace("Found Folder: %s\n",lp);
  3332. LocalFree(lp);
  3333. }
  3334. }
  3335. //////////////
  3336. #endif
  3337. MAPIFreeBuffer(lpb);
  3338. }
  3339. }
  3340. lpProfile->lpNext = lpIAB->lpProfilesList;
  3341. lpIAB->lpProfilesList = lpProfile;
  3342. }
  3343. hr = S_OK;
  3344. out:
  3345. if(ulCount && rgsbEntryIDs)
  3346. {
  3347. FreeEntryIDs(lpIAB->lpPropertyStore->hPropertyStore,
  3348. ulCount,
  3349. rgsbEntryIDs);
  3350. }
  3351. return hr;
  3352. }
  3353. static const char szProfileKey[] = "Software\\Microsoft\\WAB\\WAB4\\Profiles";
  3354. /*
  3355. - HrLoadSecondaryWABProfiles
  3356. -
  3357. -
  3358. * Creates secondary profiles which are based on profiles actually saved in the registry
  3359. *
  3360. */
  3361. HRESULT HrLoadSecondaryWABProfiles(LPIAB lpIAB)
  3362. {
  3363. SCODE sc;
  3364. HRESULT hr = E_FAIL;
  3365. ULONG ulCount = 0, i = 0;
  3366. LPWABPROFILEITEM lpProfile = NULL;
  3367. HKEY hKey = NULL;
  3368. if(ERROR_SUCCESS != RegOpenKeyEx(HKEY_CURRENT_USER, szProfileKey, 0, KEY_READ, &hKey))
  3369. {
  3370. hr = S_OK; // ignore this error
  3371. goto out;
  3372. }
  3373. {
  3374. TCHAR szValName[MAX_PATH];
  3375. DWORD dwValIndex = 0, dwValSize = sizeof(szValName), dwType = 0;
  3376. *szValName = '\0';
  3377. while(ERROR_SUCCESS == RegEnumValue(hKey, dwValIndex,
  3378. szValName, &dwValSize,
  3379. 0, &dwType,
  3380. NULL, NULL))
  3381. {
  3382. // The value names under this entry are the profiles IDs and the
  3383. // Value data is the raw folder data we care about
  3384. //
  3385. if(dwType == REG_BINARY && lstrlen(szValName))
  3386. {
  3387. //Read in the Value
  3388. if(ERROR_SUCCESS == RegQueryValueEx(hKey, szValName, 0, &dwType,
  3389. NULL, &dwValSize))
  3390. {
  3391. LPTSTR lpsz = LocalAlloc(LMEM_ZEROINIT, dwValSize);
  3392. if(lpsz)
  3393. {
  3394. if(ERROR_SUCCESS == RegQueryValueEx(hKey, szValName, 0, &dwType,
  3395. (LPBYTE) lpsz, &dwValSize))
  3396. {
  3397. LPSPropValue lpProp = NULL;
  3398. ULONG ulCount = 0;
  3399. hr = HrGetPropArrayFromBuffer(lpsz, dwValSize, 1, 0, &lpProp);
  3400. if(!HR_FAILED(hr) && lpProp && lpProp->ulPropTag == PR_WAB_FOLDER_ENTRIES)
  3401. {
  3402. hr = HrCreateNewProfileItem(&lpProfile, szValName);
  3403. if(HR_FAILED(hr) || !lpProfile)
  3404. goto out;
  3405. for(i=0;i<lpProp->Value.MVbin.cValues;i++)
  3406. {
  3407. if(lpProp->Value.MVbin.lpbin[i].lpb && lpProp->Value.MVbin.lpbin[i].cb)
  3408. {
  3409. LPSPropValue lpPropArray = NULL;
  3410. ULONG ulcValues = 0;
  3411. // Verify that this folder actually physically exists - it might have been deleted
  3412. if(!HR_FAILED(ReadRecord( lpIAB->lpPropertyStore->hPropertyStore,
  3413. &(lpProp->Value.MVbin.lpbin[i]),
  3414. 0, &ulcValues, &lpPropArray)))
  3415. {
  3416. // Add the entryids to this prop - ignore errors
  3417. // Dont add the default shared folder as thats alreadybeen added
  3418. ULONG cb = lpProp->Value.MVbin.lpbin[i].cb;
  3419. LPENTRYID lpb = (LPENTRYID) lpProp->Value.MVbin.lpbin[i].lpb;
  3420. if(WAB_CONTAINER != IsWABEntryID(cb,lpb,NULL,NULL,NULL,NULL,NULL))
  3421. {
  3422. CreateWABEntryID( WAB_CONTAINER,lpProp->Value.MVbin.lpbin[i].lpb, NULL, NULL,
  3423. lpProp->Value.MVbin.lpbin[i].cb, 0,
  3424. NULL, &cb, &lpb);
  3425. }
  3426. // Add the entryids to this prop - ignore errors
  3427. AddPropToMVPBin(lpProfile->lpspvFolders, 0, (LPVOID) lpb, cb, TRUE);
  3428. if(lpProp->Value.MVbin.lpbin[i].lpb != (LPBYTE)lpb )
  3429. MAPIFreeBuffer(lpb);
  3430. }
  3431. LocalFreePropArray(NULL, ulcValues, &lpPropArray);
  3432. }
  3433. }
  3434. lpProfile->lpNext = lpIAB->lpProfilesList;
  3435. lpIAB->lpProfilesList = lpProfile;
  3436. }
  3437. LocalFreePropArray(NULL, 1, &lpProp);
  3438. }
  3439. LocalFree(lpsz);
  3440. }
  3441. }
  3442. }
  3443. dwValIndex++;
  3444. *szValName = '\0';
  3445. dwValSize = sizeof(szValName);
  3446. }
  3447. }
  3448. hr = S_OK;
  3449. out:
  3450. if(hKey)
  3451. RegCloseKey(hKey);
  3452. return hr;
  3453. }
  3454. /*
  3455. - SetCurrentProfile - scans list and updates pointer
  3456. -
  3457. *
  3458. */
  3459. void SetCurrentProfile(LPIAB lpIAB, LPTSTR lpszProfileID)
  3460. {
  3461. LPWABPROFILEITEM lpTemp = lpIAB->lpProfilesList;
  3462. while(lpTemp)
  3463. {
  3464. if(!lstrcmpi(lpTemp->lpszProfileID, lpszProfileID))
  3465. {
  3466. lpIAB->lpCurrentProfile = lpTemp;
  3467. lpIAB->lpszProfileID = lpTemp->lpszProfileID;
  3468. break;
  3469. }
  3470. lpTemp = lpTemp->lpNext;
  3471. }
  3472. }
  3473. /*
  3474. - HrSaveProfileItem
  3475. -
  3476. -
  3477. * Persists a profile item to the registry
  3478. * Format for the data is:
  3479. * under HKCU\Software\Microsoft\WAB\Profiles create a new binary value
  3480. * corresponding to the profile ID and set the binary value data to
  3481. * a flat buffer corresponding to the PR_WAB_FOLDER_ENTRIES property
  3482. */
  3483. HRESULT HrSaveProfileItem(LPWABPROFILEITEM lpNew)
  3484. {
  3485. ULONG cbBuf = 0;
  3486. LPTSTR lpBuf = NULL;
  3487. HRESULT hr = E_FAIL;
  3488. HKEY hKey = NULL;
  3489. if(lpNew->lpszProfileID && !(lpNew->lpszProfileID)) // This item is never cached - only created dynamically
  3490. return S_OK;
  3491. hr = HrGetBufferFromPropArray( 1, lpNew->lpspvFolders,
  3492. &cbBuf, &lpBuf);
  3493. if(HR_FAILED(hr))
  3494. goto out;
  3495. if(cbBuf && lpBuf)
  3496. {
  3497. TCHAR szValName[MAX_PATH];
  3498. lstrcpy(szValName, lpNew->lpszProfileID);
  3499. //wsprintf(szValName, "%d", lpNew->dwProfileID);
  3500. if(ERROR_SUCCESS == RegCreateKeyEx( HKEY_CURRENT_USER, szProfileKey,
  3501. 0, NULL, REG_OPTION_NON_VOLATILE,
  3502. KEY_ALL_ACCESS, NULL,
  3503. &hKey, NULL))
  3504. {
  3505. RegSetValueEx( hKey, szValName,
  3506. 0, REG_BINARY,
  3507. (LPBYTE) lpBuf, cbBuf );
  3508. }
  3509. LocalFree(lpBuf);
  3510. }
  3511. out:
  3512. if(hKey)
  3513. RegCloseKey(hKey);
  3514. return hr;
  3515. }
  3516. /*
  3517. - HrCreateNewWABProfile
  3518. -
  3519. -
  3520. * Creates a new profile based on the supplied profile ID
  3521. * The profile has the default folder-id for the shared folder
  3522. * set on it.
  3523. * Also tags the new profile to the current folder list
  3524. */
  3525. HRESULT HrCreateNewWABProfile(LPIAB lpIAB, LPTSTR lpszProfileID )
  3526. {
  3527. HRESULT hr = E_FAIL;
  3528. LPWABPROFILEITEM lpNew = NULL;
  3529. hr = HrCreateNewProfileItem(&lpNew, lpszProfileID);
  3530. if(HR_FAILED(hr) || !lpNew)
  3531. goto out;
  3532. // Persist this new item to the registry
  3533. HrSaveProfileItem(lpNew);
  3534. // Add it to the main list
  3535. lpNew->lpNext = lpIAB->lpProfilesList;
  3536. lpIAB->lpProfilesList = lpNew;
  3537. hr = S_OK;
  3538. out:
  3539. if(HR_FAILED(hr) && lpNew)
  3540. {
  3541. MAPIFreeBuffer(lpNew->lpspvFolders);
  3542. LocalFree(lpNew);
  3543. }
  3544. return hr;
  3545. }
  3546. /*
  3547. - FreeWABProfilesList
  3548. -
  3549. -
  3550. * Clears up existing Profile info from the IAB object
  3551. */
  3552. void FreeWABProfilesList(LPIAB lpIAB)
  3553. {
  3554. LPWABPROFILEITEM lpTemp = lpIAB->lpProfilesList;
  3555. while(lpTemp)
  3556. {
  3557. lpIAB->lpProfilesList = lpTemp->lpNext;
  3558. MAPIFreeBuffer(lpTemp->lpspvFolders);
  3559. if(lpTemp->lpszProfileID)
  3560. LocalFree(lpTemp->lpszProfileID);
  3561. LocalFree(lpTemp);
  3562. lpTemp = lpIAB->lpProfilesList;
  3563. }
  3564. lpIAB->lpProfilesList = NULL;
  3565. lpIAB->lpCurrentProfile = NULL;
  3566. lpIAB->lpszProfileID = NULL;
  3567. }
  3568. #endif //OLD_STUFF
  3569. #endif