Commit 8ca29387 authored by Fabian Maurer's avatar Fabian Maurer Committed by Alexandre Julliard

wnet: Make WNetGetUniversalNameW return required size when buffer is too small and add test.

The pointer is set to the required size not only when the input size is 0, but generally when it is too small. Signed-off-by: 's avatarFabian Maurer <dark.shadow4@web.de> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 7ec1ae2b
......@@ -51,11 +51,14 @@ static void test_WNetGetUniversalName(void)
ok(info_size == sizeof(buffer), "Got wrong size: %u\n", info_size);
fail_size = 0;
fail_size = 1;
ret = WNetGetUniversalNameA(driveA, UNIVERSAL_NAME_INFO_LEVEL,
buffer, &fail_size);
if(drive_type == DRIVE_REMOTE)
{
todo_wine ok(ret == WN_BAD_VALUE || ret == WN_MORE_DATA, "WNetGetUniversalNameA failed: %08x\n", ret);
ok(fail_size > 1, "Got %d\n", fail_size);
}
else
ok(ret == WN_NOT_CONNECTED || ret == WN_NO_NET_OR_BAD_PATH,
"(%s) WNetGetUniversalNameW gave wrong error: %u\n", driveA, ret);
......
......@@ -2385,6 +2385,7 @@ DWORD WINAPI WNetGetUniversalNameW ( LPCWSTR lpLocalPath, DWORD dwInfoLevel,
size = sizeof(*info) + (lstrlenW(lpLocalPath) + 1) * sizeof(WCHAR);
if (*lpBufferSize < size)
{
*lpBufferSize = size;
err = WN_MORE_DATA;
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment