Implement CreateIProp & most of MAPI's IMAPIProp & IPropData ifaces.

Implement FBadEntryList and make FBadProp use it.
Test CreateIProp, start of tests for IPropData interface.
This commit is contained in:
Jon Griffiths 2005-01-03 17:05:02 +00:00 committed by Alexandre Julliard
parent c730eec6e1
commit 91332bf471
4 changed files with 1519 additions and 109 deletions

View File

@ -42,7 +42,7 @@
54 stub DeregisterIdleRoutine@4
55 stub ChangeIdleRoutine@28
59 stdcall MAPIGetDefaultMalloc@0() MAPIGetDefaultMalloc
60 stub CreateIProp@24
60 stdcall CreateIProp@24(ptr ptr ptr ptr ptr ptr) CreateIProp
61 stub CreateTable@36
62 stdcall MNLS_lstrlenW@4(wstr) MNLS_lstrlenW
63 stdcall MNLS_lstrcmpW@8(wstr wstr) MNLS_lstrcmpW
@ -127,7 +127,7 @@
187 stub __ValidateParameters@8
188 stub __CPPValidateParameters@8
189 stub FBadSortOrderSet@4
190 stub FBadEntryList@4
190 stdcall FBadEntryList@4(ptr) FBadEntryList
191 stub FBadRestriction@4
192 stub ScUNCFromLocalPath@12
193 stub ScLocalPathFromUNC@12

File diff suppressed because it is too large Load Diff

View File

@ -51,6 +51,8 @@ static ULONG (WINAPI *pFBadPropTag)(ULONG);
static ULONG (WINAPI *pFBadRow)(LPSRow);
static ULONG (WINAPI *pFBadProp)(LPSPropValue);
static ULONG (WINAPI *pFBadColumnSet)(LPSPropTagArray);
static SCODE (WINAPI *pCreateIProp)(LPCIID,ALLOCATEBUFFER*,ALLOCATEMORE*,
FREEBUFFER*,LPVOID,LPPROPDATA*);
static ULONG ptTypes[] = {
PT_I2, PT_I4, PT_R4, PT_R8, PT_CURRENCY, PT_APPTIME, PT_SYSTIME,
@ -1115,6 +1117,218 @@ static void test_FBadColumnSet(void)
}
}
static void test_IProp(void)
{
IPropData *lpIProp;
LPMAPIERROR lpError;
LPSPropProblemArray lpProbs;
LPSPropValue lpProps;
LPSPropTagArray lpTags;
SPropValue pvs[2];
SizedSPropTagArray(2,tags);
ULONG access[2], count;
SCODE sc;
pCreateIProp = (void*)GetProcAddress(hMapi32, "CreateIProp@24");
if (!pCreateIProp)
return;
memset(&tags, 0 , sizeof(tags));
/* Create the object */
lpIProp = NULL;
sc = pCreateIProp(&IID_IMAPIPropData, MAPIAllocateBuffer, MAPIAllocateMore,
MAPIFreeBuffer, NULL, &lpIProp);
ok(sc == S_OK && lpIProp,
"CreateIProp: expected S_OK, non-null, got 0x%08lX,%p\n", sc, lpIProp);
if (sc != S_OK || !lpIProp)
return;
/* GetLastError - No errors set */
lpError = NULL;
IPropData_GetLastError(lpIProp, E_INVALIDARG, 0, &lpError);
ok(sc == S_OK && !lpError,
"GetLastError: Expected S_OK, null, got 0x%08lX,%p\n", sc, lpError);
/* Get prop tags - succeeds returning 0 items */
lpTags = NULL;
sc = IPropData_GetPropList(lpIProp, 0, &lpTags);
ok(sc == S_OK && lpTags && lpTags->cValues == 0,
"GetPropList(empty): Expected S_OK, non-null, 0, got 0x%08lX,%p,%ld\n",
sc, lpTags, lpTags ? lpTags->cValues : 0);
if (lpTags)
MAPIFreeBuffer(lpTags);
/* Get props - succeeds returning 0 items */
lpProps = NULL;
count = 0;
tags.cValues = 1;
tags.aulPropTag[0] = PR_IMPORTANCE;
sc = IPropData_GetProps(lpIProp, (LPSPropTagArray)&tags, 0, &count, &lpProps);
ok(sc == MAPI_W_ERRORS_RETURNED && lpProps && count == 1,
"GetProps(empty): Expected ERRORS_RETURNED, non-null, 1, got 0x%08lX,%p,%ld\n",
sc, lpProps, count);
if (lpProps && count > 0)
{
ok(lpProps[0].ulPropTag == CHANGE_PROP_TYPE(PR_IMPORTANCE,PT_ERROR),
"GetProps(empty): Expected %x, got %lx\n",
CHANGE_PROP_TYPE(PR_IMPORTANCE,PT_ERROR), lpProps[0].ulPropTag);
MAPIFreeBuffer(lpProps);
}
/* Add (NULL) - Can't add NULL's */
lpProbs = NULL;
pvs[0].ulPropTag = PROP_TAG(PT_NULL,0x01);
sc = IPropData_SetProps(lpIProp, 1, pvs, &lpProbs);
ok(sc == MAPI_E_INVALID_PARAMETER && !lpProbs,
"SetProps(): Expected INVALID_PARAMETER, null, got 0x%08lX,%p\n",
sc, lpProbs);
/* Add (OBJECT) - Can't add OBJECTS's */
lpProbs = NULL;
pvs[0].ulPropTag = PROP_TAG(PT_OBJECT,0x01);
sc = IPropData_SetProps(lpIProp, 1, pvs, &lpProbs);
ok(sc == MAPI_E_INVALID_PARAMETER && !lpProbs,
"SetProps(OBJECT): Expected INVALID_PARAMETER, null, got 0x%08lX,%p\n",
sc, lpProbs);
/* Add - Adds value */
lpProbs = NULL;
pvs[0].ulPropTag = PR_IMPORTANCE;
sc = IPropData_SetProps(lpIProp, 1, pvs, &lpProbs);
ok(sc == S_OK && !lpProbs,
"SetProps(ERROR): Expected S_OK, null, got 0x%08lX,%p\n", sc, lpProbs);
/* Get prop list - returns 1 item */
lpTags = NULL;
IPropData_GetPropList(lpIProp, 0, &lpTags);
ok(sc == S_OK && lpTags && lpTags->cValues == 1,
"GetPropList: Expected S_OK, non-null, 1, got 0x%08lX,%p,%ld\n",
sc, lpTags, lpTags ? lpTags->cValues : 0);
if (lpTags && lpTags->cValues > 0)
{
ok(lpTags->aulPropTag[0] == PR_IMPORTANCE,
"GetPropList: Expected %x, got %lx\n",
PR_IMPORTANCE, lpTags->aulPropTag[0]);
MAPIFreeBuffer(lpTags);
}
/* Set access to read and write */
sc = IPropData_HrSetObjAccess(lpIProp, IPROP_READWRITE);
ok(sc == S_OK, "SetObjAcess(WRITE): Expected S_OK got 0x%08lX\n", sc);
tags.cValues = 1;
tags.aulPropTag[0] = PR_IMPORTANCE;
/* Set item access (bad access) - Fails */
access[0] = 0;
sc = IPropData_HrSetPropAccess(lpIProp, (LPSPropTagArray)&tags, access);
ok(sc == MAPI_E_INVALID_PARAMETER,
"SetPropAcess(0): Expected INVALID_PARAMETER got 0x%08lX\n",sc);
access[0] = IPROP_READWRITE;
sc = IPropData_HrSetPropAccess(lpIProp, (LPSPropTagArray)&tags, access);
ok(sc == MAPI_E_INVALID_PARAMETER,
"SetPropAcess(RW): Expected INVALID_PARAMETER got 0x%08lX\n",sc);
access[0] = IPROP_CLEAN;
sc = IPropData_HrSetPropAccess(lpIProp, (LPSPropTagArray)&tags, access);
ok(sc == MAPI_E_INVALID_PARAMETER,
"SetPropAcess(C): Expected INVALID_PARAMETER got 0x%08lX\n",sc);
/* Set item access to read/write/clean */
tags.cValues = 1;
tags.aulPropTag[0] = PR_IMPORTANCE;
access[0] = IPROP_READWRITE|IPROP_CLEAN;
sc = IPropData_HrSetPropAccess(lpIProp, (LPSPropTagArray)&tags, access);
ok(sc == S_OK, "SetPropAcess(RW/C): Expected S_OK got 0x%08lX\n",sc);
/* Set object access to read only */
sc = IPropData_HrSetObjAccess(lpIProp, IPROP_READONLY);
ok(sc == S_OK, "SetObjAcess(READ): Expected S_OK got 0x%08lX\n", sc);
/* Set item access to read/write/dirty - doesn't care about RO object */
access[0] = IPROP_READONLY|IPROP_DIRTY;
sc = IPropData_HrSetPropAccess(lpIProp, (LPSPropTagArray)&tags, access);
ok(sc == S_OK, "SetPropAcess(WRITE): Expected S_OK got 0x%08lX\n", sc);
/* Delete any item when set to read only - Error */
lpProbs = NULL;
tags.aulPropTag[0] = PR_RESPONSE_REQUESTED;
sc = IPropData_DeleteProps(lpIProp, (LPSPropTagArray)&tags, &lpProbs);
ok(sc == E_ACCESSDENIED && !lpProbs,
"DeleteProps(non-existant): Expected E_ACCESSDENIED null got 0x%08lX %p\n",
sc, lpProbs);
/* Set access to read and write */
sc = IPropData_HrSetObjAccess(lpIProp, IPROP_READWRITE);
ok(sc == S_OK, "SetObjAcess(WRITE): Expected S_OK got 0x%08lX\n", sc);
/* Delete non existant item - No error */
lpProbs = NULL;
tags.aulPropTag[0] = PR_RESPONSE_REQUESTED;
sc = IPropData_DeleteProps(lpIProp, (LPSPropTagArray)&tags, &lpProbs);
ok(sc == S_OK && !lpProbs,
"DeleteProps(non-existant): Expected S_OK null got 0x%08lX %p\n",
sc, lpProbs);
/* Delete existant item (r/o) - No error, but lpProbs populated */
lpProbs = NULL;
tags.aulPropTag[0] = PR_IMPORTANCE;
sc = IPropData_DeleteProps(lpIProp, (LPSPropTagArray)&tags, &lpProbs);
ok(sc == S_OK && lpProbs,
"DeleteProps(RO): Expected S_OK non-null got 0x%08lX %p\n", sc, lpProbs);
if (lpProbs && lpProbs->cProblem > 0)
{
ok(lpProbs->cProblem == 1 &&
lpProbs->aProblem[0].ulIndex == 0 &&
lpProbs->aProblem[0].ulPropTag == PR_IMPORTANCE &&
lpProbs->aProblem[0].scode == E_ACCESSDENIED,
"DeleteProps(RO): Expected (1,0,%x,%lx) got (%ld,%lx,%lx)\n",
PR_IMPORTANCE, E_ACCESSDENIED,
lpProbs->aProblem[0].ulIndex, lpProbs->aProblem[0].ulPropTag,
lpProbs->aProblem[0].scode);
MAPIFreeBuffer(lpProbs);
}
lpProbs = NULL;
tags.cValues = 1;
tags.aulPropTag[0] = PR_RESPONSE_REQUESTED;
IPropData_HrAddObjProps(lpIProp, (LPSPropTagArray)&tags, &lpProbs);
ok(sc == S_OK && !lpProbs,
"AddObjProps(RO): Expected S_OK null got 0x%08lX %p\n", sc, lpProbs);
/* Get prop list - returns 1 item */
lpTags = NULL;
IPropData_GetPropList(lpIProp, 0, &lpTags);
ok(sc == S_OK && lpTags && lpTags->cValues == 1,
"GetPropList: Expected S_OK, non-null, 1, got 0x%08lX,%p,%ld\n",
sc, lpTags, lpTags ? lpTags->cValues : 0);
if (lpTags && lpTags->cValues > 0)
{
ok(lpTags->aulPropTag[0] == PR_IMPORTANCE,
"GetPropList: Expected %x, got %lx\n",
PR_IMPORTANCE, lpTags->aulPropTag[0]);
MAPIFreeBuffer(lpTags);
}
/* Set item to r/w again */
access[0] = IPROP_READWRITE|IPROP_DIRTY;
sc = IPropData_HrSetPropAccess(lpIProp, (LPSPropTagArray)&tags, access);
ok(sc == S_OK, "SetPropAcess(WRITE): Expected S_OK got 0x%08lX\n", sc);
/* Delete existant item (r/w) - No error, no problems */
lpProbs = NULL;
sc = IPropData_DeleteProps(lpIProp, (LPSPropTagArray)&tags, &lpProbs);
ok(sc == S_OK && !lpProbs,
"DeleteProps(RO): Expected S_OK null got 0x%08lX %p\n", sc, lpProbs);
/* Free the list */
IPropData_Release(lpIProp);
}
START_TEST(prop)
{
hMapi32 = LoadLibraryA("mapi32.dll");
@ -1140,4 +1354,6 @@ START_TEST(prop)
test_FBadRow();
test_FBadProp();
test_FBadColumnSet();
test_IProp();
}

View File

@ -747,6 +747,34 @@ ULONG WINAPI UlFromSzHex(LPCWSTR lpszHex)
return ulRet;
}
/************************************************************************
* FBadEntryList@4 (MAPI32.190)
*
* Determine is an entry list is invalid.
*
* PARAMS
* lpEntryList [I] List to check
*
* RETURNS
* TRUE, if lpEntryList is invalid,
* FALSE, otherwise.
*/
BOOL WINAPI FBadEntryList(LPENTRYLIST lpEntryList)
{
ULONG i;
if (IsBadReadPtr(lpEntryList, sizeof(*lpEntryList)) ||
IsBadReadPtr(lpEntryList->lpbin,
lpEntryList->cValues * sizeof(*lpEntryList->lpbin)))
return TRUE;
for (i = 0; i < lpEntryList->cValues; i++)
if(IsBadReadPtr(lpEntryList->lpbin[i].lpb, lpEntryList->lpbin[i].cb))
return TRUE;
return FALSE;
}
/*************************************************************************
* CbOfEncoded@4 (MAPI32.207)
*