The Exchange SDK HrCreateDirEntryID Function Does Not Work Correctly When You Use Outlook 2002 (307742)
The information in this article applies to:
- Microsoft Exchange Software Development Kit (SDK)
This article was previously published under Q307742 SYMPTOMS
The call to the HrCreateDirEntryID function in the Exchange SDK March 2001 or earlier no longer works correctly after you upgrade to Microsoft Outlook 2002. This call works if you are using Microsoft Outlook 2000.
CAUSE
This behavior occurs because of a problem in the Exchange SDK. In HrSearchGAL, in Edkutils\Edkutils.c, the following call is incorrect:
hr = MAPICALL(lpAdrBook)->OpenEntry(
lpAdrBook,
cbGALEntryID,
lpGALEntryID,
&IID_IMAPIContainer,
MAPI_BEST_ACCESS | MAPI_DEFERRED_ERRORS,
&ulGALObjectType,
(LPUNKNOWN *) &lpGAL);
The problem is that the IID that is requested is IID_IMAPIContainer, but the code treats the returned interface pointer as a pointer to an IABContainer interface. (IABContainer is derived from IMAPIContainer.) In Outlook 2000, the interface that is returned from the OpenEntry call is an IABContainer interface, which works. In Outlook 2002, the interface that is returned is actually an IMAPIContainer interface, not an IABContainer interface. Therefore, when the code later tries to call IABContainer::ResolveNames, the vtable entry is not present, and the application stops unexpectedly (crashes).
RESOLUTION
Change the IID_IMAPIContainer to IID_IABContainer in the following call:
hr = MAPICALL(lpAdrBook)->OpenEntry(
lpAdrBook,
cbGALEntryID,
lpGALEntryID,
&IID_IMAPIContainer,
MAPI_BEST_ACCESS | MAPI_DEFERRED_ERRORS,
&ulGALObjectType,
(LPUNKNOWN *) &lpGAL);
The Exchange SDK includes full source code, so it is possible to fix the call. After you fix the call, you must perform a full rebuild of the Exchange SDK library.
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 7/11/2002 |
---|
Keywords: | kbbug KB307742 |
---|
|