diff --git a/dlls/kernel32/tests/environ.c b/dlls/kernel32/tests/environ.c index d19b8700c5f..9334ef8add6 100644 --- a/dlls/kernel32/tests/environ.c +++ b/dlls/kernel32/tests/environ.c @@ -17,6 +17,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#undef WINE_NO_LONG_TYPES /* temporary for migration */ #include @@ -68,15 +69,15 @@ static void test_Predefined(void) return; } NoErr = OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &Token); - ok(NoErr, "Failed to open token, error %u\n", GetLastError()); + ok(NoErr, "Failed to open token, error %lu\n", GetLastError()); DataSize = sizeof(Data); NoErr = pGetUserProfileDirectoryA(Token, Data, &DataSize); - ok(NoErr, "Failed to get user profile dir, error %u\n", GetLastError()); + ok(NoErr, "Failed to get user profile dir, error %lu\n", GetLastError()); if (NoErr) { EnvSize = GetEnvironmentVariableA("USERPROFILE", Env, sizeof(Env)); ok(EnvSize != 0 && EnvSize <= sizeof(Env), - "Failed to retrieve environment variable USERPROFILE, error %u\n", + "Failed to retrieve environment variable USERPROFILE, error %lu\n", GetLastError()); ok(strcmp(Data, Env) == 0, "USERPROFILE env var %s doesn't match GetUserProfileDirectory %s\n", @@ -85,7 +86,7 @@ static void test_Predefined(void) else skip("Skipping USERPROFILE check, can't get user profile dir\n"); NoErr = CloseHandle(Token); - ok(NoErr, "Failed to close token, error %u\n", GetLastError()); + ok(NoErr, "Failed to close token, error %lu\n", GetLastError()); } static void test_GetSetEnvironmentVariableA(void) @@ -99,34 +100,34 @@ static void test_GetSetEnvironmentVariableA(void) ret = SetEnvironmentVariableA(name, value); ok(ret == TRUE, - "unexpected error in SetEnvironmentVariableA, GetLastError=%d\n", + "unexpected error in SetEnvironmentVariableA, GetLastError=%ld\n", GetLastError()); /* Try to retrieve the environment variable we just set */ SetLastError(0xdeadbeef); ret_size = GetEnvironmentVariableA(name, NULL, 0); ok(ret_size == strlen(value) + 1, - "should return length with terminating 0 ret_size=%d\n", ret_size); + "should return length with terminating 0 ret_size=%ld\n", ret_size); ok(GetLastError() == 0xdeadbeef, - "should not fail with zero size but GetLastError=%d\n", GetLastError()); + "should not fail with zero size but GetLastError=%ld\n", GetLastError()); lstrcpyA(buf, "foo"); ret_size = GetEnvironmentVariableA(name, buf, lstrlenA(value)); ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer\n"); ok(ret_size == strlen(value) + 1, - "should return length with terminating 0 ret_size=%d\n", ret_size); + "should return length with terminating 0 ret_size=%ld\n", ret_size); lstrcpyA(buf, "foo"); ret_size = GetEnvironmentVariableA(name, buf, lstrlenA(value) + 1); ok(lstrcmpA(buf, value) == 0, "should touch the buffer\n"); ok(ret_size == strlen(value), - "should return length without terminating 0 ret_size=%d\n", ret_size); + "should return length without terminating 0 ret_size=%ld\n", ret_size); lstrcpyA(buf, "foo"); ret_size = GetEnvironmentVariableA(name_cased, buf, lstrlenA(value) + 1); ok(lstrcmpA(buf, value) == 0, "should touch the buffer\n"); ok(ret_size == strlen(value), - "should return length without terminating 0 ret_size=%d\n", ret_size); + "should return length without terminating 0 ret_size=%ld\n", ret_size); /* Remove that environment variable */ ret = SetEnvironmentVariableA(name_cased, NULL); @@ -137,24 +138,24 @@ static void test_GetSetEnvironmentVariableA(void) ret_size = GetEnvironmentVariableA(name, buf, lstrlenA(value) + 1); ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer\n"); ok(ret_size == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND, - "should not find variable but ret_size=%d GetLastError=%d\n", + "should not find variable but ret_size=%ld GetLastError=%ld\n", ret_size, GetLastError()); /* Check behavior of SetEnvironmentVariableA(name, "") */ ret = SetEnvironmentVariableA(name, value); ok(ret == TRUE, - "unexpected error in SetEnvironmentVariableA, GetLastError=%d\n", + "unexpected error in SetEnvironmentVariableA, GetLastError=%ld\n", GetLastError()); lstrcpyA(buf, "foo"); ret_size = GetEnvironmentVariableA(name_cased, buf, lstrlenA(value) + 1); ok(lstrcmpA(buf, value) == 0, "should touch the buffer\n"); ok(ret_size == strlen(value), - "should return length without terminating 0 ret_size=%d\n", ret_size); + "should return length without terminating 0 ret_size=%ld\n", ret_size); ret = SetEnvironmentVariableA(name_cased, ""); ok(ret == TRUE, - "should not fail with empty value but GetLastError=%d\n", GetLastError()); + "should not fail with empty value but GetLastError=%ld\n", GetLastError()); lstrcpyA(buf, "foo"); SetLastError(0xdeadbeef); @@ -162,36 +163,36 @@ static void test_GetSetEnvironmentVariableA(void) ok(ret_size == 0 && ((GetLastError() == 0xdeadbeef && lstrcmpA(buf, "") == 0) || (GetLastError() == ERROR_ENVVAR_NOT_FOUND)), - "%s should be set to \"\" (NT) or removed (Win9x) but ret_size=%d GetLastError=%d and buf=%s\n", + "%s should be set to \"\" (NT) or removed (Win9x) but ret_size=%ld GetLastError=%ld and buf=%s\n", name, ret_size, GetLastError(), buf); SetLastError(0xdeadbeef); ret_size = GetEnvironmentVariableA(name, NULL, 0); ok(ret_size == 1 || broken(ret_size == 0), /* XP */ - "should return 1 for empty string but ret_size=%d GetLastError=%d\n", + "should return 1 for empty string but ret_size=%ld GetLastError=%ld\n", ret_size, GetLastError()); ok(GetLastError() == 0xdeadbeef || broken(GetLastError() == ERROR_MORE_DATA), /* XP */ - "should not fail with zero size but GetLastError=%d\n", GetLastError()); + "should not fail with zero size but GetLastError=%ld\n", GetLastError()); /* Test the limits */ SetLastError(0xdeadbeef); ret_size = GetEnvironmentVariableA(NULL, NULL, 0); ok(ret_size == 0 && (GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == ERROR_ENVVAR_NOT_FOUND), - "should not find variable but ret_size=%d GetLastError=%d\n", + "should not find variable but ret_size=%ld GetLastError=%ld\n", ret_size, GetLastError()); SetLastError(0xdeadbeef); ret_size = GetEnvironmentVariableA(NULL, buf, lstrlenA(value) + 1); ok(ret_size == 0 && (GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == ERROR_ENVVAR_NOT_FOUND), - "should not find variable but ret_size=%d GetLastError=%d\n", + "should not find variable but ret_size=%ld GetLastError=%ld\n", ret_size, GetLastError()); SetLastError(0xdeadbeef); ret_size = GetEnvironmentVariableA("", buf, lstrlenA(value) + 1); ok(ret_size == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND, - "should not find variable but ret_size=%d GetLastError=%d\n", + "should not find variable but ret_size=%ld GetLastError=%ld\n", ret_size, GetLastError()); } @@ -214,17 +215,17 @@ static void test_GetSetEnvironmentVariableW(void) return; } ok(ret == TRUE, - "unexpected error in SetEnvironmentVariableW, GetLastError=%d\n", + "unexpected error in SetEnvironmentVariableW, GetLastError=%ld\n", GetLastError()); /* Try to retrieve the environment variable we just set */ SetLastError(0xdeadbeef); ret_size = GetEnvironmentVariableW(name, NULL, 0); ok(ret_size == lstrlenW(value) + 1, - "should return length with terminating 0 ret_size=%d\n", + "should return length with terminating 0 ret_size=%ld\n", ret_size); ok(GetLastError() == 0xdeadbeef, - "should not fail with zero size but GetLastError=%d\n", GetLastError()); + "should not fail with zero size but GetLastError=%ld\n", GetLastError()); lstrcpyW(buf, fooW); ret_size = GetEnvironmentVariableW(name, buf, lstrlenW(value)); @@ -233,19 +234,19 @@ static void test_GetSetEnvironmentVariableW(void) "Expected untouched or empty buffer, got \"%s\"\n", buf); ok(ret_size == lstrlenW(value) + 1, - "should return length with terminating 0 ret_size=%d\n", ret_size); + "should return length with terminating 0 ret_size=%ld\n", ret_size); lstrcpyW(buf, fooW); ret_size = GetEnvironmentVariableW(name, buf, lstrlenW(value) + 1); ok(lstrcmpW(buf, value) == 0, "should touch the buffer\n"); ok(ret_size == lstrlenW(value), - "should return length without terminating 0 ret_size=%d\n", ret_size); + "should return length without terminating 0 ret_size=%ld\n", ret_size); lstrcpyW(buf, fooW); ret_size = GetEnvironmentVariableW(name_cased, buf, lstrlenW(value) + 1); ok(lstrcmpW(buf, value) == 0, "should touch the buffer\n"); ok(ret_size == lstrlenW(value), - "should return length without terminating 0 ret_size=%d\n", ret_size); + "should return length without terminating 0 ret_size=%ld\n", ret_size); /* Remove that environment variable */ ret = SetEnvironmentVariableW(name_cased, NULL); @@ -256,23 +257,23 @@ static void test_GetSetEnvironmentVariableW(void) ret_size = GetEnvironmentVariableW(name, buf, lstrlenW(value) + 1); ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer\n"); ok(ret_size == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND, - "should not find variable but ret_size=%d GetLastError=%d\n", + "should not find variable but ret_size=%ld GetLastError=%ld\n", ret_size, GetLastError()); /* Check behavior of SetEnvironmentVariableW(name, "") */ ret = SetEnvironmentVariableW(name, value); ok(ret == TRUE, - "unexpected error in SetEnvironmentVariableW, GetLastError=%d\n", + "unexpected error in SetEnvironmentVariableW, GetLastError=%ld\n", GetLastError()); lstrcpyW(buf, fooW); ret_size = GetEnvironmentVariableW(name, buf, lstrlenW(value) + 1); ok(lstrcmpW(buf, value) == 0, "should touch the buffer\n"); ok(ret_size == lstrlenW(value), - "should return length without terminating 0 ret_size=%d\n", ret_size); + "should return length without terminating 0 ret_size=%ld\n", ret_size); ret = SetEnvironmentVariableW(name_cased, empty_strW); - ok(ret == TRUE, "should not fail with empty value but GetLastError=%d\n", GetLastError()); + ok(ret == TRUE, "should not fail with empty value but GetLastError=%ld\n", GetLastError()); lstrcpyW(buf, fooW); SetLastError(0xdeadbeef); @@ -280,7 +281,7 @@ static void test_GetSetEnvironmentVariableW(void) ok(ret_size == 0 && ((GetLastError() == 0xdeadbeef && lstrcmpW(buf, empty_strW) == 0) || (GetLastError() == ERROR_ENVVAR_NOT_FOUND)), - "should be set to \"\" (NT) or removed (Win9x) but ret_size=%d GetLastError=%d\n", + "should be set to \"\" (NT) or removed (Win9x) but ret_size=%ld GetLastError=%ld\n", ret_size, GetLastError()); ok(lstrcmpW(buf, empty_strW) == 0, "should copy an empty string\n"); @@ -288,17 +289,17 @@ static void test_GetSetEnvironmentVariableW(void) ret_size = GetEnvironmentVariableW(name, NULL, 0); ok(ret_size == 1 || broken(ret_size == 0), /* XP */ - "should return 1 for empty string but ret_size=%d GetLastError=%d\n", + "should return 1 for empty string but ret_size=%ld GetLastError=%ld\n", ret_size, GetLastError()); ok(GetLastError() == 0xdeadbeef || broken(GetLastError() == ERROR_MORE_DATA), /* XP */ - "should not fail with zero size but GetLastError=%d\n", GetLastError()); + "should not fail with zero size but GetLastError=%ld\n", GetLastError()); /* Test the limits */ SetLastError(0xdeadbeef); ret_size = GetEnvironmentVariableW(NULL, NULL, 0); ok(ret_size == 0 && (GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == ERROR_ENVVAR_NOT_FOUND), - "should not find variable but ret_size=%d GetLastError=%d\n", + "should not find variable but ret_size=%ld GetLastError=%ld\n", ret_size, GetLastError()); if (0) /* Both tests crash on Vista */ @@ -306,13 +307,13 @@ static void test_GetSetEnvironmentVariableW(void) SetLastError(0xdeadbeef); ret_size = GetEnvironmentVariableW(NULL, buf, lstrlenW(value) + 1); ok(ret_size == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND, - "should not find variable but ret_size=%d GetLastError=%d\n", + "should not find variable but ret_size=%ld GetLastError=%ld\n", ret_size, GetLastError()); SetLastError(0xdeadbeef); ret = SetEnvironmentVariableW(NULL, NULL); ok(ret == FALSE && (GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == ERROR_ENVVAR_NOT_FOUND), - "should fail with NULL, NULL but ret=%d and GetLastError=%d\n", + "should fail with NULL, NULL but ret=%d and GetLastError=%ld\n", ret, GetLastError()); } } @@ -336,46 +337,46 @@ static void test_GetSetEnvironmentVariableAW(void) /* Write W, read A */ ret = SetEnvironmentVariableW(nameW, valueW); - ok(ret == TRUE, "SetEnvironmentVariableW failed, last error %d\n", GetLastError()); + ok(ret == TRUE, "SetEnvironmentVariableW failed, last error %ld\n", GetLastError()); SetLastError(0xdeadbeef); ret_size = GetEnvironmentVariableA(name, NULL, 0); - todo_wine ok(ret_size == lstrlenA(value) + 1, "expected ret_size %d, got %d\n", lstrlenA(value) + 1, ret_size); - ok(GetLastError() == 0xdeadbeef, "expected last error 0xdeadbeef, got %d\n", GetLastError()); + todo_wine ok(ret_size == lstrlenA(value) + 1, "expected ret_size %d, got %ld\n", lstrlenA(value) + 1, ret_size); + ok(GetLastError() == 0xdeadbeef, "expected last error 0xdeadbeef, got %ld\n", GetLastError()); lstrcpyA(buf, "foo"); SetLastError(0xdeadbeef); ret_size = GetEnvironmentVariableA(name, buf, lstrlenA(value) + 1); todo_wine ok(lstrcmpA(buf, value) == 0, "expected %s, got %s\n", debugstr_a(value), debugstr_a(buf)); - todo_wine ok(ret_size == lstrlenA(value), "expected ret_size %d, got %d\n", lstrlenA(value), ret_size); - ok(GetLastError() == 0xdeadbeef, "expected last error 0xdeadbeef, got %d\n", GetLastError()); + todo_wine ok(ret_size == lstrlenA(value), "expected ret_size %d, got %ld\n", lstrlenA(value), ret_size); + ok(GetLastError() == 0xdeadbeef, "expected last error 0xdeadbeef, got %ld\n", GetLastError()); /* Write A, read A/W */ ret = SetEnvironmentVariableA(name, value); - ok(ret == TRUE, "SetEnvironmentVariableW failed, last error %d\n", GetLastError()); + ok(ret == TRUE, "SetEnvironmentVariableW failed, last error %ld\n", GetLastError()); SetLastError(0xdeadbeef); ret_size = GetEnvironmentVariableA(name, NULL, 0); - todo_wine ok(ret_size == lstrlenA(value) + 1, "expected ret_size %d, got %d\n", lstrlenA(value) + 1, ret_size); - ok(GetLastError() == 0xdeadbeef, "expected last error 0xdeadbeef, got %d\n", GetLastError()); + todo_wine ok(ret_size == lstrlenA(value) + 1, "expected ret_size %d, got %ld\n", lstrlenA(value) + 1, ret_size); + ok(GetLastError() == 0xdeadbeef, "expected last error 0xdeadbeef, got %ld\n", GetLastError()); lstrcpyA(buf, "foo"); SetLastError(0xdeadbeef); ret_size = GetEnvironmentVariableA(name, buf, lstrlenA(value) + 1); todo_wine ok(lstrcmpA(buf, value) == 0, "expected %s, got %s\n", debugstr_a(value), debugstr_a(buf)); - todo_wine ok(ret_size == lstrlenA(value), "expected ret_size %d, got %d\n", lstrlenA(value), ret_size); - ok(GetLastError() == 0xdeadbeef, "expected last error 0xdeadbeef, got %d\n", GetLastError()); + todo_wine ok(ret_size == lstrlenA(value), "expected ret_size %d, got %ld\n", lstrlenA(value), ret_size); + ok(GetLastError() == 0xdeadbeef, "expected last error 0xdeadbeef, got %ld\n", GetLastError()); SetLastError(0xdeadbeef); ret_size = GetEnvironmentVariableW(nameW, NULL, 0); - ok(ret_size == lstrlenW(valueW) + 1, "expected ret_size %d, got %d\n", lstrlenW(valueW) + 1, ret_size); - ok(GetLastError() == 0xdeadbeef, "expected last error 0xdeadbeef, got %d\n", GetLastError()); + ok(ret_size == lstrlenW(valueW) + 1, "expected ret_size %d, got %ld\n", lstrlenW(valueW) + 1, ret_size); + ok(GetLastError() == 0xdeadbeef, "expected last error 0xdeadbeef, got %ld\n", GetLastError()); lstrcpyW(bufW, L"foo"); SetLastError(0xdeadbeef); ret_size = GetEnvironmentVariableW(nameW, bufW, lstrlenW(valueW) + 1); - ok(ret_size == lstrlenW(valueW), "expected ret_size %d, got %d\n", lstrlenW(valueW), ret_size); - ok(GetLastError() == 0xdeadbeef, "expected last error 0xdeadbeef, got %d\n", GetLastError()); + ok(ret_size == lstrlenW(valueW), "expected ret_size %d, got %ld\n", lstrlenW(valueW), ret_size); + ok(GetLastError() == 0xdeadbeef, "expected last error 0xdeadbeef, got %ld\n", GetLastError()); ok(lstrcmpW(bufW, valueW) == 0, "expected %s, got %s\n", debugstr_w(valueW), debugstr_w(bufW)); } @@ -390,7 +391,7 @@ static void test_ExpandEnvironmentStringsA(void) ret_size = ExpandEnvironmentStringsA(NULL, buf1, sizeof(buf1)); ok(ret_size == 1 || ret_size == 0 /* Win9x */ || ret_size == 2 /* NT4 */, - "ExpandEnvironmentStrings returned %d\n", ret_size); + "ExpandEnvironmentStrings returned %ld\n", ret_size); /* Try to get the required buffer size 'the natural way' */ strcpy(buf, "%EnvVar%"); @@ -399,7 +400,7 @@ static void test_ExpandEnvironmentStringsA(void) ret_size == (strlen(value)+1)*2 || /* NT4 */ ret_size == strlen(value)+2 || /* win2k, XP, win2k3 */ ret_size == 0 /* Win95 */, - "ExpandEnvironmentStrings returned %d instead of %d, %d or %d\n", + "ExpandEnvironmentStrings returned %ld instead of %d, %d or %d\n", ret_size, lstrlenA(value)+1, lstrlenA(value)+2, 0); /* Again, side-stepping the Win95 bug */ @@ -407,7 +408,7 @@ static void test_ExpandEnvironmentStringsA(void) /* v5.1.2600.2945 (XP SP2) returns len + 2 here! */ ok(ret_size == strlen(value)+1 || ret_size == strlen(value)+2 || ret_size == (strlen(value)+1)*2 /* NT4 */, - "ExpandEnvironmentStrings returned %d instead of %d\n", + "ExpandEnvironmentStrings returned %ld instead of %d\n", ret_size, lstrlenA(value)+1); /* Try with a buffer that's too small */ @@ -415,7 +416,7 @@ static void test_ExpandEnvironmentStringsA(void) /* v5.1.2600.2945 (XP SP2) returns len + 2 here! */ ok(ret_size == strlen(value)+1 || ret_size == strlen(value)+2 || ret_size == (strlen(value)+1)*2 /* NT4 */, - "ExpandEnvironmentStrings returned %d instead of %d\n", + "ExpandEnvironmentStrings returned %ld instead of %d\n", ret_size, lstrlenA(value)+1); /* Try with a buffer of just the right size */ @@ -423,7 +424,7 @@ static void test_ExpandEnvironmentStringsA(void) ret_size = ExpandEnvironmentStringsA(buf, buf1, ret_size); ok(ret_size == strlen(value)+1 || ret_size == strlen(value)+2 || ret_size == (strlen(value)+1)*2 /* NT4 */, - "ExpandEnvironmentStrings returned %d instead of %d\n", + "ExpandEnvironmentStrings returned %ld instead of %d\n", ret_size, lstrlenA(value)+1); ok(!strcmp(buf1, value), "ExpandEnvironmentStrings returned [%s]\n", buf1); @@ -432,13 +433,13 @@ static void test_ExpandEnvironmentStringsA(void) ret_size = ExpandEnvironmentStringsA(buf, buf1, sizeof(buf1)); ok(ret_size == strlen(not_an_env_var)+1 || ret_size == (strlen(not_an_env_var)+1)*2 /* NT4 */, - "ExpandEnvironmentStrings returned %d instead of %d\n", ret_size, lstrlenA(not_an_env_var)+1); + "ExpandEnvironmentStrings returned %ld instead of %d\n", ret_size, lstrlenA(not_an_env_var)+1); ok(!strcmp(buf1, not_an_env_var), "ExpandEnvironmentStrings returned [%s]\n", buf1); /* test a large destination size */ strcpy(buf, "12345"); ret_size = ExpandEnvironmentStringsA(buf, buf2, sizeof(buf2)); - ok(!strcmp(buf, buf2), "ExpandEnvironmentStrings failed %s vs %s. ret_size = %d\n", buf, buf2, ret_size); + ok(!strcmp(buf, buf2), "ExpandEnvironmentStrings failed %s vs %s. ret_size = %ld\n", buf, buf2, ret_size); SetLastError(0xdeadbeef); ret_size1 = GetWindowsDirectoryA(buf1,256); @@ -446,7 +447,7 @@ static void test_ExpandEnvironmentStringsA(void) ret_size = ExpandEnvironmentStringsA("%SystemRoot%",buf,sizeof(buf)); if (ERROR_ENVVAR_NOT_FOUND != GetLastError()) { - ok(!strcmp(buf, buf1), "ExpandEnvironmentStrings failed %s vs %s. ret_size = %d\n", buf, buf1, ret_size); + ok(!strcmp(buf, buf1), "ExpandEnvironmentStrings failed %s vs %s. ret_size = %ld\n", buf, buf1, ret_size); } /* Try with a variable that references another */ @@ -456,7 +457,7 @@ static void test_ExpandEnvironmentStringsA(void) ret_size = ExpandEnvironmentStringsA(buf, buf1, sizeof(buf1)); ok(ret_size == strlen(buf2)+1 || ret_size == (strlen(buf2)+1)*2 /* NT4 */, - "ExpandEnvironmentStrings returned %d instead of %d\n", ret_size, lstrlenA(buf2)+1); + "ExpandEnvironmentStrings returned %ld instead of %d\n", ret_size, lstrlenA(buf2)+1); ok(!strcmp(buf1, buf2), "ExpandEnvironmentStrings returned [%s]\n", buf1); SetEnvironmentVariableA("IndirectVar", NULL); @@ -476,27 +477,27 @@ static void test_GetComputerName(void) SetLastError(0xdeadbeef); ret = GetComputerNameA((LPSTR)0xdeadbeef, &size); error = GetLastError(); - 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 %ld\n", error); /* Only Vista returns the computer name length as documented in the MSDN */ if (size != 0) { size++; /* nul terminating character */ name = HeapAlloc(GetProcessHeap(), 0, size * sizeof(name[0])); - ok(name != NULL, "HeapAlloc failed with error %d\n", GetLastError()); + ok(name != NULL, "HeapAlloc failed with error %ld\n", GetLastError()); ret = GetComputerNameA(name, &size); - ok(ret, "GetComputerNameA failed with error %d\n", GetLastError()); + ok(ret, "GetComputerNameA failed with error %ld\n", GetLastError()); HeapFree(GetProcessHeap(), 0, name); } size = MAX_COMPUTERNAME_LENGTH + 1; name = HeapAlloc(GetProcessHeap(), 0, size * sizeof(name[0])); - ok(name != NULL, "HeapAlloc failed with error %d\n", GetLastError()); + ok(name != NULL, "HeapAlloc failed with error %ld\n", GetLastError()); ret = GetComputerNameA(name, &size); - ok(ret, "GetComputerNameA failed with error %d\n", GetLastError()); + ok(ret, "GetComputerNameA failed with error %ld\n", GetLastError()); trace("computer name is \"%s\"\n", name); name_len = strlen(name); - ok(size == name_len, "size should be same as length, name_len=%d, size=%d\n", name_len, size); + ok(size == name_len, "size should be same as length, name_len=%d, size=%ld\n", name_len, size); HeapFree(GetProcessHeap(), 0, name); size = 0; @@ -507,12 +508,12 @@ static void test_GetComputerName(void) win_skip("GetComputerNameW is not implemented\n"); else { - ok(!ret && error == ERROR_BUFFER_OVERFLOW, "GetComputerNameW should have failed with ERROR_BUFFER_OVERFLOW instead of %d\n", error); + ok(!ret && error == ERROR_BUFFER_OVERFLOW, "GetComputerNameW should have failed with ERROR_BUFFER_OVERFLOW instead of %ld\n", error); size++; /* nul terminating character */ nameW = HeapAlloc(GetProcessHeap(), 0, size * sizeof(nameW[0])); - ok(nameW != NULL, "HeapAlloc failed with error %d\n", GetLastError()); + ok(nameW != NULL, "HeapAlloc failed with error %ld\n", GetLastError()); ret = GetComputerNameW(nameW, &size); - ok(ret, "GetComputerNameW failed with error %d\n", GetLastError()); + ok(ret, "GetComputerNameW failed with error %ld\n", GetLastError()); HeapFree(GetProcessHeap(), 0, nameW); } } @@ -537,7 +538,7 @@ static void test_GetComputerNameExA(void) ret = pGetComputerNameExA(ComputerNameDnsDomain, (LPSTR)0xdeadbeef, &size); error = GetLastError(); ok(ret == 0, "Expected 0, got %d\n", ret); - ok(error == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", error); + ok(error == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %ld\n", error); /* size is not set in win2k */ if (size == 0) @@ -546,9 +547,9 @@ static void test_GetComputerNameExA(void) size = MAX_COMP_NAME; } name = HeapAlloc(GetProcessHeap(), 0, size * sizeof(name[0])); - ok(name != NULL, "HeapAlloc failed with error %d\n", GetLastError()); + ok(name != NULL, "HeapAlloc failed with error %ld\n", GetLastError()); ret = pGetComputerNameExA(ComputerNameDnsDomain, name, &size); - ok(ret, "GetComputerNameExA(ComputerNameDnsDomain) failed with error %d\n", GetLastError()); + ok(ret, "GetComputerNameExA(ComputerNameDnsDomain) failed with error %ld\n", GetLastError()); trace("domain name is \"%s\"\n", name); HeapFree(GetProcessHeap(), 0, name); @@ -557,15 +558,15 @@ static void test_GetComputerNameExA(void) ret = pGetComputerNameExA(ComputerNameDnsFullyQualified, (LPSTR)0xdeadbeef, &size); error = GetLastError(); ok(ret == 0, "Expected 0, got %d\n", ret); - ok(error == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", error); + ok(error == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %ld\n", error); /* size is not set in win2k */ if (size == 0) size = MAX_COMP_NAME; name = HeapAlloc(GetProcessHeap(), 0, size * sizeof(name[0])); - ok(name != NULL, "HeapAlloc failed with error %d\n", GetLastError()); + ok(name != NULL, "HeapAlloc failed with error %ld\n", GetLastError()); ret = pGetComputerNameExA(ComputerNameDnsFullyQualified, name, &size); - ok(ret, "GetComputerNameExA(ComputerNameDnsFullyQualified) failed with error %d\n", GetLastError()); + ok(ret, "GetComputerNameExA(ComputerNameDnsFullyQualified) failed with error %ld\n", GetLastError()); trace("fully qualified hostname is \"%s\"\n", name); HeapFree(GetProcessHeap(), 0, name); @@ -574,15 +575,15 @@ static void test_GetComputerNameExA(void) ret = pGetComputerNameExA(ComputerNameDnsHostname, (LPSTR)0xdeadbeef, &size); error = GetLastError(); ok(ret == 0, "Expected 0, got %d\n", ret); - ok(error == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", error); + ok(error == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %ld\n", error); /* size is not set in win2k */ if (size == 0) size = MAX_COMP_NAME; name = HeapAlloc(GetProcessHeap(), 0, size * sizeof(name[0])); - ok(name != NULL, "HeapAlloc failed with error %d\n", GetLastError()); + ok(name != NULL, "HeapAlloc failed with error %ld\n", GetLastError()); ret = pGetComputerNameExA(ComputerNameDnsHostname, name, &size); - ok(ret, "GetComputerNameExA(ComputerNameDnsHostname) failed with error %d\n", GetLastError()); + ok(ret, "GetComputerNameExA(ComputerNameDnsHostname) failed with error %ld\n", GetLastError()); trace("hostname is \"%s\"\n", name); HeapFree(GetProcessHeap(), 0, name); @@ -591,22 +592,22 @@ static void test_GetComputerNameExA(void) ret = pGetComputerNameExA(ComputerNameNetBIOS, (LPSTR)0xdeadbeef, &size); error = GetLastError(); ok(ret == 0, "Expected 0, got %d\n", ret); - ok(error == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", error); + ok(error == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %ld\n", error); size = 0; SetLastError(0xdeadbeef); ret = pGetComputerNameExA(ComputerNameNetBIOS, NULL, &size); error = GetLastError(); ok(ret == 0, "Expected 0, got %d\n", ret); - ok(error == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", error); + ok(error == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %ld\n", error); /* size is not set in win2k */ if (size == 0) size = MAX_COMP_NAME; name = HeapAlloc(GetProcessHeap(), 0, size * sizeof(name[0])); - ok(name != NULL, "HeapAlloc failed with error %d\n", GetLastError()); + ok(name != NULL, "HeapAlloc failed with error %ld\n", GetLastError()); ret = pGetComputerNameExA(ComputerNameNetBIOS, name, &size); - ok(ret, "GetComputerNameExA(ComputerNameNetBIOS) failed with error %d\n", GetLastError()); + ok(ret, "GetComputerNameExA(ComputerNameNetBIOS) failed with error %ld\n", GetLastError()); trace("NetBIOS name is \"%s\"\n", name); HeapFree(GetProcessHeap(), 0, name); } @@ -628,51 +629,51 @@ static void test_GetComputerNameExW(void) SetLastError(0xdeadbeef); ret = pGetComputerNameExW(ComputerNameDnsDomain, (LPWSTR)0xdeadbeef, &size); error = GetLastError(); - ok(!ret && error == ERROR_MORE_DATA, "GetComputerNameExW should have failed with ERROR_MORE_DATA instead of %d\n", error); + ok(!ret && error == ERROR_MORE_DATA, "GetComputerNameExW should have failed with ERROR_MORE_DATA instead of %ld\n", error); nameW = HeapAlloc(GetProcessHeap(), 0, size * sizeof(nameW[0])); - ok(nameW != NULL, "HeapAlloc failed with error %d\n", GetLastError()); + ok(nameW != NULL, "HeapAlloc failed with error %ld\n", GetLastError()); ret = pGetComputerNameExW(ComputerNameDnsDomain, nameW, &size); - ok(ret, "GetComputerNameExW(ComputerNameDnsDomain) failed with error %d\n", GetLastError()); + ok(ret, "GetComputerNameExW(ComputerNameDnsDomain) failed with error %ld\n", GetLastError()); HeapFree(GetProcessHeap(), 0, nameW); size = 0; SetLastError(0xdeadbeef); ret = pGetComputerNameExW(ComputerNameDnsFullyQualified, (LPWSTR)0xdeadbeef, &size); error = GetLastError(); - ok(!ret && error == ERROR_MORE_DATA, "GetComputerNameExW should have failed with ERROR_MORE_DATA instead of %d\n", error); + ok(!ret && error == ERROR_MORE_DATA, "GetComputerNameExW should have failed with ERROR_MORE_DATA instead of %ld\n", error); nameW = HeapAlloc(GetProcessHeap(), 0, size * sizeof(nameW[0])); - ok(nameW != NULL, "HeapAlloc failed with error %d\n", GetLastError()); + ok(nameW != NULL, "HeapAlloc failed with error %ld\n", GetLastError()); ret = pGetComputerNameExW(ComputerNameDnsFullyQualified, nameW, &size); - ok(ret, "GetComputerNameExW(ComputerNameDnsFullyQualified) failed with error %d\n", GetLastError()); + ok(ret, "GetComputerNameExW(ComputerNameDnsFullyQualified) failed with error %ld\n", GetLastError()); HeapFree(GetProcessHeap(), 0, nameW); size = 0; SetLastError(0xdeadbeef); ret = pGetComputerNameExW(ComputerNameDnsHostname, (LPWSTR)0xdeadbeef, &size); error = GetLastError(); - ok(!ret && error == ERROR_MORE_DATA, "GetComputerNameExW should have failed with ERROR_MORE_DATA instead of %d\n", error); + ok(!ret && error == ERROR_MORE_DATA, "GetComputerNameExW should have failed with ERROR_MORE_DATA instead of %ld\n", error); nameW = HeapAlloc(GetProcessHeap(), 0, size * sizeof(nameW[0])); - ok(nameW != NULL, "HeapAlloc failed with error %d\n", GetLastError()); + ok(nameW != NULL, "HeapAlloc failed with error %ld\n", GetLastError()); ret = pGetComputerNameExW(ComputerNameDnsHostname, nameW, &size); - ok(ret, "GetComputerNameExW(ComputerNameDnsHostname) failed with error %d\n", GetLastError()); + ok(ret, "GetComputerNameExW(ComputerNameDnsHostname) failed with error %ld\n", GetLastError()); HeapFree(GetProcessHeap(), 0, nameW); size = 0; SetLastError(0xdeadbeef); ret = pGetComputerNameExW(ComputerNameNetBIOS, (LPWSTR)0xdeadbeef, &size); error = GetLastError(); - ok(!ret && error == ERROR_MORE_DATA, "GetComputerNameExW should have failed with ERROR_MORE_DATA instead of %d\n", error); + ok(!ret && error == ERROR_MORE_DATA, "GetComputerNameExW should have failed with ERROR_MORE_DATA instead of %ld\n", error); nameW = HeapAlloc(GetProcessHeap(), 0, size * sizeof(nameW[0])); - ok(nameW != NULL, "HeapAlloc failed with error %d\n", GetLastError()); + ok(nameW != NULL, "HeapAlloc failed with error %ld\n", GetLastError()); ret = pGetComputerNameExW(ComputerNameNetBIOS, nameW, &size); - ok(ret, "GetComputerNameExW(ComputerNameNetBIOS) failed with error %d\n", GetLastError()); + ok(ret, "GetComputerNameExW(ComputerNameNetBIOS) failed with error %ld\n", GetLastError()); HeapFree(GetProcessHeap(), 0, nameW); size = 0; SetLastError(0xdeadbeef); ret = pGetComputerNameExW(ComputerNameNetBIOS, NULL, &size); error = GetLastError(); - ok(!ret && error == ERROR_MORE_DATA, "GetComputerNameExW should have failed with ERROR_MORE_DATA instead of %d\n", error); + ok(!ret && error == ERROR_MORE_DATA, "GetComputerNameExW should have failed with ERROR_MORE_DATA instead of %ld\n", error); } static void test_GetEnvironmentStringsW(void) @@ -697,13 +698,13 @@ static void check_env_var_(int line, const char *var, const char *value) DWORD size = GetEnvironmentVariableA(var, buffer, sizeof(buffer)); if (value) { - ok_(__FILE__, line)(size == strlen(value), "wrong size %u\n", size); + ok_(__FILE__, line)(size == strlen(value), "wrong size %lu\n", size); ok_(__FILE__, line)(!strcmp(buffer, value), "wrong value %s\n", debugstr_a(buffer)); } else { - ok_(__FILE__, line)(!size, "wrong size %u\n", size); - ok_(__FILE__, line)(GetLastError() == ERROR_ENVVAR_NOT_FOUND, "got error %u\n", GetLastError()); + ok_(__FILE__, line)(!size, "wrong size %lu\n", size); + ok_(__FILE__, line)(GetLastError() == ERROR_ENVVAR_NOT_FOUND, "got error %lu\n", GetLastError()); } } #define check_env_var(a, b) check_env_var_(__LINE__, a, b) @@ -722,15 +723,15 @@ static void test_SetEnvironmentStrings(void) } ret = SetEnvironmentVariableA("testenv1", "heis"); - ok(ret, "got error %u\n", GetLastError()); + ok(ret, "got error %lu\n", GetLastError()); ret = SetEnvironmentVariableA("testenv2", "dyo"); - ok(ret, "got error %u\n", GetLastError()); + ok(ret, "got error %lu\n", GetLastError()); old_env = GetEnvironmentStringsW(); memcpy(env, testenv, sizeof(testenv)); ret = pSetEnvironmentStringsW(env); - ok(ret, "got error %u\n", GetLastError()); + ok(ret, "got error %lu\n", GetLastError()); ok(!memcmp(env, testenv, sizeof(testenv)), "input parameter should not be changed\n"); check_env_var("testenv1", "unus"); @@ -739,7 +740,7 @@ static void test_SetEnvironmentStrings(void) check_env_var("PATH", NULL); ret = pSetEnvironmentStringsW(old_env); - ok(ret, "got error %u\n", GetLastError()); + ok(ret, "got error %lu\n", GetLastError()); check_env_var("testenv1", "heis"); check_env_var("testenv2", "dyo"); @@ -752,24 +753,24 @@ static void test_SetEnvironmentStrings(void) SetLastError(0xdeadbeef); ret = pSetEnvironmentStringsW(env); ok(!ret, "expected failure\n"); - ok(GetLastError() == ERROR_INVALID_PARAMETER, "got error %u\n", GetLastError()); + ok(GetLastError() == ERROR_INVALID_PARAMETER, "got error %lu\n", GetLastError()); copy_string(env, L"=unus\0"); SetLastError(0xdeadbeef); ret = pSetEnvironmentStringsW(env); ok(!ret, "expected failure\n"); - ok(GetLastError() == ERROR_INVALID_PARAMETER, "got error %u\n", GetLastError()); + ok(GetLastError() == ERROR_INVALID_PARAMETER, "got error %lu\n", GetLastError()); copy_string(env, L"one=two=three four=five\0"); ret = pSetEnvironmentStringsW(env); - ok(ret, "got error %u\n", GetLastError()); + ok(ret, "got error %lu\n", GetLastError()); check_env_var("one", "two=three four=five"); ret = pSetEnvironmentStringsW(old_env); - ok(ret, "got error %u\n", GetLastError()); + ok(ret, "got error %lu\n", GetLastError()); ret = FreeEnvironmentStringsW(old_env); - ok(ret, "got error %u\n", GetLastError()); + ok(ret, "got error %lu\n", GetLastError()); } START_TEST(environ)