Commit 63307241 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

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

Implement NdrFullPointerFree.
parent 7af506b2
......@@ -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;
TRACE("(%p, %p)\n", pXlatTables, Pointer);
return 10;
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;
}
......@@ -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);
}
......
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