Author: fireball
Date: Thu Nov 6 14:12:22 2008
New Revision: 37231
URL:
http://svn.reactos.org/svn/reactos?rev=37231&view=rev
Log:
- Sync rpcrt4_winetest too.
Modified:
trunk/rostests/winetests/rpcrt4/cstub.c
trunk/rostests/winetests/rpcrt4/ndr_marshall.c
trunk/rostests/winetests/rpcrt4/rpc.c
trunk/rostests/winetests/rpcrt4/server.c
trunk/rostests/winetests/rpcrt4/server.idl
Modified: trunk/rostests/winetests/rpcrt4/cstub.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/rpcrt4/cstub.c?…
==============================================================================
--- trunk/rostests/winetests/rpcrt4/cstub.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/rpcrt4/cstub.c [iso-8859-1] Thu Nov 6 14:12:22 2008
@@ -432,6 +432,7 @@
{
IPSFactoryBuffer *ppsf = NULL;
const CLSID PSDispatch = {0x20420, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46}};
+ const CLSID CLSID_Unknown = {0x45678, 0x1234, 0x6666, {0xff, 0x67, 0x45, 0x98, 0x76,
0x12, 0x34, 0x56}};
HRESULT r;
HMODULE hmod = LoadLibraryA("rpcrt4.dll");
void *CStd_QueryInterface = GetProcAddress(hmod,
"CStdStubBuffer_QueryInterface");
@@ -444,6 +445,11 @@
void *CStd_CountRefs = GetProcAddress(hmod, "CStdStubBuffer_CountRefs");
void *CStd_DebugServerQueryInterface = GetProcAddress(hmod,
"CStdStubBuffer_DebugServerQueryInterface");
void *CStd_DebugServerRelease = GetProcAddress(hmod,
"CStdStubBuffer_DebugServerRelease");
+
+ r = NdrDllGetClassObject(&PSDispatch, &IID_IPSFactoryBuffer,
(void**)&ppsf, proxy_file_list,
+ &CLSID_Unknown, &PSFactoryBuffer);
+ ok(r == CLASS_E_CLASSNOTAVAILABLE, "NdrDllGetClassObject with unknown clsid
should have returned CLASS_E_CLASSNOTAVAILABLE instead of 0x%x\n", r);
+ ok(ppsf == NULL, "NdrDllGetClassObject should have set ppsf to NULL on
failure\n");
r = NdrDllGetClassObject(&PSDispatch, &IID_IPSFactoryBuffer,
(void**)&ppsf, proxy_file_list,
&PSDispatch, &PSFactoryBuffer);
@@ -518,6 +524,13 @@
#undef VTBL_TEST_ZERO
ok(PSFactoryBuffer.RefCount == 1, "ref count %d\n",
PSFactoryBuffer.RefCount);
+ IPSFactoryBuffer_Release(ppsf);
+
+ r = NdrDllGetClassObject(&IID_if3, &IID_IPSFactoryBuffer, (void**)&ppsf,
proxy_file_list,
+ NULL, &PSFactoryBuffer);
+ ok(r == S_OK, "ret %08x\n", r);
+ ok(ppsf != NULL, "ppsf == NULL\n");
+
return ppsf;
}
Modified: trunk/rostests/winetests/rpcrt4/ndr_marshall.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/rpcrt4/ndr_mars…
==============================================================================
--- trunk/rostests/winetests/rpcrt4/ndr_marshall.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/rpcrt4/ndr_marshall.c [iso-8859-1] Thu Nov 6 14:12:22 2008
@@ -1191,11 +1191,17 @@
TEST_ZERO(fHasExtensions, "%d");
TEST_ZERO(fHasNewCorrDesc, "%d");
TEST_ZERO(fIsIn, "%d");
- TEST_ZERO(fIsOut, "%d");
+ ok(stubMsg.fIsOut == 0 ||
+ stubMsg.fIsOut == -1, /* XP-SP3 */
+ "fIsOut should have been set to 0 or -1 instead of %d\n",
stubMsg.fIsOut);
TEST_ZERO(fIsOicf, "%d");
TEST_ZERO(fBufferValid, "%d");
- TEST_ZERO(fHasMemoryValidateCallback, "%d");
- TEST_ZERO(fInFree, "%d");
+ ok(stubMsg.fHasMemoryValidateCallback == 0 ||
+ stubMsg.fHasMemoryValidateCallback == -1, /* XP-SP3 */
+ "fHasMemoryValidateCallback should have been set to 0 or -1 instead of
%d\n", stubMsg.fHasMemoryValidateCallback);
+ ok(stubMsg.fInFree == 0 ||
+ stubMsg.fInFree == -1, /* XP-SP3 */
+ "fInFree should have been set to 0 or -1 instead of %d\n",
stubMsg.fInFree);
TEST_ZERO(fNeedMCCP, "%d");
ok(stubMsg.fUnused == 0 ||
stubMsg.fUnused == -2, /* Vista */
@@ -1302,11 +1308,17 @@
TEST_ZERO(fHasExtensions, "%d");
TEST_ZERO(fHasNewCorrDesc, "%d");
TEST_ZERO(fIsIn, "%d");
- TEST_ZERO(fIsOut, "%d");
+ ok(stubMsg.fIsOut == 0 ||
+ stubMsg.fIsOut == -1, /* XP-SP3 */
+ "fIsOut should have been set to 0 or -1 instead of %d\n",
stubMsg.fIsOut);
TEST_ZERO(fIsOicf, "%d");
trace("fBufferValid = %d\n", stubMsg.fBufferValid);
- TEST_ZERO(fHasMemoryValidateCallback, "%d");
- TEST_ZERO(fInFree, "%d");
+ ok(stubMsg.fHasMemoryValidateCallback == 0 ||
+ stubMsg.fHasMemoryValidateCallback == -1, /* XP-SP3 */
+ "fHasMemoryValidateCallback should have been set to 0 or -1 instead of
%d\n", stubMsg.fHasMemoryValidateCallback);
+ ok(stubMsg.fInFree == 0 ||
+ stubMsg.fInFree == -1, /* XP-SP3 */
+ "fInFree should have been set to 0 or -1 instead of %d\n",
stubMsg.fInFree);
TEST_ZERO(fNeedMCCP, "%d");
ok(stubMsg.fUnused == 0 ||
stubMsg.fUnused == -2, /* Vista */
Modified: trunk/rostests/winetests/rpcrt4/rpc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/rpcrt4/rpc.c?re…
==============================================================================
--- trunk/rostests/winetests/rpcrt4/rpc.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/rpcrt4/rpc.c [iso-8859-1] Thu Nov 6 14:12:22 2008
@@ -385,7 +385,9 @@
ok(ret == RPC_S_OK, "TowerConstruct failed with error %ld\n", ret);
ret = TowerExplode(tower, NULL, NULL, NULL, NULL, &address);
ok(ret == RPC_S_OK, "TowerExplode failed with error %ld\n", ret);
- ok(!strcmp(address, "0.0.0.0"), "address was \"%s\" instead
of \"0.0.0.0\"\n", address);
+ ok(!strcmp(address, "0.0.0.0") ||
+ broken(!strcmp(address, "255.255.255.255")),
+ "address was \"%s\" instead of \"0.0.0.0\"\n",
address);
I_RpcFree(address);
I_RpcFree(tower);
@@ -666,6 +668,7 @@
ok(retval == EXCEPTION_CONTINUE_SEARCH, "I_RpcExceptionFilter(0x%x)
should have returned %d instead of %d\n",
exception, EXCEPTION_CONTINUE_SEARCH, retval);
break;
+ case STATUS_GUARD_PAGE_VIOLATION:
case STATUS_IN_PAGE_ERROR:
case STATUS_HANDLE_NOT_CLOSABLE:
trace("I_RpcExceptionFilter(0x%x) returned %d\n", exception,
retval);
@@ -757,6 +760,74 @@
status = RpcBindingFree(&handle);
ok(status == RPC_S_OK, "RpcBindingFree failed with error %lu\n", status);
+}
+
+static char *printGuid(char *buf, const UUID *guid)
+{
+ sprintf(buf, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
+ guid->Data1, guid->Data2, guid->Data3, guid->Data4[0],
guid->Data4[1],
+ guid->Data4[2], guid->Data4[3], guid->Data4[4], guid->Data4[5],
+ guid->Data4[6], guid->Data4[7]);
+ return buf;
+}
+
+static void test_UuidCreate(void)
+{
+ UUID guid;
+ BYTE version;
+
+ UuidCreate(&guid);
+ version = (guid.Data3 & 0xf000) >> 12;
+ todo_wine
+ ok(version == 4 || broken(version == 1), "unexpected version %d\n",
+ version);
+ if (version == 4)
+ {
+ static UUID v4and = { 0, 0, 0x4000, { 0x80,0,0,0,0,0,0,0 } };
+ static UUID v4or = { 0xffffffff, 0xffff, 0x4fff,
+ { 0xbf,0xff,0xff,0xff,0xff,0xff,0xff,0xff } };
+ UUID and, or;
+ RPC_STATUS rslt;
+ int i;
+ char buf[39];
+
+ memcpy(&and, &guid, sizeof(guid));
+ memcpy(&or, &guid, sizeof(guid));
+ /* Generate a bunch of UUIDs and mask them. By the end, we expect
+ * every randomly generated bit to have been zero at least once,
+ * resulting in no bits set in the and mask except those which are not
+ * randomly generated: the version number and the topmost bits of the
+ * Data4 field (treated as big-endian.) Similarly, we expect only
+ * the bits which are not randomly set to be cleared in the or mask.
+ */
+ for (i = 0; i < 1000; i++)
+ {
+ LPBYTE src, dst;
+
+ UuidCreate(&guid);
+ for (src = (LPBYTE)&guid, dst = (LPBYTE)∧
+ src - (LPBYTE)&guid < sizeof(guid); src++, dst++)
+ *dst &= *src;
+ for (src = (LPBYTE)&guid, dst = (LPBYTE)∨
+ src - (LPBYTE)&guid < sizeof(guid); src++, dst++)
+ *dst |= *src;
+ }
+ ok(UuidEqual(&and, &v4and, &rslt),
+ "unexpected bits set in V4 UUID: %s\n", printGuid(buf, &and));
+ ok(UuidEqual(&or, &v4or, &rslt),
+ "unexpected bits set in V4 UUID: %s\n", printGuid(buf, &or));
+ }
+ else
+ {
+ /* Older versions of Windows generate V1 UUIDs. For these, there are
+ * many stable bits, including at least the MAC address if one is
+ * present. Just check that Data4[0]'s most significant bits are
+ * set as expected.
+ */
+ todo_wine
+ ok((guid.Data4[0] & 0xc0) == 0x80,
+ "unexpected value in Data4[0]: %02x\n", guid.Data4[0] & 0xc0);
+ }
}
START_TEST( rpc )
@@ -777,4 +848,5 @@
test_endpoint_mapper(ncacn_np, np_address, np_endpoint);
test_endpoint_mapper(ncalrpc, NULL, lrpc_endpoint);
test_RpcStringBindingFromBinding();
-}
+ test_UuidCreate();
+}
Modified: trunk/rostests/winetests/rpcrt4/server.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/rpcrt4/server.c…
==============================================================================
--- trunk/rostests/winetests/rpcrt4/server.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/rpcrt4/server.c [iso-8859-1] Thu Nov 6 14:12:22 2008
@@ -990,27 +990,27 @@
ULONG __RPC_USER
bstr_t_UserSize(ULONG *flags, ULONG start, bstr_t *b)
{
- return start + FIELD_OFFSET(wire_bstr_t, data[(*b)[-1]]);
+ return start + FIELD_OFFSET(user_bstr_t, data[(*b)[-1]]);
}
unsigned char * __RPC_USER
bstr_t_UserMarshal(ULONG *flags, unsigned char *buffer, bstr_t *b)
{
- wire_bstr_t *wb = (wire_bstr_t *) buffer;
+ wire_bstr_t wb = (wire_bstr_t) buffer;
wb->n = (*b)[-1];
memcpy(&wb->data, *b, wb->n * sizeof wb->data[0]);
- return buffer + FIELD_OFFSET(wire_bstr_t, data[wb->n]);
+ return buffer + FIELD_OFFSET(user_bstr_t, data[wb->n]);
}
unsigned char * __RPC_USER
bstr_t_UserUnmarshal(ULONG *flags, unsigned char *buffer, bstr_t *b)
{
- wire_bstr_t *wb = (wire_bstr_t *) buffer;
+ wire_bstr_t wb = (wire_bstr_t) buffer;
short *data = HeapAlloc(GetProcessHeap(), 0, (wb->n + 1) * sizeof *data);
data[0] = wb->n;
memcpy(&data[1], wb->data, wb->n * sizeof data[1]);
*b = &data[1];
- return buffer + FIELD_OFFSET(wire_bstr_t, data[wb->n]);
+ return buffer + FIELD_OFFSET(user_bstr_t, data[wb->n]);
}
void __RPC_USER
Modified: trunk/rostests/winetests/rpcrt4/server.idl
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/rpcrt4/server.i…
==============================================================================
--- trunk/rostests/winetests/rpcrt4/server.idl [iso-8859-1] (original)
+++ trunk/rostests/winetests/rpcrt4/server.idl [iso-8859-1] Thu Nov 6 14:12:22 2008
@@ -299,8 +299,9 @@
{
short n;
[size_is(n)] short data[];
- } wire_bstr_t;
-
+ } user_bstr_t;
+
+ typedef [unique] user_bstr_t *wire_bstr_t;
typedef [wire_marshal(wire_bstr_t)] short *bstr_t;
unsigned hash_bstr(bstr_t s);