rpcrt4: Implement remaining part of NdrFullPointerQueryPointer and implement NdrFullPointerInsertRefId.
This commit is contained in:
parent
eb0fe9e6e3
commit
767631d853
|
@ -108,8 +108,6 @@ int WINAPI NdrFullPointerQueryPointer(PFULL_PTR_XLAT_TABLES pXlatTables,
|
|||
for (i = 0; i < sizeof(pPointer); i++)
|
||||
Hash = (Hash * 3) ^ ((unsigned char *)&pPointer)[i];
|
||||
|
||||
TRACE("pXlatTables->PointerToRefId.XlatTable = %p\n", pXlatTables->PointerToRefId.XlatTable);
|
||||
TRACE("Hash = 0x%lx, pXlatTables->PointerToRefId.HashMask = 0x%lx\n", Hash, pXlatTables->PointerToRefId.HashMask);
|
||||
XlatTableEntry = pXlatTables->PointerToRefId.XlatTable[Hash & pXlatTables->PointerToRefId.HashMask];
|
||||
for (; XlatTableEntry; XlatTableEntry = XlatTableEntry->Next)
|
||||
if (pPointer == XlatTableEntry->Pointer)
|
||||
|
@ -128,7 +126,13 @@ int WINAPI NdrFullPointerQueryPointer(PFULL_PTR_XLAT_TABLES pXlatTables,
|
|||
XlatTableEntry->State = QueryType;
|
||||
pXlatTables->PointerToRefId.XlatTable[Hash & pXlatTables->PointerToRefId.HashMask] = XlatTableEntry;
|
||||
|
||||
/* FIXME: insert pointer into mapping table */
|
||||
/* insert pointer into mapping table */
|
||||
expand_pointer_table_if_necessary(pXlatTables, XlatTableEntry->RefId);
|
||||
if (pXlatTables->RefIdToPointer.NumberOfEntries > XlatTableEntry->RefId)
|
||||
{
|
||||
pXlatTables->RefIdToPointer.XlatTable[XlatTableEntry->RefId] = pPointer;
|
||||
pXlatTables->RefIdToPointer.StateTable[XlatTableEntry->RefId] = QueryType;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -141,14 +145,35 @@ int WINAPI NdrFullPointerQueryRefId(PFULL_PTR_XLAT_TABLES pXlatTables,
|
|||
|
||||
expand_pointer_table_if_necessary(pXlatTables, RefId);
|
||||
|
||||
*ppPointer = pXlatTables->RefIdToPointer.XlatTable[RefId];
|
||||
if (pXlatTables->RefIdToPointer.NumberOfEntries > RefId)
|
||||
*ppPointer = pXlatTables->RefIdToPointer.XlatTable[RefId];
|
||||
return 0;
|
||||
}
|
||||
|
||||
void WINAPI NdrFullPointerInsertRefId(PFULL_PTR_XLAT_TABLES pXlatTables,
|
||||
unsigned long RefId, void *pPointer)
|
||||
{
|
||||
FIXME("(%p, 0x%lx, %p)\n", pXlatTables, RefId, pPointer);
|
||||
unsigned long Hash = 0;
|
||||
int i;
|
||||
PFULL_PTR_TO_REFID_ELEMENT XlatTableEntry;
|
||||
|
||||
TRACE("(%p, 0x%lx, %p)\n", pXlatTables, RefId, pPointer);
|
||||
|
||||
/* simple hashing algorithm, don't know whether it matches native */
|
||||
for (i = 0; i < sizeof(pPointer); i++)
|
||||
Hash = (Hash * 3) ^ ((unsigned char *)&pPointer)[i];
|
||||
|
||||
XlatTableEntry = HeapAlloc(GetProcessHeap(), 0, sizeof(*XlatTableEntry));
|
||||
XlatTableEntry->Next = pXlatTables->PointerToRefId.XlatTable[Hash & pXlatTables->PointerToRefId.HashMask];
|
||||
XlatTableEntry->Pointer = pPointer;
|
||||
XlatTableEntry->RefId = RefId;
|
||||
XlatTableEntry->State = 0;
|
||||
pXlatTables->PointerToRefId.XlatTable[Hash & pXlatTables->PointerToRefId.HashMask] = XlatTableEntry;
|
||||
|
||||
/* insert pointer into mapping table */
|
||||
expand_pointer_table_if_necessary(pXlatTables, RefId);
|
||||
if (pXlatTables->RefIdToPointer.NumberOfEntries > RefId)
|
||||
pXlatTables->RefIdToPointer.XlatTable[XlatTableEntry->RefId] = pPointer;
|
||||
}
|
||||
|
||||
int WINAPI NdrFullPointerFree(PFULL_PTR_XLAT_TABLES pXlatTables, void *Pointer)
|
||||
|
|
|
@ -724,9 +724,7 @@ static void test_fullpointer_xlat(void)
|
|||
|
||||
ret = NdrFullPointerQueryRefId(pXlatTables, 0x2, 0, &Pointer);
|
||||
ok(ret == 0, "ret should be 0 instead of 0x%x\n", ret);
|
||||
todo_wine {
|
||||
ok(Pointer == (void *)0xcafebabe, "Pointer should be 0xcafebabe instead of %p\n", Pointer);
|
||||
}
|
||||
|
||||
ret = NdrFullPointerQueryRefId(pXlatTables, 0x4, 0, &Pointer);
|
||||
ok(ret == 0, "ret should be 0 instead of 0x%x\n", ret);
|
||||
|
@ -736,9 +734,7 @@ static void test_fullpointer_xlat(void)
|
|||
|
||||
ret = NdrFullPointerQueryRefId(pXlatTables, 0x4, 1, &Pointer);
|
||||
ok(ret == 0, "ret should be 0 instead of 0x%x\n", ret);
|
||||
todo_wine {
|
||||
ok(Pointer == (void *)0xdeadbabe, "Pointer should be (void *)0xdeadbabe instead of %p\n", Pointer);
|
||||
}
|
||||
|
||||
NdrFullPointerXlatFree(pXlatTables);
|
||||
|
||||
|
@ -754,15 +750,13 @@ static void test_fullpointer_xlat(void)
|
|||
|
||||
ret = NdrFullPointerQueryRefId(pXlatTables, 0x2, 0, &Pointer);
|
||||
ok(ret == 0, "ret should be 0 instead of 0x%x\n", ret);
|
||||
todo_wine {
|
||||
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);
|
||||
}
|
||||
ok(Pointer == (void *)0xcafebabe, "Pointer should be (void *)0xcafebabe instead of %p\n", Pointer);
|
||||
|
||||
/* "marshaling" phase */
|
||||
|
||||
|
|
Loading…
Reference in New Issue