Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

970 lines
24 KiB

  1. /***********************************************************************
  2. *
  3. * WRAP.C
  4. *
  5. * Sample Address Book Wrap object
  6. * This file contains the code for implementing the Sample AB
  7. * WRAP object.
  8. *
  9. * This file contains methods with "default" actions for objects which
  10. * expose IUnknown and/or IMAPIProp. These "default" actions are to call
  11. * the appropriate method of a "wrapped" object that is a member of this
  12. * object. Various methods in this file are used throughout this sample
  13. * provider and are especially useful with the objects that implement template
  14. * ids (see TID.C and OOTID.C).
  15. *
  16. * Copyright 1992, 1993, 1994 Microsoft Corporation. All Rights Reserved.
  17. *
  18. ***********************************************************************/
  19. #include "faxab.h"
  20. /*********************************************************************
  21. *
  22. * The actual Wrapped IMAPIProp methods
  23. *
  24. */
  25. STDMETHODIMP
  26. WRAP_QueryInterface( LPWRAP lpWRAP,
  27. REFIID lpiid,
  28. LPVOID * lppNewObj
  29. )
  30. {
  31. HRESULT hr;
  32. /*
  33. * Check to see if it has a lpVtbl object member
  34. */
  35. if (IsBadReadPtr(lpWRAP, offsetof(WRAP, lpVtbl)+SIZEOF(WRAP_Vtbl *)))
  36. {
  37. /*
  38. * No jump table found
  39. */
  40. return ResultFromScode(E_INVALIDARG);
  41. }
  42. /*
  43. * Check to see that the Vtbl is large enough to include this method
  44. */
  45. if (IsBadReadPtr(lpWRAP->lpVtbl,
  46. offsetof(WRAP_Vtbl, QueryInterface)+SIZEOF(WRAP_QueryInterface_METHOD *)))
  47. {
  48. /*
  49. * Jump table not derived from IUnknown
  50. */
  51. return ResultFromScode(E_INVALIDARG);
  52. }
  53. /*
  54. * Check to see if the method is the same
  55. */
  56. if (WRAP_QueryInterface != lpWRAP->lpVtbl->QueryInterface)
  57. {
  58. /*
  59. * Wrong object - the object passed doesn't have this
  60. * method.
  61. */
  62. return ResultFromScode(E_INVALIDARG);
  63. }
  64. EnterCriticalSection(&lpWRAP->cs);
  65. /* Call the internal prop interface */
  66. hr = lpWRAP->lpPropData->lpVtbl->QueryInterface( lpWRAP->lpPropData,
  67. lpiid,
  68. lppNewObj
  69. );
  70. /* If this object is successful in QI'ing and it returns exactly the
  71. * same object, then I need to AddRef my own "wrapper" object so that
  72. * my release code works correctly AND replace the *lppNewObj with the
  73. * "wrapper" object.
  74. */
  75. if (!HR_FAILED(hr) && (lpWRAP->lpPropData == *lppNewObj))
  76. {
  77. ++lpWRAP->lcInit;
  78. *lppNewObj = lpWRAP;
  79. }
  80. LeaveCriticalSection(&lpWRAP->cs);
  81. return hr;
  82. }
  83. STDMETHODIMP_(ULONG) WRAP_AddRef(LPWRAP lpWRAP)
  84. {
  85. ULONG ulRet;
  86. /*
  87. * Check to see if it has a lpVtbl object member
  88. */
  89. if (IsBadReadPtr(lpWRAP, offsetof(WRAP, lpVtbl)+SIZEOF(WRAP_Vtbl *)))
  90. {
  91. /*
  92. * No jump table found
  93. */
  94. return 1;
  95. }
  96. /*
  97. * Check to see that the Vtbl is large enough to include this method
  98. */
  99. if (IsBadReadPtr(lpWRAP->lpVtbl,
  100. offsetof(WRAP_Vtbl, AddRef)+SIZEOF(WRAP_AddRef_METHOD *)))
  101. {
  102. /*
  103. * Jump table not derived from IUnknown
  104. */
  105. return 1;
  106. }
  107. /*
  108. * Check to see if the method is the same
  109. */
  110. if (WRAP_AddRef != lpWRAP->lpVtbl->AddRef)
  111. {
  112. /*
  113. * Wrong object - the object passed doesn't have this
  114. * method.
  115. */
  116. return 1;
  117. }
  118. EnterCriticalSection(&lpWRAP->cs);
  119. ++lpWRAP->lcInit;
  120. /* Call the internal prop interface */
  121. ulRet = lpWRAP->lpPropData->lpVtbl->AddRef(lpWRAP->lpPropData);
  122. LeaveCriticalSection(&lpWRAP->cs);
  123. return ulRet;
  124. }
  125. STDMETHODIMP_(ULONG) WRAP_Release(LPWRAP lpWRAP)
  126. {
  127. long lcInit;
  128. /*
  129. * Check to see if it has a lpVtbl object member
  130. */
  131. if (IsBadReadPtr(lpWRAP, offsetof(WRAP, lpVtbl)+SIZEOF(WRAP_Vtbl *)))
  132. {
  133. /*
  134. * No jump table found
  135. */
  136. return 1;
  137. }
  138. /*
  139. * Check to see that the Vtbl is large enough to include this method
  140. */
  141. if (IsBadReadPtr(lpWRAP->lpVtbl,
  142. offsetof(WRAP_Vtbl, Release)+SIZEOF(WRAP_Release_METHOD *)))
  143. {
  144. /*
  145. * Jump table not derived from IUnknown
  146. */
  147. return 1;
  148. }
  149. /*
  150. * Check to see if the method is the same
  151. */
  152. if (WRAP_Release != lpWRAP->lpVtbl->Release)
  153. {
  154. /*
  155. * Wrong object - the object passed doesn't have this
  156. * method.
  157. */
  158. return 1;
  159. }
  160. EnterCriticalSection(&lpWRAP->cs);
  161. /*
  162. * Release the imapiprop object
  163. */
  164. lpWRAP->lpPropData->lpVtbl->Release(
  165. lpWRAP->lpPropData);
  166. lcInit = --lpWRAP->lcInit;
  167. LeaveCriticalSection(&lpWRAP->cs);
  168. if (lcInit == 0)
  169. {
  170. /*
  171. * Get rid of my critical section
  172. */
  173. DeleteCriticalSection(&lpWRAP->cs);
  174. /*
  175. * Set the Jump table to NULL. This way the client will find out
  176. * real fast if it's calling a method on a released object. That is,
  177. * the client will crash. Hopefully, this will happen during the
  178. * development stage of the client.
  179. */
  180. lpWRAP->lpVtbl = NULL;
  181. /*
  182. * Need to free the object
  183. */
  184. lpWRAP->lpFreeBuff(lpWRAP);
  185. return 0;
  186. }
  187. return lcInit;
  188. }
  189. STDMETHODIMP
  190. WRAP_GetLastError( LPWRAP lpWRAP,
  191. HRESULT hError,
  192. ULONG ulFlags,
  193. LPMAPIERROR FAR * lppMapiError
  194. )
  195. {
  196. HRESULT hResult;
  197. /*
  198. * Check to see if it has a lpVtbl object member
  199. */
  200. if (IsBadReadPtr(lpWRAP, offsetof(WRAP, lpVtbl)+SIZEOF(WRAP_Vtbl *)))
  201. {
  202. /*
  203. * No jump table found
  204. */
  205. hResult = ResultFromScode(E_INVALIDARG);
  206. return hResult;
  207. }
  208. /*
  209. * Check to see that the Vtbl is large enough to include this method
  210. */
  211. if (IsBadReadPtr(lpWRAP->lpVtbl,
  212. offsetof(WRAP_Vtbl, GetLastError)+SIZEOF(WRAP_GetLastError_METHOD *)))
  213. {
  214. /*
  215. * Jump table not derived from IUnknown
  216. */
  217. hResult = ResultFromScode(E_INVALIDARG);
  218. return hResult;
  219. }
  220. /*
  221. * Check to see if the method is the same
  222. */
  223. if (WRAP_GetLastError != lpWRAP->lpVtbl->GetLastError)
  224. {
  225. /*
  226. * Wrong object - the object passed doesn't have this
  227. * method.
  228. */
  229. hResult = ResultFromScode(E_INVALIDARG);
  230. return hResult;
  231. }
  232. if ( ulFlags & ~MAPI_UNICODE )
  233. {
  234. hResult = ResultFromScode( MAPI_E_UNKNOWN_FLAGS );
  235. return hResult ;
  236. }
  237. #ifndef UNICODE
  238. if ( ulFlags & MAPI_UNICODE )
  239. {
  240. hResult = ResultFromScode( MAPI_E_BAD_CHARWIDTH );
  241. return hResult;
  242. }
  243. #endif
  244. return lpWRAP->lpPropData->lpVtbl->GetLastError( lpWRAP->lpPropData,
  245. hError,
  246. ulFlags,
  247. lppMapiError
  248. );
  249. }
  250. /* IProperty */
  251. STDMETHODIMP
  252. WRAP_SaveChanges( LPWRAP lpWRAP,
  253. ULONG ulFlags
  254. )
  255. {
  256. HRESULT hResult;
  257. /*
  258. * Check to see if it has a lpVtbl object member
  259. */
  260. if (IsBadReadPtr(lpWRAP, offsetof(WRAP, lpVtbl)+SIZEOF(WRAP_Vtbl *)))
  261. {
  262. /*
  263. * No jump table found
  264. */
  265. hResult = ResultFromScode(E_INVALIDARG);
  266. return hResult;
  267. }
  268. /*
  269. * Check to see that the Vtbl is large enough to include this method
  270. */
  271. if (IsBadReadPtr(lpWRAP->lpVtbl,
  272. offsetof(WRAP_Vtbl, SaveChanges)+SIZEOF(WRAP_SaveChanges_METHOD *)))
  273. {
  274. /*
  275. * Jump table not derived from IUnknown
  276. */
  277. hResult = ResultFromScode(E_INVALIDARG);
  278. return hResult;
  279. }
  280. /*
  281. * Check to see if the method is the same
  282. */
  283. if (WRAP_SaveChanges != lpWRAP->lpVtbl->SaveChanges)
  284. {
  285. /*
  286. * Wrong object - the object passed doesn't have this
  287. * method.
  288. */
  289. hResult = ResultFromScode(E_INVALIDARG);
  290. return hResult;
  291. }
  292. hResult = lpWRAP->lpPropData->lpVtbl->SaveChanges( lpWRAP->lpPropData,
  293. ulFlags
  294. );
  295. return hResult;
  296. }
  297. STDMETHODIMP
  298. WRAP_GetProps( LPWRAP lpWRAP,
  299. LPSPropTagArray lpPropTagArray,
  300. ULONG ulFlags,
  301. ULONG * lpcValues,
  302. LPSPropValue * lppPropArray
  303. )
  304. {
  305. HRESULT hResult;
  306. /*
  307. * Check to see if it has a lpVtbl object member
  308. */
  309. if (IsBadReadPtr(lpWRAP, offsetof(WRAP, lpVtbl)+SIZEOF(WRAP_Vtbl *)))
  310. {
  311. /*
  312. * No jump table found
  313. */
  314. hResult = ResultFromScode(E_INVALIDARG);
  315. return hResult;
  316. }
  317. /*
  318. * Check to see that the Vtbl is large enough to include this method
  319. */
  320. if (IsBadReadPtr(lpWRAP->lpVtbl,
  321. offsetof(WRAP_Vtbl, GetProps)+SIZEOF(WRAP_GetProps_METHOD *)))
  322. {
  323. /*
  324. * Jump table not derived from IUnknown
  325. */
  326. hResult = ResultFromScode(E_INVALIDARG);
  327. return hResult;
  328. }
  329. /*
  330. * Check to see if the method is the same
  331. */
  332. if (WRAP_GetProps != lpWRAP->lpVtbl->GetProps)
  333. {
  334. /*
  335. * Wrong object - the object passed doesn't have this
  336. * method.
  337. */
  338. hResult = ResultFromScode(E_INVALIDARG);
  339. return hResult;
  340. }
  341. if ( ulFlags & ~(MAPI_UNICODE) )
  342. {
  343. hResult = ResultFromScode( MAPI_E_UNKNOWN_FLAGS );
  344. return hResult;
  345. }
  346. #ifndef UNICODE
  347. if ( ulFlags & MAPI_UNICODE )
  348. {
  349. hResult = ResultFromScode( MAPI_E_BAD_CHARWIDTH );
  350. return hResult;
  351. }
  352. #endif
  353. return lpWRAP->lpPropData->lpVtbl->GetProps( lpWRAP->lpPropData,
  354. lpPropTagArray,
  355. ulFlags,
  356. lpcValues,
  357. lppPropArray
  358. );
  359. }
  360. STDMETHODIMP
  361. WRAP_GetPropList( LPWRAP lpWRAP,
  362. ULONG ulFlags,
  363. LPSPropTagArray * lppPropTagArray
  364. )
  365. {
  366. HRESULT hResult = hrSuccess;
  367. /*
  368. * Check to see if it has a lpVtbl object member
  369. */
  370. if (IsBadReadPtr(lpWRAP, offsetof(WRAP, lpVtbl)+SIZEOF(WRAP_Vtbl *)))
  371. {
  372. /*
  373. * No jump table found
  374. */
  375. hResult = ResultFromScode(E_INVALIDARG);
  376. return hResult;
  377. }
  378. /*
  379. * Check to see that the Vtbl is large enough to include this method
  380. */
  381. if (IsBadReadPtr(lpWRAP->lpVtbl,
  382. offsetof(WRAP_Vtbl, GetPropList)+SIZEOF(WRAP_GetPropList_METHOD *)))
  383. {
  384. /*
  385. * Jump table not derived from IUnknown
  386. */
  387. hResult = ResultFromScode(E_INVALIDARG);
  388. return hResult;
  389. }
  390. /*
  391. * Check to see if the method is the same
  392. */
  393. if (WRAP_GetPropList != lpWRAP->lpVtbl->GetPropList)
  394. {
  395. /*
  396. * Wrong object - the object passed doesn't have this
  397. * method.
  398. */
  399. hResult = ResultFromScode(E_INVALIDARG);
  400. return hResult;
  401. }
  402. if ( ulFlags & ~(MAPI_UNICODE) )
  403. {
  404. hResult = ResultFromScode( MAPI_E_UNKNOWN_FLAGS );
  405. return hResult;
  406. }
  407. #ifndef UNICODE
  408. if ( ulFlags & MAPI_UNICODE )
  409. {
  410. hResult = ResultFromScode( MAPI_E_BAD_CHARWIDTH );
  411. return hResult;
  412. }
  413. #endif
  414. return lpWRAP->lpPropData->lpVtbl->GetPropList( lpWRAP->lpPropData,
  415. ulFlags,
  416. lppPropTagArray
  417. );
  418. }
  419. STDMETHODIMP
  420. WRAP_OpenProperty( LPWRAP lpWRAP,
  421. ULONG ulPropTag,
  422. LPCIID lpiid,
  423. ULONG ulInterfaceOptions,
  424. ULONG ulFlags,
  425. LPUNKNOWN * lppUnk
  426. )
  427. {
  428. HRESULT hResult;
  429. /*
  430. * Check to see if it has a lpVtbl object member
  431. */
  432. if (IsBadReadPtr(lpWRAP, offsetof(WRAP, lpVtbl)+SIZEOF(WRAP_Vtbl *)))
  433. {
  434. /*
  435. * No jump table found
  436. */
  437. hResult = ResultFromScode(E_INVALIDARG);
  438. return hResult;
  439. }
  440. /*
  441. * Check to see that the Vtbl is large enough to include this method
  442. */
  443. if (IsBadReadPtr(lpWRAP->lpVtbl,
  444. offsetof(WRAP_Vtbl, OpenProperty)+SIZEOF(WRAP_OpenProperty_METHOD *)))
  445. {
  446. /*
  447. * Jump table not derived from IUnknown
  448. */
  449. hResult = ResultFromScode(E_INVALIDARG);
  450. return hResult;
  451. }
  452. /*
  453. * Check to see if the method is the same
  454. */
  455. if (WRAP_OpenProperty != lpWRAP->lpVtbl->OpenProperty)
  456. {
  457. /*
  458. * Wrong object - the object passed doesn't have this
  459. * method.
  460. */
  461. hResult = ResultFromScode(E_INVALIDARG);
  462. return hResult;
  463. }
  464. if ( ulInterfaceOptions & ~MAPI_UNICODE )
  465. {
  466. hResult = ResultFromScode( MAPI_E_UNKNOWN_FLAGS );
  467. return hResult;
  468. }
  469. #ifndef UNICODE
  470. if ( ulInterfaceOptions & MAPI_UNICODE )
  471. {
  472. hResult = ResultFromScode( MAPI_E_BAD_CHARWIDTH );
  473. return hResult;
  474. }
  475. #endif
  476. hResult = lpWRAP->lpPropData->lpVtbl->OpenProperty( lpWRAP->lpPropData,
  477. ulPropTag,
  478. lpiid,
  479. ulInterfaceOptions,
  480. ulFlags,
  481. lppUnk
  482. );
  483. return hResult;
  484. }
  485. STDMETHODIMP
  486. WRAP_SetProps( LPWRAP lpWRAP,
  487. ULONG cValues,
  488. LPSPropValue lpPropArray,
  489. LPSPropProblemArray * lppProblems
  490. )
  491. {
  492. HRESULT hResult;
  493. /*
  494. * Check to see if it has a lpVtbl object member
  495. */
  496. if (IsBadReadPtr(lpWRAP, offsetof(WRAP, lpVtbl)+SIZEOF(WRAP_Vtbl *)))
  497. {
  498. /*
  499. * No jump table found
  500. */
  501. hResult = ResultFromScode(E_INVALIDARG);
  502. return hResult;
  503. }
  504. /*
  505. * Check to see that the Vtbl is large enough to include this method
  506. */
  507. if (IsBadReadPtr(lpWRAP->lpVtbl,
  508. offsetof(WRAP_Vtbl, SetProps)+SIZEOF(WRAP_SetProps_METHOD *)))
  509. {
  510. /*
  511. * Jump table not derived from IUnknown
  512. */
  513. hResult = ResultFromScode(E_INVALIDARG);
  514. return hResult;
  515. }
  516. /*
  517. * Check to see if the method is the same
  518. */
  519. if (WRAP_SetProps != lpWRAP->lpVtbl->SetProps)
  520. {
  521. /*
  522. * Wrong object - the object passed doesn't have this
  523. * method.
  524. */
  525. hResult = ResultFromScode(E_INVALIDARG);
  526. return hResult;
  527. }
  528. return lpWRAP->lpPropData->lpVtbl->SetProps( lpWRAP->lpPropData,
  529. cValues,
  530. lpPropArray,
  531. lppProblems
  532. );
  533. }
  534. STDMETHODIMP
  535. WRAP_DeleteProps( LPWRAP lpWRAP,
  536. LPSPropTagArray lpPropTagArray,
  537. LPSPropProblemArray * lppProblems
  538. )
  539. {
  540. HRESULT hResult;
  541. /*
  542. * Check to see if it has a lpVtbl object member
  543. */
  544. if (IsBadReadPtr(lpWRAP, offsetof(WRAP, lpVtbl)+SIZEOF(WRAP_Vtbl *)))
  545. {
  546. /*
  547. * No jump table found
  548. */
  549. hResult = ResultFromScode(E_INVALIDARG);
  550. return hResult;
  551. }
  552. /*
  553. * Check to see that the Vtbl is large enough to include this method
  554. */
  555. if (IsBadReadPtr(lpWRAP->lpVtbl,
  556. offsetof(WRAP_Vtbl, DeleteProps)+SIZEOF(WRAP_DeleteProps_METHOD *)))
  557. {
  558. /*
  559. * Jump table not derived from IUnknown
  560. */
  561. hResult = ResultFromScode(E_INVALIDARG);
  562. return hResult;
  563. }
  564. /*
  565. * Check to see if the method is the same
  566. */
  567. if (WRAP_DeleteProps != lpWRAP->lpVtbl->DeleteProps)
  568. {
  569. /*
  570. * Wrong object - the object passed doesn't have this
  571. * method.
  572. */
  573. hResult = ResultFromScode(E_INVALIDARG);
  574. return hResult;
  575. }
  576. return lpWRAP->lpPropData->lpVtbl->DeleteProps( lpWRAP->lpPropData,
  577. lpPropTagArray,
  578. lppProblems
  579. );
  580. }
  581. STDMETHODIMP
  582. WRAP_CopyTo( LPWRAP lpWRAP,
  583. ULONG ciidExclude,
  584. LPCIID rgiidExclude,
  585. LPSPropTagArray lpExcludeProps,
  586. ULONG ulUIParam,
  587. LPMAPIPROGRESS lpProgress,
  588. LPCIID lpInterface,
  589. LPVOID lpDestObj,
  590. ULONG ulFlags,
  591. LPSPropProblemArray FAR * lppProblems
  592. )
  593. {
  594. HRESULT hResult;
  595. /*
  596. * Check to see if it has a lpVtbl object member
  597. */
  598. if (IsBadReadPtr(lpWRAP, offsetof(WRAP, lpVtbl)+SIZEOF(WRAP_Vtbl *)))
  599. {
  600. /*
  601. * No jump table found
  602. */
  603. hResult = ResultFromScode(E_INVALIDARG);
  604. return hResult;
  605. }
  606. /*
  607. * Check to see that the Vtbl is large enough to include this method
  608. */
  609. if (IsBadReadPtr(lpWRAP->lpVtbl,
  610. offsetof(WRAP_Vtbl, CopyTo)+SIZEOF(WRAP_CopyTo_METHOD *)))
  611. {
  612. /*
  613. * Jump table not derived from IUnknown
  614. */
  615. hResult = ResultFromScode(E_INVALIDARG);
  616. return hResult;
  617. }
  618. /*
  619. * Check to see if the method is the same
  620. */
  621. if (WRAP_CopyTo != lpWRAP->lpVtbl->CopyTo)
  622. {
  623. /*
  624. * Wrong object - the object passed doesn't have this
  625. * method.
  626. */
  627. hResult = ResultFromScode(E_INVALIDARG);
  628. return hResult;
  629. }
  630. return lpWRAP->lpPropData->lpVtbl->CopyTo( lpWRAP->lpPropData,
  631. ciidExclude,
  632. rgiidExclude,
  633. lpExcludeProps,
  634. ulUIParam,
  635. lpProgress,
  636. lpInterface,
  637. lpDestObj,
  638. ulFlags,
  639. lppProblems
  640. );
  641. }
  642. STDMETHODIMP
  643. WRAP_CopyProps( LPWRAP lpWRAP,
  644. LPSPropTagArray lpIncludeProps,
  645. ULONG ulUIParam,
  646. LPMAPIPROGRESS lpProgress,
  647. LPCIID lpInterface,
  648. LPVOID lpDestObj,
  649. ULONG ulFlags,
  650. LPSPropProblemArray FAR * lppProblems
  651. )
  652. {
  653. HRESULT hResult;
  654. /*
  655. * Check to see if it has a lpVtbl object member
  656. */
  657. if (IsBadReadPtr(lpWRAP, offsetof(WRAP, lpVtbl)+SIZEOF(WRAP_Vtbl *)))
  658. {
  659. /*
  660. * No jump table found
  661. */
  662. hResult = ResultFromScode(E_INVALIDARG);
  663. return hResult;
  664. }
  665. /*
  666. * Check to see that the Vtbl is large enough to include this method
  667. */
  668. if (IsBadReadPtr(lpWRAP->lpVtbl,
  669. offsetof(WRAP_Vtbl, CopyProps)+SIZEOF(WRAP_CopyProps_METHOD *)))
  670. {
  671. /*
  672. * Jump table not derived from IUnknown
  673. */
  674. hResult = ResultFromScode(E_INVALIDARG);
  675. return hResult;
  676. }
  677. /*
  678. * Check to see if the method is the same
  679. */
  680. if (WRAP_CopyProps != lpWRAP->lpVtbl->CopyProps)
  681. {
  682. /*
  683. * Wrong object - the object passed doesn't have this
  684. * method.
  685. */
  686. hResult = ResultFromScode(E_INVALIDARG);
  687. return hResult;
  688. }
  689. return lpWRAP->lpPropData->lpVtbl->CopyProps( lpWRAP->lpPropData,
  690. lpIncludeProps,
  691. ulUIParam,
  692. lpProgress,
  693. lpInterface,
  694. lpDestObj,
  695. ulFlags,
  696. lppProblems
  697. );
  698. }
  699. STDMETHODIMP
  700. WRAP_GetNamesFromIDs( LPWRAP lpWRAP,
  701. LPSPropTagArray * lppPropTags,
  702. LPGUID lpPropSetGuid,
  703. ULONG ulFlags,
  704. ULONG * lpcPropNames,
  705. LPMAPINAMEID ** lpppPropNames
  706. )
  707. {
  708. HRESULT hResult;
  709. /*
  710. * Check to see if it has a lpVtbl object member
  711. */
  712. if (IsBadReadPtr(lpWRAP, offsetof(WRAP, lpVtbl)+SIZEOF(WRAP_Vtbl *)))
  713. {
  714. /*
  715. * No jump table found
  716. */
  717. hResult = ResultFromScode(E_INVALIDARG);
  718. return hResult;
  719. }
  720. /*
  721. * Check to see that the Vtbl is large enough to include this method
  722. */
  723. if (IsBadReadPtr(lpWRAP->lpVtbl,
  724. offsetof(WRAP_Vtbl, GetNamesFromIDs)+SIZEOF(WRAP_GetNamesFromIDs_METHOD *)))
  725. {
  726. /*
  727. * Jump table not derived from IUnknown
  728. */
  729. hResult = ResultFromScode(E_INVALIDARG);
  730. return hResult;
  731. }
  732. /*
  733. * Check to see if the method is the same
  734. */
  735. if (WRAP_GetNamesFromIDs != lpWRAP->lpVtbl->GetNamesFromIDs)
  736. {
  737. /*
  738. * Wrong object - the object passed doesn't have this
  739. * method.
  740. */
  741. hResult = ResultFromScode(E_INVALIDARG);
  742. return hResult;
  743. }
  744. return lpWRAP->lpPropData->lpVtbl->GetNamesFromIDs( lpWRAP->lpPropData,
  745. lppPropTags,
  746. lpPropSetGuid,
  747. ulFlags,
  748. lpcPropNames,
  749. lpppPropNames
  750. );
  751. }
  752. STDMETHODIMP
  753. WRAP_GetIDsFromNames( LPWRAP lpWRAP,
  754. ULONG cPropNames,
  755. LPMAPINAMEID * lppPropNames,
  756. ULONG ulFlags,
  757. LPSPropTagArray * lppPropTags
  758. )
  759. {
  760. HRESULT hResult;
  761. /*
  762. * Check to see if it has a lpVtbl object member
  763. */
  764. if (IsBadReadPtr(lpWRAP, offsetof(WRAP, lpVtbl)+SIZEOF(WRAP_Vtbl *)))
  765. {
  766. /*
  767. * No jump table found
  768. */
  769. hResult = ResultFromScode(E_INVALIDARG);
  770. return hResult;
  771. }
  772. /*
  773. * Check to see that the Vtbl is large enough to include this method
  774. */
  775. if (IsBadReadPtr(lpWRAP->lpVtbl,
  776. offsetof(WRAP_Vtbl, GetIDsFromNames)+SIZEOF(WRAP_GetIDsFromNames_METHOD *)))
  777. {
  778. /*
  779. * Jump table not derived from IUnknown
  780. */
  781. hResult = ResultFromScode(E_INVALIDARG);
  782. return hResult;
  783. }
  784. /*
  785. * Check to see if the method is the same
  786. */
  787. if (WRAP_GetIDsFromNames != lpWRAP->lpVtbl->GetIDsFromNames)
  788. {
  789. /*
  790. * Wrong object - the object passed doesn't have this
  791. * method.
  792. */
  793. hResult = ResultFromScode(E_INVALIDARG);
  794. return hResult;
  795. }
  796. return lpWRAP->lpPropData->lpVtbl->GetIDsFromNames( lpWRAP->lpPropData,
  797. cPropNames,
  798. lppPropNames,
  799. ulFlags,
  800. lppPropTags
  801. );
  802. }