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: Fabian Maurer <dark.shadow4@web.de> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7ec1ae2bef
commit
8ca2938757
|
@ -51,11 +51,14 @@ static void test_WNetGetUniversalName(void)
|
||||||
|
|
||||||
ok(info_size == sizeof(buffer), "Got wrong size: %u\n", info_size);
|
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,
|
ret = WNetGetUniversalNameA(driveA, UNIVERSAL_NAME_INFO_LEVEL,
|
||||||
buffer, &fail_size);
|
buffer, &fail_size);
|
||||||
if(drive_type == DRIVE_REMOTE)
|
if(drive_type == DRIVE_REMOTE)
|
||||||
|
{
|
||||||
todo_wine ok(ret == WN_BAD_VALUE || ret == WN_MORE_DATA, "WNetGetUniversalNameA failed: %08x\n", ret);
|
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
|
else
|
||||||
ok(ret == WN_NOT_CONNECTED || ret == WN_NO_NET_OR_BAD_PATH,
|
ok(ret == WN_NOT_CONNECTED || ret == WN_NO_NET_OR_BAD_PATH,
|
||||||
"(%s) WNetGetUniversalNameW gave wrong error: %u\n", driveA, ret);
|
"(%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);
|
size = sizeof(*info) + (lstrlenW(lpLocalPath) + 1) * sizeof(WCHAR);
|
||||||
if (*lpBufferSize < size)
|
if (*lpBufferSize < size)
|
||||||
{
|
{
|
||||||
|
*lpBufferSize = size;
|
||||||
err = WN_MORE_DATA;
|
err = WN_MORE_DATA;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue