[PATCH] dlls/wtsapi32/tests: enable compilation with long types

Eric Pouech eric.pouech at gmail.com
Thu Mar 10 01:48:25 CST 2022


Signed-off-by: Eric Pouech <eric.pouech at gmail.com>

---
 dlls/wtsapi32/tests/Makefile.in |    1 
 dlls/wtsapi32/tests/wtsapi.c    |   90 ++++++++++++++++++++-------------------
 2 files changed, 45 insertions(+), 46 deletions(-)

diff --git a/dlls/wtsapi32/tests/Makefile.in b/dlls/wtsapi32/tests/Makefile.in
index 1b18073bdac..57014aea938 100644
--- a/dlls/wtsapi32/tests/Makefile.in
+++ b/dlls/wtsapi32/tests/Makefile.in
@@ -1,4 +1,3 @@
-EXTRADEFS = -DWINE_NO_LONG_TYPES
 TESTDLL   = wtsapi32.dll
 IMPORTS   = wtsapi32 advapi32 psapi
 
diff --git a/dlls/wtsapi32/tests/wtsapi.c b/dlls/wtsapi32/tests/wtsapi.c
index 3eec81d8556..32caa05588c 100644
--- a/dlls/wtsapi32/tests/wtsapi.c
+++ b/dlls/wtsapi32/tests/wtsapi.c
@@ -64,7 +64,7 @@ static void check_wts_process_info(const WTS_PROCESS_INFOW *info, DWORD count)
         nt_length *= 2;
         nt_info = realloc(nt_info, nt_length);
     }
-    ok(!status, "got %#x\n", status);
+    ok(!status, "got %#lx\n", status);
 
     for (i = 0; i < count; i++)
     {
@@ -75,11 +75,11 @@ static void check_wts_process_info(const WTS_PROCESS_INFOW *info, DWORD count)
         DWORD size;
 
         nt_process = find_nt_process_info(nt_info, info[i].ProcessId);
-        ok(!!nt_process, "failed to find pid %#x\n", info[i].ProcessId);
+        ok(!!nt_process, "failed to find pid %#lx\n", info[i].ProcessId);
 
-        winetest_push_context("pid %#x", info[i].ProcessId);
+        winetest_push_context("pid %#lx", info[i].ProcessId);
 
-        ok(info[i].SessionId == nt_process->SessionId, "expected session id %#x, got %#x\n",
+        ok(info[i].SessionId == nt_process->SessionId, "expected session id %#lx, got %#lx\n",
                 nt_process->SessionId, info[i].SessionId);
 
         ok(!memcmp(info[i].pProcessName, nt_process->ProcessName.Buffer, nt_process->ProcessName.Length),
@@ -89,9 +89,9 @@ static void check_wts_process_info(const WTS_PROCESS_INFOW *info, DWORD count)
         if ((process = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, info[i].ProcessId)))
         {
             ret = OpenProcessToken(process, TOKEN_QUERY, &token);
-            ok(ret, "failed to open token, error %u\n", GetLastError());
+            ok(ret, "failed to open token, error %lu\n", GetLastError());
             ret = GetTokenInformation(token, TokenUser, sid_buffer, sizeof(sid_buffer), &size);
-            ok(ret, "failed to get token user, error %u\n", GetLastError());
+            ok(ret, "failed to get token user, error %lu\n", GetLastError());
             ok(EqualSid(info[i].pUserSid, sid->Sid), "SID did not match\n");
             CloseHandle(token);
             CloseHandle(process);
@@ -117,33 +117,33 @@ static void test_WTSEnumerateProcessesW(void)
     SetLastError(0xdeadbeef);
     ret = WTSEnumerateProcessesW(WTS_CURRENT_SERVER_HANDLE, 1, 1, &info, &count);
     ok(!ret, "expected WTSEnumerateProcessesW to fail\n");
-    ok(GetLastError()== ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %d\n", GetLastError());
+    ok(GetLastError()== ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %ld\n", GetLastError());
     WTSFreeMemory(info);
 
     info = NULL;
     SetLastError(0xdeadbeef);
     ret = WTSEnumerateProcessesW(WTS_CURRENT_SERVER_HANDLE, 0, 0, &info, &count);
     ok(!ret, "expected WTSEnumerateProcessesW to fail\n");
-    ok(GetLastError()== ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %d\n", GetLastError());
+    ok(GetLastError()== ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %ld\n", GetLastError());
     WTSFreeMemory(info);
 
     info = NULL;
     SetLastError(0xdeadbeef);
     ret = WTSEnumerateProcessesW(WTS_CURRENT_SERVER_HANDLE, 0, 2, &info, &count);
     ok(!ret, "expected WTSEnumerateProcessesW to fail\n");
-    ok(GetLastError()== ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %d\n", GetLastError());
+    ok(GetLastError()== ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %ld\n", GetLastError());
     WTSFreeMemory(info);
 
     SetLastError(0xdeadbeef);
     ret = WTSEnumerateProcessesW(WTS_CURRENT_SERVER_HANDLE, 0, 1, NULL, &count);
     ok(!ret, "expected WTSEnumerateProcessesW to fail\n");
-    ok(GetLastError()== ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %d\n", GetLastError());
+    ok(GetLastError()== ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %ld\n", GetLastError());
 
     info = NULL;
     SetLastError(0xdeadbeef);
     ret = WTSEnumerateProcessesW(WTS_CURRENT_SERVER_HANDLE, 0, 1, &info, NULL);
     ok(!ret, "expected WTSEnumerateProcessesW to fail\n");
-    ok(GetLastError()== ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %d\n", GetLastError());
+    ok(GetLastError()== ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %ld\n", GetLastError());
     WTSFreeMemory(info);
 
     count = 0;
@@ -151,7 +151,7 @@ static void test_WTSEnumerateProcessesW(void)
     SetLastError(0xdeadbeef);
     ret = WTSEnumerateProcessesW(WTS_CURRENT_SERVER_HANDLE, 0, 1, &info, &count);
     ok(ret, "expected success\n");
-    ok(!GetLastError(), "got error %u\n", GetLastError());
+    ok(!GetLastError(), "got error %lu\n", GetLastError());
     check_wts_process_info(info, count);
     WTSFreeMemory(info);
 
@@ -167,14 +167,14 @@ static void test_WTSEnumerateProcessesW(void)
     count = 0xdeadbeef;
     ret = pWTSEnumerateProcessesExW(WTS_CURRENT_SERVER_HANDLE, &level, WTS_ANY_SESSION, NULL, &count);
     ok(!ret, "expected failure\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "got error %u\n", GetLastError());
-    ok(count == 0xdeadbeef, "got count %u\n", count);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "got error %lu\n", GetLastError());
+    ok(count == 0xdeadbeef, "got count %lu\n", count);
 
     info = (void *)0xdeadbeef;
     SetLastError(0xdeadbeef);
     ret = pWTSEnumerateProcessesExW(WTS_CURRENT_SERVER_HANDLE, &level, WTS_ANY_SESSION, (WCHAR **)&info, NULL);
     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());
     ok(info == (void *)0xdeadbeef, "got info %p\n", info);
 
     info = NULL;
@@ -182,7 +182,7 @@ static void test_WTSEnumerateProcessesW(void)
     SetLastError(0xdeadbeef);
     ret = pWTSEnumerateProcessesExW(WTS_CURRENT_SERVER_HANDLE, &level, WTS_ANY_SESSION, (WCHAR **)&info, &count);
     ok(ret, "expected success\n");
-    ok(!GetLastError(), "got error %u\n", GetLastError());
+    ok(!GetLastError(), "got error %lu\n", GetLastError());
     check_wts_process_info(info, count);
     pWTSFreeMemoryExW(WTSTypeProcessInfoLevel0, info, count);
 }
@@ -197,91 +197,91 @@ static void test_WTSQuerySessionInformation(void)
     SetLastError(0xdeadbeef);
     count = 0;
     ret = WTSQuerySessionInformationW(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSUserName, NULL, &count);
-    ok(!ret, "got %u\n", GetLastError());
-    ok(count == 0, "got %u\n", count);
-    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "got %u\n", GetLastError());
+    ok(!ret, "got %lu\n", GetLastError());
+    ok(count == 0, "got %lu\n", count);
+    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "got %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     count = 1;
     ret = WTSQuerySessionInformationW(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSUserName, NULL, &count);
-    ok(!ret, "got %u\n", GetLastError());
-    ok(count == 1, "got %u\n", count);
-    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "got %u\n", GetLastError());
+    ok(!ret, "got %lu\n", GetLastError());
+    ok(count == 1, "got %lu\n", count);
+    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "got %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = WTSQuerySessionInformationW(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSUserName, &buf1, NULL);
-    ok(!ret, "got %u\n", GetLastError());
-    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "got %u\n", GetLastError());
+    ok(!ret, "got %lu\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "got %lu\n", GetLastError());
 
     count = 0;
     buf1 = NULL;
     ret = WTSQuerySessionInformationW(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSUserName, &buf1, &count);
-    ok(ret, "got %u\n", GetLastError());
+    ok(ret, "got %lu\n", GetLastError());
     ok(buf1 != NULL, "buf not set\n");
-    ok(count == (lstrlenW(buf1) + 1) * sizeof(WCHAR), "expected %u, got %u\n", (lstrlenW(buf1) + 1) * sizeof(WCHAR), count);
+    ok(count == (lstrlenW(buf1) + 1) * sizeof(WCHAR), "expected %Iu, got %lu\n", (lstrlenW(buf1) + 1) * sizeof(WCHAR), count);
     tempsize = UNLEN + 1;
     GetUserNameW(usernameW, &tempsize);
     /* Windows Vista, 7 and 8 return uppercase username, while the rest return lowercase. */
     ok(!wcsicmp(buf1, usernameW), "expected %s, got %s\n", wine_dbgstr_w(usernameW), wine_dbgstr_w(buf1));
-    ok(count == tempsize * sizeof(WCHAR), "expected %u, got %u\n", tempsize * sizeof(WCHAR), count);
+    ok(count == tempsize * sizeof(WCHAR), "expected %Iu, got %lu\n", tempsize * sizeof(WCHAR), count);
     WTSFreeMemory(buf1);
 
     count = 0;
     buf1 = NULL;
     ret = WTSQuerySessionInformationW(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSDomainName, &buf1, &count);
-    ok(ret, "got %u\n", GetLastError());
+    ok(ret, "got %lu\n", GetLastError());
     ok(buf1 != NULL, "buf not set\n");
-    ok(count == (lstrlenW(buf1) + 1) * sizeof(WCHAR), "expected %u, got %u\n", (lstrlenW(buf1) + 1) * sizeof(WCHAR), count);
+    ok(count == (lstrlenW(buf1) + 1) * sizeof(WCHAR), "expected %Iu, got %lu\n", (lstrlenW(buf1) + 1) * sizeof(WCHAR), count);
     tempsize = MAX_COMPUTERNAME_LENGTH + 1;
     GetComputerNameW(computernameW, &tempsize);
     /* Windows Vista, 7 and 8 return uppercase computername, while the rest return lowercase. */
     ok(!wcsicmp(buf1, computernameW), "expected %s, got %s\n", wine_dbgstr_w(computernameW), wine_dbgstr_w(buf1));
-    ok(count == (tempsize + 1) * sizeof(WCHAR), "expected %u, got %u\n", (tempsize + 1) * sizeof(WCHAR), count);
+    ok(count == (tempsize + 1) * sizeof(WCHAR), "expected %Iu, got %lu\n", (tempsize + 1) * sizeof(WCHAR), count);
     WTSFreeMemory(buf1);
 
     SetLastError(0xdeadbeef);
     count = 0;
     ret = WTSQuerySessionInformationA(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSUserName, NULL, &count);
-    ok(!ret, "got %u\n", GetLastError());
-    ok(count == 0, "got %u\n", count);
-    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "got %u\n", GetLastError());
+    ok(!ret, "got %lu\n", GetLastError());
+    ok(count == 0, "got %lu\n", count);
+    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "got %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     count = 1;
     ret = WTSQuerySessionInformationA(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSUserName, NULL, &count);
-    ok(!ret, "got %u\n", GetLastError());
-    ok(count == 1, "got %u\n", count);
-    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "got %u\n", GetLastError());
+    ok(!ret, "got %lu\n", GetLastError());
+    ok(count == 1, "got %lu\n", count);
+    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "got %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = WTSQuerySessionInformationA(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSUserName, &buf2, NULL);
-    ok(!ret, "got %u\n", GetLastError());
-    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "got %u\n", GetLastError());
+    ok(!ret, "got %lu\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "got %lu\n", GetLastError());
 
     count = 0;
     buf2 = NULL;
     ret = WTSQuerySessionInformationA(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSUserName, &buf2, &count);
-    ok(ret, "got %u\n", GetLastError());
+    ok(ret, "got %lu\n", GetLastError());
     ok(buf2 != NULL, "buf not set\n");
-    ok(count == lstrlenA(buf2) + 1, "expected %u, got %u\n", lstrlenA(buf2) + 1, count);
+    ok(count == lstrlenA(buf2) + 1, "expected %u, got %lu\n", lstrlenA(buf2) + 1, count);
     tempsize = UNLEN + 1;
     GetUserNameA(username, &tempsize);
     /* Windows Vista, 7 and 8 return uppercase username, while the rest return lowercase. */
     ok(!stricmp(buf2, username), "expected %s, got %s\n", username, buf2);
-    ok(count == tempsize, "expected %u, got %u\n", tempsize, count);
+    ok(count == tempsize, "expected %lu, got %lu\n", tempsize, count);
     WTSFreeMemory(buf2);
 
     count = 0;
     buf2 = NULL;
     ret = WTSQuerySessionInformationA(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, WTSDomainName, &buf2, &count);
-    ok(ret, "got %u\n", GetLastError());
+    ok(ret, "got %lu\n", GetLastError());
     ok(buf2 != NULL, "buf not set\n");
-    ok(count == lstrlenA(buf2) + 1, "expected %u, got %u\n", lstrlenA(buf2) + 1, count);
+    ok(count == lstrlenA(buf2) + 1, "expected %u, got %lu\n", lstrlenA(buf2) + 1, count);
     tempsize = MAX_COMPUTERNAME_LENGTH + 1;
     GetComputerNameA(computername, &tempsize);
     /* Windows Vista, 7 and 8 return uppercase computername, while the rest return lowercase. */
     ok(!stricmp(buf2, computername), "expected %s, got %s\n", computername, buf2);
-    ok(count == tempsize + 1, "expected %u, got %u\n", tempsize + 1, count);
+    ok(count == tempsize + 1, "expected %lu, got %lu\n", tempsize + 1, count);
     WTSFreeMemory(buf2);
 }
 
@@ -292,7 +292,7 @@ static void test_WTSQueryUserToken(void)
     SetLastError(0xdeadbeef);
     ret = WTSQueryUserToken(WTS_CURRENT_SESSION, NULL);
     ok(!ret, "expected WTSQueryUserToken to fail\n");
-    ok(GetLastError()==ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %d\n", GetLastError());
+    ok(GetLastError()==ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %ld\n", GetLastError());
 }
 
 START_TEST (wtsapi)




More information about the wine-devel mailing list