From: Egor Poleshko somedevfox@gmail.com
--- dlls/secur32/tests/Makefile.in | 2 +- dlls/secur32/tests/secur32.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/dlls/secur32/tests/Makefile.in b/dlls/secur32/tests/Makefile.in index caeac7e47e1..67732294ec4 100644 --- a/dlls/secur32/tests/Makefile.in +++ b/dlls/secur32/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = secur32.dll -IMPORTS = secur32 crypt32 advapi32 ws2_32 +IMPORTS = secur32 crypt32 advapi32 ws2_32 netapi32
SOURCES = \ main.c \ diff --git a/dlls/secur32/tests/secur32.c b/dlls/secur32/tests/secur32.c index dd6eea095bf..45ced684fee 100644 --- a/dlls/secur32/tests/secur32.c +++ b/dlls/secur32/tests/secur32.c @@ -31,6 +31,7 @@ #include <winsock2.h> #include <ntsecapi.h> #include <winternl.h> +#include <lmaccess.h>
#include "wine/test.h"
@@ -245,6 +246,23 @@ static void testGetUserNameExW(void) ok(! rc && GetLastError() == ERROR_MORE_DATA, "Expected fail with ERROR_MORE_DATA, got %d with %lu\n", rc, GetLastError()); ok(1 < size, "Expected size to be set to required size\n"); ok(nameW[0] == (WCHAR) 0xff, "Expected unchanged buffer\n"); + + size = 255; + LPCWSTR domainNameW = NULL; + NET_API_STATUS domainNameRc = NetGetDCName(NULL, NULL, (LPBYTE *) &domainNameW); + rc = pGetUserNameExW(NameDisplay, nameW, &size); + if(domainNameRc != 0) + ok(GetLastError() == ERROR_NONE_MAPPED, "Expected fail with ERROR_NONE_MAPPED, got %d\n", GetLastError()); + size = 0; + rc = pGetUserNameExW(NameDisplay, nameW, &size); + ok(! rc && GetLastError() == ERROR_MORE_DATA, "Expected fail with ERROR_MORE_DATA, got %d with %lu\n", rc, GetLastError()); + ok(size != 0, "Expected size to be set to required size\n"); + size = 1; + nameW[0] = 0xff; + rc = pGetUserNameExW(NameDisplay, nameW, &size); + ok(! rc && GetLastError() == ERROR_MORE_DATA, "Expected fail with ERROR_MORE_DATA, got %d with %lu\n", rc, GetLastError()); + ok(1 < size, "Expected size to be set to required size\n"); + ok(nameW[0] == (WCHAR) 0xff, "Expected unchanged buffer\n"); }
static void test_InitSecurityInterface(void)