Commit 4ed80f3b authored by Andrew Nguyen's avatar Andrew Nguyen Committed by Alexandre Julliard

mapi32/tests: Invoke MAPIInitialize before performing the FPropContainsProp tests.

This avoids crashes with the native Outlook extended MAPI provider.
parent 2da6570c
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
static HMODULE hMapi32 = 0; static HMODULE hMapi32 = 0;
static SCODE (WINAPI *pScInitMapiUtil)(ULONG); static SCODE (WINAPI *pScInitMapiUtil)(ULONG);
static void (WINAPI *pDeinitMapiUtil)(void);
static SCODE (WINAPI *pPropCopyMore)(LPSPropValue,LPSPropValue,ALLOCATEMORE*,LPVOID); static SCODE (WINAPI *pPropCopyMore)(LPSPropValue,LPSPropValue,ALLOCATEMORE*,LPVOID);
static ULONG (WINAPI *pUlPropSize)(LPSPropValue); static ULONG (WINAPI *pUlPropSize)(LPSPropValue);
static BOOL (WINAPI *pFPropContainsProp)(LPSPropValue,LPSPropValue,ULONG); static BOOL (WINAPI *pFPropContainsProp)(LPSPropValue,LPSPropValue,ULONG);
...@@ -53,7 +54,9 @@ static SCODE (WINAPI *pCreateIProp)(LPCIID,ALLOCATEBUFFER*,ALLOCATEMORE*, ...@@ -53,7 +54,9 @@ static SCODE (WINAPI *pCreateIProp)(LPCIID,ALLOCATEBUFFER*,ALLOCATEMORE*,
FREEBUFFER*,LPVOID,LPPROPDATA*); FREEBUFFER*,LPVOID,LPPROPDATA*);
static SCODE (WINAPI *pMAPIAllocateBuffer)(ULONG, LPVOID); static SCODE (WINAPI *pMAPIAllocateBuffer)(ULONG, LPVOID);
static SCODE (WINAPI *pMAPIAllocateMore)(ULONG, LPVOID, LPVOID); static SCODE (WINAPI *pMAPIAllocateMore)(ULONG, LPVOID, LPVOID);
static SCODE (WINAPI *pMAPIInitialize)(LPVOID);
static SCODE (WINAPI *pMAPIFreeBuffer)(LPVOID); static SCODE (WINAPI *pMAPIFreeBuffer)(LPVOID);
static void (WINAPI *pMAPIUninitialize)(void);
static BOOL InitFuncPtrs(void) static BOOL InitFuncPtrs(void)
{ {
...@@ -79,13 +82,15 @@ static BOOL InitFuncPtrs(void) ...@@ -79,13 +82,15 @@ static BOOL InitFuncPtrs(void)
pCreateIProp = (void*)GetProcAddress(hMapi32, "CreateIProp@24"); pCreateIProp = (void*)GetProcAddress(hMapi32, "CreateIProp@24");
pScInitMapiUtil = (void*)GetProcAddress(hMapi32, "ScInitMapiUtil@4"); pScInitMapiUtil = (void*)GetProcAddress(hMapi32, "ScInitMapiUtil@4");
pDeinitMapiUtil = (void*)GetProcAddress(hMapi32, "DeinitMapiUtil@0");
pMAPIAllocateBuffer = (void*)GetProcAddress(hMapi32, "MAPIAllocateBuffer"); pMAPIAllocateBuffer = (void*)GetProcAddress(hMapi32, "MAPIAllocateBuffer");
pMAPIAllocateMore = (void*)GetProcAddress(hMapi32, "MAPIAllocateMore"); pMAPIAllocateMore = (void*)GetProcAddress(hMapi32, "MAPIAllocateMore");
pMAPIFreeBuffer = (void*)GetProcAddress(hMapi32, "MAPIFreeBuffer"); pMAPIFreeBuffer = (void*)GetProcAddress(hMapi32, "MAPIFreeBuffer");
if(pScInitMapiUtil && pMAPIAllocateBuffer && pMAPIAllocateMore && pMAPIFreeBuffer) pMAPIInitialize = (void*)GetProcAddress(hMapi32, "MAPIInitialize");
return TRUE; pMAPIUninitialize = (void*)GetProcAddress(hMapi32, "MAPIUninitialize");
else
return FALSE; return pMAPIAllocateBuffer && pMAPIAllocateMore && pMAPIFreeBuffer &&
pScInitMapiUtil && pDeinitMapiUtil;
} }
/* FIXME: Test PT_I2, PT_I4, PT_R4, PT_R8, PT_CURRENCY, PT_APPTIME, PT_SYSTIME, /* FIXME: Test PT_I2, PT_I4, PT_R4, PT_R8, PT_CURRENCY, PT_APPTIME, PT_SYSTIME,
...@@ -1441,7 +1446,17 @@ START_TEST(prop) ...@@ -1441,7 +1446,17 @@ START_TEST(prop)
test_PropCopyMore(); test_PropCopyMore();
test_UlPropSize(); test_UlPropSize();
/* We call MAPIInitialize here for the benefit of native extended MAPI
* providers which crash in the FPropContainsProp tests when MAPIInitialize
* has not been called. Since MAPIInitialize is irrelevant for FPropContainsProp
* on Wine, we do not care whether MAPIInitialize succeeds. */
if (pMAPIInitialize)
ret = pMAPIInitialize(NULL);
test_FPropContainsProp(); test_FPropContainsProp();
if (pMAPIUninitialize && ret == S_OK)
pMAPIUninitialize();
test_FPropCompareProp(); test_FPropCompareProp();
test_LPropCompareProp(); test_LPropCompareProp();
test_PpropFindProp(); test_PpropFindProp();
...@@ -1457,5 +1472,7 @@ START_TEST(prop) ...@@ -1457,5 +1472,7 @@ START_TEST(prop)
test_FBadColumnSet(); test_FBadColumnSet();
test_IProp(); test_IProp();
pDeinitMapiUtil();
FreeLibrary(hMapi32); FreeLibrary(hMapi32);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment