[RPCRT4_WINETEST] Sync with Wine Staging 1.7.55. CORE-10536

svn path=/trunk/; revision=69907
This commit is contained in:
Amine Khaldi 2015-11-17 10:08:11 +00:00
parent ada28839e7
commit ca6b297569
4 changed files with 154 additions and 14 deletions

View file

@ -397,6 +397,8 @@ static BOOL check_address(void *actual, void *expected)
{
static void *ole32_start = NULL;
static void *ole32_end = NULL;
static void *combase_start = NULL;
static void *combase_end = NULL;
if (actual == expected)
return TRUE;
@ -412,7 +414,21 @@ static BOOL check_address(void *actual, void *expected)
ole32_end = (void *)((char *) ole32_start + nt_headers->OptionalHeader.SizeOfImage);
}
return ole32_start <= actual && actual < ole32_end;
if (ole32_start <= actual && actual < ole32_end)
return TRUE;
/* On Win8, actual can be located inside combase.dll */
if (combase_start == NULL || combase_end == NULL)
{
PIMAGE_NT_HEADERS nt_headers;
combase_start = (void *) GetModuleHandleA("combase.dll");
if (combase_start == NULL)
return FALSE;
nt_headers = (PIMAGE_NT_HEADERS)((char *) combase_start + ((PIMAGE_DOS_HEADER) combase_start)->e_lfanew);
combase_end = (void *)((char *) combase_start + nt_headers->OptionalHeader.SizeOfImage);
}
return (combase_start <= actual && actual < combase_end);
}
static const ExtendedProxyFileInfo my_proxy_file_info =

View file

@ -29,11 +29,12 @@
#include <winbase.h>
#include <winnt.h>
#include <winerror.h>
#include <ole2.h>
#include "rpc.h"
#include "rpcdce.h"
#include "rpcproxy.h"
#include "midles.h"
static int my_alloc_called;
static int my_free_called;
@ -964,7 +965,7 @@ static void test_simple_struct(void)
s1.c = 0xa5;
s1.l1 = 0xdeadbeef;
s1.l2 = 0xcafebabe;
s1.ll = ((LONGLONG) 0xbadefeed << 32) | 0x2468ace0;
s1.ll = ((ULONGLONG) 0xbadefeed << 32) | 0x2468ace0;
wiredatalen = 24;
memcpy(wiredata, &s1, wiredatalen);
@ -1319,9 +1320,9 @@ todo_wine
ok(stubMsg.ReuseBuffer == 0 ||
broken(stubMsg.ReuseBuffer == 1), /* win2k */
"stubMsg.ReuseBuffer should have been set to zero instead of %d\n", stubMsg.ReuseBuffer);
ok(stubMsg.CorrDespIncrement == 0xcc ||
stubMsg.CorrDespIncrement == 0,
"CorrDespIncrement should have been unset instead of 0x%x\n", stubMsg.CorrDespIncrement);
ok(stubMsg.CorrDespIncrement == 0 ||
broken(stubMsg.CorrDespIncrement == 0xcc), /* <= Win 2003 */
"CorrDespIncrement should have been set to zero instead of 0x%x\n", stubMsg.CorrDespIncrement);
ok(stubMsg.FullPtrXlatTables == 0, "stubMsg.BufferLength should have been 0 instead of %p\n", stubMsg.FullPtrXlatTables);
}
@ -1559,6 +1560,11 @@ todo_wine {
ok(my_alloc_called == 0, "alloc called %d\n", my_alloc_called);
}
/* Prevent a memory leak when running with Wine.
Remove once the todo_wine block above is fixed. */
if (mem != mem_orig)
HeapFree(GetProcessHeap(), 0, mem_orig);
my_free_called = 0;
StubMsg.Buffer = StubMsg.BufferStart;
NdrPointerFree( &StubMsg, mem, fmtstr_conf_str );
@ -2404,6 +2410,85 @@ static void test_NdrGetUserMarshalInfo(void)
"NdrGetUserMarshalInfo should have failed with RPC_S_INVALID_ARG instead of %d\n", status);
}
static void test_MesEncodeFixedBufferHandleCreate(void)
{
ULONG encoded_size;
RPC_STATUS status;
handle_t handle;
char *buffer;
status = MesEncodeFixedBufferHandleCreate(NULL, 0, NULL, NULL);
ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
status = MesEncodeFixedBufferHandleCreate(NULL, 0, NULL, &handle);
ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
status = MesEncodeFixedBufferHandleCreate((char*)0xdeadbeef, 0, NULL, &handle);
ok(status == RPC_X_INVALID_BUFFER, "got %d\n", status);
buffer = (void*)((0xdeadbeef + 7) & ~7);
status = MesEncodeFixedBufferHandleCreate(buffer, 0, NULL, &handle);
ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
status = MesEncodeFixedBufferHandleCreate(buffer, 0, &encoded_size, &handle);
todo_wine
ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
if (status == RPC_S_OK)
MesHandleFree(handle);
status = MesEncodeFixedBufferHandleCreate(buffer, 32, NULL, &handle);
ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
status = MesEncodeFixedBufferHandleCreate(buffer, 32, &encoded_size, &handle);
ok(status == RPC_S_OK, "got %d\n", status);
status = MesBufferHandleReset(NULL, MES_DYNAMIC_BUFFER_HANDLE, MES_ENCODE,
&buffer, 32, &encoded_size);
ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
/* convert to dynamic buffer handle */
status = MesBufferHandleReset(handle, MES_DYNAMIC_BUFFER_HANDLE, MES_ENCODE,
&buffer, 32, &encoded_size);
ok(status == RPC_S_OK, "got %d\n", status);
status = MesBufferHandleReset(handle, MES_DYNAMIC_BUFFER_HANDLE, MES_ENCODE,
NULL, 32, &encoded_size);
ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
status = MesBufferHandleReset(handle, MES_DYNAMIC_BUFFER_HANDLE, MES_ENCODE,
&buffer, 32, NULL);
ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
/* invalid handle type */
status = MesBufferHandleReset(handle, MES_DYNAMIC_BUFFER_HANDLE+1, MES_ENCODE,
&buffer, 32, &encoded_size);
ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
status = MesHandleFree(handle);
ok(status == RPC_S_OK, "got %d\n", status);
}
static void test_NdrCorrelationInitialize(void)
{
MIDL_STUB_MESSAGE stub_msg;
BYTE buf[256];
memset( &stub_msg, 0, sizeof(stub_msg) );
memset( buf, 0, sizeof(buf) );
NdrCorrelationInitialize( &stub_msg, buf, sizeof(buf), 0 );
ok( stub_msg.CorrDespIncrement == 2 ||
broken(stub_msg.CorrDespIncrement == 0), /* <= Win 2003 */
"got %d\n", stub_msg.CorrDespIncrement );
memset( &stub_msg, 0, sizeof(stub_msg) );
memset( buf, 0, sizeof(buf) );
stub_msg.CorrDespIncrement = 1;
NdrCorrelationInitialize( &stub_msg, buf, sizeof(buf), 0 );
ok( stub_msg.CorrDespIncrement == 1, "got %d\n", stub_msg.CorrDespIncrement );
}
START_TEST( ndr_marshall )
{
determine_pointer_marshalling_style();
@ -2424,4 +2509,6 @@ START_TEST( ndr_marshall )
test_ndr_buffer();
test_NdrMapCommAndFaultStatus();
test_NdrGetUserMarshalInfo();
test_MesEncodeFixedBufferHandleCreate();
test_NdrCorrelationInitialize();
}

View file

@ -222,10 +222,8 @@ static void test_rpc_ncacn_ip_tcp(void)
ok(status == RPC_S_OK, "return wrong\n");
status = RpcMgmtStopServerListening(NULL);
todo_wine {
ok(status == RPC_S_NOT_LISTENING,
"wrong RpcMgmtStopServerListening error (%u)\n", status);
}
status = RpcMgmtWaitServerListen();
ok(status == RPC_S_NOT_LISTENING,
@ -242,9 +240,7 @@ todo_wine {
ok(status == RPC_S_OK, "RpcServerRegisterIf failed (%u)\n", status);
status = RpcServerListen(1, 20, TRUE);
todo_wine {
ok(status == RPC_S_OK, "RpcServerListen failed (%u)\n", status);
}
status = RpcServerListen(1, 20, TRUE);
todo_wine {
@ -663,7 +659,7 @@ static void test_I_RpcExceptionFilter(void)
if (!pI_RpcExceptionFilter)
{
skip("I_RpcExceptionFilter not exported\n");
win_skip("I_RpcExceptionFilter not exported\n");
return;
}
@ -682,9 +678,9 @@ static void test_I_RpcExceptionFilter(void)
case STATUS_ACCESS_VIOLATION:
case STATUS_ILLEGAL_INSTRUCTION:
case STATUS_PRIVILEGED_INSTRUCTION:
case 0xc00000aa /* STATUS_INSTRUCTION_MISALIGNMENT */:
case STATUS_INSTRUCTION_MISALIGNMENT:
case STATUS_STACK_OVERFLOW:
case 0xc0000194 /* STATUS_POSSIBLE_DEADLOCK */:
case STATUS_POSSIBLE_DEADLOCK:
ok(retval == EXCEPTION_CONTINUE_SEARCH, "I_RpcExceptionFilter(0x%x) should have returned %d instead of %d\n",
exception, EXCEPTION_CONTINUE_SEARCH, retval);
break;
@ -789,13 +785,17 @@ static void test_UuidCreateSequential(void)
UUID guid1;
BYTE version;
RPC_STATUS (WINAPI *pUuidCreateSequential)(UUID *) = (void *)GetProcAddress(GetModuleHandleA("rpcrt4.dll"), "UuidCreateSequential");
RPC_STATUS (WINAPI *pI_UuidCreate)(UUID *) = (void*)GetProcAddress(GetModuleHandleA("rpcrt4.dll"), "I_UuidCreate");
RPC_STATUS ret;
if (!pUuidCreateSequential)
{
skip("UuidCreateSequential not exported\n");
win_skip("UuidCreateSequential not exported\n");
return;
}
ok(pI_UuidCreate != pUuidCreateSequential, "got %p, %p\n", pI_UuidCreate, pUuidCreateSequential);
ret = pUuidCreateSequential(&guid1);
ok(!ret || ret == RPC_S_UUID_LOCAL_ONLY,
"expected RPC_S_OK or RPC_S_UUID_LOCAL_ONLY, got %08x\n", ret);
@ -834,6 +834,14 @@ static void test_UuidCreateSequential(void)
ok(!memcmp(guid1.Data4, guid2.Data4, sizeof(guid2.Data4)),
"unexpected value in MAC address: %s\n",
wine_dbgstr_guid(&guid2));
/* I_UuidCreate does exactly the same */
pI_UuidCreate(&guid2);
version = (guid2.Data3 & 0xf000) >> 12;
ok(version == 1, "unexpected version %d\n", version);
ok(!memcmp(guid1.Data4, guid2.Data4, sizeof(guid2.Data4)),
"unexpected value in MAC address: %s\n",
wine_dbgstr_guid(&guid2));
}
}

View file

@ -1531,6 +1531,26 @@ set_auth_info(RPC_BINDING_HANDLE handle)
ok(status == RPC_S_OK, "RpcBindingSetAuthInfoExA failed %d\n", status);
}
#define test_is_server_listening(a,b) _test_is_server_listening(__LINE__,a,b)
static void _test_is_server_listening(unsigned line, RPC_BINDING_HANDLE binding, RPC_STATUS expected_status)
{
RPC_STATUS status;
status = RpcMgmtIsServerListening(binding);
ok_(__FILE__,line)(status == expected_status, "RpcMgmtIsServerListening returned %u, expected %u\n",
status, expected_status);
}
#define test_is_server_listening2(a,b,c) _test_is_server_listening2(__LINE__,a,b,c)
static void _test_is_server_listening2(unsigned line, RPC_BINDING_HANDLE binding, RPC_STATUS expected_status,
RPC_STATUS expected_status2)
{
RPC_STATUS status;
status = RpcMgmtIsServerListening(binding);
ok_(__FILE__,line)(status == expected_status || status == expected_status2,
"RpcMgmtIsServerListening returned %u, expected %u or %u\n",
status, expected_status, expected_status2);
}
static void
client(const char *test)
{
@ -1552,6 +1572,7 @@ client(const char *test)
run_tests();
authinfo_test(RPC_PROTSEQ_TCP, 0);
test_is_server_listening2(IServer_IfHandle, RPC_S_OK, RPC_S_ACCESS_DENIED);
ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
ok(RPC_S_OK == RpcBindingFree(&IServer_IfHandle), "RpcBindingFree\n");
@ -1563,6 +1584,7 @@ client(const char *test)
set_auth_info(IServer_IfHandle);
authinfo_test(RPC_PROTSEQ_TCP, 1);
test_is_server_listening(IServer_IfHandle, RPC_S_ACCESS_DENIED);
ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
ok(RPC_S_OK == RpcBindingFree(&IServer_IfHandle), "RpcBindingFree\n");
@ -1574,6 +1596,7 @@ client(const char *test)
run_tests(); /* can cause RPC_X_BAD_STUB_DATA exception */
authinfo_test(RPC_PROTSEQ_LRPC, 0);
test_is_server_listening(IServer_IfHandle, RPC_S_OK);
ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
ok(RPC_S_OK == RpcBindingFree(&IServer_IfHandle), "RpcBindingFree\n");
@ -1585,6 +1608,7 @@ client(const char *test)
set_auth_info(IServer_IfHandle);
authinfo_test(RPC_PROTSEQ_LRPC, 1);
test_is_server_listening(IServer_IfHandle, RPC_S_OK);
ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
ok(RPC_S_OK == RpcBindingFree(&IServer_IfHandle), "RpcBindingFree\n");
@ -1594,9 +1618,12 @@ client(const char *test)
ok(RPC_S_OK == RpcStringBindingComposeA(NULL, np, address_np, pipe, NULL, &binding), "RpcStringBindingCompose\n");
ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IServer_IfHandle), "RpcBindingFromStringBinding\n");
test_is_server_listening(IServer_IfHandle, RPC_S_OK);
run_tests();
authinfo_test(RPC_PROTSEQ_NMP, 0);
test_is_server_listening(IServer_IfHandle, RPC_S_OK);
stop();
test_is_server_listening(IServer_IfHandle, RPC_S_NOT_LISTENING);
ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
ok(RPC_S_OK == RpcBindingFree(&IServer_IfHandle), "RpcBindingFree\n");
@ -1637,8 +1664,10 @@ server(void)
else
status = RpcServerRegisterIf(s_IServer_v0_0_s_ifspec, NULL, NULL);
ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %d\n", status);
test_is_server_listening(NULL, RPC_S_NOT_LISTENING);
status = RpcServerListen(1, 20, TRUE);
ok(status == RPC_S_OK, "RpcServerListen failed with status %d\n", status);
test_is_server_listening(NULL, RPC_S_OK);
stop_event = CreateEventW(NULL, FALSE, FALSE, NULL);
ok(stop_event != NULL, "CreateEvent failed with error %d\n", GetLastError());