From 88abeb9ff2c20e7c00938f30e99b6d16a4f0b1f9 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Fri, 6 Dec 2013 23:30:49 +0000 Subject: [PATCH] [RPCRT4_WINETEST] * Sync with Wine 1.7.1. CORE-7469 svn path=/trunk/; revision=61238 --- rostests/winetests/rpcrt4/ndr_marshall.c | 4 +- rostests/winetests/rpcrt4/rpc.c | 68 ++++++++++++++++++++++-- rostests/winetests/rpcrt4/testlist.c | 5 +- 3 files changed, 67 insertions(+), 10 deletions(-) diff --git a/rostests/winetests/rpcrt4/ndr_marshall.c b/rostests/winetests/rpcrt4/ndr_marshall.c index ac3bacc7291..cc3e1d3c7bd 100644 --- a/rostests/winetests/rpcrt4/ndr_marshall.c +++ b/rostests/winetests/rpcrt4/ndr_marshall.c @@ -18,12 +18,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include - #define _WIN32_WINNT 0x0500 #define NTDDI_WIN2K 0x05000000 #define NTDDI_VERSION NTDDI_WIN2K /* for some MIDL_STUB_MESSAGE fields */ +#include + #include "wine/test.h" #include #include diff --git a/rostests/winetests/rpcrt4/rpc.c b/rostests/winetests/rpcrt4/rpc.c index 8e965e594ca..5c767acddd6 100644 --- a/rostests/winetests/rpcrt4/rpc.c +++ b/rostests/winetests/rpcrt4/rpc.c @@ -28,10 +28,12 @@ #include #include #include -#include #include "rpc.h" #include "rpcdce.h" +#include "secext.h" + +typedef long NTSTATUS; typedef unsigned int unsigned32; typedef struct twr_t @@ -814,6 +816,7 @@ static void test_UuidCreateSequential(void) if (version == 1) { UUID guid2; + char buf[39]; if (!ret) { @@ -821,7 +824,8 @@ static void test_UuidCreateSequential(void) * address in the uuid: */ ok(!(guid1.Data4[2] & 0x01), - "GUID does not appear to contain a MAC address\n"); + "GUID does not appear to contain a MAC address: %s\n", + printGuid(buf, sizeof(buf), &guid1)); } else { @@ -829,7 +833,8 @@ static void test_UuidCreateSequential(void) * address in the uuid: */ ok((guid1.Data4[2] & 0x01), - "GUID does not appear to contain a multicast MAC address\n"); + "GUID does not appear to contain a multicast MAC address: %s\n", + printGuid(buf, sizeof(buf), &guid1)); } /* Generate another GUID, and make sure its MAC address matches the * first. @@ -840,7 +845,8 @@ static void test_UuidCreateSequential(void) 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\n"); + "unexpected value in MAC address: %s\n", + printGuid(buf, sizeof(buf), &guid2)); } } @@ -855,6 +861,59 @@ static void test_RpcBindingFree(void) status); } +static void test_RpcServerInqDefaultPrincName(void) +{ + RPC_STATUS ret; + RPC_CSTR principal, saved_principal; + BOOLEAN (WINAPI *pGetUserNameExA)(EXTENDED_NAME_FORMAT,LPSTR,PULONG); + char *username; + ULONG len = 0; + + pGetUserNameExA = (void *)GetProcAddress( LoadLibraryA("secur32.dll"), "GetUserNameExA" ); + if (!pGetUserNameExA) + { + win_skip( "GetUserNameExA not exported\n" ); + return; + } + pGetUserNameExA( NameSamCompatible, NULL, &len ); + username = HeapAlloc( GetProcessHeap(), 0, len ); + pGetUserNameExA( NameSamCompatible, username, &len ); + + ret = RpcServerInqDefaultPrincNameA( 0, NULL ); + ok( ret == RPC_S_UNKNOWN_AUTHN_SERVICE, "got %u\n", ret ); + + ret = RpcServerInqDefaultPrincNameA( RPC_C_AUTHN_DEFAULT, NULL ); + ok( ret == RPC_S_UNKNOWN_AUTHN_SERVICE, "got %u\n", ret ); + + principal = (RPC_CSTR)0xdeadbeef; + ret = RpcServerInqDefaultPrincNameA( RPC_C_AUTHN_DEFAULT, &principal ); + ok( ret == RPC_S_UNKNOWN_AUTHN_SERVICE, "got %u\n", ret ); + ok( principal == (RPC_CSTR)0xdeadbeef, "got unexpected principal\n" ); + + saved_principal = (RPC_CSTR)0xdeadbeef; + ret = RpcServerInqDefaultPrincNameA( RPC_C_AUTHN_WINNT, &saved_principal ); + ok( ret == RPC_S_OK, "got %u\n", ret ); + ok( saved_principal != (RPC_CSTR)0xdeadbeef, "expected valid principal\n" ); + ok( !strcmp( (const char *)saved_principal, username ), "got \'%s\'\n", saved_principal ); + trace("%s\n", saved_principal); + + ret = RpcServerRegisterAuthInfoA( (RPC_CSTR)"wine\\test", RPC_C_AUTHN_WINNT, NULL, NULL ); + ok( ret == RPC_S_OK, "got %u\n", ret ); + + principal = (RPC_CSTR)0xdeadbeef; + ret = RpcServerInqDefaultPrincNameA( RPC_C_AUTHN_WINNT, &principal ); + ok( ret == RPC_S_OK, "got %u\n", ret ); + ok( principal != (RPC_CSTR)0xdeadbeef, "expected valid principal\n" ); + ok( !strcmp( (const char *)principal, username ), "got \'%s\'\n", principal ); + RpcStringFree( &principal ); + + ret = RpcServerRegisterAuthInfoA( saved_principal, RPC_C_AUTHN_WINNT, NULL, NULL ); + ok( ret == RPC_S_OK, "got %u\n", ret ); + + RpcStringFree( &saved_principal ); + HeapFree( GetProcessHeap(), 0, username ); +} + START_TEST( rpc ) { UuidConversionAndComparison(); @@ -868,4 +927,5 @@ START_TEST( rpc ) test_UuidCreate(); test_UuidCreateSequential(); test_RpcBindingFree(); + test_RpcServerInqDefaultPrincName(); } diff --git a/rostests/winetests/rpcrt4/testlist.c b/rostests/winetests/rpcrt4/testlist.c index 71ed0c9e831..a8b2797ebe0 100644 --- a/rostests/winetests/rpcrt4/testlist.c +++ b/rostests/winetests/rpcrt4/testlist.c @@ -1,10 +1,7 @@ /* Automatically generated file; DO NOT EDIT!! */ -#define WIN32_LEAN_AND_MEAN -#include - #define STANDALONE -#include "wine/test.h" +#include extern void func_cstub(void); extern void func_generated(void); -- 2.17.1