Author: cwittich
Date: Fri Mar 5 19:41:30 2010
New Revision: 45882
URL:
http://svn.reactos.org/svn/reactos?rev=45882&view=rev
Log:
[MAPI32_WINETEST]
sync mapi32_winetest to wine 1.1.39
Modified:
trunk/rostests/winetests/mapi32/imalloc.c
trunk/rostests/winetests/mapi32/prop.c
trunk/rostests/winetests/mapi32/util.c
Modified: trunk/rostests/winetests/mapi32/imalloc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/mapi32/imalloc.…
==============================================================================
--- trunk/rostests/winetests/mapi32/imalloc.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/mapi32/imalloc.c [iso-8859-1] Fri Mar 5 19:41:30 2010
@@ -45,11 +45,18 @@
pMAPIGetDefaultMalloc = (void*)GetProcAddress(hMapi32,
"MAPIGetDefaultMalloc@0");
if (!pMAPIGetDefaultMalloc)
+ {
+ win_skip("MAPIGetDefaultMalloc is not available\n");
return;
+ }
lpMalloc = pMAPIGetDefaultMalloc();
+ ok(lpMalloc != NULL, "Expected MAPIGetDefaultMalloc to return
non-NULL\n");
if (!lpMalloc)
+ {
+ skip("MAPIGetDefaultMalloc failed\n");
return;
+ }
lpVoid = NULL;
hRet = IMalloc_QueryInterface(lpMalloc, &IID_IUnknown, &lpVoid);
Modified: trunk/rostests/winetests/mapi32/prop.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/mapi32/prop.c?r…
==============================================================================
--- trunk/rostests/winetests/mapi32/prop.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/mapi32/prop.c [iso-8859-1] Fri Mar 5 19:41:30 2010
@@ -32,6 +32,7 @@
static HMODULE hMapi32 = 0;
static SCODE (WINAPI *pScInitMapiUtil)(ULONG);
+static void (WINAPI *pDeinitMapiUtil)(void);
static SCODE (WINAPI
*pPropCopyMore)(LPSPropValue,LPSPropValue,ALLOCATEMORE*,LPVOID);
static ULONG (WINAPI *pUlPropSize)(LPSPropValue);
static BOOL (WINAPI *pFPropContainsProp)(LPSPropValue,LPSPropValue,ULONG);
@@ -53,26 +54,49 @@
FREEBUFFER*,LPVOID,LPPROPDATA*);
static SCODE (WINAPI *pMAPIAllocateBuffer)(ULONG, LPVOID);
static SCODE (WINAPI *pMAPIAllocateMore)(ULONG, LPVOID, LPVOID);
+static SCODE (WINAPI *pMAPIInitialize)(LPVOID);
static SCODE (WINAPI *pMAPIFreeBuffer)(LPVOID);
+static void (WINAPI *pMAPIUninitialize)(void);
static BOOL InitFuncPtrs(void)
{
hMapi32 = LoadLibraryA("mapi32.dll");
+ pPropCopyMore = (void*)GetProcAddress(hMapi32, "PropCopyMore@16");
+ pUlPropSize = (void*)GetProcAddress(hMapi32, "UlPropSize@4");
+ pFPropContainsProp = (void*)GetProcAddress(hMapi32,
"FPropContainsProp@12");
+ pFPropCompareProp = (void*)GetProcAddress(hMapi32, "FPropCompareProp@12");
+ pLPropCompareProp = (void*)GetProcAddress(hMapi32, "LPropCompareProp@8");
+ pPpropFindProp = (void*)GetProcAddress(hMapi32, "PpropFindProp@12");
+ pScCountProps = (void*)GetProcAddress(hMapi32, "ScCountProps@12");
+ pScCopyProps = (void*)GetProcAddress(hMapi32, "ScCopyProps@16");
+ pScRelocProps = (void*)GetProcAddress(hMapi32, "ScRelocProps@20");
+ pLpValFindProp = (void*)GetProcAddress(hMapi32, "LpValFindProp@12");
+ pFBadRglpszA = (void*)GetProcAddress(hMapi32, "FBadRglpszA@8");
+ pFBadRglpszW = (void*)GetProcAddress(hMapi32, "FBadRglpszW@8");
+ pFBadRowSet = (void*)GetProcAddress(hMapi32, "FBadRowSet@4");
+ pFBadPropTag = (void*)GetProcAddress(hMapi32, "FBadPropTag@4");
+ pFBadRow = (void*)GetProcAddress(hMapi32, "FBadRow@4");
+ pFBadProp = (void*)GetProcAddress(hMapi32, "FBadProp@4");
+ pFBadColumnSet = (void*)GetProcAddress(hMapi32, "FBadColumnSet@4");
+ pCreateIProp = (void*)GetProcAddress(hMapi32, "CreateIProp@24");
+
pScInitMapiUtil = (void*)GetProcAddress(hMapi32, "ScInitMapiUtil@4");
+ pDeinitMapiUtil = (void*)GetProcAddress(hMapi32, "DeinitMapiUtil@0");
pMAPIAllocateBuffer = (void*)GetProcAddress(hMapi32,
"MAPIAllocateBuffer");
pMAPIAllocateMore = (void*)GetProcAddress(hMapi32, "MAPIAllocateMore");
pMAPIFreeBuffer = (void*)GetProcAddress(hMapi32, "MAPIFreeBuffer");
- if(pScInitMapiUtil && pMAPIAllocateBuffer && pMAPIAllocateMore
&& pMAPIFreeBuffer)
- return TRUE;
- else
- return FALSE;
-}
-
+ pMAPIInitialize = (void*)GetProcAddress(hMapi32, "MAPIInitialize");
+ pMAPIUninitialize = (void*)GetProcAddress(hMapi32, "MAPIUninitialize");
+
+ return pMAPIAllocateBuffer && pMAPIAllocateMore && pMAPIFreeBuffer
&&
+ pScInitMapiUtil && pDeinitMapiUtil;
+}
+
+/* FIXME: Test PT_I2, PT_I4, PT_R4, PT_R8, PT_CURRENCY, PT_APPTIME, PT_SYSTIME,
+ * PT_ERROR, PT_BOOLEAN, PT_I8, and PT_CLSID. */
static ULONG ptTypes[] = {
- PT_I2, PT_I4, PT_R4, PT_R8, PT_CURRENCY, PT_APPTIME, PT_SYSTIME,
- PT_ERROR, PT_BOOLEAN, PT_I8, PT_CLSID, PT_STRING8, PT_BINARY,
- PT_UNICODE
+ PT_STRING8, PT_BINARY, PT_UNICODE
};
static inline int strcmpW(const WCHAR *str1, const WCHAR *str2)
@@ -89,18 +113,27 @@
ULONG i;
SCODE scode;
- pPropCopyMore = (void*)GetProcAddress(hMapi32, "PropCopyMore@16");
-
if (!pPropCopyMore)
- return;
-
- scode = pMAPIAllocateBuffer(sizeof(LPSPropValue), lpDest);
+ {
+ win_skip("PropCopyMore is not available\n");
+ return;
+ }
+
+ scode = pMAPIAllocateBuffer(sizeof(SPropValue), &lpDest);
+ ok(scode == S_OK, "Expected MAPIAllocateBuffer to return S_OK, got 0x%x\n",
scode);
if (FAILED(scode))
- return;
-
- scode = pMAPIAllocateMore(sizeof(LPSPropValue), lpDest, lpSrc);
+ {
+ skip("MAPIAllocateBuffer failed\n");
+ return;
+ }
+
+ scode = pMAPIAllocateMore(sizeof(SPropValue), lpDest, &lpSrc);
+ ok(scode == S_OK, "Expected MAPIAllocateMore to return S_OK, got 0x%x\n",
scode);
if (FAILED(scode))
- return;
+ {
+ skip("MAPIAllocateMore failed\n");
+ return;
+ }
for (i = 0; i < sizeof(ptTypes)/sizeof(ptTypes[0]); i++)
{
@@ -148,7 +181,8 @@
}
/* Since all allocations are linked, freeing lpDest frees everything */
- pMAPIFreeBuffer(lpDest);
+ scode = pMAPIFreeBuffer(lpDest);
+ ok(scode == S_OK, "Expected MAPIFreeBuffer to return S_OK, got 0x%x\n",
scode);
}
static void test_UlPropSize(void)
@@ -160,10 +194,11 @@
SBinary buffbin[2];
ULONG pt, exp, res;
- pUlPropSize = (void*)GetProcAddress(hMapi32, "UlPropSize@4");
-
if (!pUlPropSize)
- return;
+ {
+ win_skip("UlPropSize is not available\n");
+ return;
+ }
for (pt = 0; pt < PROP_ID_INVALID; pt++)
{
@@ -257,10 +292,11 @@
ULONG pt;
BOOL bRet;
- pFPropContainsProp = (void*)GetProcAddress(hMapi32,
"FPropContainsProp@12");
-
if (!pFPropContainsProp)
- return;
+ {
+ win_skip("FPropContainsProp is not available\n");
+ return;
+ }
/* Ensure that only PT_STRING8 and PT_BINARY are handled */
for (pt = 0; pt < PROP_ID_INVALID; pt++)
@@ -406,10 +442,11 @@
ULONG i, j;
BOOL bRet, bExp;
- pFPropCompareProp = (void*)GetProcAddress(hMapi32, "FPropCompareProp@12");
-
if (!pFPropCompareProp)
- return;
+ {
+ win_skip("FPropCompareProp is not available\n");
+ return;
+ }
lbuffa[1] = '\0';
rbuffa[1] = '\0';
@@ -535,10 +572,11 @@
ULONG i, j;
INT iRet, iExp;
- pLPropCompareProp = (void*)GetProcAddress(hMapi32, "LPropCompareProp@8");
-
if (!pLPropCompareProp)
- return;
+ {
+ win_skip("LPropCompareProp is not available\n");
+ return;
+ }
lbuffa[1] = '\0';
rbuffa[1] = '\0';
@@ -640,10 +678,11 @@
SPropValue pvProp, *pRet;
ULONG i;
- pPpropFindProp = (void*)GetProcAddress(hMapi32, "PpropFindProp@12");
-
if (!pPpropFindProp)
- return;
+ {
+ win_skip("PpropFindProp is not available\n");
+ return;
+ }
for (i = 0; i < sizeof(ptTypes)/sizeof(ptTypes[0]); i++)
{
@@ -679,10 +718,11 @@
ULONG pt, exp, ulRet;
int success = 1;
- pScCountProps = (void*)GetProcAddress(hMapi32, "ScCountProps@12");
-
if (!pScCountProps)
- return;
+ {
+ win_skip("ScCountProps is not available\n");
+ return;
+ }
for (pt = 0; pt < PROP_ID_INVALID && success; pt++)
{
@@ -814,11 +854,11 @@
ULONG ulCount;
SCODE sc;
- pScCopyProps = (void*)GetProcAddress(hMapi32, "ScCopyProps@16");
- pScRelocProps = (void*)GetProcAddress(hMapi32, "ScRelocProps@20");
-
if (!pScCopyProps || !pScRelocProps)
- return;
+ {
+ win_skip("SPropValue copy functions are not available\n");
+ return;
+ }
pvProp.ulPropTag = PROP_TAG(PT_MV_STRING8, 1u);
@@ -877,10 +917,11 @@
SPropValue pvProp, *pRet;
ULONG i;
- pLpValFindProp = (void*)GetProcAddress(hMapi32, "LpValFindProp@12");
-
if (!pLpValFindProp)
- return;
+ {
+ win_skip("LpValFindProp is not available\n");
+ return;
+ }
for (i = 0; i < sizeof(ptTypes)/sizeof(ptTypes[0]); i++)
{
@@ -912,9 +953,11 @@
static CHAR szString[] = "A String";
BOOL bRet;
- pFBadRglpszA = (void*)GetProcAddress(hMapi32, "FBadRglpszA@8");
if (!pFBadRglpszA)
- return;
+ {
+ win_skip("FBadRglpszA is not available\n");
+ return;
+ }
bRet = pFBadRglpszA(NULL, 10);
ok(bRet == TRUE, "FBadRglpszA(Null): expected TRUE, got FALSE\n");
@@ -937,9 +980,11 @@
static WCHAR szString[] = { 'A','
','S','t','r','i','n','g','\0'
};
BOOL bRet;
- pFBadRglpszW = (void*)GetProcAddress(hMapi32, "FBadRglpszW@8");
if (!pFBadRglpszW)
- return;
+ {
+ win_skip("FBadRglpszW is not available\n");
+ return;
+ }
bRet = pFBadRglpszW(NULL, 10);
ok(bRet == TRUE, "FBadRglpszW(Null): expected TRUE, got FALSE\n");
@@ -960,9 +1005,11 @@
{
ULONG ulRet;
- pFBadRowSet = (void*)GetProcAddress(hMapi32, "FBadRowSet@4");
if (!pFBadRowSet)
- return;
+ {
+ win_skip("FBadRowSet is not available\n");
+ return;
+ }
ulRet = pFBadRowSet(NULL);
ok(ulRet != 0, "FBadRow(null): Expected non-zero, got 0\n");
@@ -974,9 +1021,11 @@
{
ULONG pt, res;
- pFBadPropTag = (void*)GetProcAddress(hMapi32, "FBadPropTag@4");
if (!pFBadPropTag)
- return;
+ {
+ win_skip("FBadPropTag is not available\n");
+ return;
+ }
for (pt = 0; pt < PROP_ID_INVALID; pt++)
{
@@ -1006,9 +1055,11 @@
{
ULONG ulRet;
- pFBadRow = (void*)GetProcAddress(hMapi32, "FBadRow@4");
if (!pFBadRow)
- return;
+ {
+ win_skip("FBadRow is not available\n");
+ return;
+ }
ulRet = pFBadRow(NULL);
ok(ulRet != 0, "FBadRow(null): Expected non-zero, got 0\n");
@@ -1023,9 +1074,11 @@
ULONG pt, res;
SPropValue pv;
- pFBadProp = (void*)GetProcAddress(hMapi32, "FBadProp@4");
if (!pFBadProp)
- return;
+ {
+ win_skip("FBadProp is not available\n");
+ return;
+ }
for (pt = 0; pt < PROP_ID_INVALID; pt++)
{
@@ -1097,9 +1150,11 @@
SPropTagArray pta;
ULONG pt, res;
- pFBadColumnSet = (void*)GetProcAddress(hMapi32, "FBadColumnSet@4");
if (!pFBadColumnSet)
- return;
+ {
+ win_skip("FBadColumnSet is not available\n");
+ return;
+ }
res = pFBadColumnSet(NULL);
ok(res != 0, "(null): Expected non-zero, got 0\n");
@@ -1157,10 +1212,11 @@
ULONG access[2], count;
SCODE sc;
- pCreateIProp = (void*)GetProcAddress(hMapi32, "CreateIProp@24");
-
if (!pCreateIProp)
- return;
+ {
+ win_skip("CreateIProp is not available\n");
+ return;
+ }
memset(&tags, 0 , sizeof(tags));
@@ -1390,7 +1446,17 @@
test_PropCopyMore();
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();
+ if (pMAPIUninitialize && ret == S_OK)
+ pMAPIUninitialize();
+
test_FPropCompareProp();
test_LPropCompareProp();
test_PpropFindProp();
@@ -1406,5 +1472,7 @@
test_FBadColumnSet();
test_IProp();
+
+ pDeinitMapiUtil();
FreeLibrary(hMapi32);
}
Modified: trunk/rostests/winetests/mapi32/util.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/mapi32/util.c?r…
==============================================================================
--- trunk/rostests/winetests/mapi32/util.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/mapi32/util.c [iso-8859-1] Fri Mar 5 19:41:30 2010
@@ -31,22 +31,45 @@
static HMODULE hMapi32 = 0;
static SCODE (WINAPI *pScInitMapiUtil)(ULONG);
+static void (WINAPI *pDeinitMapiUtil)(void);
static void (WINAPI *pSwapPword)(PUSHORT,ULONG);
static void (WINAPI *pSwapPlong)(PULONG,ULONG);
static void (WINAPI *pHexFromBin)(LPBYTE,int,LPWSTR);
-static void (WINAPI *pFBinFromHex)(LPWSTR,LPBYTE);
+static BOOL (WINAPI *pFBinFromHex)(LPWSTR,LPBYTE);
static UINT (WINAPI *pUFromSz)(LPCSTR);
static ULONG (WINAPI *pUlFromSzHex)(LPCSTR);
static ULONG (WINAPI *pCbOfEncoded)(LPCSTR);
static BOOL (WINAPI *pIsBadBoundedStringPtr)(LPCSTR,ULONG);
+static SCODE (WINAPI *pMAPIInitialize)(LPVOID);
+static void (WINAPI *pMAPIUninitialize)(void);
+
+static void init_function_pointers(void)
+{
+ hMapi32 = LoadLibraryA("mapi32.dll");
+
+ pScInitMapiUtil = (void*)GetProcAddress(hMapi32, "ScInitMapiUtil@4");
+ pDeinitMapiUtil = (void*)GetProcAddress(hMapi32, "DeinitMapiUtil@0");
+ pSwapPword = (void*)GetProcAddress(hMapi32, "SwapPword@8");
+ pSwapPlong = (void*)GetProcAddress(hMapi32, "SwapPlong@8");
+ pHexFromBin = (void*)GetProcAddress(hMapi32, "HexFromBin@12");
+ pFBinFromHex = (void*)GetProcAddress(hMapi32, "FBinFromHex@8");
+ pUFromSz = (void*)GetProcAddress(hMapi32, "UFromSz@4");
+ pUlFromSzHex = (void*)GetProcAddress(hMapi32, "UlFromSzHex@4");
+ pCbOfEncoded = (void*)GetProcAddress(hMapi32, "CbOfEncoded@4");
+ pIsBadBoundedStringPtr = (void*)GetProcAddress(hMapi32,
"IsBadBoundedStringPtr@8");
+ pMAPIInitialize = (void*)GetProcAddress(hMapi32, "MAPIInitialize");
+ pMAPIUninitialize = (void*)GetProcAddress(hMapi32, "MAPIUninitialize");
+}
static void test_SwapPword(void)
{
USHORT shorts[3];
- pSwapPword = (void*)GetProcAddress(hMapi32, "SwapPword@8");
if (!pSwapPword)
- return;
+ {
+ win_skip("SwapPword is not available\n");
+ return;
+ }
shorts[0] = 0xff01;
shorts[1] = 0x10ff;
@@ -61,9 +84,11 @@
{
ULONG longs[3];
- pSwapPlong = (void*)GetProcAddress(hMapi32, "SwapPlong@8");
if (!pSwapPlong)
- return;
+ {
+ win_skip("SwapPlong is not available\n");
+ return;
+ }
longs[0] = 0xffff0001;
longs[1] = 0x1000ffff;
@@ -89,10 +114,11 @@
BOOL bOk;
int i;
- pHexFromBin = (void*)GetProcAddress(hMapi32, "HexFromBin@12");
- pFBinFromHex = (void*)GetProcAddress(hMapi32, "FBinFromHex@8");
if (!pHexFromBin || !pFBinFromHex)
- return;
+ {
+ win_skip("Hexadecimal conversion functions are not available\n");
+ return;
+ }
for (i = 0; i < 255; i++)
data[i] = i;
@@ -112,9 +138,11 @@
static void test_UFromSz(void)
{
- pUFromSz = (void*)GetProcAddress(hMapi32, "UFromSz@4");
if (!pUFromSz)
- return;
+ {
+ win_skip("UFromSz is not available\n");
+ return;
+ }
ok(pUFromSz("105679") == 105679u,
"UFromSz: expected 105679, got %d\n", pUFromSz("105679"));
@@ -125,9 +153,11 @@
static void test_UlFromSzHex(void)
{
- pUlFromSzHex = (void*)GetProcAddress(hMapi32, "UlFromSzHex@4");
if (!pUlFromSzHex)
- return;
+ {
+ win_skip("UlFromSzHex is not available\n");
+ return;
+ }
ok(pUlFromSzHex("fF") == 0xffu,
"UlFromSzHex: expected 0xff, got 0x%x\n",
pUlFromSzHex("fF"));
@@ -141,9 +171,11 @@
char buff[129];
unsigned int i;
- pCbOfEncoded = (void*)GetProcAddress(hMapi32, "CbOfEncoded@4");
if (!pCbOfEncoded)
- return;
+ {
+ win_skip("CbOfEncoded is not available\n");
+ return;
+ }
for (i = 0; i < sizeof(buff) - 1; i++)
{
@@ -160,9 +192,11 @@
static void test_IsBadBoundedStringPtr(void)
{
- pIsBadBoundedStringPtr = (void*)GetProcAddress(hMapi32,
"IsBadBoundedStringPtr@8");
if (!pIsBadBoundedStringPtr)
- return;
+ {
+ win_skip("IsBadBoundedStringPtr is not available\n");
+ return;
+ }
ok(pIsBadBoundedStringPtr(NULL, 0) == TRUE, "IsBadBoundedStringPtr: expected
TRUE\n");
ok(pIsBadBoundedStringPtr("TEST", 4) == TRUE, "IsBadBoundedStringPtr:
expected TRUE\n");
@@ -179,13 +213,11 @@
return;
}
- hMapi32 = LoadLibraryA("mapi32.dll");
-
- pScInitMapiUtil = (void*)GetProcAddress(hMapi32, "ScInitMapiUtil@4");
-
- if (!pScInitMapiUtil)
- {
- win_skip("ScInitMapiUtil is not available\n");
+ init_function_pointers();
+
+ if (!pScInitMapiUtil || !pDeinitMapiUtil)
+ {
+ win_skip("MAPI utility initialization functions are not available\n");
FreeLibrary(hMapi32);
return;
}
@@ -207,11 +239,22 @@
test_SwapPword();
test_SwapPlong();
+
+ /* We call MAPIInitialize here for the benefit of native extended MAPI
+ * providers which crash in the HexFromBin tests when MAPIInitialize has
+ * not been called. Since MAPIInitialize is irrelevant for HexFromBin on
+ * Wine, we do not care whether MAPIInitialize succeeds. */
+ if (pMAPIInitialize)
+ ret = pMAPIInitialize(NULL);
test_HexFromBin();
+ if (pMAPIUninitialize && ret == S_OK)
+ pMAPIUninitialize();
+
test_UFromSz();
test_UlFromSzHex();
test_CbOfEncoded();
test_IsBadBoundedStringPtr();
+ pDeinitMapiUtil();
FreeLibrary(hMapi32);
}