rpcrt4: For full pointers the state consists of flags, so or new flags into the field instead of assigning.
The return value of all full pointer functions that return an int depends on the passed in query type being a flag in the state.
This commit is contained in:
parent
5ca5c8489e
commit
bf985900e2
|
@ -113,10 +113,10 @@ int WINAPI NdrFullPointerQueryPointer(PFULL_PTR_XLAT_TABLES pXlatTables,
|
|||
if (pPointer == XlatTableEntry->Pointer)
|
||||
{
|
||||
*pRefId = XlatTableEntry->RefId;
|
||||
if (pXlatTables->XlatSide == XLAT_SERVER)
|
||||
return XlatTableEntry->State;
|
||||
else
|
||||
return 0;
|
||||
if (XlatTableEntry->State & QueryType)
|
||||
return 1;
|
||||
XlatTableEntry->State |= QueryType;
|
||||
return 0;
|
||||
}
|
||||
|
||||
XlatTableEntry = HeapAlloc(GetProcessHeap(), 0, sizeof(*XlatTableEntry));
|
||||
|
@ -152,9 +152,10 @@ int WINAPI NdrFullPointerQueryRefId(PFULL_PTR_XLAT_TABLES pXlatTables,
|
|||
*ppPointer = pXlatTables->RefIdToPointer.XlatTable[RefId];
|
||||
if (QueryType)
|
||||
{
|
||||
int ret = pXlatTables->RefIdToPointer.StateTable[RefId];
|
||||
pXlatTables->RefIdToPointer.StateTable[RefId] = QueryType;
|
||||
return ret;
|
||||
if (pXlatTables->RefIdToPointer.StateTable[RefId] & QueryType)
|
||||
return 1;
|
||||
pXlatTables->RefIdToPointer.StateTable[RefId] |= QueryType;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
|
@ -209,7 +210,9 @@ int WINAPI NdrFullPointerFree(PFULL_PTR_XLAT_TABLES pXlatTables, void *Pointer)
|
|||
for (; XlatTableEntry; XlatTableEntry = XlatTableEntry->Next)
|
||||
if (Pointer == XlatTableEntry->Pointer)
|
||||
{
|
||||
XlatTableEntry->State = 0x20;
|
||||
if (XlatTableEntry->State & 0x20)
|
||||
return 0;
|
||||
XlatTableEntry->State |= 0x20;
|
||||
RefId = XlatTableEntry->RefId;
|
||||
break;
|
||||
}
|
||||
|
@ -219,7 +222,7 @@ int WINAPI NdrFullPointerFree(PFULL_PTR_XLAT_TABLES pXlatTables, void *Pointer)
|
|||
|
||||
if (pXlatTables->RefIdToPointer.NumberOfEntries > RefId)
|
||||
{
|
||||
pXlatTables->RefIdToPointer.StateTable[RefId] = 0x20;
|
||||
pXlatTables->RefIdToPointer.StateTable[RefId] |= 0x20;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -767,9 +767,7 @@ static void test_fullpointer_xlat(void)
|
|||
ok(RefId == 0x3, "RefId should be 0x3 instead of 0x%lx\n", RefId);
|
||||
|
||||
ret = NdrFullPointerQueryPointer(pXlatTables, (void *)0xcafebeef, 0, &RefId);
|
||||
todo_wine {
|
||||
ok(ret == 0, "ret should be 0 instead of 0x%x\n", ret);
|
||||
}
|
||||
ok(RefId == 0x3, "RefId should be 0x3 instead of 0x%lx\n", RefId);
|
||||
|
||||
ret = NdrFullPointerQueryPointer(pXlatTables, (void *)0xcafebabe, 0, &RefId);
|
||||
|
@ -785,12 +783,35 @@ static void test_fullpointer_xlat(void)
|
|||
ret = NdrFullPointerFree(pXlatTables, (void *)0xcafebeef);
|
||||
ok(ret == 1, "ret should be 1 instead of 0x%x\n", ret);
|
||||
|
||||
ret = NdrFullPointerQueryPointer(pXlatTables, (void *)0xcafebeef, 0x20, &RefId);
|
||||
ok(ret == 1, "ret should be 1 instead of 0x%x\n", ret);
|
||||
ok(RefId == 0x3, "RefId should be 0x3 instead of 0x%lx\n", RefId);
|
||||
|
||||
ret = NdrFullPointerQueryPointer(pXlatTables, (void *)0xcafebeef, 1, &RefId);
|
||||
ok(ret == 1, "ret should be 1 instead of 0x%x\n", ret);
|
||||
ok(RefId == 0x3, "RefId should be 0x3 instead of 0x%lx\n", RefId);
|
||||
|
||||
ret = NdrFullPointerFree(pXlatTables, (void *)0xcafebabe);
|
||||
ok(ret == 1, "ret should be 1 instead of 0x%x\n", ret);
|
||||
|
||||
ret = NdrFullPointerFree(pXlatTables, (void *)0xdeadbeef);
|
||||
ok(ret == 1, "ret should be 1 instead of 0x%x\n", ret);
|
||||
|
||||
ret = NdrFullPointerQueryPointer(pXlatTables, (void *)0xdeadbeef, 0x20, &RefId);
|
||||
ok(ret == 1, "ret should be 1 instead of 0x%x\n", ret);
|
||||
ok(RefId == 0x4, "RefId should be 0x4 instead of 0x%lx\n", RefId);
|
||||
|
||||
ret = NdrFullPointerQueryPointer(pXlatTables, (void *)0xdeadbeef, 1, &RefId);
|
||||
ok(ret == 0, "ret should be 0 instead of 0x%x\n", ret);
|
||||
ok(RefId == 0x4, "RefId should be 0x4 instead of 0x%lx\n", RefId);
|
||||
|
||||
ret = NdrFullPointerQueryPointer(pXlatTables, (void *)0xdeadbeef, 1, &RefId);
|
||||
ok(ret == 1, "ret should be 1 instead of 0x%x\n", ret);
|
||||
ok(RefId == 0x4, "RefId should be 0x4 instead of 0x%lx\n", RefId);
|
||||
|
||||
ret = NdrFullPointerFree(pXlatTables, (void *)0xdeadbeef);
|
||||
ok(ret == 0, "ret should be 0 instead of 0x%x\n", ret);
|
||||
|
||||
NdrFullPointerXlatFree(pXlatTables);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue