Commit 72c54e5d authored by Paul Vriens's avatar Paul Vriens Committed by Alexandre Julliard

adapi32/tests: Fix test failures when the computername is fully qualified on W2K3 and earlier.

parent af0bb4a1
......@@ -712,7 +712,7 @@ static void test_readwrite(void)
BOOL ret, sidavailable;
BOOL on_vista = FALSE; /* Used to indicate Vista, W2K8 or Win7 */
int i;
char *localcomputer;
char *localcomputer = NULL;
DWORD size;
if (pCreateWellKnownSid)
......@@ -730,24 +730,6 @@ static void test_readwrite(void)
user = NULL;
}
if (pGetComputerNameExA)
{
size = 0;
SetLastError(0xdeadbeef);
pGetComputerNameExA(ComputerNameDnsFullyQualified, NULL, &size);
/* Cope with W2K (needed size is not set) */
if (size == 0 && GetLastError() == ERROR_MORE_DATA)
size = 1024;
localcomputer = HeapAlloc(GetProcessHeap(), 0, size);
pGetComputerNameExA(ComputerNameDnsFullyQualified, localcomputer, &size);
}
else
{
size = MAX_COMPUTERNAME_LENGTH + 1;
localcomputer = HeapAlloc(GetProcessHeap(), 0, size);
GetComputerNameA(localcomputer, &size);
}
/* Write an event with an incorrect event type. This will fail on Windows 7
* but succeed on all others, hence it's not part of the struct.
*/
......@@ -878,6 +860,22 @@ static void test_readwrite(void)
if (on_vista)
skip("There is no DWORD alignment enforced for UserSid on Vista, W2K8 or Win7\n");
if (on_vista && pGetComputerNameExA)
{
/* New Vista+ behavior */
size = 0;
SetLastError(0xdeadbeef);
pGetComputerNameExA(ComputerNameDnsFullyQualified, NULL, &size);
localcomputer = HeapAlloc(GetProcessHeap(), 0, size);
pGetComputerNameExA(ComputerNameDnsFullyQualified, localcomputer, &size);
}
else
{
size = MAX_COMPUTERNAME_LENGTH + 1;
localcomputer = HeapAlloc(GetProcessHeap(), 0, size);
GetComputerNameA(localcomputer, &size);
}
/* Read all events from our created eventlog, one by one */
handle = OpenEventLogA(NULL, eventlogname);
i = 0;
......
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