rpcrt4: Store the QueryType in the state table in NdrFullPointerQueryRefId.

Implement NdrFullPointerFree.
This commit is contained in:
Robert Shearman 2006-05-26 19:56:35 +01:00 committed by Alexandre Julliard
parent 7af506b2b4
commit 63307241dd
2 changed files with 37 additions and 7 deletions

View File

@ -151,7 +151,11 @@ int WINAPI NdrFullPointerQueryRefId(PFULL_PTR_XLAT_TABLES pXlatTables,
{
*ppPointer = pXlatTables->RefIdToPointer.XlatTable[RefId];
if (QueryType)
return pXlatTables->RefIdToPointer.StateTable[RefId];
{
int ret = pXlatTables->RefIdToPointer.StateTable[RefId];
pXlatTables->RefIdToPointer.StateTable[RefId] = QueryType;
return ret;
}
else
return 0;
}
@ -187,7 +191,37 @@ void WINAPI NdrFullPointerInsertRefId(PFULL_PTR_XLAT_TABLES pXlatTables,
int WINAPI NdrFullPointerFree(PFULL_PTR_XLAT_TABLES pXlatTables, void *Pointer)
{
FIXME("(%p, %p)\n", pXlatTables, Pointer);
unsigned long Hash = 0;
int i;
PFULL_PTR_TO_REFID_ELEMENT XlatTableEntry;
unsigned long RefId = 0;
return 10;
TRACE("(%p, %p)\n", pXlatTables, Pointer);
if (!Pointer)
return 1;
/* simple hashing algorithm, don't know whether it matches native */
for (i = 0; i < sizeof(Pointer); i++)
Hash = (Hash * 3) ^ ((unsigned char *)&Pointer)[i];
XlatTableEntry = pXlatTables->PointerToRefId.XlatTable[Hash & pXlatTables->PointerToRefId.HashMask];
for (; XlatTableEntry; XlatTableEntry = XlatTableEntry->Next)
if (Pointer == XlatTableEntry->Pointer)
{
XlatTableEntry->State = 0x20;
RefId = XlatTableEntry->RefId;
break;
}
if (!XlatTableEntry)
return 0;
if (pXlatTables->RefIdToPointer.NumberOfEntries > RefId)
{
pXlatTables->RefIdToPointer.StateTable[RefId] = 0x20;
return 1;
}
return 0;
}

View File

@ -753,9 +753,7 @@ static void test_fullpointer_xlat(void)
ok(Pointer == (void *)0xcafebabe, "Pointer should be (void *)0xcafebabe instead of %p\n", Pointer);
ret = NdrFullPointerQueryRefId(pXlatTables, 0x2, 1, &Pointer);
todo_wine {
ok(ret == 1, "ret should be 1 instead of 0x%x\n", ret);
}
ok(Pointer == (void *)0xcafebabe, "Pointer should be (void *)0xcafebabe instead of %p\n", Pointer);
/* "marshaling" phase */
@ -784,7 +782,6 @@ static void test_fullpointer_xlat(void)
/* "freeing" phase */
todo_wine {
ret = NdrFullPointerFree(pXlatTables, (void *)0xcafebeef);
ok(ret == 1, "ret should be 1 instead of 0x%x\n", ret);
@ -793,7 +790,6 @@ static void test_fullpointer_xlat(void)
ret = NdrFullPointerFree(pXlatTables, (void *)0xdeadbeef);
ok(ret == 1, "ret should be 1 instead of 0x%x\n", ret);
}
NdrFullPointerXlatFree(pXlatTables);
}