kernel32/tests: Despite the MSDN claims, GetComputerName() does not return the required buffer size... except on Vista. So update the tests accordingly.
This commit is contained in:
parent
e3e2a5c0ac
commit
0069651056
@ -298,12 +298,17 @@ static void test_GetComputerName(void)
|
|||||||
error = GetLastError();
|
error = GetLastError();
|
||||||
todo_wine
|
todo_wine
|
||||||
ok(!ret && error == ERROR_BUFFER_OVERFLOW, "GetComputerNameA should have failed with ERROR_BUFFER_OVERFLOW instead of %d\n", error);
|
ok(!ret && error == ERROR_BUFFER_OVERFLOW, "GetComputerNameA should have failed with ERROR_BUFFER_OVERFLOW instead of %d\n", error);
|
||||||
size++; /* nul terminating character */
|
|
||||||
name = HeapAlloc(GetProcessHeap(), 0, size * sizeof(name[0]));
|
/* Only Vista returns the computer name length as documented in the MSDN */
|
||||||
ok(name != NULL, "HeapAlloc failed with error %d\n", GetLastError());
|
if (size != 0)
|
||||||
ret = GetComputerNameA(name, &size);
|
{
|
||||||
ok(ret, "GetComputerNameA failed with error %d\n", GetLastError());
|
size++; /* nul terminating character */
|
||||||
HeapFree(GetProcessHeap(), 0, name);
|
name = HeapAlloc(GetProcessHeap(), 0, size * sizeof(name[0]));
|
||||||
|
ok(name != NULL, "HeapAlloc failed with error %d\n", GetLastError());
|
||||||
|
ret = GetComputerNameA(name, &size);
|
||||||
|
ok(ret, "GetComputerNameA failed with error %d\n", GetLastError());
|
||||||
|
HeapFree(GetProcessHeap(), 0, name);
|
||||||
|
}
|
||||||
|
|
||||||
size = MAX_COMPUTERNAME_LENGTH + 1;
|
size = MAX_COMPUTERNAME_LENGTH + 1;
|
||||||
name = HeapAlloc(GetProcessHeap(), 0, size * sizeof(name[0]));
|
name = HeapAlloc(GetProcessHeap(), 0, size * sizeof(name[0]));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user