Wine-devel
Threads by month
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
March 2022
- 80 participants
- 950 discussions
24 Mar '22
Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com>
---
dlls/ntdll/tests/threadpool.c | 749 +++++++++++++++++++++--------------------
1 file changed, 375 insertions(+), 374 deletions(-)
diff --git a/dlls/ntdll/tests/threadpool.c b/dlls/ntdll/tests/threadpool.c
index 6c28d0642d7..80a36fc71cf 100644
--- a/dlls/ntdll/tests/threadpool.c
+++ b/dlls/ntdll/tests/threadpool.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 */
#define NONAMELESSSTRUCT
#define NONAMELESSUNION
@@ -130,32 +131,32 @@ static void test_RtlQueueWorkItem(void)
DWORD result;
semaphore = CreateSemaphoreA(NULL, 0, 1, NULL);
- ok(semaphore != NULL, "CreateSemaphoreA failed %u\n", GetLastError());
+ ok(semaphore != NULL, "CreateSemaphoreA failed %lu\n", GetLastError());
status = RtlQueueWorkItem(rtl_work_cb, semaphore, WT_EXECUTEDEFAULT);
- ok(!status, "RtlQueueWorkItem failed with status %x\n", status);
+ ok(!status, "RtlQueueWorkItem failed with status %lx\n", status);
result = WaitForSingleObject(semaphore, 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
status = RtlQueueWorkItem(rtl_work_cb, semaphore, WT_EXECUTEINIOTHREAD);
- ok(!status, "RtlQueueWorkItem failed with status %x\n", status);
+ ok(!status, "RtlQueueWorkItem failed with status %lx\n", status);
result = WaitForSingleObject(semaphore, 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
status = RtlQueueWorkItem(rtl_work_cb, semaphore, WT_EXECUTEINPERSISTENTTHREAD);
- ok(!status, "RtlQueueWorkItem failed with status %x\n", status);
+ ok(!status, "RtlQueueWorkItem failed with status %lx\n", status);
result = WaitForSingleObject(semaphore, 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
status = RtlQueueWorkItem(rtl_work_cb, semaphore, WT_EXECUTELONGFUNCTION);
- ok(!status, "RtlQueueWorkItem failed with status %x\n", status);
+ ok(!status, "RtlQueueWorkItem failed with status %lx\n", status);
result = WaitForSingleObject(semaphore, 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
status = RtlQueueWorkItem(rtl_work_cb, semaphore, WT_TRANSFER_IMPERSONATION);
- ok(!status, "RtlQueueWorkItem failed with status %x\n", status);
+ ok(!status, "RtlQueueWorkItem failed with status %lx\n", status);
result = WaitForSingleObject(semaphore, 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
CloseHandle(semaphore);
}
@@ -184,7 +185,7 @@ static void CALLBACK rtl_wait_cb(void *userdata, BOOLEAN timeout)
if (info->semaphore2)
{
result = WaitForSingleObject(info->semaphore2, 200);
- ok(result == info->wait_result, "expected %u, got %u\n", info->wait_result, result);
+ ok(result == info->wait_result, "expected %lu, got %lu\n", info->wait_result, result);
ReleaseSemaphore(info->semaphore1, 1, NULL);
}
}
@@ -219,257 +220,257 @@ static void test_RtlRegisterWait(void)
wait1 = NULL;
info.userdata = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, INFINITE, WT_EXECUTEDEFAULT);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
ok(wait1 != NULL, "expected wait1 != NULL\n");
status = RtlDeregisterWait(wait1);
- ok(!status, "RtlDeregisterWait failed with status %x\n", status);
- ok(info.userdata == 0, "expected info.userdata = 0, got %u\n", info.userdata);
+ ok(!status, "RtlDeregisterWait failed with status %lx\n", status);
+ ok(info.userdata == 0, "expected info.userdata = 0, got %lu\n", info.userdata);
/* infinite timeout, signal the semaphore two times */
info.userdata = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, INFINITE, WT_EXECUTEDEFAULT);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 1, "expected info.userdata = 1, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 1, "expected info.userdata = 1, got %lu\n", info.userdata);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 2, "expected info.userdata = 2, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 2, "expected info.userdata = 2, got %lu\n", info.userdata);
result = WaitForSingleObject(semaphores[1], 0);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
Sleep(50);
status = RtlDeregisterWait(wait1);
- ok(!status, "RtlDeregisterWait failed with status %x\n", status);
+ ok(!status, "RtlDeregisterWait failed with status %lx\n", status);
/* repeat test with WT_EXECUTEONLYONCE */
info.userdata = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, INFINITE, WT_EXECUTEONLYONCE);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 1, "expected info.userdata = 1, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 1, "expected info.userdata = 1, got %lu\n", info.userdata);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 1, "expected info.userdata = 1, got %u\n", info.userdata);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 1, "expected info.userdata = 1, got %lu\n", info.userdata);
result = WaitForSingleObject(semaphores[1], 0);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
Sleep(50);
status = RtlDeregisterWait(wait1);
- ok(!status, "RtlDeregisterWait failed with status %x\n", status);
+ ok(!status, "RtlDeregisterWait failed with status %lx\n", status);
/* finite timeout, no event */
info.userdata = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, 200, WT_EXECUTEDEFAULT);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 0, "expected info.userdata = 0, got %u\n", info.userdata);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 0, "expected info.userdata = 0, got %lu\n", info.userdata);
result = WaitForSingleObject(semaphores[0], 200);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %lu\n", info.userdata);
result = WaitForSingleObject(semaphores[1], 0);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
Sleep(50);
status = RtlDeregisterWait(wait1);
- ok(!status, "RtlDeregisterWait failed with status %x\n", status);
+ ok(!status, "RtlDeregisterWait failed with status %lx\n", status);
/* finite timeout, with event */
info.userdata = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, 200, WT_EXECUTEDEFAULT);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 0, "expected info.userdata = 0, got %u\n", info.userdata);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 0, "expected info.userdata = 0, got %lu\n", info.userdata);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 1, "expected info.userdata = 1, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 1, "expected info.userdata = 1, got %lu\n", info.userdata);
result = WaitForSingleObject(semaphores[1], 0);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
Sleep(50);
status = RtlDeregisterWait(wait1);
- ok(!status, "RtlDeregisterWait failed with status %x\n", status);
+ ok(!status, "RtlDeregisterWait failed with status %lx\n", status);
/* test RtlRegisterWait WT_EXECUTEINWAITTHREAD flag */
info.userdata = 0;
info.threadid = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, 200, WT_EXECUTEINWAITTHREAD|WT_EXECUTEONLYONCE);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 200);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 1, "expected info.userdata = 1, got %u\n", info.userdata);
- ok(info.threadid && info.threadid != GetCurrentThreadId(), "unexpected wait thread id %x\n", info.threadid);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 1, "expected info.userdata = 1, got %lu\n", info.userdata);
+ ok(info.threadid && info.threadid != GetCurrentThreadId(), "unexpected wait thread id %lx\n", info.threadid);
threadid = info.threadid;
result = WaitForSingleObject(semaphores[1], 0);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
Sleep(50);
status = RtlDeregisterWait(wait1);
- ok(!status, "RtlDeregisterWait failed with status %x\n", status);
+ ok(!status, "RtlDeregisterWait failed with status %lx\n", status);
info.userdata = 0;
info.threadid = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, 200, WT_EXECUTEINWAITTHREAD|WT_EXECUTEONLYONCE);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 200);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 1, "expected info.userdata = 1, got %u\n", info.userdata);
- ok(info.threadid == threadid, "unexpected different wait thread id %x\n", info.threadid);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 1, "expected info.userdata = 1, got %lu\n", info.userdata);
+ ok(info.threadid == threadid, "unexpected different wait thread id %lx\n", info.threadid);
result = WaitForSingleObject(semaphores[1], 0);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
Sleep(50);
status = RtlDeregisterWait(wait1);
- ok(!status, "RtlDeregisterWait failed with status %x\n", status);
+ ok(!status, "RtlDeregisterWait failed with status %lx\n", status);
/* test RtlRegisterWait WT_EXECUTEINWAITTHREAD flag with 0 timeout */
info.userdata = 0;
info.threadid = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, 0, WT_EXECUTEINWAITTHREAD|WT_EXECUTEONLYONCE);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %u\n", info.userdata);
- ok(info.threadid == threadid, "unexpected different wait thread id %x\n", info.threadid);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %lu\n", info.userdata);
+ ok(info.threadid == threadid, "unexpected different wait thread id %lx\n", info.threadid);
result = WaitForSingleObject(semaphores[1], 0);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
Sleep(50);
status = RtlDeregisterWait(wait1);
- ok(!status, "RtlDeregisterWait failed with status %x\n", status);
+ ok(!status, "RtlDeregisterWait failed with status %lx\n", status);
/* test RtlRegisterWait WT_EXECUTEINWAITTHREAD flag with already signaled event */
info.userdata = 0;
info.threadid = 0;
ReleaseSemaphore(semaphores[1], 1, NULL);
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, 200, WT_EXECUTEINWAITTHREAD|WT_EXECUTEONLYONCE);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
result = WaitForSingleObject(semaphores[0], 200);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 1, "expected info.userdata = 1, got %u\n", info.userdata);
- ok(info.threadid == threadid, "unexpected different wait thread id %x\n", info.threadid);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 1, "expected info.userdata = 1, got %lu\n", info.userdata);
+ ok(info.threadid == threadid, "unexpected different wait thread id %lx\n", info.threadid);
result = WaitForSingleObject(semaphores[1], 0);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
Sleep(50);
status = RtlDeregisterWait(wait1);
- ok(!status, "RtlDeregisterWait failed with status %x\n", status);
+ ok(!status, "RtlDeregisterWait failed with status %lx\n", status);
/* test for IO threads */
info.userdata = 0;
info.threadid = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, INFINITE, WT_EXECUTEINIOTHREAD);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 1, "expected info.userdata = 1, got %u\n", info.userdata);
- ok(info.threadid != 0, "expected info.threadid != 0, got %u\n", info.threadid);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 1, "expected info.userdata = 1, got %lu\n", info.userdata);
+ ok(info.threadid != 0, "expected info.threadid != 0, got %lu\n", info.threadid);
thread = OpenThread(THREAD_SET_CONTEXT, FALSE, info.threadid);
- ok(thread != NULL, "OpenThread failed with %u\n", GetLastError());
+ ok(thread != NULL, "OpenThread failed with %lu\n", GetLastError());
rtl_wait_apc_semaphore = semaphores[0];
result = QueueUserAPC(rtl_wait_apc_cb, thread, 0);
- ok(result != 0, "QueueUserAPC failed with %u\n", GetLastError());
+ ok(result != 0, "QueueUserAPC failed with %lu\n", GetLastError());
result = WaitForSingleObject(semaphores[0], 200);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
rtl_wait_apc_semaphore = 0;
CloseHandle(thread);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 2, "expected info.userdata = 2, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 2, "expected info.userdata = 2, got %lu\n", info.userdata);
Sleep(50);
status = RtlDeregisterWait(wait1);
- ok(!status, "RtlDeregisterWait failed with status %x\n", status);
+ ok(!status, "RtlDeregisterWait failed with status %lx\n", status);
info.userdata = 0;
info.threadid = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, INFINITE, WT_EXECUTEDEFAULT);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 1, "expected info.userdata = 1, got %u\n", info.userdata);
- ok(info.threadid != 0, "expected info.threadid != 0, got %u\n", info.threadid);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 1, "expected info.userdata = 1, got %lu\n", info.userdata);
+ ok(info.threadid != 0, "expected info.threadid != 0, got %lu\n", info.threadid);
thread = OpenThread(THREAD_SET_CONTEXT, FALSE, info.threadid);
- ok(thread != NULL, "OpenThread failed with %u\n", GetLastError());
+ ok(thread != NULL, "OpenThread failed with %lu\n", GetLastError());
rtl_wait_apc_semaphore = semaphores[0];
result = QueueUserAPC(rtl_wait_apc_cb, thread, 0);
- ok(result != 0, "QueueUserAPC failed with %u\n", GetLastError());
+ ok(result != 0, "QueueUserAPC failed with %lu\n", GetLastError());
result = WaitForSingleObject(semaphores[0], 200);
ok(result == WAIT_TIMEOUT || broken(result == WAIT_OBJECT_0) /* >= Win Vista */,
- "WaitForSingleObject returned %u\n", result);
+ "WaitForSingleObject returned %lu\n", result);
rtl_wait_apc_semaphore = 0;
CloseHandle(thread);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 2, "expected info.userdata = 2, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 2, "expected info.userdata = 2, got %lu\n", info.userdata);
Sleep(50);
status = RtlDeregisterWait(wait1);
- ok(!status, "RtlDeregisterWait failed with status %x\n", status);
+ ok(!status, "RtlDeregisterWait failed with status %lx\n", status);
/* test RtlDeregisterWaitEx before wait expired */
info.userdata = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, INFINITE, WT_EXECUTEDEFAULT);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
status = RtlDeregisterWaitEx(wait1, NULL);
- ok(!status, "RtlDeregisterWaitEx failed with status %x\n", status);
- ok(info.userdata == 0, "expected info.userdata = 0, got %u\n", info.userdata);
+ ok(!status, "RtlDeregisterWaitEx failed with status %lx\n", status);
+ ok(info.userdata == 0, "expected info.userdata = 0, got %lu\n", info.userdata);
info.userdata = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, INFINITE, WT_EXECUTEDEFAULT);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
status = RtlDeregisterWaitEx(wait1, INVALID_HANDLE_VALUE);
- ok(!status, "RtlDeregisterWaitEx failed with status %x\n", status);
- ok(info.userdata == 0, "expected info.userdata = 0, got %u\n", info.userdata);
+ ok(!status, "RtlDeregisterWaitEx failed with status %lx\n", status);
+ ok(info.userdata == 0, "expected info.userdata = 0, got %lu\n", info.userdata);
info.userdata = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, INFINITE, WT_EXECUTEDEFAULT);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
status = RtlDeregisterWaitEx(wait1, event);
- ok(!status, "RtlDeregisterWaitEx failed with status %x\n", status);
- ok(info.userdata == 0, "expected info.userdata = 0, got %u\n", info.userdata);
+ ok(!status, "RtlDeregisterWaitEx failed with status %lx\n", status);
+ ok(info.userdata == 0, "expected info.userdata = 0, got %lu\n", info.userdata);
result = WaitForSingleObject(event, 200);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
/* test RtlDeregisterWaitEx after wait expired */
info.userdata = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, 0, WT_EXECUTEONLYONCE);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %lu\n", info.userdata);
Sleep(50);
status = RtlDeregisterWaitEx(wait1, NULL);
- ok(!status, "RtlDeregisterWaitEx failed with status %x\n", status);
- ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %u\n", info.userdata);
+ ok(!status, "RtlDeregisterWaitEx failed with status %lx\n", status);
+ ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %lu\n", info.userdata);
info.userdata = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, 0, WT_EXECUTEONLYONCE);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %lu\n", info.userdata);
Sleep(50);
status = RtlDeregisterWaitEx(wait1, INVALID_HANDLE_VALUE);
- ok(!status, "RtlDeregisterWaitEx failed with status %x\n", status);
- ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %u\n", info.userdata);
+ ok(!status, "RtlDeregisterWaitEx failed with status %lx\n", status);
+ ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %lu\n", info.userdata);
info.userdata = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, 0, WT_EXECUTEONLYONCE);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %lu\n", info.userdata);
Sleep(50);
status = RtlDeregisterWaitEx(wait1, event);
- ok(!status, "RtlDeregisterWaitEx failed with status %x\n", status);
- ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %u\n", info.userdata);
+ ok(!status, "RtlDeregisterWaitEx failed with status %lx\n", status);
+ ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %lu\n", info.userdata);
result = WaitForSingleObject(event, 200);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
/* test RtlDeregisterWaitEx while callback is running */
info.semaphore2 = semaphores[1];
@@ -477,84 +478,84 @@ static void test_RtlRegisterWait(void)
info.userdata = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, INFINITE, WT_EXECUTEONLYONCE);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 1, "expected info.userdata = 1, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 1, "expected info.userdata = 1, got %lu\n", info.userdata);
status = RtlDeregisterWait(wait1);
- ok(status == STATUS_PENDING, "expected STATUS_PENDING, got %x\n", status);
+ ok(status == STATUS_PENDING, "expected STATUS_PENDING, got %lx\n", status);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
info.userdata = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, INFINITE, WT_EXECUTEINWAITTHREAD|WT_EXECUTEONLYONCE);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 1, "expected info.userdata = 1, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 1, "expected info.userdata = 1, got %lu\n", info.userdata);
status = RtlDeregisterWait(wait1);
- ok(status == STATUS_PENDING, "expected STATUS_PENDING, got %x\n", status);
+ ok(status == STATUS_PENDING, "expected STATUS_PENDING, got %lx\n", status);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
info.userdata = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, INFINITE, WT_EXECUTEONLYONCE);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 1, "expected info.userdata = 1, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 1, "expected info.userdata = 1, got %lu\n", info.userdata);
status = RtlDeregisterWaitEx(wait1, NULL);
- ok(status == STATUS_PENDING, "expected STATUS_PENDING, got %x\n", status);
+ ok(status == STATUS_PENDING, "expected STATUS_PENDING, got %lx\n", status);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
info.wait_result = WAIT_TIMEOUT;
info.userdata = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, INFINITE, WT_EXECUTEONLYONCE);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 1, "expected info.userdata = 1, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 1, "expected info.userdata = 1, got %lu\n", info.userdata);
status = RtlDeregisterWaitEx(wait1, INVALID_HANDLE_VALUE);
- ok(!status, "RtlDeregisterWaitEx failed with status %x\n", status);
+ ok(!status, "RtlDeregisterWaitEx failed with status %lx\n", status);
result = WaitForSingleObject(semaphores[0], 0);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
info.wait_result = WAIT_TIMEOUT;
info.userdata = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, INFINITE, WT_EXECUTEINWAITTHREAD|WT_EXECUTEONLYONCE);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 1, "expected info.userdata = 1, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 1, "expected info.userdata = 1, got %lu\n", info.userdata);
status = RtlDeregisterWaitEx(wait1, INVALID_HANDLE_VALUE);
- ok(!status, "RtlDeregisterWaitEx failed with status %x\n", status);
+ ok(!status, "RtlDeregisterWaitEx failed with status %lx\n", status);
result = WaitForSingleObject(semaphores[0], 0);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
info.wait_result = WAIT_OBJECT_0;
info.userdata = 0;
status = RtlRegisterWait(&wait1, semaphores[1], rtl_wait_cb, &info, INFINITE, WT_EXECUTEONLYONCE);
- ok(!status, "RtlRegisterWait failed with status %x\n", status);
+ ok(!status, "RtlRegisterWait failed with status %lx\n", status);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 1, "expected info.userdata = 1, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 1, "expected info.userdata = 1, got %lu\n", info.userdata);
status = RtlDeregisterWaitEx(wait1, event);
- ok(status == STATUS_PENDING, "expected STATUS_PENDING, got %x\n", status);
+ ok(status == STATUS_PENDING, "expected STATUS_PENDING, got %lx\n", status);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(event, 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
result = WaitForSingleObject(semaphores[0], 0);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
CloseHandle(semaphores[0]);
CloseHandle(semaphores[1]);
@@ -586,21 +587,21 @@ static void test_tp_simple(void)
int i;
semaphore = CreateSemaphoreA(NULL, 0, 1, NULL);
- ok(semaphore != NULL, "CreateSemaphoreA failed %u\n", GetLastError());
+ ok(semaphore != NULL, "CreateSemaphoreA failed %lu\n", GetLastError());
/* post the callback using the default threadpool */
memset(&environment, 0, sizeof(environment));
environment.Version = 1;
environment.Pool = NULL;
status = pTpSimpleTryPost(simple_cb, semaphore, &environment);
- ok(!status, "TpSimpleTryPost failed with status %x\n", status);
+ ok(!status, "TpSimpleTryPost failed with status %lx\n", status);
result = WaitForSingleObject(semaphore, 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
/* allocate new threadpool */
pool = NULL;
status = pTpAllocPool(&pool, NULL);
- ok(!status, "TpAllocPool failed with status %x\n", status);
+ ok(!status, "TpAllocPool failed with status %lx\n", status);
ok(pool != NULL, "expected pool != NULL\n");
/* post the callback using the new threadpool */
@@ -608,9 +609,9 @@ static void test_tp_simple(void)
environment.Version = 1;
environment.Pool = pool;
status = pTpSimpleTryPost(simple_cb, semaphore, &environment);
- ok(!status, "TpSimpleTryPost failed with status %x\n", status);
+ ok(!status, "TpSimpleTryPost failed with status %lx\n", status);
result = WaitForSingleObject(semaphore, 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
/* test with environment version 3 */
memset(&environment3, 0, sizeof(environment3));
@@ -622,15 +623,15 @@ static void test_tp_simple(void)
{
environment3.CallbackPriority = TP_CALLBACK_PRIORITY_HIGH + i;
status = pTpSimpleTryPost(simple_cb, semaphore, (TP_CALLBACK_ENVIRON *)&environment3);
- ok(!status, "TpSimpleTryPost failed with status %x\n", status);
+ ok(!status, "TpSimpleTryPost failed with status %lx\n", status);
result = WaitForSingleObject(semaphore, 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
}
environment3.CallbackPriority = 10;
status = pTpSimpleTryPost(simple_cb, semaphore, (TP_CALLBACK_ENVIRON *)&environment3);
ok(status == STATUS_INVALID_PARAMETER || broken(!status) /* Vista does not support priorities */,
- "TpSimpleTryPost failed with status %x\n", status);
+ "TpSimpleTryPost failed with status %lx\n", status);
/* test with invalid version number */
memset(&environment, 0, sizeof(environment));
@@ -639,17 +640,17 @@ static void test_tp_simple(void)
status = pTpSimpleTryPost(simple_cb, semaphore, &environment);
todo_wine
ok(status == STATUS_INVALID_PARAMETER || broken(!status) /* Vista/2008 */,
- "TpSimpleTryPost unexpectedly returned status %x\n", status);
+ "TpSimpleTryPost unexpectedly returned status %lx\n", status);
if (!status)
{
result = WaitForSingleObject(semaphore, 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
}
/* allocate a cleanup group for synchronization */
group = NULL;
status = pTpAllocCleanupGroup(&group);
- ok(!status, "TpAllocCleanupGroup failed with status %x\n", status);
+ ok(!status, "TpAllocCleanupGroup failed with status %lx\n", status);
ok(group != NULL, "expected pool != NULL\n");
/* use cleanup group to wait for a simple callback */
@@ -659,9 +660,9 @@ static void test_tp_simple(void)
environment.Pool = pool;
environment.CleanupGroup = group;
status = pTpSimpleTryPost(simple2_cb, &userdata, &environment);
- ok(!status, "TpSimpleTryPost failed with status %x\n", status);
+ ok(!status, "TpSimpleTryPost failed with status %lx\n", status);
pTpReleaseCleanupGroupMembers(group, FALSE, NULL);
- ok(userdata == 1, "expected userdata = 1, got %u\n", userdata);
+ ok(userdata == 1, "expected userdata = 1, got %lu\n", userdata);
/* test cancellation of pending simple callbacks */
userdata = 0;
@@ -673,10 +674,10 @@ static void test_tp_simple(void)
for (i = 0; i < 100; i++)
{
status = pTpSimpleTryPost(simple2_cb, &userdata, &environment);
- ok(!status, "TpSimpleTryPost failed with status %x\n", status);
+ ok(!status, "TpSimpleTryPost failed with status %lx\n", status);
}
pTpReleaseCleanupGroupMembers(group, TRUE, NULL);
- ok(userdata < 100, "expected userdata < 100, got %u\n", userdata);
+ ok(userdata < 100, "expected userdata < 100, got %lu\n", userdata);
/* cleanup */
pTpReleaseCleanupGroup(group);
@@ -708,7 +709,7 @@ static void test_tp_work(void)
/* allocate new threadpool with only one thread */
pool = NULL;
status = pTpAllocPool(&pool, NULL);
- ok(!status, "TpAllocPool failed with status %x\n", status);
+ ok(!status, "TpAllocPool failed with status %lx\n", status);
ok(pool != NULL, "expected pool != NULL\n");
pTpSetPoolMaxThreads(pool, 1);
@@ -718,7 +719,7 @@ static void test_tp_work(void)
environment.Version = 1;
environment.Pool = pool;
status = pTpAllocWork(&work, work_cb, &userdata, &environment);
- ok(!status, "TpAllocWork failed with status %x\n", status);
+ ok(!status, "TpAllocWork failed with status %lx\n", status);
ok(work != NULL, "expected work != NULL\n");
/* post 5 identical work items at once */
@@ -726,14 +727,14 @@ static void test_tp_work(void)
for (i = 0; i < 5; i++)
pTpPostWork(work);
pTpWaitForWork(work, FALSE);
- ok(userdata == 5, "expected userdata = 5, got %u\n", userdata);
+ ok(userdata == 5, "expected userdata = 5, got %lu\n", userdata);
/* add more tasks and cancel them immediately */
userdata = 0;
for (i = 0; i < 10; i++)
pTpPostWork(work);
pTpWaitForWork(work, TRUE);
- ok(userdata < 10, "expected userdata < 10, got %u\n", userdata);
+ ok(userdata < 10, "expected userdata < 10, got %lu\n", userdata);
/* cleanup */
pTpReleaseWork(work);
@@ -753,14 +754,14 @@ static void test_tp_work_scheduler(void)
/* allocate new threadpool with only one thread */
pool = NULL;
status = pTpAllocPool(&pool, NULL);
- ok(!status, "TpAllocPool failed with status %x\n", status);
+ ok(!status, "TpAllocPool failed with status %lx\n", status);
ok(pool != NULL, "expected pool != NULL\n");
pTpSetPoolMaxThreads(pool, 1);
/* create a cleanup group */
group = NULL;
status = pTpAllocCleanupGroup(&group);
- ok(!status, "TpAllocCleanupGroup failed with status %x\n", status);
+ ok(!status, "TpAllocCleanupGroup failed with status %lx\n", status);
ok(group != NULL, "expected pool != NULL\n");
/* the first work item has no cleanup group associated */
@@ -769,7 +770,7 @@ static void test_tp_work_scheduler(void)
environment.Version = 1;
environment.Pool = pool;
status = pTpAllocWork(&work, work_cb, &userdata, &environment);
- ok(!status, "TpAllocWork failed with status %x\n", status);
+ ok(!status, "TpAllocWork failed with status %lx\n", status);
ok(work != NULL, "expected work != NULL\n");
/* allocate a second work item with a cleanup group */
@@ -779,7 +780,7 @@ static void test_tp_work_scheduler(void)
environment.Pool = pool;
environment.CleanupGroup = group;
status = pTpAllocWork(&work2, work2_cb, &userdata, &environment);
- ok(!status, "TpAllocWork failed with status %x\n", status);
+ ok(!status, "TpAllocWork failed with status %lx\n", status);
ok(work2 != NULL, "expected work2 != NULL\n");
/* the 'work' callbacks are not blocking execution of 'work2' callbacks */
@@ -791,8 +792,8 @@ static void test_tp_work_scheduler(void)
Sleep(500);
pTpWaitForWork(work, TRUE);
pTpWaitForWork(work2, TRUE);
- ok(userdata & 0xffff, "expected userdata & 0xffff != 0, got %u\n", userdata & 0xffff);
- ok(userdata >> 16, "expected userdata >> 16 != 0, got %u\n", userdata >> 16);
+ ok(userdata & 0xffff, "expected userdata & 0xffff != 0, got %lu\n", userdata & 0xffff);
+ ok(userdata >> 16, "expected userdata >> 16 != 0, got %lu\n", userdata >> 16);
/* test TpReleaseCleanupGroupMembers on a work item */
userdata = 0;
@@ -802,8 +803,8 @@ static void test_tp_work_scheduler(void)
pTpPostWork(work2);
pTpReleaseCleanupGroupMembers(group, FALSE, NULL);
pTpWaitForWork(work, TRUE);
- ok((userdata & 0xffff) < 10, "expected userdata & 0xffff < 10, got %u\n", userdata & 0xffff);
- ok((userdata >> 16) == 3, "expected userdata >> 16 == 3, got %u\n", userdata >> 16);
+ ok((userdata & 0xffff) < 10, "expected userdata & 0xffff < 10, got %lu\n", userdata & 0xffff);
+ ok((userdata >> 16) == 3, "expected userdata >> 16 == 3, got %lu\n", userdata >> 16);
/* cleanup */
pTpReleaseWork(work);
@@ -857,18 +858,18 @@ static void test_tp_group_wait(void)
DWORD result;
semaphore = CreateSemaphoreA(NULL, 0, 1, NULL);
- ok(semaphore != NULL, "CreateSemaphoreA failed %u\n", GetLastError());
+ ok(semaphore != NULL, "CreateSemaphoreA failed %lu\n", GetLastError());
/* allocate new threadpool */
pool = NULL;
status = pTpAllocPool(&pool, NULL);
- ok(!status, "TpAllocPool failed with status %x\n", status);
+ ok(!status, "TpAllocPool failed with status %lx\n", status);
ok(pool != NULL, "expected pool != NULL\n");
/* allocate a cleanup group */
group = NULL;
status = pTpAllocCleanupGroup(&group);
- ok(!status, "TpAllocCleanupGroup failed with status %x\n", status);
+ ok(!status, "TpAllocCleanupGroup failed with status %lx\n", status);
ok(group != NULL, "expected pool != NULL\n");
/* release work object during TpReleaseCleanupGroupMembers */
@@ -878,11 +879,11 @@ static void test_tp_group_wait(void)
environment.Pool = pool;
environment.CleanupGroup = group;
status = pTpAllocWork(&work, work_release_cb, semaphore, &environment);
- ok(!status, "TpAllocWork failed with status %x\n", status);
+ ok(!status, "TpAllocWork failed with status %lx\n", status);
ok(work != NULL, "expected work != NULL\n");
pTpPostWork(work);
result = WaitForSingleObject(semaphore, 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
pTpReleaseCleanupGroupMembers(group, FALSE, NULL);
/* release timer object during TpReleaseCleanupGroupMembers */
@@ -892,12 +893,12 @@ static void test_tp_group_wait(void)
environment.Pool = pool;
environment.CleanupGroup = group;
status = pTpAllocTimer(&timer, timer_release_cb, semaphore, &environment);
- ok(!status, "TpAllocTimer failed with status %x\n", status);
+ ok(!status, "TpAllocTimer failed with status %lx\n", status);
ok(timer != NULL, "expected timer != NULL\n");
when.QuadPart = 0;
pTpSetTimer(timer, &when, 0, 0);
result = WaitForSingleObject(semaphore, 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
pTpReleaseCleanupGroupMembers(group, FALSE, NULL);
/* release wait object during TpReleaseCleanupGroupMembers */
@@ -907,12 +908,12 @@ static void test_tp_group_wait(void)
environment.Pool = pool;
environment.CleanupGroup = group;
status = pTpAllocWait(&wait, wait_release_cb, semaphore, &environment);
- ok(!status, "TpAllocWait failed with status %x\n", status);
+ ok(!status, "TpAllocWait failed with status %lx\n", status);
ok(wait != NULL, "expected wait != NULL\n");
when.QuadPart = 0;
pTpSetWait(wait, INVALID_HANDLE_VALUE, &when);
result = WaitForSingleObject(semaphore, 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
pTpReleaseCleanupGroupMembers(group, FALSE, NULL);
/* cleanup */
@@ -932,13 +933,13 @@ static void CALLBACK simple_group_cancel_cb(TP_CALLBACK_INSTANCE *instance, void
status = pTpCallbackMayRunLong(instance);
ok(status == STATUS_TOO_MANY_THREADS || broken(status == 1) /* Win Vista / 2008 */,
- "expected STATUS_TOO_MANY_THREADS, got %08x\n", status);
+ "expected STATUS_TOO_MANY_THREADS, got %08lx\n", status);
ReleaseSemaphore(semaphores[1], 1, NULL);
for (i = 0; i < 4; i++)
{
result = WaitForSingleObject(semaphores[0], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
}
ReleaseSemaphore(semaphores[1], 1, NULL);
}
@@ -950,7 +951,7 @@ static void CALLBACK work_group_cancel_cb(TP_CALLBACK_INSTANCE *instance, void *
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 200);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
}
static void CALLBACK group_cancel_cleanup_release_cb(void *object, void *userdata)
@@ -1016,21 +1017,21 @@ static void test_tp_group_cancel(void)
int i;
semaphores[0] = CreateSemaphoreA(NULL, 0, 4, NULL);
- ok(semaphores[0] != NULL, "CreateSemaphoreA failed %u\n", GetLastError());
+ ok(semaphores[0] != NULL, "CreateSemaphoreA failed %lu\n", GetLastError());
semaphores[1] = CreateSemaphoreA(NULL, 0, 1, NULL);
- ok(semaphores[1] != NULL, "CreateSemaphoreA failed %u\n", GetLastError());
+ ok(semaphores[1] != NULL, "CreateSemaphoreA failed %lu\n", GetLastError());
/* allocate new threadpool with only one thread */
pool = NULL;
status = pTpAllocPool(&pool, NULL);
- ok(!status, "TpAllocPool failed with status %x\n", status);
+ ok(!status, "TpAllocPool failed with status %lx\n", status);
ok(pool != NULL, "expected pool != NULL\n");
pTpSetPoolMaxThreads(pool, 1);
/* allocate a cleanup group */
group = NULL;
status = pTpAllocCleanupGroup(&group);
- ok(!status, "TpAllocCleanupGroup failed with status %x\n", status);
+ ok(!status, "TpAllocCleanupGroup failed with status %lx\n", status);
ok(group != NULL, "expected pool != NULL\n");
/* test execution of cancellation callback */
@@ -1038,9 +1039,9 @@ static void test_tp_group_cancel(void)
environment.Version = 1;
environment.Pool = pool;
status = pTpSimpleTryPost(simple_group_cancel_cb, semaphores, &environment);
- ok(!status, "TpSimpleTryPost failed with status %x\n", status);
+ ok(!status, "TpSimpleTryPost failed with status %lx\n", status);
result = WaitForSingleObject(semaphores[1], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
memset(&environment, 0, sizeof(environment));
environment.Version = 1;
@@ -1048,28 +1049,28 @@ static void test_tp_group_cancel(void)
environment.CleanupGroup = group;
environment.CleanupGroupCancelCallback = group_cancel_cleanup_release_cb;
status = pTpSimpleTryPost(unexpected_simple_cb, (void *)0xdeadbeef, &environment);
- ok(!status, "TpSimpleTryPost failed with status %x\n", status);
+ ok(!status, "TpSimpleTryPost failed with status %lx\n", status);
work = NULL;
status = pTpAllocWork(&work, unexpected_work_cb, (void *)0xdeadbeef, &environment);
- ok(!status, "TpAllocWork failed with status %x\n", status);
+ ok(!status, "TpAllocWork failed with status %lx\n", status);
ok(work != NULL, "expected work != NULL\n");
timer = NULL;
status = pTpAllocTimer(&timer, unexpected_timer_cb, (void *)0xdeadbeef, &environment);
- ok(!status, "TpAllocTimer failed with status %x\n", status);
+ ok(!status, "TpAllocTimer failed with status %lx\n", status);
ok(timer != NULL, "expected timer != NULL\n");
wait = NULL;
status = pTpAllocWait(&wait, unexpected_wait_cb, (void *)0xdeadbeef, &environment);
- ok(!status, "TpAllocWait failed with status %x\n", status);
+ ok(!status, "TpAllocWait failed with status %lx\n", status);
ok(wait != NULL, "expected wait != NULL\n");
group_cancel_tid = 0xdeadbeef;
pTpReleaseCleanupGroupMembers(group, TRUE, semaphores);
result = WaitForSingleObject(semaphores[1], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(group_cancel_tid == GetCurrentThreadId(), "expected tid %x, got %x\n",
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(group_cancel_tid == GetCurrentThreadId(), "expected tid %lx, got %lx\n",
GetCurrentThreadId(), group_cancel_tid);
/* test if cancellation callbacks are executed before or after wait */
@@ -1080,19 +1081,19 @@ static void test_tp_group_cancel(void)
environment.CleanupGroup = group;
environment.CleanupGroupCancelCallback = group_cancel_cleanup_release2_cb;
status = pTpAllocWork(&work, work_group_cancel_cb, semaphores, &environment);
- ok(!status, "TpAllocWork failed with status %x\n", status);
+ ok(!status, "TpAllocWork failed with status %lx\n", status);
ok(work != NULL, "expected work != NULL\n");
pTpPostWork(work);
pTpPostWork(work);
result = WaitForSingleObject(semaphores[1], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
group_cancel_tid = 0xdeadbeef;
pTpReleaseCleanupGroupMembers(group, TRUE, semaphores);
result = WaitForSingleObject(semaphores[0], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(group_cancel_tid == GetCurrentThreadId(), "expected tid %x, got %x\n",
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(group_cancel_tid == GetCurrentThreadId(), "expected tid %lx, got %lx\n",
GetCurrentThreadId(), group_cancel_tid);
/* group cancel callback is not executed if object is destroyed while waiting */
@@ -1103,12 +1104,12 @@ static void test_tp_group_cancel(void)
environment.CleanupGroup = group;
environment.CleanupGroupCancelCallback = unexpected_group_cancel_cleanup_cb;
status = pTpAllocWork(&work, work_release_cb, semaphores[1], &environment);
- ok(!status, "TpAllocWork failed with status %x\n", status);
+ ok(!status, "TpAllocWork failed with status %lx\n", status);
ok(work != NULL, "expected work != NULL\n");
pTpPostWork(work);
result = WaitForSingleObject(semaphores[1], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
pTpReleaseCleanupGroupMembers(group, TRUE, NULL);
/* terminated simple callbacks should not trigger the group cancel callback */
@@ -1118,9 +1119,9 @@ static void test_tp_group_cancel(void)
environment.CleanupGroup = group;
environment.CleanupGroupCancelCallback = unexpected_group_cancel_cleanup_cb;
status = pTpSimpleTryPost(simple_release_cb, semaphores[1], &environment);
- ok(!status, "TpSimpleTryPost failed with status %x\n", status);
+ ok(!status, "TpSimpleTryPost failed with status %lx\n", status);
result = WaitForSingleObject(semaphores[1], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
pTpReleaseCleanupGroupMembers(group, TRUE, semaphores);
/* test cancellation callback for objects with multiple instances */
@@ -1131,7 +1132,7 @@ static void test_tp_group_cancel(void)
environment.CleanupGroup = group;
environment.CleanupGroupCancelCallback = group_cancel_cleanup_increment_cb;
status = pTpAllocWork(&work, work_cb, &userdata, &environment);
- ok(!status, "TpAllocWork failed with status %x\n", status);
+ ok(!status, "TpAllocWork failed with status %lx\n", status);
ok(work != NULL, "expected work != NULL\n");
/* post 10 identical work items at once */
@@ -1142,9 +1143,9 @@ static void test_tp_group_cancel(void)
/* check if we get multiple cancellation callbacks */
group_cancel_tid = 0xdeadbeef;
pTpReleaseCleanupGroupMembers(group, TRUE, &userdata2);
- ok(userdata <= 5, "expected userdata <= 5, got %u\n", userdata);
- ok(userdata2 == 1, "expected only one cancellation callback, got %u\n", userdata2);
- ok(group_cancel_tid == GetCurrentThreadId(), "expected tid %x, got %x\n",
+ ok(userdata <= 5, "expected userdata <= 5, got %lu\n", userdata);
+ ok(userdata2 == 1, "expected only one cancellation callback, got %lu\n", userdata2);
+ ok(group_cancel_tid == GetCurrentThreadId(), "expected tid %lx, got %lx\n",
GetCurrentThreadId(), group_cancel_tid);
/* cleanup */
@@ -1167,7 +1168,7 @@ static void CALLBACK instance_finalization_cb(TP_CALLBACK_INSTANCE *instance, vo
Sleep(50);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
ReleaseSemaphore(semaphores[1], 1, NULL);
}
@@ -1187,7 +1188,7 @@ static void test_tp_instance(void)
/* allocate new threadpool */
pool = NULL;
status = pTpAllocPool(&pool, NULL);
- ok(!status, "TpAllocPool failed with status %x\n", status);
+ ok(!status, "TpAllocPool failed with status %lx\n", status);
ok(pool != NULL, "expected pool != NULL\n");
/* test for TpCallbackReleaseSemaphoreOnCompletion */
@@ -1195,9 +1196,9 @@ static void test_tp_instance(void)
environment.Version = 1;
environment.Pool = pool;
status = pTpSimpleTryPost(instance_semaphore_completion_cb, semaphores, &environment);
- ok(!status, "TpSimpleTryPost failed with status %x\n", status);
+ ok(!status, "TpSimpleTryPost failed with status %lx\n", status);
result = WaitForSingleObject(semaphores[0], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
/* test for finalization callback */
memset(&environment, 0, sizeof(environment));
@@ -1205,11 +1206,11 @@ static void test_tp_instance(void)
environment.Pool = pool;
environment.FinalizationCallback = instance_finalization_cb;
status = pTpSimpleTryPost(instance_semaphore_completion_cb, semaphores, &environment);
- ok(!status, "TpSimpleTryPost failed with status %x\n", status);
+ ok(!status, "TpSimpleTryPost failed with status %lx\n", status);
result = WaitForSingleObject(semaphores[0], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
result = WaitForSingleObject(semaphores[1], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
/* cleanup */
pTpReleasePool(pool);
@@ -1224,7 +1225,7 @@ static void CALLBACK disassociate_cb(TP_CALLBACK_INSTANCE *instance, void *userd
pTpDisassociateCallback(instance);
result = WaitForSingleObject(semaphores[0], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
ReleaseSemaphore(semaphores[1], 1, NULL);
}
@@ -1235,7 +1236,7 @@ static void CALLBACK disassociate2_cb(TP_CALLBACK_INSTANCE *instance, void *user
pTpDisassociateCallback(instance);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
ReleaseSemaphore(semaphores[1], 1, NULL);
}
@@ -1246,7 +1247,7 @@ static void CALLBACK disassociate3_cb(TP_CALLBACK_INSTANCE *instance, void *user
pTpDisassociateCallback(instance);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
ReleaseSemaphore(semaphores[1], 1, NULL);
}
@@ -1268,12 +1269,12 @@ static void test_tp_disassociate(void)
/* allocate new threadpool and cleanup group */
pool = NULL;
status = pTpAllocPool(&pool, NULL);
- ok(!status, "TpAllocPool failed with status %x\n", status);
+ ok(!status, "TpAllocPool failed with status %lx\n", status);
ok(pool != NULL, "expected pool != NULL\n");
group = NULL;
status = pTpAllocCleanupGroup(&group);
- ok(!status, "TpAllocCleanupGroup failed with status %x\n", status);
+ ok(!status, "TpAllocCleanupGroup failed with status %lx\n", status);
ok(group != NULL, "expected pool != NULL\n");
/* test TpDisassociateCallback on work objects without group */
@@ -1282,17 +1283,17 @@ static void test_tp_disassociate(void)
environment.Version = 1;
environment.Pool = pool;
status = pTpAllocWork(&work, disassociate_cb, semaphores, &environment);
- ok(!status, "TpAllocWork failed with status %x\n", status);
+ ok(!status, "TpAllocWork failed with status %lx\n", status);
ok(work != NULL, "expected work != NULL\n");
pTpPostWork(work);
pTpWaitForWork(work, FALSE);
result = WaitForSingleObject(semaphores[1], 100);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
ReleaseSemaphore(semaphores[0], 1, NULL);
result = WaitForSingleObject(semaphores[1], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
pTpReleaseWork(work);
/* test TpDisassociateCallback on work objects with group (1) */
@@ -1302,17 +1303,17 @@ static void test_tp_disassociate(void)
environment.Pool = pool;
environment.CleanupGroup = group;
status = pTpAllocWork(&work, disassociate_cb, semaphores, &environment);
- ok(!status, "TpAllocWork failed with status %x\n", status);
+ ok(!status, "TpAllocWork failed with status %lx\n", status);
ok(work != NULL, "expected work != NULL\n");
pTpPostWork(work);
pTpWaitForWork(work, FALSE);
result = WaitForSingleObject(semaphores[1], 100);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
ReleaseSemaphore(semaphores[0], 1, NULL);
result = WaitForSingleObject(semaphores[1], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
pTpReleaseCleanupGroupMembers(group, FALSE, NULL);
/* test TpDisassociateCallback on work objects with group (2) */
@@ -1322,7 +1323,7 @@ static void test_tp_disassociate(void)
environment.Pool = pool;
environment.CleanupGroup = group;
status = pTpAllocWork(&work, disassociate2_cb, semaphores, &environment);
- ok(!status, "TpAllocWork failed with status %x\n", status);
+ ok(!status, "TpAllocWork failed with status %lx\n", status);
ok(work != NULL, "expected work != NULL\n");
pTpPostWork(work);
@@ -1330,9 +1331,9 @@ static void test_tp_disassociate(void)
ReleaseSemaphore(semaphores[0], 1, NULL);
result = WaitForSingleObject(semaphores[1], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
result = WaitForSingleObject(semaphores[0], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
/* test TpDisassociateCallback on simple callbacks */
memset(&environment, 0, sizeof(environment));
@@ -1340,15 +1341,15 @@ static void test_tp_disassociate(void)
environment.Pool = pool;
environment.CleanupGroup = group;
status = pTpSimpleTryPost(disassociate3_cb, semaphores, &environment);
- ok(!status, "TpSimpleTryPost failed with status %x\n", status);
+ ok(!status, "TpSimpleTryPost failed with status %lx\n", status);
pTpReleaseCleanupGroupMembers(group, FALSE, NULL);
ReleaseSemaphore(semaphores[0], 1, NULL);
result = WaitForSingleObject(semaphores[1], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
result = WaitForSingleObject(semaphores[0], 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
/* cleanup */
pTpReleaseCleanupGroup(group);
@@ -1376,12 +1377,12 @@ static void test_tp_timer(void)
int i;
semaphore = CreateSemaphoreA(NULL, 0, 1, NULL);
- ok(semaphore != NULL, "CreateSemaphoreA failed %u\n", GetLastError());
+ ok(semaphore != NULL, "CreateSemaphoreA failed %lu\n", GetLastError());
/* allocate new threadpool */
pool = NULL;
status = pTpAllocPool(&pool, NULL);
- ok(!status, "TpAllocPool failed with status %x\n", status);
+ ok(!status, "TpAllocPool failed with status %lx\n", status);
ok(pool != NULL, "expected pool != NULL\n");
/* allocate new timer */
@@ -1390,7 +1391,7 @@ static void test_tp_timer(void)
environment.Version = 1;
environment.Pool = pool;
status = pTpAllocTimer(&timer, timer_cb, semaphore, &environment);
- ok(!status, "TpAllocTimer failed with status %x\n", status);
+ ok(!status, "TpAllocTimer failed with status %lx\n", status);
ok(timer != NULL, "expected timer != NULL\n");
success = pTpIsTimerSet(timer);
@@ -1405,9 +1406,9 @@ static void test_tp_timer(void)
pTpWaitForTimer(timer, FALSE);
result = WaitForSingleObject(semaphore, 100);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
result = WaitForSingleObject(semaphore, 200);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
success = pTpIsTimerSet(timer);
ok(success, "TpIsTimerSet returned FALSE\n");
@@ -1421,9 +1422,9 @@ static void test_tp_timer(void)
pTpWaitForTimer(timer, FALSE);
result = WaitForSingleObject(semaphore, 100);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
result = WaitForSingleObject(semaphore, 200);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
success = pTpIsTimerSet(timer);
ok(success, "TpIsTimerSet returned FALSE\n");
@@ -1436,7 +1437,7 @@ static void test_tp_timer(void)
pTpWaitForTimer(timer, FALSE);
result = WaitForSingleObject(semaphore, 50);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
success = pTpIsTimerSet(timer);
ok(success, "TpIsTimerSet returned FALSE\n");
@@ -1450,7 +1451,7 @@ static void test_tp_timer(void)
CloseHandle(semaphore);
semaphore = CreateSemaphoreA(NULL, 0, 3, NULL);
- ok(semaphore != NULL, "CreateSemaphoreA failed %u\n", GetLastError());
+ ok(semaphore != NULL, "CreateSemaphoreA failed %lu\n", GetLastError());
/* allocate a new timer */
timer = NULL;
@@ -1458,7 +1459,7 @@ static void test_tp_timer(void)
environment.Version = 1;
environment.Pool = pool;
status = pTpAllocTimer(&timer, timer_cb, semaphore, &environment);
- ok(!status, "TpAllocTimer failed with status %x\n", status);
+ ok(!status, "TpAllocTimer failed with status %lx\n", status);
ok(timer != NULL, "expected timer != NULL\n");
/* test a relative timeout repeated periodically */
@@ -1472,11 +1473,11 @@ static void test_tp_timer(void)
for (i = 0; i < 3; i++)
{
result = WaitForSingleObject(semaphore, 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
}
ticks = GetTickCount() - ticks;
ok(ticks >= 500 && (ticks <= 700 || broken(ticks <= 750)) /* Win 7 */,
- "expected approximately 600 ticks, got %u\n", ticks);
+ "expected approximately 600 ticks, got %lu\n", ticks);
/* unset the timer */
pTpSetTimer(timer, NULL, 0, 0);
@@ -1516,12 +1517,12 @@ static void test_tp_window_length(void)
BOOL merged;
semaphore = CreateSemaphoreA(NULL, 0, 2, NULL);
- ok(semaphore != NULL, "CreateSemaphoreA failed %u\n", GetLastError());
+ ok(semaphore != NULL, "CreateSemaphoreA failed %lu\n", GetLastError());
/* allocate new threadpool */
pool = NULL;
status = pTpAllocPool(&pool, NULL);
- ok(!status, "TpAllocPool failed with status %x\n", status);
+ ok(!status, "TpAllocPool failed with status %lx\n", status);
ok(pool != NULL, "expected pool != NULL\n");
/* allocate two identical timers */
@@ -1532,13 +1533,13 @@ static void test_tp_window_length(void)
timer1 = NULL;
info1.semaphore = semaphore;
status = pTpAllocTimer(&timer1, window_length_cb, &info1, &environment);
- ok(!status, "TpAllocTimer failed with status %x\n", status);
+ ok(!status, "TpAllocTimer failed with status %lx\n", status);
ok(timer1 != NULL, "expected timer1 != NULL\n");
timer2 = NULL;
info2.semaphore = semaphore;
status = pTpAllocTimer(&timer2, window_length_cb, &info2, &environment);
- ok(!status, "TpAllocTimer failed with status %x\n", status);
+ ok(!status, "TpAllocTimer failed with status %lx\n", status);
ok(timer2 != NULL, "expected timer2 != NULL\n");
/* choose parameters so that timers are not merged */
@@ -1553,9 +1554,9 @@ static void test_tp_window_length(void)
pTpSetTimer(timer1, &when, 0, 75);
result = WaitForSingleObject(semaphore, 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
result = WaitForSingleObject(semaphore, 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
ok(info1.ticks != 0 && info2.ticks != 0, "expected that ticks are nonzero\n");
ok(info2.ticks >= info1.ticks + 75 || broken(info2.ticks < info1.ticks + 75) /* Win 2008 */,
"expected that timers are not merged\n");
@@ -1572,9 +1573,9 @@ static void test_tp_window_length(void)
pTpSetTimer(timer1, &when, 0, 200);
result = WaitForSingleObject(semaphore, 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
result = WaitForSingleObject(semaphore, 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
ok(info1.ticks != 0 && info2.ticks != 0, "expected that ticks are nonzero\n");
merged = info2.ticks >= info1.ticks - 50 && info2.ticks <= info1.ticks + 50;
ok(merged || broken(!merged) /* Win 10 */, "expected that timers are merged\n");
@@ -1591,9 +1592,9 @@ static void test_tp_window_length(void)
pTpSetTimer(timer2, &when, 0, 0);
result = WaitForSingleObject(semaphore, 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
result = WaitForSingleObject(semaphore, 1000);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
ok(info1.ticks != 0 && info2.ticks != 0, "expected that ticks are nonzero\n");
merged = info2.ticks >= info1.ticks - 50 && info2.ticks <= info1.ticks + 50;
todo_wine
@@ -1621,7 +1622,7 @@ static void CALLBACK wait_cb(TP_CALLBACK_INSTANCE *instance, void *userdata,
else if (result == WAIT_TIMEOUT)
InterlockedExchangeAdd(&info->userdata, 0x10000);
else
- ok(0, "unexpected result %u\n", result);
+ ok(0, "unexpected result %lu\n", result);
ReleaseSemaphore(info->semaphore, 1, NULL);
}
@@ -1645,7 +1646,7 @@ static void test_tp_wait(void)
/* allocate new threadpool */
pool = NULL;
status = pTpAllocPool(&pool, NULL);
- ok(!status, "TpAllocPool failed with status %x\n", status);
+ ok(!status, "TpAllocPool failed with status %lx\n", status);
ok(pool != NULL, "expected pool != NULL\n");
/* allocate new wait items */
@@ -1655,12 +1656,12 @@ static void test_tp_wait(void)
wait1 = NULL;
status = pTpAllocWait(&wait1, wait_cb, &info, &environment);
- ok(!status, "TpAllocWait failed with status %x\n", status);
+ ok(!status, "TpAllocWait failed with status %lx\n", status);
ok(wait1 != NULL, "expected wait1 != NULL\n");
wait2 = NULL;
status = pTpAllocWait(&wait2, wait_cb, &info, &environment);
- ok(!status, "TpAllocWait failed with status %x\n", status);
+ ok(!status, "TpAllocWait failed with status %lx\n", status);
ok(wait2 != NULL, "expected wait2 != NULL\n");
/* infinite timeout, signal the semaphore immediately */
@@ -1668,79 +1669,79 @@ static void test_tp_wait(void)
pTpSetWait(wait1, semaphores[1], NULL);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 1, "expected info.userdata = 1, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 1, "expected info.userdata = 1, got %lu\n", info.userdata);
result = WaitForSingleObject(semaphores[1], 0);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
/* relative timeout, no event */
info.userdata = 0;
when.QuadPart = (ULONGLONG)200 * -10000;
pTpSetWait(wait1, semaphores[1], &when);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 0, "expected info.userdata = 0, got %u\n", info.userdata);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 0, "expected info.userdata = 0, got %lu\n", info.userdata);
result = WaitForSingleObject(semaphores[0], 200);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %lu\n", info.userdata);
result = WaitForSingleObject(semaphores[1], 0);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
/* repeat test with call to TpWaitForWait(..., TRUE) */
info.userdata = 0;
when.QuadPart = (ULONGLONG)200 * -10000;
pTpSetWait(wait1, semaphores[1], &when);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
pTpWaitForWait(wait1, TRUE);
- ok(info.userdata == 0, "expected info.userdata = 0, got %u\n", info.userdata);
+ ok(info.userdata == 0, "expected info.userdata = 0, got %lu\n", info.userdata);
result = WaitForSingleObject(semaphores[0], 200);
ok(result == WAIT_OBJECT_0 || broken(result == WAIT_TIMEOUT) /* Win 8 */,
- "WaitForSingleObject returned %u\n", result);
+ "WaitForSingleObject returned %lu\n", result);
if (result == WAIT_OBJECT_0)
- ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %u\n", info.userdata);
+ ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %lu\n", info.userdata);
else
- ok(info.userdata == 0, "expected info.userdata = 0, got %u\n", info.userdata);
+ ok(info.userdata == 0, "expected info.userdata = 0, got %lu\n", info.userdata);
result = WaitForSingleObject(semaphores[1], 0);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
/* relative timeout, with event */
info.userdata = 0;
when.QuadPart = (ULONGLONG)200 * -10000;
pTpSetWait(wait1, semaphores[1], &when);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 0, "expected info.userdata = 0, got %u\n", info.userdata);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 0, "expected info.userdata = 0, got %lu\n", info.userdata);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 1, "expected info.userdata = 1, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 1, "expected info.userdata = 1, got %lu\n", info.userdata);
result = WaitForSingleObject(semaphores[1], 0);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
/* repeat test with call to TpWaitForWait(..., TRUE) */
info.userdata = 0;
when.QuadPart = (ULONGLONG)200 * -10000;
pTpSetWait(wait1, semaphores[1], &when);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
pTpWaitForWait(wait1, TRUE);
- ok(info.userdata == 0, "expected info.userdata = 0, got %u\n", info.userdata);
+ ok(info.userdata == 0, "expected info.userdata = 0, got %lu\n", info.userdata);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 100);
ok(result == WAIT_OBJECT_0 || broken(result == WAIT_TIMEOUT) /* Win 8 */,
- "WaitForSingleObject returned %u\n", result);
+ "WaitForSingleObject returned %lu\n", result);
if (result == WAIT_OBJECT_0)
{
- ok(info.userdata == 1, "expected info.userdata = 1, got %u\n", info.userdata);
+ ok(info.userdata == 1, "expected info.userdata = 1, got %lu\n", info.userdata);
result = WaitForSingleObject(semaphores[1], 0);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
}
else
{
- ok(info.userdata == 0, "expected info.userdata = 0, got %u\n", info.userdata);
+ ok(info.userdata == 0, "expected info.userdata = 0, got %lu\n", info.userdata);
result = WaitForSingleObject(semaphores[1], 0);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
}
/* absolute timeout, no event */
@@ -1749,13 +1750,13 @@ static void test_tp_wait(void)
when.QuadPart += (ULONGLONG)200 * 10000;
pTpSetWait(wait1, semaphores[1], &when);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 0, "expected info.userdata = 0, got %u\n", info.userdata);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 0, "expected info.userdata = 0, got %lu\n", info.userdata);
result = WaitForSingleObject(semaphores[0], 200);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %lu\n", info.userdata);
result = WaitForSingleObject(semaphores[1], 0);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
/* absolute timeout, with event */
info.userdata = 0;
@@ -1763,63 +1764,63 @@ static void test_tp_wait(void)
when.QuadPart += (ULONGLONG)200 * 10000;
pTpSetWait(wait1, semaphores[1], &when);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 0, "expected info.userdata = 0, got %u\n", info.userdata);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 0, "expected info.userdata = 0, got %lu\n", info.userdata);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 1, "expected info.userdata = 1, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 1, "expected info.userdata = 1, got %lu\n", info.userdata);
result = WaitForSingleObject(semaphores[1], 0);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
/* test timeout of zero */
info.userdata = 0;
when.QuadPart = 0;
pTpSetWait(wait1, semaphores[1], &when);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %lu\n", info.userdata);
result = WaitForSingleObject(semaphores[1], 0);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
/* cancel a pending wait */
info.userdata = 0;
when.QuadPart = (ULONGLONG)250 * -10000;
pTpSetWait(wait1, semaphores[1], &when);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
pTpSetWait(wait1, NULL, (void *)0xdeadbeef);
Sleep(50);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 0, "expected info.userdata = 0, got %u\n", info.userdata);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 0, "expected info.userdata = 0, got %lu\n", info.userdata);
result = WaitForSingleObject(semaphores[1], 0);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
/* test with INVALID_HANDLE_VALUE */
info.userdata = 0;
when.QuadPart = 0;
pTpSetWait(wait1, INVALID_HANDLE_VALUE, &when);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %lu\n", info.userdata);
/* cancel a pending wait with INVALID_HANDLE_VALUE */
info.userdata = 0;
when.QuadPart = (ULONGLONG)250 * -10000;
pTpSetWait(wait1, semaphores[1], &when);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
when.QuadPart = 0;
pTpSetWait(wait1, INVALID_HANDLE_VALUE, &when);
Sleep(50);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 0x10000, "expected info.userdata = 0x10000, got %lu\n", info.userdata);
result = WaitForSingleObject(semaphores[1], 0);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
CloseHandle(semaphores[1]);
semaphores[1] = CreateSemaphoreW(NULL, 0, 2, NULL);
@@ -1832,12 +1833,12 @@ static void test_tp_wait(void)
Sleep(50);
ReleaseSemaphore(semaphores[1], 1, NULL);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 1, "expected info.userdata = 1, got %u\n", info.userdata);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 1, "expected info.userdata = 1, got %lu\n", info.userdata);
result = WaitForSingleObject(semaphores[1], 0);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
/* repeat test above with release count 2 */
info.userdata = 0;
@@ -1846,12 +1847,12 @@ static void test_tp_wait(void)
Sleep(50);
result = ReleaseSemaphore(semaphores[1], 2, NULL);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
result = WaitForSingleObject(semaphores[0], 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(info.userdata == 2, "expected info.userdata = 2, got %u\n", info.userdata);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(info.userdata == 2, "expected info.userdata = 2, got %lu\n", info.userdata);
result = WaitForSingleObject(semaphores[1], 0);
- ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_TIMEOUT, "WaitForSingleObject returned %lu\n", result);
/* cleanup */
pTpReleaseWait(wait1);
@@ -1876,7 +1877,7 @@ static void CALLBACK multi_wait_cb(TP_CALLBACK_INSTANCE *instance, void *userdat
else if (result == WAIT_TIMEOUT)
multi_wait_info.result = 0x10000 | index;
else
- ok(0, "unexpected result %u\n", result);
+ ok(0, "unexpected result %lu\n", result);
ReleaseSemaphore(multi_wait_info.semaphore, 1, NULL);
}
@@ -1899,7 +1900,7 @@ static void test_tp_multi_wait(void)
/* allocate new threadpool */
pool = NULL;
status = pTpAllocPool(&pool, NULL);
- ok(!status, "TpAllocPool failed with status %x\n", status);
+ ok(!status, "TpAllocPool failed with status %lx\n", status);
ok(pool != NULL, "expected pool != NULL\n");
memset(&environment, 0, sizeof(environment));
@@ -1914,7 +1915,7 @@ static void test_tp_multi_wait(void)
waits[i] = NULL;
status = pTpAllocWait(&waits[i], multi_wait_cb, (void *)(DWORD_PTR)i, &environment);
- ok(!status, "TpAllocWait failed with status %x\n", status);
+ ok(!status, "TpAllocWait failed with status %lx\n", status);
ok(waits[i] != NULL, "expected waits[%d] != NULL\n", i);
pTpSetWait(waits[i], semaphores[i], NULL);
@@ -1927,8 +1928,8 @@ static void test_tp_multi_wait(void)
ReleaseSemaphore(semaphores[i], 1, NULL);
result = WaitForSingleObject(semaphore, 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(multi_wait_info.result == i, "expected result %d, got %u\n", i, multi_wait_info.result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(multi_wait_info.result == i, "expected result %d, got %lu\n", i, multi_wait_info.result);
pTpSetWait(waits[i], semaphores[i], NULL);
}
@@ -1940,8 +1941,8 @@ static void test_tp_multi_wait(void)
ReleaseSemaphore(semaphores[i], 1, NULL);
result = WaitForSingleObject(semaphore, 100);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
- ok(multi_wait_info.result == i, "expected result %d, got %u\n", i, multi_wait_info.result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
+ ok(multi_wait_info.result == i, "expected result %d, got %lu\n", i, multi_wait_info.result);
pTpSetWait(waits[i], semaphores[i], NULL);
}
@@ -1957,7 +1958,7 @@ static void test_tp_multi_wait(void)
for (i = 0; i < ARRAY_SIZE(semaphores); i++)
{
result = WaitForSingleObject(semaphore, 150);
- ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+ ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
}
ok(multi_wait_info.result >> 16, "expected multi_wait_info.result >> 16 != 0\n");
@@ -2024,19 +2025,19 @@ static void test_tp_io(void)
ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
status = pTpAllocPool(&pool, NULL);
- ok(!status, "failed to allocate pool, status %#x\n", status);
+ ok(!status, "failed to allocate pool, status %#lx\n", status);
server = CreateNamedPipeA("\\\\.\\pipe\\wine_tp_test",
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, 0, 1, 1024, 1024, 0, NULL);
- ok(server != INVALID_HANDLE_VALUE, "Failed to create server pipe, error %u.\n", GetLastError());
+ ok(server != INVALID_HANDLE_VALUE, "Failed to create server pipe, error %lu.\n", GetLastError());
client = CreateFileA("\\\\.\\pipe\\wine_tp_test", GENERIC_READ | GENERIC_WRITE,
0, NULL, OPEN_EXISTING, 0, 0);
- ok(client != INVALID_HANDLE_VALUE, "Failed to create client pipe, error %u.\n", GetLastError());
+ ok(client != INVALID_HANDLE_VALUE, "Failed to create client pipe, error %lu.\n", GetLastError());
environment.Pool = pool;
io = NULL;
status = pTpAllocIoCompletion(&io, server, io_cb, &userdata, &environment);
- ok(!status, "got %#x\n", status);
+ ok(!status, "got %#lx\n", status);
ok(!!io, "expected non-NULL TP_IO\n");
pTpWaitForIoCompletion(io, FALSE);
@@ -2049,16 +2050,16 @@ static void test_tp_io(void)
ret = ReadFile(server, in, sizeof(in), NULL, &ovl);
ok(!ret, "wrong ret %d\n", ret);
- ok(GetLastError() == ERROR_IO_PENDING, "wrong error %u\n", GetLastError());
+ ok(GetLastError() == ERROR_IO_PENDING, "wrong error %lu\n", GetLastError());
ret = WriteFile(client, out, sizeof(out), &ret_size, NULL);
- ok(ret, "WriteFile() failed, error %u\n", GetLastError());
+ ok(ret, "WriteFile() failed, error %lu\n", GetLastError());
pTpWaitForIoCompletion(io, FALSE);
ok(userdata.count == 1, "callback ran %u times\n", userdata.count);
ok(userdata.ovl == &ovl, "expected %p, got %p\n", &ovl, userdata.ovl);
- ok(userdata.ret == STATUS_SUCCESS, "got status %#x\n", userdata.ret);
- ok(userdata.length == 1, "got length %lu\n", userdata.length);
+ ok(userdata.ret == STATUS_SUCCESS, "got status %#lx\n", userdata.ret);
+ ok(userdata.length == 1, "got length %Iu\n", userdata.length);
ok(userdata.io == io, "expected %p, got %p\n", io, userdata.io);
ok(!WaitForSingleObject(thread, 1000), "wait timed out\n");
@@ -2070,20 +2071,20 @@ static void test_tp_io(void)
ret = ReadFile(server, in, sizeof(in), NULL, &ovl);
ok(!ret, "wrong ret %d\n", ret);
- ok(GetLastError() == ERROR_IO_PENDING, "wrong error %u\n", GetLastError());
+ ok(GetLastError() == ERROR_IO_PENDING, "wrong error %lu\n", GetLastError());
ret = ReadFile(server, in2, sizeof(in2), NULL, &ovl2);
ok(!ret, "wrong ret %d\n", ret);
- ok(GetLastError() == ERROR_IO_PENDING, "wrong error %u\n", GetLastError());
+ ok(GetLastError() == ERROR_IO_PENDING, "wrong error %lu\n", GetLastError());
ret = WriteFile(client, out, sizeof(out), &ret_size, NULL);
- ok(ret, "WriteFile() failed, error %u\n", GetLastError());
+ ok(ret, "WriteFile() failed, error %lu\n", GetLastError());
ret = WriteFile(client, out, sizeof(out), &ret_size, NULL);
- ok(ret, "WriteFile() failed, error %u\n", GetLastError());
+ ok(ret, "WriteFile() failed, error %lu\n", GetLastError());
pTpWaitForIoCompletion(io, FALSE);
ok(userdata.count == 2, "callback ran %u times\n", userdata.count);
- ok(userdata.ret == STATUS_SUCCESS, "got status %#x\n", userdata.ret);
- ok(userdata.length == 1, "got length %lu\n", userdata.length);
+ ok(userdata.ret == STATUS_SUCCESS, "got status %#lx\n", userdata.ret);
+ ok(userdata.length == 1, "got length %Iu\n", userdata.length);
ok(userdata.io == io, "expected %p, got %p\n", io, userdata.io);
/* The documentation is a bit unclear about passing TRUE to
@@ -2100,7 +2101,7 @@ static void test_tp_io(void)
pTpStartAsyncIoOperation(io);
ret = WriteFile(client, out, sizeof(out), &ret_size, NULL);
- ok(ret, "WriteFile() failed, error %u\n", GetLastError());
+ ok(ret, "WriteFile() failed, error %lu\n", GetLastError());
ret = ReadFile(server, in, sizeof(in), NULL, &ovl);
ok(ret, "wrong ret %d\n", ret);
@@ -2108,8 +2109,8 @@ static void test_tp_io(void)
pTpWaitForIoCompletion(io, FALSE);
ok(userdata.count == 1, "callback ran %u times\n", userdata.count);
ok(userdata.ovl == &ovl, "expected %p, got %p\n", &ovl, userdata.ovl);
- ok(userdata.ret == STATUS_SUCCESS, "got status %#x\n", userdata.ret);
- ok(userdata.length == 1, "got length %lu\n", userdata.length);
+ ok(userdata.ret == STATUS_SUCCESS, "got status %#lx\n", userdata.ret);
+ ok(userdata.length == 1, "got length %Iu\n", userdata.length);
ok(userdata.io == io, "expected %p, got %p\n", io, userdata.io);
userdata.count = 0;
@@ -2117,7 +2118,7 @@ static void test_tp_io(void)
ret = ReadFile(server, NULL, 1, NULL, &ovl);
ok(!ret, "wrong ret %d\n", ret);
- ok(GetLastError() == ERROR_NOACCESS, "wrong error %u\n", GetLastError());
+ ok(GetLastError() == ERROR_NOACCESS, "wrong error %lu\n", GetLastError());
pTpCancelAsyncIoOperation(io);
pTpWaitForIoCompletion(io, FALSE);
@@ -2128,15 +2129,15 @@ static void test_tp_io(void)
ret = ReadFile(server, in, sizeof(in), NULL, &ovl);
ok(!ret, "wrong ret %d\n", ret);
- ok(GetLastError() == ERROR_IO_PENDING, "wrong error %u\n", GetLastError());
+ ok(GetLastError() == ERROR_IO_PENDING, "wrong error %lu\n", GetLastError());
ret = CancelIo(server);
- ok(ret, "CancelIo() failed, error %u\n", GetLastError());
+ ok(ret, "CancelIo() failed, error %lu\n", GetLastError());
pTpWaitForIoCompletion(io, FALSE);
ok(userdata.count == 1, "callback ran %u times\n", userdata.count);
ok(userdata.ovl == &ovl, "expected %p, got %p\n", &ovl, userdata.ovl);
- ok(userdata.ret == STATUS_CANCELLED, "got status %#x\n", userdata.ret);
- ok(!userdata.length, "got length %lu\n", userdata.length);
+ ok(userdata.ret == STATUS_CANCELLED, "got status %#lx\n", userdata.ret);
+ ok(!userdata.length, "got length %Iu\n", userdata.length);
ok(userdata.io == io, "expected %p, got %p\n", io, userdata.io);
userdata.count = 0;
@@ -2145,8 +2146,8 @@ static void test_tp_io(void)
ret = ReadFile(server, in, sizeof(in), NULL, &ovl);
ok(!ret, "wrong ret %d\n", ret);
ret = WriteFile(client, out, sizeof(out), &ret_size, NULL);
- ok(ret, "WriteFile() failed, error %u\n", GetLastError());
- ok(GetLastError() == ERROR_IO_PENDING, "wrong error %u\n", GetLastError());
+ ok(ret, "WriteFile() failed, error %lu\n", GetLastError());
+ ok(GetLastError() == ERROR_IO_PENDING, "wrong error %lu\n", GetLastError());
pTpWaitForIoCompletion(io, FALSE);
if (0)
@@ -2163,10 +2164,10 @@ static void test_tp_io(void)
/* Test TPIO object destruction. */
server = CreateNamedPipeA("\\\\.\\pipe\\wine_tp_test",
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, 0, 1, 1024, 1024, 0, NULL);
- ok(server != INVALID_HANDLE_VALUE, "Failed to create server pipe, error %u.\n", GetLastError());
+ ok(server != INVALID_HANDLE_VALUE, "Failed to create server pipe, error %lu.\n", GetLastError());
io = NULL;
status = pTpAllocIoCompletion(&io, server, io_cb, &userdata, &environment);
- ok(!status, "got %#x\n", status);
+ ok(!status, "got %#lx\n", status);
ret = HeapValidate(GetProcessHeap(), 0, io);
ok(ret, "Got unexpected ret %#x.\n", ret);
@@ -2178,14 +2179,14 @@ static void test_tp_io(void)
server = CreateNamedPipeA("\\\\.\\pipe\\wine_tp_test",
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, 0, 1, 1024, 1024, 0, NULL);
- ok(server != INVALID_HANDLE_VALUE, "Failed to create server pipe, error %u.\n", GetLastError());
+ ok(server != INVALID_HANDLE_VALUE, "Failed to create server pipe, error %lu.\n", GetLastError());
client = CreateFileA("\\\\.\\pipe\\wine_tp_test", GENERIC_READ | GENERIC_WRITE,
0, NULL, OPEN_EXISTING, 0, 0);
- ok(client != INVALID_HANDLE_VALUE, "Failed to create client pipe, error %u.\n", GetLastError());
+ ok(client != INVALID_HANDLE_VALUE, "Failed to create client pipe, error %lu.\n", GetLastError());
io = NULL;
status = pTpAllocIoCompletion(&io, server, io_cb, &userdata, &environment);
- ok(!status, "got %#x\n", status);
+ ok(!status, "got %#lx\n", status);
pTpStartAsyncIoOperation(io);
pTpWaitForIoCompletion(io, TRUE);
ret = HeapValidate(GetProcessHeap(), 0, io);
@@ -2204,7 +2205,7 @@ static void test_tp_io(void)
ret = ReadFile(server, in, sizeof(in), NULL, &ovl);
ok(!ret, "wrong ret %d\n", ret);
ret = WriteFile(client, out, sizeof(out), &ret_size, NULL);
- ok(ret, "WriteFile() failed, error %u\n", GetLastError());
+ ok(ret, "WriteFile() failed, error %lu\n", GetLastError());
Sleep(2000);
ret = HeapValidate(GetProcessHeap(), 0, io);
ok(!ret, "Got unexpected ret %#x.\n", ret);
@@ -2244,14 +2245,14 @@ static void test_kernel32_tp_io(void)
ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
status = pTpAllocPool(&pool, NULL);
- ok(!status, "failed to allocate pool, status %#x\n", status);
+ ok(!status, "failed to allocate pool, status %#lx\n", status);
server = CreateNamedPipeA("\\\\.\\pipe\\wine_tp_test",
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, 0, 1, 1024, 1024, 0, NULL);
- ok(server != INVALID_HANDLE_VALUE, "Failed to create server pipe, error %u.\n", GetLastError());
+ ok(server != INVALID_HANDLE_VALUE, "Failed to create server pipe, error %lu.\n", GetLastError());
client = CreateFileA("\\\\.\\pipe\\wine_tp_test", GENERIC_READ | GENERIC_WRITE,
0, NULL, OPEN_EXISTING, 0, 0);
- ok(client != INVALID_HANDLE_VALUE, "Failed to create client pipe, error %u.\n", GetLastError());
+ ok(client != INVALID_HANDLE_VALUE, "Failed to create client pipe, error %lu.\n", GetLastError());
environment.Pool = pool;
io = NULL;
@@ -2268,16 +2269,16 @@ static void test_kernel32_tp_io(void)
ret = ReadFile(server, in, sizeof(in), NULL, &ovl);
ok(!ret, "wrong ret %d\n", ret);
- ok(GetLastError() == ERROR_IO_PENDING, "wrong error %u\n", GetLastError());
+ ok(GetLastError() == ERROR_IO_PENDING, "wrong error %lu\n", GetLastError());
ret = WriteFile(client, out, sizeof(out), &ret_size, NULL);
- ok(ret, "WriteFile() failed, error %u\n", GetLastError());
+ ok(ret, "WriteFile() failed, error %lu\n", GetLastError());
pWaitForThreadpoolIoCallbacks(io, FALSE);
ok(userdata.count == 1, "callback ran %u times\n", userdata.count);
ok(userdata.ovl == &ovl, "expected %p, got %p\n", &ovl, userdata.ovl);
- ok(userdata.ret == ERROR_SUCCESS, "got status %#x\n", userdata.ret);
- ok(userdata.length == 1, "got length %lu\n", userdata.length);
+ ok(userdata.ret == ERROR_SUCCESS, "got status %#lx\n", userdata.ret);
+ ok(userdata.length == 1, "got length %Iu\n", userdata.length);
ok(userdata.io == io, "expected %p, got %p\n", io, userdata.io);
ok(!WaitForSingleObject(thread, 1000), "wait timed out\n");
@@ -2289,20 +2290,20 @@ static void test_kernel32_tp_io(void)
ret = ReadFile(server, in, sizeof(in), NULL, &ovl);
ok(!ret, "wrong ret %d\n", ret);
- ok(GetLastError() == ERROR_IO_PENDING, "wrong error %u\n", GetLastError());
+ ok(GetLastError() == ERROR_IO_PENDING, "wrong error %lu\n", GetLastError());
ret = ReadFile(server, in2, sizeof(in2), NULL, &ovl2);
ok(!ret, "wrong ret %d\n", ret);
- ok(GetLastError() == ERROR_IO_PENDING, "wrong error %u\n", GetLastError());
+ ok(GetLastError() == ERROR_IO_PENDING, "wrong error %lu\n", GetLastError());
ret = WriteFile(client, out, sizeof(out), &ret_size, NULL);
- ok(ret, "WriteFile() failed, error %u\n", GetLastError());
+ ok(ret, "WriteFile() failed, error %lu\n", GetLastError());
ret = WriteFile(client, out, sizeof(out), &ret_size, NULL);
- ok(ret, "WriteFile() failed, error %u\n", GetLastError());
+ ok(ret, "WriteFile() failed, error %lu\n", GetLastError());
pWaitForThreadpoolIoCallbacks(io, FALSE);
ok(userdata.count == 2, "callback ran %u times\n", userdata.count);
- ok(userdata.ret == STATUS_SUCCESS, "got status %#x\n", userdata.ret);
- ok(userdata.length == 1, "got length %lu\n", userdata.length);
+ ok(userdata.ret == STATUS_SUCCESS, "got status %#lx\n", userdata.ret);
+ ok(userdata.length == 1, "got length %Iu\n", userdata.length);
ok(userdata.io == io, "expected %p, got %p\n", io, userdata.io);
userdata.count = 0;
@@ -2313,7 +2314,7 @@ static void test_kernel32_tp_io(void)
pStartThreadpoolIo(io);
ret = WriteFile(client, out, sizeof(out), &ret_size, NULL);
- ok(ret, "WriteFile() failed, error %u\n", GetLastError());
+ ok(ret, "WriteFile() failed, error %lu\n", GetLastError());
ret = ReadFile(server, in, sizeof(in), NULL, &ovl);
ok(ret, "wrong ret %d\n", ret);
@@ -2321,8 +2322,8 @@ static void test_kernel32_tp_io(void)
pWaitForThreadpoolIoCallbacks(io, FALSE);
ok(userdata.count == 1, "callback ran %u times\n", userdata.count);
ok(userdata.ovl == &ovl, "expected %p, got %p\n", &ovl, userdata.ovl);
- ok(userdata.ret == ERROR_SUCCESS, "got status %#x\n", userdata.ret);
- ok(userdata.length == 1, "got length %lu\n", userdata.length);
+ ok(userdata.ret == ERROR_SUCCESS, "got status %#lx\n", userdata.ret);
+ ok(userdata.length == 1, "got length %Iu\n", userdata.length);
ok(userdata.io == io, "expected %p, got %p\n", io, userdata.io);
userdata.count = 0;
@@ -2330,7 +2331,7 @@ static void test_kernel32_tp_io(void)
ret = ReadFile(server, NULL, 1, NULL, &ovl);
ok(!ret, "wrong ret %d\n", ret);
- ok(GetLastError() == ERROR_NOACCESS, "wrong error %u\n", GetLastError());
+ ok(GetLastError() == ERROR_NOACCESS, "wrong error %lu\n", GetLastError());
pCancelThreadpoolIo(io);
pWaitForThreadpoolIoCallbacks(io, FALSE);
@@ -2341,15 +2342,15 @@ static void test_kernel32_tp_io(void)
ret = ReadFile(server, in, sizeof(in), NULL, &ovl);
ok(!ret, "wrong ret %d\n", ret);
- ok(GetLastError() == ERROR_IO_PENDING, "wrong error %u\n", GetLastError());
+ ok(GetLastError() == ERROR_IO_PENDING, "wrong error %lu\n", GetLastError());
ret = CancelIo(server);
- ok(ret, "CancelIo() failed, error %u\n", GetLastError());
+ ok(ret, "CancelIo() failed, error %lu\n", GetLastError());
pWaitForThreadpoolIoCallbacks(io, FALSE);
ok(userdata.count == 1, "callback ran %u times\n", userdata.count);
ok(userdata.ovl == &ovl, "expected %p, got %p\n", &ovl, userdata.ovl);
- ok(userdata.ret == ERROR_OPERATION_ABORTED, "got status %#x\n", userdata.ret);
- ok(!userdata.length, "got length %lu\n", userdata.length);
+ ok(userdata.ret == ERROR_OPERATION_ABORTED, "got status %#lx\n", userdata.ret);
+ ok(!userdata.length, "got length %Iu\n", userdata.length);
ok(userdata.io == io, "expected %p, got %p\n", io, userdata.io);
CloseHandle(ovl.hEvent);
2
1
Allow use of graphics tablets with applications that support them.
Update the existing wintab code for the sake of correctness and to
reduce code duplication. Based on behavior observed from a Wacom
Intuos tablet on Windows 10.
Signed-off-by: Elaine Lefler <elaineclefler(a)gmail.com>
---
This is an effort to get PaintTool SAI working on macOS. I've split up
the macdrv changes to make them easier to read, but all three are
needed for the app to work. I'm separately submitting ntdll changes
which are useful but not strictly necessary.
Tablet support: SaiV2 works out of the box. Tested with Intuos tablet
as well as Apple iPad in Sidecar mode. SaiV1 works in theory, but is
32-bit only and I don't know how to compile that on a modern Mac.
WTPACKET has been renamed to PACKET for consistency with Wacom's
headers. Also, pktdef.h was included in Wine but never used, so it's
been deleted. The X11 code remains functionally unchanged, except for
TABLET_CopyPacketData incorrectly inserting values of SM_CXSCREEN and
SM_CYSCREEN when the X11 driver was trying to report the correct values
of SM_CXVIRTUALSCREEN and SM_CYVIRTUALSCREEN, so this should fix
multimonitor support. The other changes to wintab32.dll are just for
minor edge cases.
---
dlls/winemac.drv/Makefile.in | 6 +-
dlls/winemac.drv/cocoa_wintab.h | 64 +++
dlls/winemac.drv/cocoa_wintab.m | 219 +++++++++++
dlls/winemac.drv/event.c | 3 +
dlls/winemac.drv/macdrv.h | 1 +
dlls/winemac.drv/macdrv_cocoa.h | 11 +
dlls/winemac.drv/winemac.drv.spec | 6 +
dlls/winemac.drv/wintab.c | 631 ++++++++++++++++++++++++++++++
dlls/winex11.drv/wintab.c | 242 +++++-------
dlls/wintab32/context.c | 215 ++++++----
dlls/wintab32/wintab32.c | 18 +-
dlls/wintab32/wintab_internal.h | 26 +-
include/Makefile.in | 1 -
include/pktdef.h | 248 ------------
include/wintab.h | 91 ++++-
tools/winapi/win32.api | 2 +-
16 files changed, 1279 insertions(+), 505 deletions(-)
create mode 100644 dlls/winemac.drv/cocoa_wintab.h
create mode 100644 dlls/winemac.drv/cocoa_wintab.m
create mode 100644 dlls/winemac.drv/wintab.c
delete mode 100644 include/pktdef.h
diff --git a/dlls/winemac.drv/Makefile.in b/dlls/winemac.drv/Makefile.in
index da2e5eaf4c4..5fc8f4152fe 100644
--- a/dlls/winemac.drv/Makefile.in
+++ b/dlls/winemac.drv/Makefile.in
@@ -21,7 +21,8 @@ C_SRCS = \
surface.c \
systray.c \
vulkan.c \
- window.c
+ window.c \
+ wintab.c
OBJC_SRCS = \
cocoa_app.m \
@@ -32,6 +33,7 @@ OBJC_SRCS = \
cocoa_main.m \
cocoa_opengl.m \
cocoa_status_item.m \
- cocoa_window.m
+ cocoa_window.m \
+ cocoa_wintab.m
RC_SRCS = winemac.rc
diff --git a/dlls/winemac.drv/cocoa_wintab.h b/dlls/winemac.drv/cocoa_wintab.h
new file mode 100644
index 00000000000..8db44422d02
--- /dev/null
+++ b/dlls/winemac.drv/cocoa_wintab.h
@@ -0,0 +1,64 @@
+/*
+ * MACDRV Cocoa wintab declarations
+ *
+ * Copyright 2022 Elaine Lefler
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __WINE_MACDRV_COCOA_WINTAB_H
+#define __WINE_MACDRV_COCOA_WINTAB_H
+
+#include <math.h>
+
+#ifdef __OBJC__
+/* Necessary hack because this header must be included on both the Wine side
+ * and from Objective-C */
+typedef BOOL OBJC_BOOL;
+#define BOOL WIN_BOOL
+#endif
+
+#include "windef.h"
+#include "wintab.h"
+
+/* Extents that shouldn't cause math problems */
+#define TABLET_WIDTH 0x40000000
+#define TABLET_HEIGHT 0x40000000
+/* Largest reportable pressure value */
+#define MAX_PRESSURE 0x7fff
+/* Wacom's demo app teaches developers to assume 1/10th degree.
+ * Best stick to that. */
+#define ANGLE_SCALE 10
+/* Largest reportable angle (360 is included, due to rounding) */
+#define MAX_ANGLE (360 * ANGLE_SCALE)
+
+#define MAKE_ANGLE_DEG(degrees) ((degrees) * ANGLE_SCALE)
+#define MAKE_ANGLE_RAD(radians) ((radians) * MAKE_ANGLE_DEG(180) / M_PI)
+
+/* Cursor indices */
+#define MACDRV_CURSOR_PEN 0
+#define MACDRV_CURSOR_ERASER 1
+#define MACDRV_CURSOR_CURSOR 2
+
+/* Shared device context */
+extern LOGCONTEXTW macdrv_tablet_ctx DECLSPEC_HIDDEN;
+
+/* Window to which tablet events are delivered */
+extern void* macdrv_tablet_window DECLSPEC_HIDDEN;
+
+/* Objective-C function to start tablet events */
+void CDECL macdrv_start_tablet_monitor(void) DECLSPEC_HIDDEN;
+
+#endif // !defined(__WINE_MACDRV_COCOA_WINTAB_H)
diff --git a/dlls/winemac.drv/cocoa_wintab.m b/dlls/winemac.drv/cocoa_wintab.m
new file mode 100644
index 00000000000..48878eaf078
--- /dev/null
+++ b/dlls/winemac.drv/cocoa_wintab.m
@@ -0,0 +1,219 @@
+/*
+ * MACDRV Cocoa wintab implementations
+ *
+ * Copyright 2022 Elaine Lefler
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+
+#include "cocoa_app.h"
+#include "cocoa_event.h"
+#include "cocoa_window.h"
+#include "cocoa_wintab.h"
+
+static UINT packet_id = 0;
+static UINT current_cursor = MACDRV_CURSOR_CURSOR;
+
+static CFMachPortRef event_tap;
+
+static const CGEventMask MOUSE_DOWN_EVENTS =
+ CGEventMaskBit(kCGEventLeftMouseDown)
+ | CGEventMaskBit(kCGEventRightMouseDown)
+ | CGEventMaskBit(kCGEventOtherMouseDown);
+static const CGEventMask MOUSE_UP_EVENTS =
+ CGEventMaskBit(kCGEventLeftMouseUp)
+ | CGEventMaskBit(kCGEventRightMouseUp)
+ | CGEventMaskBit(kCGEventOtherMouseUp);
+static const CGEventMask MOUSE_DRAG_EVENTS =
+ CGEventMaskBit(kCGEventLeftMouseDragged)
+ | CGEventMaskBit(kCGEventRightMouseDragged)
+ | CGEventMaskBit(kCGEventOtherMouseDragged);
+
+static const CGEventMask MOUSE_EVENTS =
+ CGEventMaskBit(kCGEventMouseMoved)
+ | MOUSE_DOWN_EVENTS | MOUSE_UP_EVENTS | MOUSE_DRAG_EVENTS;
+
+static const CGEventMask TABLET_EVENTS =
+ CGEventMaskBit(kCGEventTabletPointer)
+ | CGEventMaskBit(kCGEventTabletProximity);
+
+static UINT cursor_from_nx(NSPointingDeviceType device_type)
+{
+ switch(device_type)
+ {
+ case NX_TABLET_POINTER_PEN:
+ return MACDRV_CURSOR_PEN;
+ case NX_TABLET_POINTER_ERASER:
+ return MACDRV_CURSOR_ERASER;
+ default:
+ /* Squash Unknown into Cursor */
+ return MACDRV_CURSOR_CURSOR;
+ }
+}
+
+static void packet_from_cgevent(PACKET* pkt, CGEventRef event)
+{
+ static const double ALTI_VECTOR_SCALE = 0.89879404629916700; /* cos(26) */
+ static const double IN_VECTOR_ANGLE_SCALE = .073519026192766368; /* (cos(19) / cos(26) - 1) * sqrt(2) */
+
+ double azimuth, altitude;
+ double angle_scale, max_length, length;
+
+ CGPoint location = CGEventGetUnflippedLocation(event);
+ double tilt_x = CGEventGetDoubleValueField(event, kCGTabletEventTiltX);
+ double tilt_y = CGEventGetDoubleValueField(event, kCGTabletEventTiltY);
+ uint64_t time_ns = CGEventGetTimestamp(event);
+ pkt->pkStatus = (current_cursor == MACDRV_CURSOR_ERASER ? TPS_INVERT : 0);
+ pkt->pkTime = [[WineApplicationController sharedController] ticksForEventTime:time_ns / (double)NSEC_PER_SEC];
+ pkt->pkSerialNumber = ++packet_id;
+
+ pkt->pkCursor = current_cursor;
+ pkt->pkButtons = CGEventGetIntegerValueField(event, kCGTabletEventPointButtons);
+
+ location = cgpoint_win_from_mac(location);
+
+ /* y should be y-1 because of the way "unflipped" location is calculated.
+ * We don't -1 the extents because macOS doesn't map the tablet that way. */
+ pkt->pkX = (location.x - (double)macdrv_tablet_ctx.lcSysOrgX) / macdrv_tablet_ctx.lcSysExtX * TABLET_WIDTH;
+ pkt->pkY = (location.y - 1 - (double)macdrv_tablet_ctx.lcSysOrgY) / macdrv_tablet_ctx.lcSysExtY * TABLET_HEIGHT;
+ pkt->pkZ = CGEventGetIntegerValueField(event, kCGTabletEventPointZ);
+
+ pkt->pkNormalPressure = CGEventGetDoubleValueField(event, kCGTabletEventPointPressure) * MAX_PRESSURE;
+ pkt->pkTangentPressure = CGEventGetDoubleValueField(event, kCGTabletEventTangentialPressure) * MAX_PRESSURE;
+
+ /* Find the angle around the Z axis. Note that 0 is up and angles move
+ * clockwise. Swapping x and y gives the correct angle. */
+ azimuth = atan2(tilt_x, tilt_y);
+ /* Adjust to 0..360 range */
+ if (azimuth < 0.)
+ azimuth += 2 * M_PI;
+
+ /* With the pen resting on its barrel and oriented horizontally or
+ * vertically, a real tablet reads an altitude of 26. This corresponds to a
+ * tilt of 1. Spinning it to a 45 degree angle allows reading a little bit
+ * lower, down to 19. However, the X/Y tilt appears to report values that
+ * are out of range for wintab. Cap the vector at a value that smoothly
+ * transitions between 1 and the maximum length based on the azimuth. */
+ angle_scale = fmin(fabs(cos(azimuth)), fabs(sin(azimuth)));
+ max_length = 1. + IN_VECTOR_ANGLE_SCALE * angle_scale;
+
+ /* Since the pen moves in a circular path we can calculate the altitude as
+ * the arccosine of the X/Y vector. Multiply it by cos(26) such that a
+ * vector of length 1 maps to 26 degrees. */
+ length = fmin(max_length, sqrt(tilt_x * tilt_x + tilt_y * tilt_y));
+ altitude = acos(length * ALTI_VECTOR_SCALE);
+
+ pkt->pkOrientation.orAzimuth = MAKE_ANGLE_RAD(azimuth);
+ /* Altitude is negative on the eraser */
+ pkt->pkOrientation.orAltitude = MAKE_ANGLE_RAD(!(pkt->pkStatus & TPS_INVERT) ? altitude : -altitude);
+ /* Rotation is the same as twist */
+ pkt->pkOrientation.orTwist = MAKE_ANGLE_DEG(CGEventGetDoubleValueField(event, kCGTabletEventRotation));
+}
+
+static CGEventRef tablet_event_cb(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void* refcon)
+{
+ CGEventMask type_mask;
+ BOOL is_proximity;
+
+ macdrv_event* out_event;
+
+ /* Tap can be disabled for various reasons, make sure it comes back */
+ if (type == kCGEventTapDisabledByTimeout
+ || type == kCGEventTapDisabledByUserInput)
+ {
+ CGEventTapEnable(event_tap, YES);
+ return event;
+ }
+
+ type_mask = CGEventMaskBit(type);
+ is_proximity = (type == kCGEventTabletProximity);
+
+ if (!(type_mask & TABLET_EVENTS))
+ {
+ int64_t subtype = CGEventGetIntegerValueField(event, kCGMouseEventSubtype);
+ if (subtype == kCGEventMouseSubtypeTabletProximity)
+ is_proximity = YES;
+ else if (subtype != kCGEventMouseSubtypeTabletPoint)
+ /* Not a tablet event */
+ return event;
+ }
+
+ /*NSLog(@"%@", [NSEvent eventWithCGEvent:event]);*/
+ out_event = macdrv_create_event(TABLET_EVENT, (WineWindow*)macdrv_tablet_window);
+
+ if (is_proximity)
+ {
+ /* Cursor type only appears during proximity events */
+ current_cursor = cursor_from_nx(CGEventGetIntegerValueField(event, kCGTabletProximityEventPointerType));
+
+ if (CGEventGetIntegerValueField(event, kCGTabletProximityEventEnterProximity) != 0)
+ out_event->tablet_event.type = TABLET_EVENT_PROXIMITY_ENTER;
+ else
+ out_event->tablet_event.type = TABLET_EVENT_PROXIMITY_LEAVE;
+ }
+ else
+ {
+ PACKET* event_packet = calloc(1, sizeof(PACKET));
+ packet_from_cgevent(event_packet, event);
+ out_event->tablet_event.type = TABLET_EVENT_POINT;
+ out_event->tablet_event.packet = event_packet;
+ }
+
+ [[(WineWindow*)macdrv_tablet_window queue] postEvent:out_event];
+ macdrv_release_event(out_event);
+ return event;
+}
+
+static void* macdrv_tablet_main(void* _)
+{
+ CFRunLoopSourceRef source;
+ event_tap = CGEventTapCreate(kCGAnnotatedSessionEventTap, kCGHeadInsertEventTap,
+ kCGEventTapOptionListenOnly, MOUSE_EVENTS | TABLET_EVENTS, tablet_event_cb, NULL);
+
+ if (!event_tap)
+ return NULL;
+
+ source = CFMachPortCreateRunLoopSource(NULL, event_tap, 0);
+ if (!source)
+ {
+ CFRelease(event_tap);
+ return NULL;
+ }
+
+ CFRunLoopAddSource(CFRunLoopGetCurrent(), source, kCFRunLoopCommonModes);
+ CFRelease(source);
+
+ CFRunLoopRun();
+
+ CFRelease(event_tap);
+ return NULL;
+}
+
+void CDECL macdrv_start_tablet_monitor(void)
+{
+ /* Install a global monitor for relevant events. This ensures we can deliver
+ * the full device area and event frequency that the tablet offers. It's
+ * essential to run the monitor in its own thread, because CoreGraphics
+ * blocks event handling until it's done. Scheduling on a busy thread would
+ * cause the mouse to lag. */
+ static pthread_t thread;
+ if (!thread)
+ {
+ if (pthread_create(&thread, NULL, macdrv_tablet_main, NULL) == 0)
+ pthread_detach(thread);
+ }
+}
diff --git a/dlls/winemac.drv/event.c b/dlls/winemac.drv/event.c
index f197af0808e..22caf0cf2a7 100644
--- a/dlls/winemac.drv/event.c
+++ b/dlls/winemac.drv/event.c
@@ -308,6 +308,9 @@ void macdrv_handle_event(const macdrv_event *event)
case WINDOW_RESTORE_REQUESTED:
macdrv_window_restore_requested(hwnd, event);
break;
+ case TABLET_EVENT:
+ macdrv_tablet_event(event);
+ break;
default:
TRACE(" ignoring\n");
break;
diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h
index 4e4524722af..3eecb26a01e 100644
--- a/dlls/winemac.drv/macdrv.h
+++ b/dlls/winemac.drv/macdrv.h
@@ -232,6 +232,7 @@ extern DWORD CDECL macdrv_MsgWaitForMultipleObjectsEx(DWORD count, const HANDLE
extern void macdrv_window_drag_begin(HWND hwnd, const macdrv_event *event) DECLSPEC_HIDDEN;
extern void macdrv_window_drag_end(HWND hwnd) DECLSPEC_HIDDEN;
extern void macdrv_reassert_window_position(HWND hwnd) DECLSPEC_HIDDEN;
+extern void macdrv_tablet_event(const macdrv_event *event) DECLSPEC_HIDDEN;
extern BOOL query_resize_size(HWND hwnd, macdrv_query *query) DECLSPEC_HIDDEN;
extern BOOL query_resize_start(HWND hwnd) DECLSPEC_HIDDEN;
extern BOOL query_min_max_info(HWND hwnd) DECLSPEC_HIDDEN;
diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h
index 94f9fbcfa17..c7f87888fdc 100644
--- a/dlls/winemac.drv/macdrv_cocoa.h
+++ b/dlls/winemac.drv/macdrv_cocoa.h
@@ -351,6 +351,7 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display,
WINDOW_MINIMIZE_REQUESTED,
WINDOW_RESIZE_ENDED,
WINDOW_RESTORE_REQUESTED,
+ TABLET_EVENT,
NUM_EVENT_TYPES
};
@@ -361,6 +362,12 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display,
QUIT_REASON_SHUTDOWN,
};
+enum {
+ TABLET_EVENT_POINT,
+ TABLET_EVENT_PROXIMITY_ENTER,
+ TABLET_EVENT_PROXIMITY_LEAVE,
+};
+
typedef uint64_t macdrv_event_mask;
typedef struct macdrv_event {
@@ -455,6 +462,10 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display,
int keep_frame;
CGRect frame;
} window_restore_requested;
+ struct {
+ int type;
+ void *packet;
+ } tablet_event;
};
} macdrv_event;
diff --git a/dlls/winemac.drv/winemac.drv.spec b/dlls/winemac.drv/winemac.drv.spec
index b060d1cc2a6..13f5522242c 100644
--- a/dlls/winemac.drv/winemac.drv.spec
+++ b/dlls/winemac.drv/winemac.drv.spec
@@ -18,3 +18,9 @@
@ stdcall ImeToAsciiEx(long long ptr ptr long long)
@ stdcall ImeUnregisterWord(wstr long wstr)
@ stdcall NotifyIME(long long long long)
+
+# WinTab32
+@ cdecl AttachEventQueueToTablet(long) macdrv_AttachEventQueueToTablet
+@ cdecl GetCurrentPacket(ptr) macdrv_GetCurrentPacket
+@ cdecl LoadTabletInfo(long) macdrv_LoadTabletInfo
+@ cdecl WTInfoW(long long ptr) macdrv_WTInfoW
diff --git a/dlls/winemac.drv/wintab.c b/dlls/winemac.drv/wintab.c
new file mode 100644
index 00000000000..1dcd14eb179
--- /dev/null
+++ b/dlls/winemac.drv/wintab.c
@@ -0,0 +1,631 @@
+/*
+ * MACDRV Wintab implementations
+ *
+ * Copyright 2022 Elaine Lefler
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+
+#include "macdrv.h"
+#include "macdrv_cocoa.h"
+
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "wine/unicode.h"
+#include "wine/debug.h"
+
+#include "cocoa_wintab.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(wintab32);
+
+LOGCONTEXTW macdrv_tablet_ctx;
+static LOGCONTEXTW macdrv_system_ctx;
+
+void* macdrv_tablet_window;
+static HWND macdrv_tablet_hwnd;
+static PACKET current_packet;
+static int last_event_type = -1;
+
+static size_t registered_hwnd_count = 0;
+static size_t registered_hwnd_cap = 0;
+static HWND* registered_hwnd = NULL;
+
+static const WCHAR CURSOR_NAME_PEN[] = {'P','r','e','s','s','u','r','e',' ','S','t','y','l','u','s',0};
+static const WCHAR CURSOR_NAME_ERASER[] = {'E','r','a','s','e','r',0};
+static const WCHAR CURSOR_NAME_CURSOR[] = {'P','u','c','k',0};
+
+static const UINT CURSOR_COUNT = 3;
+static const WCHAR* const CURSOR_NAMES[CURSOR_COUNT] = {
+ CURSOR_NAME_PEN,
+ CURSOR_NAME_ERASER,
+ CURSOR_NAME_CURSOR
+};
+
+static const UINT CURSOR_TYPES[CURSOR_COUNT] = {
+ CSR_TYPE_PEN,
+ CSR_TYPE_ERASER,
+ CSR_TYPE_MOUSE_2D
+};
+
+static const UINT CURSOR_CAPABILITIES[CURSOR_COUNT] = {
+ CRC_MULTIMODE | CRC_AGGREGATE,
+ CRC_MULTIMODE | CRC_AGGREGATE | CRC_INVERT,
+ CRC_AGGREGATE
+};
+
+static const BYTE BUTTON_COUNT = 16;
+
+BOOL CDECL macdrv_LoadTabletInfo(HWND tablet_hwnd){
+ static const WCHAR tablet_name[] = {'M','a','c','d','r','v',' ','T','a','b','l','e','t',' ','C','o','n','t','e','x','t',0};
+ static const WCHAR sys_name[] = {'M','a','c','d','r','v',' ','S','y','s','t','e','m',' ','C','o','n','t','e','x','t',0};
+ struct macdrv_win_data* tablet_win_data;
+
+ macdrv_tablet_hwnd = tablet_hwnd;
+ TRACE("%p\n", macdrv_tablet_hwnd);
+
+ tablet_win_data = get_win_data(macdrv_tablet_hwnd);
+ macdrv_tablet_window = tablet_win_data->cocoa_window;
+ release_win_data(tablet_win_data);
+
+ /* TODO?: It is possible to query the Wacom driver for real values, but it
+ * doesn't report all of these fields anyway and adds a lot of complexity.
+ * The quick'n'dirty solution is to make a fake tablet with the greatest
+ * possible capabilities. */
+ macdrv_tablet_ctx.lcOptions = CXO_SYSTEM;
+ macdrv_tablet_ctx.lcLocks = CXL_INSIZE | CXL_INASPECT | CXL_MARGIN
+ | CXL_SENSITIVITY | CXL_SYSOUT;
+ macdrv_tablet_ctx.lcStatus = CXS_ONTOP;
+ macdrv_tablet_ctx.lcMsgBase = WT_DEFBASE;
+ macdrv_tablet_ctx.lcDevice = 0;
+ macdrv_tablet_ctx.lcPktRate = 0; /* not supported */
+ macdrv_tablet_ctx.lcPktData = PK_CONTEXT | PK_STATUS | PK_TIME | PK_CHANGED
+ | PK_SERIAL_NUMBER | PK_CURSOR | PK_BUTTONS | PK_X | PK_Y | PK_Z
+ | PK_NORMAL_PRESSURE | PK_TANGENT_PRESSURE | PK_ORIENTATION;
+ macdrv_tablet_ctx.lcPktMode = 0; /* all absolute */
+ macdrv_tablet_ctx.lcMoveMask = PK_BUTTONS | PK_X | PK_Y | PK_Z
+ | PK_NORMAL_PRESSURE | PK_TANGENT_PRESSURE | PK_ORIENTATION;
+ macdrv_tablet_ctx.lcBtnDnMask = (1 << BUTTON_COUNT) - 1;
+ macdrv_tablet_ctx.lcBtnUpMask = (1 << BUTTON_COUNT) - 1;
+
+ macdrv_tablet_ctx.lcInOrgX = 0;
+ macdrv_tablet_ctx.lcInOrgY = 0;
+ /* NSEvent reports floating point coordinates. The actual precision is not
+ * known, so we convert them to really big values. */
+ macdrv_tablet_ctx.lcInExtX = TABLET_WIDTH;
+ macdrv_tablet_ctx.lcInExtY = TABLET_HEIGHT;
+ /* These values are correct for Intuos tablets. Wacom's Mac driver doesn't
+ * reveal them. */
+ macdrv_tablet_ctx.lcInOrgZ = -1023;
+ macdrv_tablet_ctx.lcInExtZ = 2047;
+
+ macdrv_tablet_ctx.lcOutOrgZ = macdrv_tablet_ctx.lcInOrgZ;
+ macdrv_tablet_ctx.lcOutExtZ = macdrv_tablet_ctx.lcInExtZ;
+ macdrv_tablet_ctx.lcSensX = 65536;
+ macdrv_tablet_ctx.lcSensY = 65536;
+ macdrv_tablet_ctx.lcSensZ = 65536;
+
+ macdrv_tablet_ctx.lcSysMode = 0; /* absolute */
+ macdrv_tablet_ctx.lcSysOrgX = GetSystemMetrics(SM_XVIRTUALSCREEN);
+ macdrv_tablet_ctx.lcSysOrgY = GetSystemMetrics(SM_YVIRTUALSCREEN);
+ macdrv_tablet_ctx.lcSysExtX = GetSystemMetrics(SM_CXVIRTUALSCREEN);
+ macdrv_tablet_ctx.lcSysExtY = GetSystemMetrics(SM_CYVIRTUALSCREEN);
+ macdrv_tablet_ctx.lcSysSensX = 65536;
+ macdrv_tablet_ctx.lcSysSensY = 65536;
+
+ /* "device" and "system" context are identical, except that "system"
+ * translates tablet coords to screen coords */
+ macdrv_system_ctx = macdrv_tablet_ctx;
+ strcpyW(macdrv_tablet_ctx.lcName, tablet_name);
+ strcpyW(macdrv_system_ctx.lcName, sys_name);
+
+ macdrv_tablet_ctx.lcOutOrgX = macdrv_tablet_ctx.lcInOrgX;
+ macdrv_tablet_ctx.lcOutOrgY = macdrv_tablet_ctx.lcInOrgY;
+ macdrv_tablet_ctx.lcOutExtX = macdrv_tablet_ctx.lcInExtX;
+ macdrv_tablet_ctx.lcOutExtY = macdrv_tablet_ctx.lcInExtY;
+
+ macdrv_system_ctx.lcOutOrgX = macdrv_system_ctx.lcSysOrgX;
+ macdrv_system_ctx.lcOutOrgY = macdrv_system_ctx.lcSysOrgY;
+ macdrv_system_ctx.lcOutExtX = macdrv_system_ctx.lcSysExtX;
+ macdrv_system_ctx.lcOutExtY = macdrv_system_ctx.lcSysExtY;
+
+ return TRUE;
+}
+
+UINT CDECL macdrv_WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput)
+{
+ TRACE("(%u, %u, %p)\n", wCategory, nIndex, lpOutput);
+
+ if (IS_WTI_EXTENSIONS_TYPE(wCategory))
+ {
+ FIXME("WTI_EXTENSIONS unimplemented");
+ return 0;
+ }
+ else if (IS_WTI_CURSORS_TYPE(wCategory))
+ {
+ INT cursor_idx = wCategory - WTI_CURSORS;
+ if (cursor_idx < 0)
+ cursor_idx += CURSOR_COUNT;
+ if (cursor_idx < 0 || cursor_idx >= CURSOR_COUNT)
+ return 0;
+ switch(nIndex){
+ case CSR_NAME:
+ return TABLET_CopyData(lpOutput, CURSOR_NAMES[cursor_idx], (strlenW(CURSOR_NAMES[cursor_idx]) + 1) * sizeof(WCHAR));
+ case CSR_ACTIVE:
+ {
+ BOOL active = 1;
+ return TABLET_CopyData(lpOutput, &active, sizeof(active));
+ }
+ case CSR_PKTDATA:
+ return TABLET_CopyData(lpOutput, &macdrv_tablet_ctx.lcPktData, sizeof(macdrv_tablet_ctx.lcPktData));
+ case CSR_BUTTONS:
+ case CSR_BUTTONBITS:
+ return TABLET_CopyData(lpOutput, &BUTTON_COUNT, sizeof(BUTTON_COUNT));
+ case CSR_BTNNAMES:
+ {
+ static const char* const fmt = "button %d";
+ static char buffer[10];
+ int out_size = 0;
+ PWCHAR out_char = lpOutput;
+ int button;
+
+ /* Each button name is \0-terminated, with an extra \0 at the
+ * end. */
+ for (button = 0; button < BUTTON_COUNT; button++)
+ {
+ int name_len;
+
+ snprintf(buffer, sizeof(buffer), fmt, button);
+ name_len = strlen(buffer);
+
+ out_size += name_len + 1;
+ if(out_char != NULL)
+ {
+ int c;
+ for(c = 0; c <= name_len; c++)
+ *(out_char++) = buffer[c];
+ }
+ }
+ if(out_char != NULL)
+ *out_char = 0;
+ return (out_size + 1) * sizeof(WCHAR);
+ }
+ case CSR_BUTTONMAP:
+ case CSR_SYSBTNMAP:
+ {
+ PBYTE out_byte = lpOutput;
+ int b;
+
+ if (out_byte != NULL)
+ {
+ /* Always use 1:1 mapping */
+ for (b = 0; b < BUTTON_COUNT; b++)
+ out_byte[b] = b;
+ }
+ return BUTTON_COUNT * sizeof(BYTE);
+ }
+ case CSR_NPBUTTON:
+ case CSR_TPBUTTON:
+ {
+ BYTE button = 0;
+ return TABLET_CopyData(lpOutput, &button, sizeof(button));
+ }
+ case CSR_NPBTNMARKS:
+ case CSR_TPBTNMARKS:
+ {
+ static const UINT marks[] = {0, 1};
+ return TABLET_CopyData(lpOutput, &marks, sizeof(marks));
+ }
+ case CSR_NPRESPONSE:
+ case CSR_TPRESPONSE:
+ {
+ static const int POINT_COUNT = 256;
+ PUINT out_uint = lpOutput;
+ int p;
+
+ if (out_uint != NULL)
+ {
+ /* Linear response */
+ for (p = 0; p < POINT_COUNT; p++)
+ out_uint[p] = MAX_PRESSURE * p / POINT_COUNT;
+ }
+ return POINT_COUNT * sizeof(UINT);
+ }
+ case CSR_PHYSID:
+ {
+ DWORD physid = 0xdeadbeef;
+ return TABLET_CopyData(lpOutput, &physid, sizeof(physid));
+ }
+ case CSR_MODE:
+ {
+ UINT mode = (UINT)cursor_idx;
+ if(!(CURSOR_CAPABILITIES[cursor_idx] & CRC_MULTIMODE))
+ return 0;
+ return TABLET_CopyData(lpOutput, &mode, sizeof(mode));
+ }
+ case CSR_MINPKTDATA:
+ {
+ /* Should be safe to assume all tablets support these */
+ UINT pktdata = PK_CONTEXT | PK_STATUS | PK_TIME | PK_CHANGED
+ | PK_SERIAL_NUMBER | PK_CURSOR | PK_BUTTONS | PK_X | PK_Y
+ | PK_NORMAL_PRESSURE;
+ if(!(CURSOR_CAPABILITIES[cursor_idx] & CRC_AGGREGATE))
+ return 0;
+ return TABLET_CopyData(lpOutput, &pktdata, sizeof(pktdata));
+ }
+ case CSR_MINBUTTONS:
+ {
+ UINT minbuttons = 1;
+ if(!(CURSOR_CAPABILITIES[cursor_idx] & CRC_AGGREGATE))
+ return 0;
+ return TABLET_CopyData(lpOutput, &minbuttons, sizeof(minbuttons));
+ }
+ case CSR_CAPABILITIES:
+ return TABLET_CopyData(lpOutput, CURSOR_CAPABILITIES + cursor_idx, sizeof(*CURSOR_CAPABILITIES));
+ case CSR_TYPE:
+ return TABLET_CopyData(lpOutput, CURSOR_TYPES + cursor_idx, sizeof(*CURSOR_TYPES));
+ default:
+ FIXME("WTI_CURSORS+%d unhandled index %i\n", cursor_idx, nIndex);
+ return 0;
+ }
+ }
+
+ /* Non-indexed categories */
+ switch(wCategory)
+ {
+ case 0:
+ /* Largest buffer necessary for any category. This is currently
+ * WTI_CURSORS :: CSR_NPRESPONSE (or CSR_TPRESPONSE). */
+ return 256 * sizeof(UINT);
+ case WTI_INTERFACE:
+ switch (nIndex)
+ {
+ case IFC_WINTABID:
+ {
+ static const WCHAR name[] = {'M','a','c','d','r','v',' ','W','i','n','t','a','b',' ','1','.','1',0};
+ return TABLET_CopyData(lpOutput, name, sizeof(name));
+ }
+ case IFC_SPECVERSION:
+ {
+ static const WORD version = (0x01) | (0x01 << 8);
+ return TABLET_CopyData(lpOutput, &version, sizeof(version));
+ }
+ case IFC_IMPLVERSION:
+ {
+ static const WORD version = (0x00) | (0x01 << 8);
+ return TABLET_CopyData(lpOutput, &version, sizeof(version));
+ }
+ case IFC_NDEVICES:
+ {
+ static const UINT num = 1;
+ return TABLET_CopyData(lpOutput, &num, sizeof(num));
+ }
+ case IFC_NCURSORS:
+ {
+ return TABLET_CopyData(lpOutput, &CURSOR_COUNT, sizeof(CURSOR_COUNT));
+ }
+ case IFC_NCONTEXTS:
+ {
+ static const UINT num = 1;
+ return TABLET_CopyData(lpOutput, &num, sizeof(num));
+ }
+ default:
+ FIXME("WTI_INTERFACE unhandled index %i\n", nIndex);
+ return 0;
+ }
+ break;
+ case WTI_DEFCONTEXT:
+ case WTI_DEFSYSCTX:
+ case WTI_DDCTXS:
+ case WTI_DDCTXS - 1:
+ case WTI_DSCTXS:
+ case WTI_DSCTXS - 1:
+ {
+ BOOL is_sys = (wCategory == WTI_DEFSYSCTX || wCategory == WTI_DSCTXS || wCategory == WTI_DSCTXS - 1);
+ LPLOGCONTEXTW active_ctx = (is_sys ? &macdrv_system_ctx : &macdrv_tablet_ctx);
+ switch (nIndex)
+ {
+ case 0:
+ return TABLET_CopyData(lpOutput, active_ctx, sizeof(*active_ctx));
+ case CTX_NAME:
+ return TABLET_CopyData(lpOutput, active_ctx->lcName, (strlenW(active_ctx->lcName) + 1) * sizeof(WCHAR));
+ case CTX_OPTIONS:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcOptions, sizeof(active_ctx->lcOptions));
+ case CTX_STATUS:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcStatus, sizeof(active_ctx->lcStatus));
+ case CTX_LOCKS:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcLocks, sizeof(active_ctx->lcLocks));
+ case CTX_MSGBASE:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcMsgBase, sizeof(active_ctx->lcMsgBase));
+ case CTX_DEVICE:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcDevice, sizeof(active_ctx->lcDevice));
+ case CTX_PKTRATE:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcPktRate, sizeof(active_ctx->lcPktRate));
+ case CTX_PKTDATA:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcPktData, sizeof(active_ctx->lcPktData));
+ case CTX_PKTMODE:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcPktMode, sizeof(active_ctx->lcPktMode));
+ case CTX_MOVEMASK:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcMoveMask, sizeof(active_ctx->lcMoveMask));
+ case CTX_BTNDNMASK:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcBtnDnMask, sizeof(active_ctx->lcBtnDnMask));
+ case CTX_BTNUPMASK:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcBtnUpMask, sizeof(active_ctx->lcBtnUpMask));
+ case CTX_INORGX:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcInOrgX, sizeof(active_ctx->lcInOrgX));
+ case CTX_INORGY:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcInOrgY, sizeof(active_ctx->lcInOrgY));
+ case CTX_INORGZ:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcInOrgZ, sizeof(active_ctx->lcInOrgZ));
+ case CTX_INEXTX:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcInExtX, sizeof(active_ctx->lcInExtX));
+ case CTX_INEXTY:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcInExtY, sizeof(active_ctx->lcInExtY));
+ case CTX_INEXTZ:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcInExtZ, sizeof(active_ctx->lcInExtZ));
+ case CTX_OUTORGX:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcOutOrgX, sizeof(active_ctx->lcOutOrgX));
+ case CTX_OUTORGY:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcOutOrgY, sizeof(active_ctx->lcOutOrgY));
+ case CTX_OUTORGZ:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcOutOrgZ, sizeof(active_ctx->lcOutOrgZ));
+ case CTX_OUTEXTX:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcOutExtX, sizeof(active_ctx->lcOutExtX));
+ case CTX_OUTEXTY:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcOutExtY, sizeof(active_ctx->lcOutExtY));
+ case CTX_OUTEXTZ:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcOutExtZ, sizeof(active_ctx->lcOutExtZ));
+ case CTX_SENSX:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcSensX, sizeof(active_ctx->lcSensX));
+ case CTX_SENSY:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcSensY, sizeof(active_ctx->lcSensY));
+ case CTX_SENSZ:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcSensZ, sizeof(active_ctx->lcSensZ));
+ case CTX_SYSMODE:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcSysMode, sizeof(active_ctx->lcSysMode));
+ case CTX_SYSORGX:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcSysOrgX, sizeof(active_ctx->lcSysOrgX));
+ case CTX_SYSORGY:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcSysOrgY, sizeof(active_ctx->lcSysOrgY));
+ case CTX_SYSEXTX:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcSysExtX, sizeof(active_ctx->lcSysExtX));
+ case CTX_SYSEXTY:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcSysExtY, sizeof(active_ctx->lcSysExtY));
+ case CTX_SYSSENSX:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcSysSensX, sizeof(active_ctx->lcSysSensX));
+ case CTX_SYSSENSY:
+ return TABLET_CopyData(lpOutput, &active_ctx->lcSysSensY, sizeof(active_ctx->lcSysSensY));
+ default:
+ FIXME("WTI_DEFSYSCTX unhandled index %i\n", nIndex);
+ return 0;
+ }
+ }
+ case WTI_DEVICES:
+ case WTI_DEVICES - 1:
+ switch (nIndex)
+ {
+ case DVC_NAME:
+ {
+ static const WCHAR name[] = {'M','a','c','d','r','v',' ','T','a','b','l','e','t',0};
+ return TABLET_CopyData(lpOutput, name, sizeof(name));
+ }
+ case DVC_HARDWARE:
+ {
+ static const UINT hardware = HWC_HARDPROX;
+ return TABLET_CopyData(lpOutput, &hardware, sizeof(hardware));
+ }
+ case DVC_NCSRTYPES:
+ {
+ static const UINT num = 0;
+ return TABLET_CopyData(lpOutput, &num, sizeof(num));
+ }
+ case DVC_FIRSTCSR:
+ {
+ static const UINT first = 0;
+ return TABLET_CopyData(lpOutput, &first, sizeof(first));
+ }
+ case DVC_PKTRATE:
+ return TABLET_CopyData(lpOutput, &macdrv_tablet_ctx.lcPktRate, sizeof(macdrv_tablet_ctx.lcPktRate));
+ case DVC_PKTDATA:
+ return TABLET_CopyData(lpOutput, &macdrv_tablet_ctx.lcPktData, sizeof(macdrv_tablet_ctx.lcPktData));
+ case DVC_PKTMODE:
+ return TABLET_CopyData(lpOutput, &macdrv_tablet_ctx.lcPktMode, sizeof(macdrv_tablet_ctx.lcPktMode));
+ case DVC_CSRDATA:
+ {
+ static const WTPKT data = 0;
+ return TABLET_CopyData(lpOutput, &data, sizeof(data));
+ }
+ case DVC_XMARGIN:
+ case DVC_YMARGIN:
+ case DVC_ZMARGIN:
+ {
+ static const INT margin = 0;
+ return TABLET_CopyData(lpOutput, &margin, sizeof(margin));
+ }
+ case DVC_X:
+ case DVC_Y:
+ case DVC_Z:
+ {
+ UINT org = (nIndex == DVC_X ? macdrv_tablet_ctx.lcInOrgX : nIndex == DVC_Y ? macdrv_tablet_ctx.lcInOrgY : macdrv_tablet_ctx.lcInOrgZ);
+ UINT ext = (nIndex == DVC_X ? macdrv_tablet_ctx.lcInExtX : nIndex == DVC_Y ? macdrv_tablet_ctx.lcInExtY : macdrv_tablet_ctx.lcInExtZ);
+ AXIS ax = {
+ .axMin = org,
+ .axMax = org + ext - 1,
+ .axUnits = TU_NONE,
+ .axResolution = 1
+ };
+ return TABLET_CopyData(lpOutput, &ax, sizeof(ax));
+ }
+ case DVC_NPRESSURE:
+ {
+ static const AXIS ax = {
+ .axMin = 0,
+ .axMax = MAX_PRESSURE,
+ .axUnits = TU_NONE,
+ .axResolution = 1
+ };
+ return TABLET_CopyData(lpOutput, &ax, sizeof(ax));
+ }
+ case DVC_TPRESSURE:
+ {
+ static const AXIS ax = {
+ .axMin = -MAX_PRESSURE,
+ .axMax = MAX_PRESSURE,
+ .axUnits = TU_NONE,
+ .axResolution = 1
+ };
+ return TABLET_CopyData(lpOutput, &ax, sizeof(ax));
+ }
+ case DVC_ORIENTATION:
+ {
+ static const AXIS axes[] = {
+ /*.orAzimuth = */ {
+ .axMin = 0,
+ .axMax = MAX_ANGLE,
+ .axUnits = TU_CIRCLE,
+ .axResolution = CASTFIX32(MAX_ANGLE)
+ },
+ /*.orAltitude = */ {
+ .axMin = -MAKE_ANGLE_DEG(90),
+ .axMax = MAKE_ANGLE_DEG(90),
+ .axUnits = TU_CIRCLE,
+ .axResolution = CASTFIX32(MAX_ANGLE)
+ },
+ /*.orTwist = */ {
+ .axMin = 0,
+ .axMax = MAX_ANGLE,
+ .axUnits = TU_CIRCLE,
+ .axResolution = CASTFIX32(MAX_ANGLE)
+ }
+ };
+ return TABLET_CopyData(lpOutput, &axes, sizeof(axes));
+ }
+ case DVC_ROTATION:
+ /* Unsupported */
+ return 0;
+ case DVC_PNPID:
+ {
+ static const WCHAR pnpId[] = {'n','o','n','-','p','l','u','g','-','n','-','p','l','a','y',0};
+ return TABLET_CopyData(lpOutput, pnpId, sizeof(pnpId));
+ }
+ default:
+ FIXME("WTI_DEVICES unhandled index %i\n", nIndex);
+ return 0;
+ }
+ break;
+ default:
+ if (IS_WTI_DEVICES_TYPE(wCategory) || IS_WTI_DDCTXS_TYPE(wCategory)
+ || IS_WTI_DSCTXS_TYPE(wCategory))
+ /* User error, there's only one device */
+ return 0;
+ FIXME("Unhandled Category %i\n", wCategory);
+ }
+ return 0;
+}
+
+int CDECL macdrv_AttachEventQueueToTablet(HWND hOwner)
+{
+ /* Tablet events come from a global monitor rather than relying on
+ * individual views. Maintain a list of HWNDs interested in these events so
+ * we can deliver to them later. */
+ if (registered_hwnd_count >= registered_hwnd_cap)
+ {
+ registered_hwnd_cap = registered_hwnd_cap * 2 + 1;
+ registered_hwnd = realloc(registered_hwnd, registered_hwnd_cap * sizeof(*registered_hwnd));
+ }
+
+ registered_hwnd[registered_hwnd_count++] = hOwner;
+
+ if (registered_hwnd_count > 1)
+ FIXME("Multiple contexts are not correctly supported. All events are delivered to all contexts.\n");
+
+ macdrv_start_tablet_monitor();
+ return 0;
+}
+
+/***********************************************************************
+ * macdrv_tablet_event
+ *
+ * Handler for TABLET_EVENT events.
+ */
+void macdrv_tablet_event(const macdrv_event* event)
+{
+ int i;
+ PACKET* old_pkt = ¤t_packet;
+ PACKET* new_pkt = event->tablet_event.packet;
+ int event_type = event->tablet_event.type;
+ BOOL is_proximity = (event_type != TABLET_EVENT_POINT);
+
+ if (is_proximity)
+ {
+ /* Wacom's documentation very confusingly states:
+ * > The high-order word is non-zero when the cursor is leaving or
+ * > entering hardware proximity.
+ * What it actually means is that the high-order word is 1 when entering
+ * proximity or 0 when leaving proximity.
+ *
+ * The low and high order words are always the same. The only way to
+ * enter/leave context proximity without entering/leaving device
+ * proximity is to have multiple contexts. Macdrv has no awareness of
+ * contexts so this would have to be handled by wintab.dll. */
+ BOOL is_enter = (event_type == TABLET_EVENT_PROXIMITY_ENTER);
+ LPARAM l_param = MAKELPARAM(is_enter, is_enter);
+
+ /* We can get duplicate events due to NSEventTypeMouseMoved +
+ * NSEventTypeTabletProximity both being delivered. Squash them here. */
+ if (last_event_type == event_type)
+ return;
+
+ last_event_type = event_type;
+
+ for (i = 0; i < registered_hwnd_count; i++)
+ {
+ HWND hwnd = registered_hwnd[i];
+ SendMessageW(macdrv_tablet_hwnd, WT_PROXIMITY, (WPARAM)hwnd, l_param);
+ }
+ }
+ else
+ {
+ last_event_type = TABLET_EVENT_POINT;
+
+ /* Calculate which values changed */
+ new_pkt->pkChanged = ((new_pkt->pkStatus != old_pkt->pkStatus) * PK_STATUS)
+ | ((new_pkt->pkTime != old_pkt->pkTime) * PK_TIME)
+ | PK_SERIAL_NUMBER
+ | ((new_pkt->pkButtons != old_pkt->pkButtons) * PK_BUTTONS)
+ | ((new_pkt->pkX != old_pkt->pkX) * PK_X)
+ | ((new_pkt->pkY != old_pkt->pkY) * PK_Y)
+ | ((new_pkt->pkZ != old_pkt->pkZ) * PK_Z)
+ | ((new_pkt->pkNormalPressure != old_pkt->pkNormalPressure) * PK_NORMAL_PRESSURE)
+ | ((new_pkt->pkTangentPressure != old_pkt->pkTangentPressure) * PK_TANGENT_PRESSURE)
+ | ((memcmp(&new_pkt->pkOrientation, &old_pkt->pkOrientation, sizeof(new_pkt->pkOrientation)) != 0) * PK_ORIENTATION);
+
+ *old_pkt = *new_pkt;
+ free(new_pkt);
+
+ for (i = 0; i < registered_hwnd_count; i++)
+ {
+ HWND hwnd = registered_hwnd[i];
+ SendMessageW(macdrv_tablet_hwnd, WT_PACKET, (WPARAM)current_packet.pkSerialNumber, (LPARAM)hwnd);
+ }
+ }
+}
+
+int CDECL macdrv_GetCurrentPacket(LPPACKET packet){
+ *packet = current_packet;
+ return 1;
+}
diff --git a/dlls/winex11.drv/wintab.c b/dlls/winex11.drv/wintab.c
index 331601c3325..f8b0cb1cac9 100644
--- a/dlls/winex11.drv/wintab.c
+++ b/dlls/winex11.drv/wintab.c
@@ -203,54 +203,6 @@ typedef struct tagWTI_DEVICES_INFO
} WTI_DEVICES_INFO, *LPWTI_DEVICES_INFO;
-/***********************************************************************
- * WACOM WINTAB EXTENSIONS TO SUPPORT CSR_TYPE
- * In Wintab 1.2, a CSR_TYPE feature was added. This adds the
- * ability to return a type of cursor on a tablet.
- * Unfortunately, we cannot get the cursor type directly from X,
- * and it is not specified directly anywhere. So we virtualize
- * the type here. (This is unfortunate, the kernel module has
- * the exact type, but we have no way of getting that module to
- * pass us that type).
- *
- * Reference linuxwacom driver project wcmCommon.c function
- * idtotype for a much larger list of CSR_TYPE.
- *
- * http://linuxwacom.cvs.sourceforge.net/linuxwacom/linuxwacom-prod/src/xdrv/w…
- *
- * The WTI_CURSORS_INFO.TYPE data is supposed to be used like this:
- * (cursor.TYPE & 0x0F06) == target_cursor_type
- * Reference: Section Unique ID
- * http://www.wacomeng.com/devsupport/ibmpc/gddevpc.html
- */
-#define CSR_TYPE_PEN 0x822
-#define CSR_TYPE_ERASER 0x82a
-#define CSR_TYPE_MOUSE_2D 0x007
-#define CSR_TYPE_MOUSE_4D 0x094
-/* CSR_TYPE_OTHER is a special value! assumed no real world significance
- * if a stylus type or eraser type eventually have this value
- * it'll be a bug. As of 2008 05 21 we can be sure because
- * linux wacom lists all the known values and this isn't one of them */
-#define CSR_TYPE_OTHER 0x000
-
-typedef struct tagWTPACKET {
- HCTX pkContext;
- UINT pkStatus;
- LONG pkTime;
- WTPKT pkChanged;
- UINT pkSerialNumber;
- UINT pkCursor;
- DWORD pkButtons;
- DWORD pkX;
- DWORD pkY;
- DWORD pkZ;
- UINT pkNormalPressure;
- UINT pkTangentPressure;
- ORIENTATION pkOrientation;
- ROTATION pkRotation; /* 1.1 */
-} WTPACKET, *LPWTPACKET;
-
-
#ifdef SONAME_LIBXI
#include <X11/Xlib.h>
@@ -265,9 +217,9 @@ static int proximity_in_type;
static int proximity_out_type;
static HWND hwndTabletDefault;
-static WTPACKET gMsgPacket;
+static PACKET gMsgPacket;
static DWORD gSerial;
-static WTPACKET last_packet;
+static PACKET last_packet;
/* Reference: http://www.wacomeng.com/devsupport/ibmpc/gddevpc.html
*
@@ -845,7 +797,7 @@ static int cursor_from_device(DWORD deviceid, LPWTI_CURSORS_INFO *cursorp)
return -1;
}
-static DWORD get_changed_state( WTPACKET *pkt)
+static DWORD get_changed_state( PACKET *pkt)
{
DWORD change = 0;
@@ -879,6 +831,11 @@ static DWORD get_changed_state( WTPACKET *pkt)
return change;
}
+static inline DWORD flip_y( DWORD y )
+{
+ return gSysContext.lcInExtY - y;
+}
+
static BOOL motion_event( HWND hwnd, XEvent *event )
{
XDeviceMotionEvent *motion = (XDeviceMotionEvent *)event;
@@ -887,7 +844,7 @@ static BOOL motion_event( HWND hwnd, XEvent *event )
if (curnum < 0)
return FALSE;
- memset(&gMsgPacket,0,sizeof(WTPACKET));
+ memset(&gMsgPacket,0,sizeof(PACKET));
TRACE("Received tablet motion event (%p); device id %d, cursor num %d\n",hwnd, (int) motion->deviceid, curnum);
@@ -897,7 +854,7 @@ static BOOL motion_event( HWND hwnd, XEvent *event )
gMsgPacket.pkSerialNumber = gSerial++;
gMsgPacket.pkCursor = curnum;
gMsgPacket.pkX = motion->axis_data[0];
- gMsgPacket.pkY = motion->axis_data[1];
+ gMsgPacket.pkY = flip_y(motion->axis_data[1]);
gMsgPacket.pkOrientation.orAzimuth = figure_deg(motion->axis_data[3],motion->axis_data[4]);
gMsgPacket.pkOrientation.orAltitude = ((1000 - 15 * max
(abs(motion->axis_data[3]),
@@ -919,7 +876,7 @@ static BOOL button_event( HWND hwnd, XEvent *event )
if (curnum < 0)
return FALSE;
- memset(&gMsgPacket,0,sizeof(WTPACKET));
+ memset(&gMsgPacket,0,sizeof(PACKET));
TRACE("Received tablet button %s event\n", (event->type == button_press_type)?"press":"release");
@@ -931,7 +888,7 @@ static BOOL button_event( HWND hwnd, XEvent *event )
gMsgPacket.pkCursor = curnum;
if (button->axes_count > 0) {
gMsgPacket.pkX = button->axis_data[0];
- gMsgPacket.pkY = button->axis_data[1];
+ gMsgPacket.pkY = flip_y(button->axis_data[1]);
gMsgPacket.pkOrientation.orAzimuth = figure_deg(button->axis_data[3],button->axis_data[4]);
gMsgPacket.pkOrientation.orAltitude = ((1000 - 15 * max(abs(button->axis_data[3]),
abs(button->axis_data[4])))
@@ -971,7 +928,7 @@ static BOOL proximity_event( HWND hwnd, XEvent *event )
if (curnum < 0)
return FALSE;
- memset(&gMsgPacket,0,sizeof(WTPACKET));
+ memset(&gMsgPacket,0,sizeof(PACKET));
/* Set cursor to inverted if cursor is the eraser */
gMsgPacket.pkStatus = (cursor->TYPE == CSR_TYPE_ERASER ? TPS_INVERT:0);
@@ -980,7 +937,7 @@ static BOOL proximity_event( HWND hwnd, XEvent *event )
gMsgPacket.pkSerialNumber = gSerial++;
gMsgPacket.pkCursor = curnum;
gMsgPacket.pkX = proximity->axis_data[0];
- gMsgPacket.pkY = proximity->axis_data[1];
+ gMsgPacket.pkY = flip_y(proximity->axis_data[1]);
gMsgPacket.pkOrientation.orAzimuth = figure_deg(proximity->axis_data[3],proximity->axis_data[4]);
gMsgPacket.pkOrientation.orAltitude = ((1000 - 15 * max(abs(proximity->axis_data[3]),
abs(proximity->axis_data[4])))
@@ -1095,24 +1052,13 @@ int CDECL X11DRV_AttachEventQueueToTablet(HWND hOwner)
/***********************************************************************
* X11DRV_GetCurrentPacket (X11DRV.@)
*/
-int CDECL X11DRV_GetCurrentPacket(LPWTPACKET packet)
+int CDECL X11DRV_GetCurrentPacket(LPPACKET packet)
{
*packet = gMsgPacket;
return 1;
}
-static inline int CopyTabletData(LPVOID target, LPCVOID src, INT size)
-{
- /*
- * It is valid to call CopyTabletData with NULL.
- * This handles the WTInfo() case where lpOutput is null.
- */
- if(target != NULL)
- memcpy(target,src,size);
- return(size);
-}
-
/***********************************************************************
* X11DRV_WTInfoW (X11DRV.@)
*/
@@ -1123,7 +1069,7 @@ UINT CDECL X11DRV_WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput)
* lpOutput == NULL signifies the user only wishes
* to find the size of the data.
* NOTE:
- * From now on use CopyTabletData to fill lpOutput. memcpy will break
+ * From now on use TABLET_CopyData to fill lpOutput. memcpy will break
* the code.
*/
int rc = 0;
@@ -1151,24 +1097,24 @@ UINT CDECL X11DRV_WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput)
case IFC_WINTABID:
{
static const WCHAR driver[] = {'W','i','n','e',' ','W','i','n','t','a','b',' ','1','.','1',0};
- rc = CopyTabletData(lpOutput, driver, (strlenW(driver) + 1) * sizeof(WCHAR));
+ rc = TABLET_CopyData(lpOutput, driver, (strlenW(driver) + 1) * sizeof(WCHAR));
break;
}
case IFC_SPECVERSION:
version = (0x01) | (0x01 << 8);
- rc = CopyTabletData(lpOutput, &version,sizeof(WORD));
+ rc = TABLET_CopyData(lpOutput, &version,sizeof(WORD));
break;
case IFC_IMPLVERSION:
version = (0x00) | (0x01 << 8);
- rc = CopyTabletData(lpOutput, &version,sizeof(WORD));
+ rc = TABLET_CopyData(lpOutput, &version,sizeof(WORD));
break;
case IFC_NDEVICES:
num = 1;
- rc = CopyTabletData(lpOutput, &num,sizeof(num));
+ rc = TABLET_CopyData(lpOutput, &num,sizeof(num));
break;
case IFC_NCURSORS:
num = gNumCursors;
- rc = CopyTabletData(lpOutput, &num,sizeof(num));
+ rc = TABLET_CopyData(lpOutput, &num,sizeof(num));
break;
default:
FIXME("WTI_INTERFACE unhandled index %i\n",nIndex);
@@ -1185,143 +1131,143 @@ UINT CDECL X11DRV_WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput)
if (0 == gNumCursors)
rc = 0;
else
- rc = CopyTabletData(lpOutput, &gSysContext,
+ rc = TABLET_CopyData(lpOutput, &gSysContext,
sizeof(LOGCONTEXTW));
break;
case CTX_NAME:
- rc = CopyTabletData(lpOutput, gSysContext.lcName,
+ rc = TABLET_CopyData(lpOutput, gSysContext.lcName,
(strlenW(gSysContext.lcName)+1) * sizeof(WCHAR));
break;
case CTX_OPTIONS:
- rc = CopyTabletData(lpOutput, &gSysContext.lcOptions,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcOptions,
sizeof(UINT));
break;
case CTX_STATUS:
- rc = CopyTabletData(lpOutput, &gSysContext.lcStatus,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcStatus,
sizeof(UINT));
break;
case CTX_LOCKS:
- rc= CopyTabletData (lpOutput, &gSysContext.lcLocks,
+ rc= TABLET_CopyData (lpOutput, &gSysContext.lcLocks,
sizeof(UINT));
break;
case CTX_MSGBASE:
- rc = CopyTabletData(lpOutput, &gSysContext.lcMsgBase,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcMsgBase,
sizeof(UINT));
break;
case CTX_DEVICE:
- rc = CopyTabletData(lpOutput, &gSysContext.lcDevice,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcDevice,
sizeof(UINT));
break;
case CTX_PKTRATE:
- rc = CopyTabletData(lpOutput, &gSysContext.lcPktRate,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcPktRate,
sizeof(UINT));
break;
case CTX_PKTDATA:
- rc = CopyTabletData(lpOutput, &gSysContext.lcPktData,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcPktData,
sizeof(WTPKT));
break;
case CTX_PKTMODE:
- rc = CopyTabletData(lpOutput, &gSysContext.lcPktMode,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcPktMode,
sizeof(WTPKT));
break;
case CTX_MOVEMASK:
- rc = CopyTabletData(lpOutput, &gSysContext.lcMoveMask,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcMoveMask,
sizeof(WTPKT));
break;
case CTX_BTNDNMASK:
- rc = CopyTabletData(lpOutput, &gSysContext.lcBtnDnMask,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcBtnDnMask,
sizeof(DWORD));
break;
case CTX_BTNUPMASK:
- rc = CopyTabletData(lpOutput, &gSysContext.lcBtnUpMask,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcBtnUpMask,
sizeof(DWORD));
break;
case CTX_INORGX:
- rc = CopyTabletData(lpOutput, &gSysContext.lcInOrgX,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcInOrgX,
sizeof(LONG));
break;
case CTX_INORGY:
- rc = CopyTabletData(lpOutput, &gSysContext.lcInOrgY,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcInOrgY,
sizeof(LONG));
break;
case CTX_INORGZ:
- rc = CopyTabletData(lpOutput, &gSysContext.lcInOrgZ,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcInOrgZ,
sizeof(LONG));
break;
case CTX_INEXTX:
- rc = CopyTabletData(lpOutput, &gSysContext.lcInExtX,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcInExtX,
sizeof(LONG));
break;
case CTX_INEXTY:
- rc = CopyTabletData(lpOutput, &gSysContext.lcInExtY,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcInExtY,
sizeof(LONG));
break;
case CTX_INEXTZ:
- rc = CopyTabletData(lpOutput, &gSysContext.lcInExtZ,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcInExtZ,
sizeof(LONG));
break;
case CTX_OUTORGX:
- rc = CopyTabletData(lpOutput, &gSysContext.lcOutOrgX,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcOutOrgX,
sizeof(LONG));
break;
case CTX_OUTORGY:
- rc = CopyTabletData(lpOutput, &gSysContext.lcOutOrgY,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcOutOrgY,
sizeof(LONG));
break;
case CTX_OUTORGZ:
- rc = CopyTabletData(lpOutput, &gSysContext.lcOutOrgZ,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcOutOrgZ,
sizeof(LONG));
break;
case CTX_OUTEXTX:
- rc = CopyTabletData(lpOutput, &gSysContext.lcOutExtX,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcOutExtX,
sizeof(LONG));
break;
case CTX_OUTEXTY:
- rc = CopyTabletData(lpOutput, &gSysContext.lcOutExtY,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcOutExtY,
sizeof(LONG));
break;
case CTX_OUTEXTZ:
- rc = CopyTabletData(lpOutput, &gSysContext.lcOutExtZ,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcOutExtZ,
sizeof(LONG));
break;
case CTX_SENSX:
- rc = CopyTabletData(lpOutput, &gSysContext.lcSensX,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcSensX,
sizeof(LONG));
break;
case CTX_SENSY:
- rc = CopyTabletData(lpOutput, &gSysContext.lcSensY,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcSensY,
sizeof(LONG));
break;
case CTX_SENSZ:
- rc = CopyTabletData(lpOutput, &gSysContext.lcSensZ,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcSensZ,
sizeof(LONG));
break;
case CTX_SYSMODE:
- rc = CopyTabletData(lpOutput, &gSysContext.lcSysMode,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcSysMode,
sizeof(LONG));
break;
case CTX_SYSORGX:
- rc = CopyTabletData(lpOutput, &gSysContext.lcSysOrgX,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcSysOrgX,
sizeof(LONG));
break;
case CTX_SYSORGY:
- rc = CopyTabletData(lpOutput, &gSysContext.lcSysOrgY,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcSysOrgY,
sizeof(LONG));
break;
case CTX_SYSEXTX:
- rc = CopyTabletData(lpOutput, &gSysContext.lcSysExtX,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcSysExtX,
sizeof(LONG));
break;
case CTX_SYSEXTY:
- rc = CopyTabletData(lpOutput, &gSysContext.lcSysExtY,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcSysExtY,
sizeof(LONG));
break;
case CTX_SYSSENSX:
- rc = CopyTabletData(lpOutput, &gSysContext.lcSysSensX,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcSysSensX,
sizeof(LONG));
break;
case CTX_SYSSENSY:
- rc = CopyTabletData(lpOutput, &gSysContext.lcSysSensY,
+ rc = TABLET_CopyData(lpOutput, &gSysContext.lcSysSensY,
sizeof(LONG));
break;
default:
@@ -1353,44 +1299,44 @@ UINT CDECL X11DRV_WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput)
switch (nIndex)
{
case CSR_NAME:
- rc = CopyTabletData(lpOutput, tgtcursor->NAME,
+ rc = TABLET_CopyData(lpOutput, tgtcursor->NAME,
(strlenW(tgtcursor->NAME)+1) * sizeof(WCHAR));
break;
case CSR_ACTIVE:
- rc = CopyTabletData(lpOutput,&tgtcursor->ACTIVE,
+ rc = TABLET_CopyData(lpOutput,&tgtcursor->ACTIVE,
sizeof(BOOL));
break;
case CSR_PKTDATA:
- rc = CopyTabletData(lpOutput,&tgtcursor->PKTDATA,
+ rc = TABLET_CopyData(lpOutput,&tgtcursor->PKTDATA,
sizeof(WTPKT));
break;
case CSR_BUTTONS:
- rc = CopyTabletData(lpOutput,&tgtcursor->BUTTONS,
+ rc = TABLET_CopyData(lpOutput,&tgtcursor->BUTTONS,
sizeof(BYTE));
break;
case CSR_BUTTONBITS:
- rc = CopyTabletData(lpOutput,&tgtcursor->BUTTONBITS,
+ rc = TABLET_CopyData(lpOutput,&tgtcursor->BUTTONBITS,
sizeof(BYTE));
break;
case CSR_BTNNAMES:
FIXME("Button Names not returned correctly\n");
- rc = CopyTabletData(lpOutput,&tgtcursor->BTNNAMES,
+ rc = TABLET_CopyData(lpOutput,&tgtcursor->BTNNAMES,
tgtcursor->cchBTNNAMES*sizeof(WCHAR));
break;
case CSR_BUTTONMAP:
- rc = CopyTabletData(lpOutput,tgtcursor->BUTTONMAP,
+ rc = TABLET_CopyData(lpOutput,tgtcursor->BUTTONMAP,
sizeof(BYTE)*32);
break;
case CSR_SYSBTNMAP:
- rc = CopyTabletData(lpOutput,tgtcursor->SYSBTNMAP,
+ rc = TABLET_CopyData(lpOutput,tgtcursor->SYSBTNMAP,
sizeof(BYTE)*32);
break;
case CSR_NPBTNMARKS:
- rc = CopyTabletData(lpOutput,tgtcursor->NPBTNMARKS,
+ rc = TABLET_CopyData(lpOutput,tgtcursor->NPBTNMARKS,
sizeof(UINT)*2);
break;
case CSR_NPBUTTON:
- rc = CopyTabletData(lpOutput,&tgtcursor->NPBUTTON,
+ rc = TABLET_CopyData(lpOutput,&tgtcursor->NPBUTTON,
sizeof(BYTE));
break;
case CSR_NPRESPONSE:
@@ -1398,11 +1344,11 @@ UINT CDECL X11DRV_WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput)
rc = 0;
break;
case CSR_TPBUTTON:
- rc = CopyTabletData(lpOutput,&tgtcursor->TPBUTTON,
+ rc = TABLET_CopyData(lpOutput,&tgtcursor->TPBUTTON,
sizeof(BYTE));
break;
case CSR_TPBTNMARKS:
- rc = CopyTabletData(lpOutput,tgtcursor->TPBTNMARKS,
+ rc = TABLET_CopyData(lpOutput,tgtcursor->TPBTNMARKS,
sizeof(UINT)*2);
break;
case CSR_TPRESPONSE:
@@ -1413,26 +1359,26 @@ UINT CDECL X11DRV_WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput)
{
DWORD id;
id = tgtcursor->PHYSID;
- rc = CopyTabletData(lpOutput,&id,sizeof(DWORD));
+ rc = TABLET_CopyData(lpOutput,&id,sizeof(DWORD));
}
break;
case CSR_MODE:
- rc = CopyTabletData(lpOutput,&tgtcursor->MODE,sizeof(UINT));
+ rc = TABLET_CopyData(lpOutput,&tgtcursor->MODE,sizeof(UINT));
break;
case CSR_MINPKTDATA:
- rc = CopyTabletData(lpOutput,&tgtcursor->MINPKTDATA,
+ rc = TABLET_CopyData(lpOutput,&tgtcursor->MINPKTDATA,
sizeof(UINT));
break;
case CSR_MINBUTTONS:
- rc = CopyTabletData(lpOutput,&tgtcursor->MINBUTTONS,
+ rc = TABLET_CopyData(lpOutput,&tgtcursor->MINBUTTONS,
sizeof(UINT));
break;
case CSR_CAPABILITIES:
- rc = CopyTabletData(lpOutput,&tgtcursor->CAPABILITIES,
+ rc = TABLET_CopyData(lpOutput,&tgtcursor->CAPABILITIES,
sizeof(UINT));
break;
case CSR_TYPE:
- rc = CopyTabletData(lpOutput,&tgtcursor->TYPE,
+ rc = TABLET_CopyData(lpOutput,&tgtcursor->TYPE,
sizeof(UINT));
break;
default:
@@ -1445,91 +1391,91 @@ UINT CDECL X11DRV_WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput)
switch (nIndex)
{
case DVC_NAME:
- rc = CopyTabletData(lpOutput,gSysDevice.NAME,
+ rc = TABLET_CopyData(lpOutput,gSysDevice.NAME,
(strlenW(gSysDevice.NAME)+1) * sizeof(WCHAR));
break;
case DVC_HARDWARE:
- rc = CopyTabletData(lpOutput,&gSysDevice.HARDWARE,
+ rc = TABLET_CopyData(lpOutput,&gSysDevice.HARDWARE,
sizeof(UINT));
break;
case DVC_NCSRTYPES:
- rc = CopyTabletData(lpOutput,&gSysDevice.NCSRTYPES,
+ rc = TABLET_CopyData(lpOutput,&gSysDevice.NCSRTYPES,
sizeof(UINT));
break;
case DVC_FIRSTCSR:
- rc = CopyTabletData(lpOutput,&gSysDevice.FIRSTCSR,
+ rc = TABLET_CopyData(lpOutput,&gSysDevice.FIRSTCSR,
sizeof(UINT));
break;
case DVC_PKTRATE:
- rc = CopyTabletData(lpOutput,&gSysDevice.PKTRATE,
+ rc = TABLET_CopyData(lpOutput,&gSysDevice.PKTRATE,
sizeof(UINT));
break;
case DVC_PKTDATA:
- rc = CopyTabletData(lpOutput,&gSysDevice.PKTDATA,
+ rc = TABLET_CopyData(lpOutput,&gSysDevice.PKTDATA,
sizeof(WTPKT));
break;
case DVC_PKTMODE:
- rc = CopyTabletData(lpOutput,&gSysDevice.PKTMODE,
+ rc = TABLET_CopyData(lpOutput,&gSysDevice.PKTMODE,
sizeof(WTPKT));
break;
case DVC_CSRDATA:
- rc = CopyTabletData(lpOutput,&gSysDevice.CSRDATA,
+ rc = TABLET_CopyData(lpOutput,&gSysDevice.CSRDATA,
sizeof(WTPKT));
break;
case DVC_XMARGIN:
- rc = CopyTabletData(lpOutput,&gSysDevice.XMARGIN,
+ rc = TABLET_CopyData(lpOutput,&gSysDevice.XMARGIN,
sizeof(INT));
break;
case DVC_YMARGIN:
- rc = CopyTabletData(lpOutput,&gSysDevice.YMARGIN,
+ rc = TABLET_CopyData(lpOutput,&gSysDevice.YMARGIN,
sizeof(INT));
break;
case DVC_ZMARGIN:
rc = 0; /* unsupported */
/*
- rc = CopyTabletData(lpOutput,&gSysDevice.ZMARGIN,
+ rc = TABLET_CopyData(lpOutput,&gSysDevice.ZMARGIN,
sizeof(INT));
*/
break;
case DVC_X:
- rc = CopyTabletData(lpOutput,&gSysDevice.X,
+ rc = TABLET_CopyData(lpOutput,&gSysDevice.X,
sizeof(AXIS));
break;
case DVC_Y:
- rc = CopyTabletData(lpOutput,&gSysDevice.Y,
+ rc = TABLET_CopyData(lpOutput,&gSysDevice.Y,
sizeof(AXIS));
break;
case DVC_Z:
rc = 0; /* unsupported */
/*
- rc = CopyTabletData(lpOutput,&gSysDevice.Z,
+ rc = TABLET_CopyData(lpOutput,&gSysDevice.Z,
sizeof(AXIS));
*/
break;
case DVC_NPRESSURE:
- rc = CopyTabletData(lpOutput,&gSysDevice.NPRESSURE,
+ rc = TABLET_CopyData(lpOutput,&gSysDevice.NPRESSURE,
sizeof(AXIS));
break;
case DVC_TPRESSURE:
rc = 0; /* unsupported */
/*
- rc = CopyTabletData(lpOutput,&gSysDevice.TPRESSURE,
+ rc = TABLET_CopyData(lpOutput,&gSysDevice.TPRESSURE,
sizeof(AXIS));
*/
break;
case DVC_ORIENTATION:
- rc = CopyTabletData(lpOutput,gSysDevice.ORIENTATION,
+ rc = TABLET_CopyData(lpOutput,gSysDevice.ORIENTATION,
sizeof(AXIS)*3);
break;
case DVC_ROTATION:
rc = 0; /* unsupported */
/*
- rc = CopyTabletData(lpOutput,&gSysDevice.ROTATION,
+ rc = TABLET_CopyData(lpOutput,&gSysDevice.ROTATION,
sizeof(AXIS)*3);
*/
break;
case DVC_PNPID:
- rc = CopyTabletData(lpOutput,gSysDevice.PNPID,
+ rc = TABLET_CopyData(lpOutput,gSysDevice.PNPID,
(strlenW(gSysDevice.PNPID)+1)*sizeof(WCHAR));
break;
default:
@@ -1556,7 +1502,7 @@ int CDECL X11DRV_AttachEventQueueToTablet(HWND hOwner)
/***********************************************************************
* GetCurrentPacket (X11DRV.@)
*/
-int CDECL X11DRV_GetCurrentPacket(LPWTPACKET packet)
+int CDECL X11DRV_GetCurrentPacket(LPPACKET packet)
{
return 0;
}
diff --git a/dlls/wintab32/context.c b/dlls/wintab32/context.c
index 58ba6b49074..8c7953a8e68 100644
--- a/dlls/wintab32/context.c
+++ b/dlls/wintab32/context.c
@@ -38,7 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wintab32);
/*
* Documentation found at
- * http://www.csl.sony.co.jp/projects/ar/restricted/wintabl.html
+ * https://developer-docs.wacom.com/intuos-cintiq-business-tablets/docs/wintab…
*/
static LPOPENCONTEXT gOpenContexts;
@@ -62,7 +62,8 @@ static void LOGCONTEXTWtoA(const LOGCONTEXTW *in, LOGCONTEXTA *out)
static BOOL is_logcontext_category(UINT wCategory)
{
- return wCategory == WTI_DEFSYSCTX || wCategory == WTI_DEFCONTEXT || wCategory == WTI_DDCTXS;
+ return wCategory == WTI_DEFSYSCTX || wCategory == WTI_DEFCONTEXT
+ || IS_WTI_DDCTXS_TYPE(wCategory) || IS_WTI_DSCTXS_TYPE(wCategory);
}
static BOOL is_string_field(UINT wCategory, UINT nIndex)
@@ -71,10 +72,11 @@ static BOOL is_string_field(UINT wCategory, UINT nIndex)
return TRUE;
if (is_logcontext_category(wCategory) && nIndex == CTX_NAME)
return TRUE;
- if ((wCategory >= WTI_CURSORS && wCategory <= WTI_CURSORS + 9) &&
- (nIndex == CSR_NAME || nIndex == CSR_BTNNAMES))
+ if (IS_WTI_CURSORS_TYPE(wCategory)
+ && (nIndex == CSR_NAME || nIndex == CSR_BTNNAMES))
return TRUE;
- if (wCategory == WTI_DEVICES && (nIndex == DVC_NAME || nIndex == DVC_PNPID))
+ if (IS_WTI_DEVICES_TYPE(wCategory)
+ && (nIndex == DVC_NAME || nIndex == DVC_PNPID))
return TRUE;
return FALSE;
}
@@ -100,7 +102,7 @@ static const char* DUMPBITS(int x)
return wine_dbg_sprintf("{%s}",buf);
}
-static inline void DUMPPACKET(WTPACKET packet)
+static inline void DUMPPACKET(PACKET packet)
{
TRACE("pkContext: %p pkStatus: 0x%x pkTime : 0x%lx pkChanged: 0x%lx pkSerialNumber: 0x%x pkCursor : %i pkButtons: %lx pkX: %li pkY: %li pkZ: %li pkNormalPressure: %i pkTangentPressure: %i pkOrientation: (%i,%i,%i) pkRotation: (%i,%i,%i)\n",
packet.pkContext, packet.pkStatus, packet.pkTime, packet.pkChanged, packet.pkSerialNumber,
@@ -175,15 +177,47 @@ int TABLET_PostTabletMessage(LPOPENCONTEXT newcontext, UINT msg, WPARAM wParam,
return 0;
}
+LPOPENCONTEXT FindContextForHwnd(HWND hwnd)
+{
+ LPOPENCONTEXT ptr = gOpenContexts;
+
+ EnterCriticalSection(&csTablet);
+ while (ptr)
+ {
+ if (ptr->hwndOwner == hwnd && ptr->enabled)
+ break;
+ ptr = ptr->next;
+ }
+ LeaveCriticalSection(&csTablet);
+ return ptr;
+}
+
+/* Scale point for tablet area. Org is offset. Ext is length. Negative extent
+ * indicates flipped coordinate system, but coordinates remain positive.
+ * (Org <= x < Org + abs(Ext)) */
static inline DWORD ScaleForContext(DWORD In, LONG InOrg, LONG InExt, LONG OutOrg, LONG OutExt)
{
- if (((InExt > 0 )&&(OutExt > 0)) || ((InExt<0) && (OutExt < 0)))
- return MulDiv(In - InOrg, abs(OutExt), abs(InExt)) + OutOrg;
+ LONG AbsInExt = abs(InExt);
+ LONG AbsOutExt = abs(OutExt);
+
+ if (AbsInExt <= 1 || AbsOutExt <= 1)
+ /* No dimensions */
+ return 0;
+
+ /* Largest representable value is 1 less than extent, we need to scale by
+ * that. This is the same way wintab does it. */
+ AbsInExt--;
+ AbsOutExt--;
+
+ if ((InExt < 0) == (OutExt < 0))
+ /* Same sign, maintain direction */
+ return MulDiv(In - InOrg, AbsOutExt, AbsInExt) + OutOrg;
else
- return MulDiv(abs(InExt) - (In - InOrg), abs(OutExt), abs(InExt)) + OutOrg;
+ /* Opposite signs, invert direction */
+ return MulDiv(AbsInExt - (In - InOrg), AbsOutExt, AbsInExt) + OutOrg;
}
-LPOPENCONTEXT AddPacketToContextQueue(LPWTPACKET packet, HWND hwnd)
+LPOPENCONTEXT AddPacketToContextQueue(LPPACKET packet, HWND hwnd)
{
LPOPENCONTEXT ptr=NULL;
@@ -204,29 +238,36 @@ LPOPENCONTEXT AddPacketToContextQueue(LPWTPACKET packet, HWND hwnd)
}
tgt = ptr->PacketsQueued;
+ if (tgt > 0 && ptr->PacketQueue[tgt - 1].pkSerialNumber == packet->pkSerialNumber)
+ {
+ ptr = ptr->next;
+ continue;
+
+ }
packet->pkContext = ptr->handle;
- /* translate packet data to the context */
+ /* Translate packet data to the context */
packet->pkChanged = packet->pkChanged & ptr->context.lcPktData;
- /* Scale as per documentation */
- packet->pkY = ScaleForContext(packet->pkY, ptr->context.lcInOrgY,
- ptr->context.lcInExtY, ptr->context.lcOutOrgY,
- ptr->context.lcOutExtY);
+ packet->pkX = ScaleForContext(packet->pkX,
+ ptr->context.lcInOrgX, ptr->context.lcInExtX,
+ ptr->context.lcOutOrgX, ptr->context.lcOutExtX);
- packet->pkX = ScaleForContext(packet->pkX, ptr->context.lcInOrgX,
- ptr->context.lcInExtX, ptr->context.lcOutOrgX,
- ptr->context.lcOutExtX);
+ packet->pkY = ScaleForContext(packet->pkY,
+ ptr->context.lcInOrgY, ptr->context.lcInExtY,
+ ptr->context.lcOutOrgY, ptr->context.lcOutExtY);
- /* flip the Y axis */
- if (ptr->context.lcOutExtY > 0)
- packet->pkY = ptr->context.lcOutExtY - packet->pkY;
- else if (ptr->context.lcOutExtY < 0)
- {
- int y = ptr->context.lcOutExtY + packet->pkY;
- packet->pkY = abs(y);
- }
+ /* Clip values if outside of reporting range */
+ if ((LONG)packet->pkX < ptr->context.lcOutOrgX)
+ packet->pkX = ptr->context.lcOutOrgX;
+ else if((LONG)packet->pkX >= ptr->context.lcOutOrgX + abs(ptr->context.lcOutExtX))
+ packet->pkX = ptr->context.lcOutOrgX + abs(ptr->context.lcOutExtX) - 1;
+
+ if ((LONG)packet->pkY < ptr->context.lcOutOrgY)
+ packet->pkY = ptr->context.lcOutOrgY;
+ else if((LONG)packet->pkY >= ptr->context.lcOutOrgY + abs(ptr->context.lcOutExtY))
+ packet->pkY = ptr->context.lcOutOrgY + abs(ptr->context.lcOutExtY) - 1;
DUMPPACKET(*packet);
@@ -274,7 +315,7 @@ static inline int CopyTabletData(LPVOID target, LPVOID src, INT size)
}
static INT TABLET_FindPacket(LPOPENCONTEXT context, UINT wSerial,
- LPWTPACKET *pkt)
+ LPPACKET *pkt)
{
int loop;
int index = -1;
@@ -293,7 +334,7 @@ static INT TABLET_FindPacket(LPOPENCONTEXT context, UINT wSerial,
static LPVOID TABLET_CopyPacketData(LPOPENCONTEXT context, LPVOID lpPkt,
- LPWTPACKET wtp)
+ LPPACKET wtp)
{
LPBYTE ptr;
@@ -378,47 +419,27 @@ static UINT WTInfoT(UINT wCategory, UINT nIndex, LPVOID lpOutput, BOOL bUnicode)
if (!LoadTablet()) return 0;
TRACE("(%d, %d, %p, %d)\n", wCategory, nIndex, lpOutput, bUnicode);
-
- /*
- * Handle system extents here, as we can use user32.dll code to set them.
- */
- if(wCategory == WTI_DEFSYSCTX)
+ if (is_logcontext_category(wCategory) && nIndex == 0)
{
- switch(nIndex)
+ if (pWTInfoW(wCategory, nIndex, NULL) == 0)
{
- case CTX_SYSEXTX:
- if(lpOutput != NULL)
- *(LONG*)lpOutput = GetSystemMetrics(SM_CXSCREEN);
- return sizeof(LONG);
- case CTX_SYSEXTY:
- if(lpOutput != NULL)
- *(LONG*)lpOutput = GetSystemMetrics(SM_CYSCREEN);
- return sizeof(LONG);
- /* No action, delegate to X11Drv */
+ result = 0;
}
- }
-
- if (is_logcontext_category(wCategory) && nIndex == 0)
- {
- if (lpOutput)
+ else
{
- LOGCONTEXTW buf;
- pWTInfoW(wCategory, nIndex, &buf);
-
- /* Handle system extents here, as we can use user32.dll code to set them */
- if(wCategory == WTI_DEFSYSCTX)
+ if (lpOutput)
{
- buf.lcSysExtX = GetSystemMetrics(SM_CXSCREEN);
- buf.lcSysExtY = GetSystemMetrics(SM_CYSCREEN);
+ LOGCONTEXTW buf;
+ pWTInfoW(wCategory, nIndex, &buf);
+
+ if (bUnicode)
+ memcpy(lpOutput, &buf, sizeof(buf));
+ else
+ LOGCONTEXTWtoA(&buf, lpOutput);
}
- if (bUnicode)
- memcpy(lpOutput, &buf, sizeof(buf));
- else
- LOGCONTEXTWtoA(&buf, lpOutput);
+ result = bUnicode ? sizeof(LOGCONTEXTW) : sizeof(LOGCONTEXTA);
}
-
- result = bUnicode ? sizeof(LOGCONTEXTW) : sizeof(LOGCONTEXTA);
}
else if (is_string_field(wCategory, nIndex) && !bUnicode)
{
@@ -458,6 +479,9 @@ UINT WINAPI WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput)
HCTX WINAPI WTOpenW(HWND hWnd, LPLOGCONTEXTW lpLogCtx, BOOL fEnable)
{
LPOPENCONTEXT newcontext;
+ LONG inOrgX, inOrgY, inExtX, inExtY;
+ int sysOrgX, sysOrgY, sysExtX, sysExtY;
+ AXIS devAxX, devAxY;
if (!LoadTablet()) return 0;
@@ -468,9 +492,61 @@ HCTX WINAPI WTOpenW(HWND hWnd, LPLOGCONTEXTW lpLogCtx, BOOL fEnable)
newcontext->context = *lpLogCtx;
newcontext->hwndOwner = hWnd;
newcontext->ActiveCursor = -1;
- newcontext->QueueSize = 10;
+ newcontext->QueueSize = 25;
newcontext->PacketsQueued = 0;
- newcontext->PacketQueue=HeapAlloc(GetProcessHeap(),0,sizeof(WTPACKET)*10);
+ newcontext->PacketQueue=HeapAlloc(GetProcessHeap(),0,sizeof(PACKET)*newcontext->QueueSize);
+
+ /* Tablet area remapping is not supported. Ignore the incoming lcIn* values
+ * and use the system-provided values instead. */
+ pWTInfoW(WTI_DEFSYSCTX, CTX_INORGX, &inOrgX);
+ pWTInfoW(WTI_DEFSYSCTX, CTX_INORGY, &inOrgY);
+ pWTInfoW(WTI_DEFSYSCTX, CTX_INEXTX, &inExtX);
+ pWTInfoW(WTI_DEFSYSCTX, CTX_INEXTY, &inExtY);
+
+ /* According to Wacom's ScribbleDemo, the way to request raw tablet
+ * coordinates is to request an extent larger than the axis. */
+ if (pWTInfoW(WTI_DEVICES + newcontext->context.lcDevice, DVC_X, &devAxX) > 0
+ && pWTInfoW(WTI_DEVICES + newcontext->context.lcDevice, DVC_Y, &devAxY) > 0)
+ {
+ if (abs(newcontext->context.lcOutExtX) > devAxX.axMax - devAxX.axMin + 1
+ || abs(newcontext->context.lcOutExtY) > devAxY.axMax - devAxY.axMin + 1)
+ {
+ newcontext->context.lcOutOrgX = inOrgX;
+ newcontext->context.lcOutExtX = (newcontext->context.lcOutExtX >= 0
+ ? inExtX : -inExtX);
+
+ newcontext->context.lcOutOrgY = inOrgY;
+ newcontext->context.lcOutExtY = (newcontext->context.lcOutExtY >= 0
+ ? inExtY : -inExtY);
+ }
+ }
+
+ /* wintab allows developers to customize the area of the screen that the
+ * tablet points to. Wine does NOT allow this, so fudge the input area as
+ * necessary to make it line up with the actual screen. */
+ pWTInfoW(WTI_DEFSYSCTX, CTX_SYSORGX, &sysOrgX);
+ pWTInfoW(WTI_DEFSYSCTX, CTX_SYSORGY, &sysOrgY);
+ pWTInfoW(WTI_DEFSYSCTX, CTX_SYSEXTX, &sysExtX);
+ pWTInfoW(WTI_DEFSYSCTX, CTX_SYSEXTY, &sysExtY);
+
+ newcontext->context.lcInOrgX = ScaleForContext(newcontext->context.lcSysOrgX,
+ sysOrgX, sysExtX, inOrgX, inExtX);
+
+ /* Scale Y region from the bottom because the tablet is upside down */
+ newcontext->context.lcInOrgY = ScaleForContext(newcontext->context.lcSysOrgY + abs(newcontext->context.lcSysExtY),
+ sysOrgY, -sysExtY, inOrgY, inExtY);
+
+ newcontext->context.lcInExtX = MulDiv(abs(newcontext->context.lcSysExtX),
+ inExtX, sysExtX);
+
+ newcontext->context.lcInExtY = MulDiv(abs(newcontext->context.lcSysExtY),
+ inExtY, sysExtY);
+
+ if (memcmp(&newcontext->context, lpLogCtx, sizeof(newcontext->context)) != 0)
+ {
+ TRACE("Incoming context has been modified. Result:\n");
+ DUMPCONTEXT(newcontext->context);
+ }
EnterCriticalSection(&csTablet);
newcontext->handle = gTopContext++;
@@ -598,7 +674,7 @@ int WINAPI WTPacketsGet(HCTX hCtx, int cMaxPkts, LPVOID lpPkts)
if (limit < context->PacketsQueued)
{
memmove(context->PacketQueue, &context->PacketQueue[limit],
- (context->PacketsQueued - (limit))*sizeof(WTPACKET));
+ (context->PacketsQueued - (limit))*sizeof(PACKET));
}
context->PacketsQueued -= limit;
LeaveCriticalSection(&csTablet);
@@ -615,7 +691,7 @@ BOOL WINAPI WTPacket(HCTX hCtx, UINT wSerial, LPVOID lpPkt)
{
int rc = 0;
LPOPENCONTEXT context;
- LPWTPACKET wtp = NULL;
+ LPPACKET wtp = NULL;
TRACE("(%p, %d, %p)\n", hCtx, wSerial, lpPkt);
@@ -635,13 +711,14 @@ BOOL WINAPI WTPacket(HCTX hCtx, UINT wSerial, LPVOID lpPkt)
if (rc >= 0)
{
+
if (lpPkt)
TABLET_CopyPacketData(context ,lpPkt, wtp);
- if ((rc+1) < context->QueueSize)
+ if ((rc+1) < context->PacketsQueued)
{
memmove(context->PacketQueue, &context->PacketQueue[rc+1],
- (context->PacketsQueued - (rc+1))*sizeof(WTPACKET));
+ (context->PacketsQueued - (rc+1))*sizeof(PACKET));
}
context->PacketsQueued -= (rc+1);
}
@@ -990,7 +1067,7 @@ int WINAPI WTDataGet(HCTX hCtx, UINT wBegin, UINT wEnd,
/* remove read packets */
if ((end+1) < context->PacketsQueued)
memmove( &context->PacketQueue[bgn], &context->PacketQueue[end+1],
- (context->PacketsQueued - (end+1)) * sizeof (WTPACKET));
+ (context->PacketsQueued - (end+1)) * sizeof (PACKET));
context->PacketsQueued -= ((end-bgn)+1);
*lpNPkts = ((end-bgn)+1);
@@ -1125,7 +1202,7 @@ BOOL WINAPI WTQueueSizeSet(HCTX hCtx, int nPkts)
}
context->PacketQueue = HeapReAlloc(GetProcessHeap(), 0,
- context->PacketQueue, sizeof(WTPACKET)*nPkts);
+ context->PacketQueue, sizeof(PACKET)*nPkts);
context->QueueSize = nPkts;
LeaveCriticalSection(&csTablet);
diff --git a/dlls/wintab32/wintab32.c b/dlls/wintab32/wintab32.c
index b13c0573454..61a1917701a 100644
--- a/dlls/wintab32/wintab32.c
+++ b/dlls/wintab32/wintab32.c
@@ -43,7 +43,7 @@ static CRITICAL_SECTION_DEBUG csTablet_debug =
CRITICAL_SECTION csTablet = { &csTablet_debug, -1, 0, 0, 0, 0 };
int (CDECL *pLoadTabletInfo)(HWND hwnddefault) = NULL;
-int (CDECL *pGetCurrentPacket)(LPWTPACKET packet) = NULL;
+int (CDECL *pGetCurrentPacket)(LPPACKET packet) = NULL;
int (CDECL *pAttachEventQueueToTablet)(HWND hOwner) = NULL;
UINT (CDECL *pWTInfoW)(UINT wCategory, UINT nIndex, LPVOID lpOutput) = NULL;
@@ -143,7 +143,7 @@ static LRESULT WINAPI TABLET_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
case WT_PACKET:
{
- WTPACKET packet;
+ PACKET packet;
LPOPENCONTEXT handler;
if (pGetCurrentPacket)
{
@@ -158,16 +158,10 @@ static LRESULT WINAPI TABLET_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
}
case WT_PROXIMITY:
{
- WTPACKET packet;
- LPOPENCONTEXT handler;
- if (pGetCurrentPacket)
- {
- pGetCurrentPacket(&packet);
- handler = AddPacketToContextQueue(&packet,(HWND)wParam);
- if (handler)
- TABLET_PostTabletMessage(handler, WT_PROXIMITY,
- (WPARAM)handler->handle, lParam, TRUE);
- }
+ LPOPENCONTEXT handler = FindContextForHwnd((HWND)wParam);
+ if (handler)
+ TABLET_PostTabletMessage(handler, WT_PROXIMITY,
+ (WPARAM)handler->handle, lParam, TRUE);
break;
}
}
diff --git a/dlls/wintab32/wintab_internal.h b/dlls/wintab32/wintab_internal.h
index 18c64bfe700..f28c7d0aba0 100644
--- a/dlls/wintab32/wintab_internal.h
+++ b/dlls/wintab32/wintab_internal.h
@@ -116,23 +116,6 @@ typedef struct tagWTI_EXTENSIONS_INFO
*/
} WTI_EXTENSIONS_INFO, *LPWTI_EXTENSIONS_INFO;
-typedef struct tagWTPACKET {
- HCTX pkContext;
- UINT pkStatus;
- LONG pkTime;
- WTPKT pkChanged;
- UINT pkSerialNumber;
- UINT pkCursor;
- DWORD pkButtons;
- DWORD pkX;
- DWORD pkY;
- DWORD pkZ;
- UINT pkNormalPressure;
- UINT pkTangentPressure;
- ORIENTATION pkOrientation;
- ROTATION pkRotation; /* 1.1 */
-} WTPACKET, *LPWTPACKET;
-
typedef struct tagOPENCONTEXT
{
HCTX handle;
@@ -142,17 +125,18 @@ typedef struct tagOPENCONTEXT
INT ActiveCursor;
INT QueueSize;
INT PacketsQueued;
- LPWTPACKET PacketQueue;
+ LPPACKET PacketQueue;
struct tagOPENCONTEXT *next;
} OPENCONTEXT, *LPOPENCONTEXT;
int TABLET_PostTabletMessage(LPOPENCONTEXT newcontext, UINT msg, WPARAM wParam,
LPARAM lParam, BOOL send_always) DECLSPEC_HIDDEN;
-LPOPENCONTEXT AddPacketToContextQueue(LPWTPACKET packet, HWND hwnd) DECLSPEC_HIDDEN;
+LPOPENCONTEXT FindContextForHwnd(HWND hwnd) DECLSPEC_HIDDEN;
+LPOPENCONTEXT AddPacketToContextQueue(LPPACKET packet, HWND hwnd) DECLSPEC_HIDDEN;
-/* X11drv functions */
+/* User driver functions */
extern int (CDECL *pLoadTabletInfo)(HWND hwnddefault) DECLSPEC_HIDDEN;
-extern int (CDECL *pGetCurrentPacket)(LPWTPACKET packet) DECLSPEC_HIDDEN;
+extern int (CDECL *pGetCurrentPacket)(LPPACKET packet) DECLSPEC_HIDDEN;
extern int (CDECL *pAttachEventQueueToTablet)(HWND hOwner) DECLSPEC_HIDDEN;
extern UINT (CDECL *pWTInfoW)(UINT wCategory, UINT nIndex, LPVOID lpOutput) DECLSPEC_HIDDEN;
diff --git a/include/Makefile.in b/include/Makefile.in
index 9578c557af7..b9d2f8416fa 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -590,7 +590,6 @@ SOURCES = \
perflib.h \
perhist.idl \
physicalmonitorenumerationapi.h \
- pktdef.h \
poppack.h \
powrprof.h \
prntvpt.h \
diff --git a/include/pktdef.h b/include/pktdef.h
deleted file mode 100644
index a1622062658..00000000000
--- a/include/pktdef.h
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Copyright (C) 1991-1998 by LCS/Telegraphics
- * Copyright (C) 2002 Patrik Stridvall
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#ifndef __WINE_PKTDEF_H
-#define __WINE_PKTDEF_H
-
-/***********************************************************************
- * How to use pktdef.h:
- *
- * 1. Include wintab.h
- * 2. if using just one packet format:
- * a. Define PACKETDATA and PACKETMODE as or'ed combinations of WTPKT bits
- * (use the PK_* identifiers).
- * b. Include pktdef.h.
- * c. The generated structure typedef will be called PACKET. Use PACKETDATA
- * and PACKETMODE to fill in the LOGCONTEXT structure.
- * 3. If using multiple packet formats, for each one:
- * a. Define PACKETNAME. Its text value will be a prefix for this packet's
- * parameters and names.
- * b. Define <PACKETNAME>PACKETDATA and <PACKETNAME>PACKETMODE similar to
- * 2.a. above.
- * c. Include pktdef.h.
- * d. The generated structure typedef will be called
- * <PACKETNAME>PACKET. Compare with 2.c. above and example #2 below.
- * 4. If using extension packet data, do the following additional steps
- * for each extension:
- * a. Before including pktdef.h, define <PACKETNAME>PACKET<EXTENSION>
- * as either PKEXT_ABSOLUTE or PKEXT_RELATIVE.
- * b. The generated structure typedef will contain a field for the
- * extension data.
- * c. Scan the WTI_EXTENSION categories to find the extension's
- * packet mask bit.
- * d. OR the packet mask bit with <PACKETNAME>PACKETDATA and use the
- * result in the lcPktData field of the LOGCONTEXT structure.
- * e. If <PACKETNAME>PACKET<EXTENSION> was PKEXT_RELATIVE, OR the
- * packet mask bit with <PACKETNAME>PACKETMODE and use the result
- * in the lcPktMode field of the LOGCONTEXT structure.
- *
- *
- * Example #1. -- single packet format
- *
- * #include <wintab.h>
- * #define PACKETDATA PK_X | PK_Y | PK_BUTTONS /@ x, y, buttons @/
- * #define PACKETMODE PK_BUTTONS /@ buttons relative mode @/
- * #include <pktdef.h>
- * ...
- * lc.lcPktData = PACKETDATA;
- * lc.lcPktMode = PACKETMODE;
- *
- * Example #2. -- multiple formats
- *
- * #include <wintab.h>
- * #define PACKETNAME MOE
- * #define MOEPACKETDATA PK_X | PK_Y | PK_BUTTONS /@ x, y, buttons @/
- * #define MOEPACKETMODE PK_BUTTONS /@ buttons relative mode @/
- * #include <pktdef.h>
- * #define PACKETNAME LARRY
- * #define LARRYPACKETDATA PK_Y | PK_Z | PK_BUTTONS /@ y, z, buttons @/
- * #define LARRYPACKETMODE PK_BUTTONS /@ buttons relative mode @/
- * #include <pktdef.h>
- * #define PACKETNAME CURLY
- * #define CURLYPACKETDATA PK_X | PK_Z | PK_BUTTONS /@ x, z, buttons @/
- * #define CURLYPACKETMODE PK_BUTTONS /@ buttons relative mode @/
- * #include <pktdef.h>
- * ...
- * lcMOE.lcPktData = MOEPACKETDATA;
- * lcMOE.lcPktMode = MOEPACKETMODE;
- * ...
- * lcLARRY.lcPktData = LARRYPACKETDATA;
- * lcLARRY.lcPktMode = LARRYPACKETMODE;
- * ...
- * lcCURLY.lcPktData = CURLYPACKETDATA;
- * lcCURLY.lcPktMode = CURLYPACKETMODE;
- *
- * Example #3. -- extension packet data "XFOO".
- *
- * #include <wintab.h>
- * #define PACKETDATA PK_X | PK_Y | PK_BUTTONS /@ x, y, buttons @/
- * #define PACKETMODE PK_BUTTONS /@ buttons relative mode @/
- * #define PACKETXFOO PKEXT_ABSOLUTE /@ XFOO absolute mode @/
- * #include <pktdef.h>
- * ...
- * UINT ScanExts(UINT wTag)
- * {
- * UINT i;
- * UINT wScanTag;
- *
- * /@ scan for wTag's info category. @/
- * for (i = 0; WTInfo(WTI_EXTENSIONS + i, EXT_TAG, &wScanTag); i++) {
- * if (wTag == wScanTag) {
- * /@ return category offset from WTI_EXTENSIONS. @/
- * return i;
- * }
- * }
- * /@ return error code. @/
- * return 0xFFFF;
- * }
- * ...
- * lc.lcPktData = PACKETDATA;
- * lc.lcPktMode = PACKETMODE;
- * #ifdef PACKETXFOO
- * categoryXFOO = ScanExts(WTX_XFOO);
- * WTInfo(WTI_EXTENSIONS + categoryXFOO, EXT_MASK, &maskXFOO);
- * lc.lcPktData |= maskXFOO;
- * #if PACKETXFOO == PKEXT_RELATIVE
- * lc.lcPktMode |= maskXFOO;
- * #endif
- * #endif
- * WTOpen(hWnd, &lc, TRUE);
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* defined(__cplusplus) */
-
-#ifndef PACKETNAME
-/* if no packet name prefix */
-# define __PFX(x) x
-# define __IFX(x,y) x ## y
-#else
-/* add prefixes and infixes to packet format names */
-# define __PFX(x) __PFX2(PACKETNAME,x)
-# define __PFX2(p,x) __PFX3(p,x)
-# define __PFX3(p,x) p ## x
-# define __IFX(x,y) __IFX2(x,PACKETNAME,y)
-# define __IFX2(x,i,y) __IFX3(x,i,y)
-# define __IFX3(x,i,y) x ## i ## y
-#endif
-
-#define __SFX2(x,s) __SFX3(x,s)
-#define __SFX3(x,s) x ## s
-
-#define __TAG __IFX(tag,PACKET)
-#define __TYPES \
- __PFX(PACKET), * __IFX(P,PACKET), \
- * __IFX(NP,PACKET), * __IFX(LP,PACKET)
-
-#define __DATA (__PFX(PACKETDATA))
-#define __MODE (__PFX(PACKETMODE))
-#define __EXT(x) __SFX2(__PFX(PACKET),x)
-
-typedef struct __TAG {
-#if (__DATA & PK_CONTEXT)
- HCTX pkContext;
-#endif
-#if (__DATA & PK_STATUS)
- UINT pkStatus;
-#endif
-#if (__DATA & PK_TIME)
- DWORD pkTime;
-#endif
-#if (__DATA & PK_CHANGED)
- WTPKT pkChanged;
-#endif
-#if (__DATA & PK_SERIAL_NUMBER)
- UINT pkSerialNumber;
-#endif
-#if (__DATA & PK_CURSOR)
- UINT pkCursor;
-#endif
-#if (__DATA & PK_BUTTONS)
- DWORD pkButtons;
-#endif
-#if (__DATA & PK_X)
- LONG pkX;
-#endif
-#if (__DATA & PK_Y)
- LONG pkY;
-#endif
-#if (__DATA & PK_Z)
- LONG pkZ;
-#endif
-#if (__DATA & PK_NORMAL_PRESSURE)
-# if (__MODE & PK_NORMAL_PRESSURE)
- /* relative */
- int pkNormalPressure;
-# else
- /* absolute */
- UINT pkNormalPressure;
-# endif
-#endif
-#if (__DATA & PK_TANGENT_PRESSURE)
-# if (__MODE & PK_TANGENT_PRESSURE)
- /* relative */
- int pkTangentPressure;
-# else
- /* absolute */
- UINT pkTangentPressure;
-# endif
-#endif
-#if (__DATA & PK_ORIENTATION)
- ORIENTATION pkOrientation;
-#endif
-#if (__DATA & PK_ROTATION)
- ROTATION pkRotation; /* 1.1 */
-#endif
-
-#ifndef NOWTEXTENSIONS
- /* extensions begin here. */
-
-#if (__EXT(FKEYS) == PKEXT_RELATIVE) || (__EXT(FKEYS) == PKEXT_ABSOLUTE)
- UINT pkFKeys;
-#endif
-#if (__EXT(TILT) == PKEXT_RELATIVE) || (__EXT(TILT) == PKEXT_ABSOLUTE)
- TILT pkTilt;
-#endif
-
-#endif
-
-} __TYPES;
-
-#undef PACKETNAME
-#undef __TAG
-#undef __TAG2
-#undef __TYPES
-#undef __TYPES2
-#undef __DATA
-#undef __MODE
-#undef __PFX
-#undef __PFX2
-#undef __PFX3
-#undef __IFX
-#undef __IFX2
-#undef __IFX3
-#undef __SFX2
-#undef __SFX3
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif /* defined(__cplusplus) */
-
-#endif /* defined(__WINE_PKTDEF_H */
diff --git a/include/wintab.h b/include/wintab.h
index d10371b0217..056e4a332dd 100644
--- a/include/wintab.h
+++ b/include/wintab.h
@@ -462,8 +462,6 @@ DECL_WINELIB_TYPE_AW(LPLOGCONTEXT)
* EVENT DATA DEFS
*/
-/* For packet structure definition, see pktdef.h */
-
/* packet status values */
#define TPS_PROXIMITY 0x0001
#define TPS_QUEUE_ERR 0x0002
@@ -493,6 +491,23 @@ typedef struct tagROTATION { /* 1.1 */
#define TBN_UP 1
#define TBN_DOWN 2
+typedef struct tagPACKET {
+ HCTX pkContext;
+ UINT pkStatus;
+ LONG pkTime;
+ WTPKT pkChanged;
+ UINT pkSerialNumber;
+ UINT pkCursor;
+ DWORD pkButtons;
+ DWORD pkX;
+ DWORD pkY;
+ DWORD pkZ;
+ UINT pkNormalPressure;
+ UINT pkTangentPressure;
+ ORIENTATION pkOrientation;
+ ROTATION pkRotation; /* 1.1 */
+} PACKET, *LPPACKET;
+
/***********************************************************************
* DEVICE CONFIG CONSTANTS
*/
@@ -779,10 +794,80 @@ BOOL WINAPI WTMgrCsrPressureBtnMarksEx(HMGR, UINT, UINT *, UINT *);
#endif
+/***********************************************************************
+ * WACOM WINTAB EXTENSIONS TO SUPPORT CSR_TYPE
+ * In Wintab 1.2, a CSR_TYPE feature was added. This adds the
+ * ability to return a type of cursor on a tablet.
+ * Unfortunately, we cannot get the cursor type directly from X,
+ * and it is not specified directly anywhere. So we virtualize
+ * the type here. (This is unfortunate, the kernel module has
+ * the exact type, but we have no way of getting that module to
+ * pass us that type).
+ *
+ * Reference linuxwacom driver project wcmCommon.c function
+ * idtotype for a much larger list of CSR_TYPE.
+ *
+ * http://linuxwacom.cvs.sourceforge.net/linuxwacom/linuxwacom-prod/src/xdrv/w…
+ *
+ * The WTI_CURSORS_INFO.TYPE data is supposed to be used like this:
+ * (cursor.TYPE & 0x0F06) == target_cursor_type
+ * Reference: Section Unique ID
+ * http://www.wacomeng.com/devsupport/ibmpc/gddevpc.html
+ */
+#define CSR_TYPE_PEN 0x822
+#define CSR_TYPE_ERASER 0x82a
+#define CSR_TYPE_MOUSE_2D 0x007
+#define CSR_TYPE_MOUSE_4D 0x094
+/* CSR_TYPE_OTHER is a special value! assumed no real world significance
+ * if a stylus type or eraser type eventually have this value
+ * it'll be a bug. As of 2008 05 21 we can be sure because
+ * linux wacom lists all the known values and this isn't one of them */
+#define CSR_TYPE_OTHER 0x000
+
+/***********************************************************************
+ * WINE HELPER FUNCTIONS
+ */
+
+/* Helper for WTInfoW. It is valid to call WTInfoW with lpOutput == NULL, in
+ * in which case it must return the size of the data without copying anything.
+ * This function handles that case. */
+static inline int TABLET_CopyData(LPVOID target, LPCVOID src, INT size)
+{
+ if(target != NULL)
+ memcpy(target,src,size);
+ return(size);
+}
+
+/* Helpers for category. Though undocumented, negative indices are valid, and
+ * represent iterating the categories in reverse order. */
+#ifndef NOWTDEVICES
+static inline BOOL IS_WTI_DEVICES_TYPE(UINT wCategory){
+ return wCategory > WTI_DEVICES - 50 && wCategory <= WTI_DEVICES + 50;
+}
#endif
+#ifndef NOWTCURSORS
+static inline BOOL IS_WTI_CURSORS_TYPE(UINT wCategory){
+ return wCategory > WTI_CURSORS - 50 && wCategory <= WTI_CURSORS + 50;
+}
+#endif
+#ifndef NOWTEXTENSIONS
+static inline BOOL IS_WTI_EXTENSIONS_TYPE(UINT wCategory){
+ return wCategory > WTI_EXTENSIONS - 50 && wCategory <= WTI_EXTENSIONS + 50;
+}
+#endif
+#ifndef NOWTDEFCONTEXT
+static inline BOOL IS_WTI_DDCTXS_TYPE(UINT wCategory){
+ return wCategory > WTI_DDCTXS - 50 && wCategory <= WTI_DDCTXS + 50;
+}
+static inline BOOL IS_WTI_DSCTXS_TYPE(UINT wCategory){
+ return wCategory > WTI_DSCTXS - 50 && wCategory <= WTI_DSCTXS + 50;
+}
+#endif
+
+#endif /* !defined(NOWTFUNCTIONS) */
#ifdef __cplusplus
} /* extern "C" */
#endif /* defined(__cplusplus) */
-#endif /* defined(__WINE_WINTAB_H */
+#endif /* !defined(__WINE_WINTAB_H) */
diff --git a/tools/winapi/win32.api b/tools/winapi/win32.api
index 5f3dd85cc93..49116614a4b 100644
--- a/tools/winapi/win32.api
+++ b/tools/winapi/win32.api
@@ -5756,7 +5756,7 @@ LPPOINT
LPRECT
LPSIZE
LPVOID
-LPWTPACKET *
+LPPACKET *
MONITORENUMPROC
PIXELFORMATDESCRIPTOR *
POINT *
--
2.32.0 (Apple Git-132)
2
5
[PATCH resend 1/4] user32/tests: Add some optional messages to WmRestoreMinimizedSeq
by Alex Henrie 24 Mar '22
by Alex Henrie 24 Mar '22
24 Mar '22
Fixes a testbot failure.
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
---
dlls/user32/tests/msg.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index a2adf56565d..20e808cbffe 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -18619,7 +18619,11 @@ static const struct message WmRestoreMinimizedSeq[] =
{ WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED },
{ WM_MOVE, sent|defwinproc },
{ WM_SIZE, sent|defwinproc },
+ { WM_NCCALCSIZE, sent|wparam|defwinproc|optional, 1 }, /* 32-bit Vista sends it */
+ { WM_NCPAINT, sent|wparam|defwinproc|optional, 1 }, /* 32-bit Vista sends it */
+ { WM_ERASEBKGND, sent|defwinproc|optional }, /* 32-bit Vista sends it */
{ EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam|winevent_hook_todo, 0, 0 },
+ { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam|optional, 0, 0 }, /* 32-bit Vista sends it */
{ EVENT_SYSTEM_MINIMIZEEND, winevent_hook|wparam|lparam|winevent_hook_todo, 0, 0 },
{ WM_NCCALCSIZE, sent|wparam|defwinproc|optional, 1 },
{ WM_NCPAINT, sent|wparam|defwinproc|optional, 1 },
--
2.35.1
2
7
24 Mar '22
Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com>
---
dlls/ntdll/tests/wow64.c | 327 +++++++++++++++++++++++-----------------------
1 file changed, 164 insertions(+), 163 deletions(-)
diff --git a/dlls/ntdll/tests/wow64.c b/dlls/ntdll/tests/wow64.c
index 1c8ca28a999..702b2b4d771 100644
--- a/dlls/ntdll/tests/wow64.c
+++ b/dlls/ntdll/tests/wow64.c
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
#include "ntdll_test.h"
#include "winioctl.h"
@@ -78,8 +79,8 @@ static void test_process_architecture( HANDLE process, USHORT expect_machine, US
len = 0xdead;
status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process),
&buffer, sizeof(buffer), &len );
- ok( !status, "failed %x\n", status );
- ok( !(len & 3), "wrong len %x\n", len );
+ ok( !status, "failed %lx\n", status );
+ ok( !(len & 3), "wrong len %lx\n", len );
len /= sizeof(DWORD);
for (i = 0; i < len - 1; i++)
{
@@ -87,31 +88,31 @@ static void test_process_architecture( HANDLE process, USHORT expect_machine, US
USHORT machine = LOWORD(buffer[i]);
if (flags & 8)
- ok( machine == expect_machine, "wrong current machine %x\n", buffer[i]);
+ ok( machine == expect_machine, "wrong current machine %lx\n", buffer[i]);
else
- ok( machine != expect_machine, "wrong machine %x\n", buffer[i]);
+ ok( machine != expect_machine, "wrong machine %lx\n", buffer[i]);
/* FIXME: not quite sure what the other flags mean,
* observed on amd64 Windows: (flags & 7) == 7 for MACHINE_AMD64 and 2 for MACHINE_I386
*/
if (flags & 4)
- ok( machine == expect_native, "wrong native machine %x\n", buffer[i]);
+ ok( machine == expect_native, "wrong native machine %lx\n", buffer[i]);
else
- ok( machine != expect_native, "wrong machine %x\n", buffer[i]);
+ ok( machine != expect_native, "wrong machine %lx\n", buffer[i]);
}
ok( !buffer[i], "missing terminating null\n" );
len = i * sizeof(DWORD);
status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process),
&buffer, len, &len );
- ok( status == STATUS_BUFFER_TOO_SMALL, "failed %x\n", status );
- ok( len == (i + 1) * sizeof(DWORD), "wrong len %u\n", len );
+ ok( status == STATUS_BUFFER_TOO_SMALL, "failed %lx\n", status );
+ ok( len == (i + 1) * sizeof(DWORD), "wrong len %lu\n", len );
if (pRtlWow64GetProcessMachines)
{
USHORT current = 0xdead, native = 0xbeef;
status = pRtlWow64GetProcessMachines( process, ¤t, &native );
- ok( !status, "failed %x\n", status );
+ ok( !status, "failed %lx\n", status );
if (expect_machine == expect_native)
ok( current == 0, "wrong current machine %x / %x\n", current, expect_machine );
else
@@ -154,25 +155,25 @@ static void test_query_architectures(void)
win_skip( "SystemSupportedProcessorArchitectures not supported\n" );
return;
}
- ok( !status, "failed %x\n", status );
+ ok( !status, "failed %lx\n", status );
process = (HANDLE)0xdeadbeef;
status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process),
&buffer, sizeof(buffer), &len );
- ok( status == STATUS_INVALID_HANDLE, "failed %x\n", status );
+ ok( status == STATUS_INVALID_HANDLE, "failed %lx\n", status );
process = (HANDLE)0xdeadbeef;
status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, 3,
&buffer, sizeof(buffer), &len );
ok( status == STATUS_INVALID_PARAMETER || broken(status == STATUS_INVALID_HANDLE),
- "failed %x\n", status );
+ "failed %lx\n", status );
process = GetCurrentProcess();
status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, 3,
&buffer, sizeof(buffer), &len );
ok( status == STATUS_INVALID_PARAMETER || broken( status == STATUS_SUCCESS),
- "failed %x\n", status );
+ "failed %lx\n", status );
status = pNtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, NULL, 0,
&buffer, sizeof(buffer), &len );
- ok( status == STATUS_INVALID_PARAMETER, "failed %x\n", status );
+ ok( status == STATUS_INVALID_PARAMETER, "failed %lx\n", status );
test_process_architecture( GetCurrentProcess(), current_machine, native_machine );
test_process_architecture( 0, 0, native_machine );
@@ -203,24 +204,24 @@ static void test_query_architectures(void)
{
BOOLEAN ret = 0xcc;
status = pRtlWow64IsWowGuestMachineSupported( IMAGE_FILE_MACHINE_I386, &ret );
- ok( !status, "failed %x\n", status );
+ ok( !status, "failed %lx\n", status );
ok( ret == (native_machine == IMAGE_FILE_MACHINE_AMD64 ||
native_machine == IMAGE_FILE_MACHINE_ARM64), "wrong result %u\n", ret );
ret = 0xcc;
status = pRtlWow64IsWowGuestMachineSupported( IMAGE_FILE_MACHINE_ARMNT, &ret );
- ok( !status, "failed %x\n", status );
+ ok( !status, "failed %lx\n", status );
ok( ret == (native_machine == IMAGE_FILE_MACHINE_ARM64), "wrong result %u\n", ret );
ret = 0xcc;
status = pRtlWow64IsWowGuestMachineSupported( IMAGE_FILE_MACHINE_AMD64, &ret );
- ok( !status, "failed %x\n", status );
+ ok( !status, "failed %lx\n", status );
ok( !ret, "wrong result %u\n", ret );
ret = 0xcc;
status = pRtlWow64IsWowGuestMachineSupported( IMAGE_FILE_MACHINE_ARM64, &ret );
- ok( !status, "failed %x\n", status );
+ ok( !status, "failed %lx\n", status );
ok( !ret, "wrong result %u\n", ret );
ret = 0xcc;
status = pRtlWow64IsWowGuestMachineSupported( 0xdead, &ret );
- ok( !status, "failed %x\n", status );
+ ok( !status, "failed %lx\n", status );
ok( !ret, "wrong result %u\n", ret );
}
}
@@ -249,28 +250,28 @@ static void test_peb_teb(void)
{
memset( &info, 0xcc, sizeof(info) );
status = NtQueryInformationThread( pi.hThread, ThreadBasicInformation, &info, sizeof(info), NULL );
- ok( !status, "ThreadBasicInformation failed %x\n", status );
+ ok( !status, "ThreadBasicInformation failed %lx\n", status );
if (!ReadProcessMemory( pi.hProcess, info.TebBaseAddress, &teb, sizeof(teb), &res )) res = 0;
- ok( res == sizeof(teb), "wrong len %lx\n", res );
+ ok( res == sizeof(teb), "wrong len %Ix\n", res );
ok( teb.Tib.Self == info.TebBaseAddress, "wrong teb %p / %p\n", teb.Tib.Self, info.TebBaseAddress );
if (is_wow64)
{
ok( !!teb.GdiBatchCount, "GdiBatchCount not set\n" );
ok( (char *)info.TebBaseAddress + teb.WowTebOffset == ULongToPtr(teb.GdiBatchCount) ||
broken(!NtCurrentTeb()->WowTebOffset), /* pre-win10 */
- "wrong teb offset %d\n", teb.WowTebOffset );
+ "wrong teb offset %ld\n", teb.WowTebOffset );
}
else
{
ok( !teb.GdiBatchCount, "GdiBatchCount set\n" );
ok( teb.WowTebOffset == 0x2000 ||
broken( !teb.WowTebOffset || teb.WowTebOffset == 1 ), /* pre-win10 */
- "wrong teb offset %d\n", teb.WowTebOffset );
+ "wrong teb offset %ld\n", teb.WowTebOffset );
ok( (char *)teb.Tib.ExceptionList == (char *)info.TebBaseAddress + 0x2000,
"wrong Tib.ExceptionList %p / %p\n",
(char *)teb.Tib.ExceptionList, (char *)info.TebBaseAddress + 0x2000 );
if (!ReadProcessMemory( pi.hProcess, teb.Tib.ExceptionList, &teb32, sizeof(teb32), &res )) res = 0;
- ok( res == sizeof(teb32), "wrong len %lx\n", res );
+ ok( res == sizeof(teb32), "wrong len %Ix\n", res );
ok( (char *)ULongToPtr(teb32.Peb) == (char *)teb.Peb + 0x1000 ||
broken( ULongToPtr(teb32.Peb) != teb.Peb ), /* vista */
"wrong peb %p / %p\n", ULongToPtr(teb32.Peb), teb.Peb );
@@ -278,21 +279,21 @@ static void test_peb_teb(void)
status = NtQueryInformationProcess( pi.hProcess, ProcessBasicInformation,
&proc_info, sizeof(proc_info), NULL );
- ok( !status, "ProcessBasicInformation failed %x\n", status );
+ ok( !status, "ProcessBasicInformation failed %lx\n", status );
ok( proc_info.PebBaseAddress == teb.Peb, "wrong peb %p / %p\n", proc_info.PebBaseAddress, teb.Peb );
if (!ReadProcessMemory( pi.hProcess, proc_info.PebBaseAddress, &peb, sizeof(peb), &res )) res = 0;
- ok( res == sizeof(peb), "wrong len %lx\n", res );
+ ok( res == sizeof(peb), "wrong len %Ix\n", res );
ok( !peb.BeingDebugged, "BeingDebugged is %u\n", peb.BeingDebugged );
if (!is_wow64)
{
if (!ReadProcessMemory( pi.hProcess, ULongToPtr(teb32.Peb), &peb32, sizeof(peb32), &res )) res = 0;
- ok( res == sizeof(peb32), "wrong len %lx\n", res );
+ ok( res == sizeof(peb32), "wrong len %Ix\n", res );
ok( !peb32.BeingDebugged, "BeingDebugged is %u\n", peb32.BeingDebugged );
}
if (!ReadProcessMemory( pi.hProcess, peb.ProcessParameters, ¶ms, sizeof(params), &res )) res = 0;
- ok( res == sizeof(params), "wrong len %lx\n", res );
+ ok( res == sizeof(params), "wrong len %Ix\n", res );
#define CHECK_STR(name) \
ok( (char *)params.name.Buffer >= (char *)peb.ProcessParameters && \
(char *)params.name.Buffer < (char *)peb.ProcessParameters + params.Size, \
@@ -309,11 +310,11 @@ static void test_peb_teb(void)
ok( peb32.ProcessParameters && ULongToPtr(peb32.ProcessParameters) != peb.ProcessParameters,
"wrong ptr32 %p / %p\n", ULongToPtr(peb32.ProcessParameters), peb.ProcessParameters );
if (!ReadProcessMemory( pi.hProcess, ULongToPtr(peb32.ProcessParameters), ¶ms32, sizeof(params32), &res )) res = 0;
- ok( res == sizeof(params32), "wrong len %lx\n", res );
+ ok( res == sizeof(params32), "wrong len %Ix\n", res );
#define CHECK_STR(name) \
ok( ULongToPtr(params32.name.Buffer) >= ULongToPtr(peb32.ProcessParameters) && \
ULongToPtr(params32.name.Buffer) < ULongToPtr(peb32.ProcessParameters + params32.Size), \
- "wrong " #name " ptr %x / %x-%x\n", params32.name.Buffer, peb32.ProcessParameters, \
+ "wrong " #name " ptr %lx / %lx-%lx\n", params32.name.Buffer, peb32.ProcessParameters, \
peb32.ProcessParameters + params.Size ); \
ok( params32.name.Length == params.name.Length, "wrong " #name "len %u / %u\n", \
params32.name.Length, params.name.Length )
@@ -323,19 +324,19 @@ static void test_peb_teb(void)
CHECK_STR( Desktop );
CHECK_STR( ShellInfo );
#undef CHECK_STR
- ok( params32.EnvironmentSize == params.EnvironmentSize, "wrong size %u / %lu\n",
+ ok( params32.EnvironmentSize == params.EnvironmentSize, "wrong size %lu / %Iu\n",
params32.EnvironmentSize, params.EnvironmentSize );
}
ret = DebugActiveProcess( pi.dwProcessId );
ok( ret, "debugging failed\n" );
if (!ReadProcessMemory( pi.hProcess, proc_info.PebBaseAddress, &peb, sizeof(peb), &res )) res = 0;
- ok( res == sizeof(peb), "wrong len %lx\n", res );
+ ok( res == sizeof(peb), "wrong len %Ix\n", res );
ok( peb.BeingDebugged == !!ret, "BeingDebugged is %u\n", peb.BeingDebugged );
if (!is_wow64)
{
if (!ReadProcessMemory( pi.hProcess, ULongToPtr(teb32.Peb), &peb32, sizeof(peb32), &res )) res = 0;
- ok( res == sizeof(peb32), "wrong len %lx\n", res );
+ ok( res == sizeof(peb32), "wrong len %Ix\n", res );
ok( peb32.BeingDebugged == !!ret, "BeingDebugged is %u\n", peb32.BeingDebugged );
}
@@ -349,22 +350,22 @@ static void test_peb_teb(void)
{
memset( &info, 0xcc, sizeof(info) );
status = NtQueryInformationThread( pi.hThread, ThreadBasicInformation, &info, sizeof(info), NULL );
- ok( !status, "ThreadBasicInformation failed %x\n", status );
+ ok( !status, "ThreadBasicInformation failed %lx\n", status );
if (!is_wow64)
{
if (!ReadProcessMemory( pi.hProcess, info.TebBaseAddress, &teb, sizeof(teb), &res )) res = 0;
- ok( res == sizeof(teb), "wrong len %lx\n", res );
+ ok( res == sizeof(teb), "wrong len %Ix\n", res );
ok( teb.Tib.Self == info.TebBaseAddress, "wrong teb %p / %p\n",
teb.Tib.Self, info.TebBaseAddress );
ok( !teb.GdiBatchCount, "GdiBatchCount set\n" );
ok( !teb.WowTebOffset || broken( teb.WowTebOffset == 1 ), /* vista */
- "wrong teb offset %d\n", teb.WowTebOffset );
+ "wrong teb offset %ld\n", teb.WowTebOffset );
}
else ok( !info.TebBaseAddress, "got teb %p\n", info.TebBaseAddress );
status = NtQueryInformationProcess( pi.hProcess, ProcessBasicInformation,
&proc_info, sizeof(proc_info), NULL );
- ok( !status, "ProcessBasicInformation failed %x\n", status );
+ ok( !status, "ProcessBasicInformation failed %lx\n", status );
if (is_wow64)
ok( !proc_info.PebBaseAddress ||
broken( (char *)proc_info.PebBaseAddress >= (char *)0x7f000000 ), /* vista */
@@ -389,13 +390,13 @@ static void test_peb_teb(void)
ok( !!teb64, "GdiBatchCount not set\n" );
ok( (char *)NtCurrentTeb() + NtCurrentTeb()->WowTebOffset == (char *)teb64 ||
broken(!NtCurrentTeb()->WowTebOffset), /* pre-win10 */
- "wrong WowTebOffset %x (%p/%p)\n", NtCurrentTeb()->WowTebOffset, teb64, NtCurrentTeb() );
+ "wrong WowTebOffset %lx (%p/%p)\n", NtCurrentTeb()->WowTebOffset, teb64, NtCurrentTeb() );
ok( (char *)teb64 + 0x2000 == (char *)NtCurrentTeb(), "unexpected diff %p / %p\n",
teb64, NtCurrentTeb() );
ok( (char *)teb64 + teb64->WowTebOffset == (char *)NtCurrentTeb() ||
broken( !teb64->WowTebOffset || teb64->WowTebOffset == 1 ), /* pre-win10 */
- "wrong WowTebOffset %x (%p/%p)\n", teb64->WowTebOffset, teb64, NtCurrentTeb() );
- ok( !teb64->GdiBatchCount, "GdiBatchCount set %x\n", teb64->GdiBatchCount );
+ "wrong WowTebOffset %lx (%p/%p)\n", teb64->WowTebOffset, teb64, NtCurrentTeb() );
+ ok( !teb64->GdiBatchCount, "GdiBatchCount set %lx\n", teb64->GdiBatchCount );
ok( teb64->Tib.ExceptionList == PtrToUlong( NtCurrentTeb() ), "wrong Tib.ExceptionList %s / %p\n",
wine_dbgstr_longlong(teb64->Tib.ExceptionList), NtCurrentTeb() );
ok( teb64->Tib.Self == PtrToUlong( teb64 ), "wrong Tib.Self %s / %p\n",
@@ -403,24 +404,24 @@ static void test_peb_teb(void)
ok( teb64->StaticUnicodeString.Buffer == PtrToUlong( teb64->StaticUnicodeBuffer ),
"wrong StaticUnicodeString %s / %p\n",
wine_dbgstr_longlong(teb64->StaticUnicodeString.Buffer), teb64->StaticUnicodeBuffer );
- ok( teb64->ClientId.UniqueProcess == GetCurrentProcessId(), "wrong pid %s / %x\n",
+ ok( teb64->ClientId.UniqueProcess == GetCurrentProcessId(), "wrong pid %s / %lx\n",
wine_dbgstr_longlong(teb64->ClientId.UniqueProcess), GetCurrentProcessId() );
- ok( teb64->ClientId.UniqueThread == GetCurrentThreadId(), "wrong tid %s / %x\n",
+ ok( teb64->ClientId.UniqueThread == GetCurrentThreadId(), "wrong tid %s / %lx\n",
wine_dbgstr_longlong(teb64->ClientId.UniqueThread), GetCurrentThreadId() );
peb64 = ULongToPtr( teb64->Peb );
ok( peb64->ImageBaseAddress == PtrToUlong( NtCurrentTeb()->Peb->ImageBaseAddress ),
"wrong ImageBaseAddress %s / %p\n",
wine_dbgstr_longlong(peb64->ImageBaseAddress), NtCurrentTeb()->Peb->ImageBaseAddress);
- ok( peb64->OSBuildNumber == NtCurrentTeb()->Peb->OSBuildNumber, "wrong OSBuildNumber %x / %x\n",
+ ok( peb64->OSBuildNumber == NtCurrentTeb()->Peb->OSBuildNumber, "wrong OSBuildNumber %lx / %lx\n",
peb64->OSBuildNumber, NtCurrentTeb()->Peb->OSBuildNumber );
- ok( peb64->OSPlatformId == NtCurrentTeb()->Peb->OSPlatformId, "wrong OSPlatformId %x / %x\n",
+ ok( peb64->OSPlatformId == NtCurrentTeb()->Peb->OSPlatformId, "wrong OSPlatformId %lx / %lx\n",
peb64->OSPlatformId, NtCurrentTeb()->Peb->OSPlatformId );
return;
}
#endif
- ok( !NtCurrentTeb()->GdiBatchCount, "GdiBatchCount set to %x\n", NtCurrentTeb()->GdiBatchCount );
+ ok( !NtCurrentTeb()->GdiBatchCount, "GdiBatchCount set to %lx\n", NtCurrentTeb()->GdiBatchCount );
ok( !NtCurrentTeb()->WowTebOffset || broken( NtCurrentTeb()->WowTebOffset == 1 ), /* vista */
- "WowTebOffset set to %x\n", NtCurrentTeb()->WowTebOffset );
+ "WowTebOffset set to %lx\n", NtCurrentTeb()->WowTebOffset );
}
static void test_selectors(void)
@@ -457,25 +458,25 @@ static void test_selectors(void)
NtQueryInformationThread( GetCurrentThread(), ThreadDescriptorTableEntry, info, size, ret )
#endif
- trace( "cs %04x ss %04x fs %04x\n", context.SegCs, context.SegSs, context.SegFs );
+ trace( "cs %04lx ss %04lx fs %04lx\n", context.SegCs, context.SegSs, context.SegFs );
retlen = 0xdeadbeef;
info.Selector = 0;
status = GET_ENTRY( &info, sizeof(info) - 1, &retlen );
- ok( status == STATUS_INFO_LENGTH_MISMATCH, "wrong status %x\n", status );
- ok( retlen == 0xdeadbeef, "len set %u\n", retlen );
+ ok( status == STATUS_INFO_LENGTH_MISMATCH, "wrong status %lx\n", status );
+ ok( retlen == 0xdeadbeef, "len set %lu\n", retlen );
retlen = 0xdeadbeef;
status = GET_ENTRY( &info, sizeof(info) + 1, &retlen );
- ok( status == STATUS_INFO_LENGTH_MISMATCH, "wrong status %x\n", status );
- ok( retlen == 0xdeadbeef, "len set %u\n", retlen );
+ ok( status == STATUS_INFO_LENGTH_MISMATCH, "wrong status %lx\n", status );
+ ok( retlen == 0xdeadbeef, "len set %lu\n", retlen );
retlen = 0xdeadbeef;
status = GET_ENTRY( NULL, 0, &retlen );
- ok( status == STATUS_INFO_LENGTH_MISMATCH, "wrong status %x\n", status );
- ok( retlen == 0xdeadbeef, "len set %u\n", retlen );
+ ok( status == STATUS_INFO_LENGTH_MISMATCH, "wrong status %lx\n", status );
+ ok( retlen == 0xdeadbeef, "len set %lu\n", retlen );
status = GET_ENTRY( &info, sizeof(info), NULL );
- ok( !status, "wrong status %x\n", status );
+ ok( !status, "wrong status %lx\n", status );
for (info.Selector = 0; info.Selector < 0x100; info.Selector++)
{
@@ -489,19 +490,19 @@ static void test_selectors(void)
if (sel == 0x03) /* null selector */
{
- ok( !status, "wrong status %x\n", status );
- ok( retlen == sizeof(info.Entry), "len set %u\n", retlen );
- ok( !base, "wrong base %x\n", base );
- ok( !limit, "wrong limit %x\n", limit );
+ ok( !status, "wrong status %lx\n", status );
+ ok( retlen == sizeof(info.Entry), "len set %lu\n", retlen );
+ ok( !base, "wrong base %lx\n", base );
+ ok( !limit, "wrong limit %lx\n", limit );
ok( !info.Entry.HighWord.Bytes.Flags1, "wrong flags1 %x\n", info.Entry.HighWord.Bytes.Flags1 );
ok( !info.Entry.HighWord.Bytes.Flags2, "wrong flags2 %x\n", info.Entry.HighWord.Bytes.Flags2 );
}
else if (sel == context.SegCs) /* 32-bit code selector */
{
- ok( !status, "wrong status %x\n", status );
- ok( retlen == sizeof(info.Entry), "len set %u\n", retlen );
- ok( !base, "wrong base %x\n", base );
- ok( limit == 0xfffff, "wrong limit %x\n", limit );
+ ok( !status, "wrong status %lx\n", status );
+ ok( retlen == sizeof(info.Entry), "len set %lu\n", retlen );
+ ok( !base, "wrong base %lx\n", base );
+ ok( limit == 0xfffff, "wrong limit %lx\n", limit );
ok( info.Entry.HighWord.Bits.Type == 0x1b, "wrong type %x\n", info.Entry.HighWord.Bits.Type );
ok( info.Entry.HighWord.Bits.Dpl == 3, "wrong dpl %x\n", info.Entry.HighWord.Bits.Dpl );
ok( info.Entry.HighWord.Bits.Pres, "wrong pres\n" );
@@ -511,10 +512,10 @@ static void test_selectors(void)
}
else if (sel == context.SegSs) /* 32-bit data selector */
{
- ok( !status, "wrong status %x\n", status );
- ok( retlen == sizeof(info.Entry), "len set %u\n", retlen );
- ok( !base, "wrong base %x\n", base );
- ok( limit == 0xfffff, "wrong limit %x\n", limit );
+ ok( !status, "wrong status %lx\n", status );
+ ok( retlen == sizeof(info.Entry), "len set %lu\n", retlen );
+ ok( !base, "wrong base %lx\n", base );
+ ok( limit == 0xfffff, "wrong limit %lx\n", limit );
ok( info.Entry.HighWord.Bits.Type == 0x13, "wrong type %x\n", info.Entry.HighWord.Bits.Type );
ok( info.Entry.HighWord.Bits.Dpl == 3, "wrong dpl %x\n", info.Entry.HighWord.Bits.Dpl );
ok( info.Entry.HighWord.Bits.Pres, "wrong pres\n" );
@@ -524,17 +525,17 @@ static void test_selectors(void)
}
else if (sel == context.SegFs) /* TEB selector */
{
- ok( !status, "wrong status %x\n", status );
- ok( retlen == sizeof(info.Entry), "len set %u\n", retlen );
+ ok( !status, "wrong status %lx\n", status );
+ ok( retlen == sizeof(info.Entry), "len set %lu\n", retlen );
#ifdef _WIN64
if (NtCurrentTeb()->WowTebOffset == 0x2000)
- ok( base == (ULONG_PTR)NtCurrentTeb() + 0x2000, "wrong base %x / %p\n",
+ ok( base == (ULONG_PTR)NtCurrentTeb() + 0x2000, "wrong base %lx / %p\n",
base, NtCurrentTeb() );
#else
- ok( base == (ULONG_PTR)NtCurrentTeb(), "wrong base %x / %p\n", base, NtCurrentTeb() );
+ ok( base == (ULONG_PTR)NtCurrentTeb(), "wrong base %lx / %p\n", base, NtCurrentTeb() );
#endif
ok( limit == 0xfff || broken(limit == 0x4000), /* <= win8 */
- "wrong limit %x\n", limit );
+ "wrong limit %lx\n", limit );
ok( info.Entry.HighWord.Bits.Type == 0x13, "wrong type %x\n", info.Entry.HighWord.Bits.Type );
ok( info.Entry.HighWord.Bits.Dpl == 3, "wrong dpl %x\n", info.Entry.HighWord.Bits.Dpl );
ok( info.Entry.HighWord.Bits.Pres, "wrong pres\n" );
@@ -544,8 +545,8 @@ static void test_selectors(void)
}
else if (!status)
{
- ok( retlen == sizeof(info.Entry), "len set %u\n", retlen );
- trace( "succeeded for %x base %x limit %x type %x\n",
+ ok( retlen == sizeof(info.Entry), "len set %lu\n", retlen );
+ trace( "succeeded for %lx base %lx limit %lx type %x\n",
sel, base, limit, info.Entry.HighWord.Bits.Type );
}
else
@@ -553,8 +554,8 @@ static void test_selectors(void)
ok( status == STATUS_UNSUCCESSFUL ||
((sel & 4) && (status == STATUS_NO_LDT)) ||
broken( status == STATUS_ACCESS_VIOLATION), /* <= win8 */
- "%x: wrong status %x\n", info.Selector, status );
- ok( retlen == 0xdeadbeef, "len set %u\n", retlen );
+ "%lx: wrong status %lx\n", info.Selector, status );
+ ok( retlen == 0xdeadbeef, "len set %lu\n", retlen );
}
}
#undef GET_ENTRY
@@ -595,18 +596,18 @@ static void test_cpu_area(void)
cpu->Flags = 0;
cpu->Machine = tests[i].machine;
status = pRtlWow64GetCpuAreaInfo( cpu, 0, &info );
- ok( status == tests[i].expect, "%u:%u: failed %x\n", i, j, status );
+ ok( status == tests[i].expect, "%lu:%lu: failed %lx\n", i, j, status );
if (status) continue;
- ok( info.Context == ALIGN( cpu + 1, tests[i].align ), "%u:%u: wrong offset %u\n",
+ ok( info.Context == ALIGN( cpu + 1, tests[i].align ), "%lu:%lu: wrong offset %lu\n",
i, j, (ULONG)((char *)info.Context - (char *)cpu) );
ok( info.ContextEx == ALIGN( (char *)info.Context + tests[i].size, sizeof(void*) ),
- "%u:%u: wrong ex offset %u\n", i, j, (ULONG)((char *)info.ContextEx - (char *)cpu) );
+ "%lu:%lu: wrong ex offset %lu\n", i, j, (ULONG)((char *)info.ContextEx - (char *)cpu) );
ok( info.ContextFlagsLocation == (char *)info.Context + tests[i].offset,
- "%u:%u: wrong flags offset %u\n",
+ "%lu:%lu: wrong flags offset %lu\n",
i, j, (ULONG)((char *)info.ContextFlagsLocation - (char *)info.Context) );
- ok( info.CpuReserved == cpu, "%u:%u: wrong cpu %p / %p\n", i, j, info.CpuReserved, cpu );
- ok( info.ContextFlag == tests[i].flag, "%u:%u: wrong flag %08x\n", i, j, info.ContextFlag );
- ok( info.Machine == tests[i].machine, "%u:%u: wrong machine %x\n", i, j, info.Machine );
+ ok( info.CpuReserved == cpu, "%lu:%lu: wrong cpu %p / %p\n", i, j, info.CpuReserved, cpu );
+ ok( info.ContextFlag == tests[i].flag, "%lu:%lu: wrong flag %08lx\n", i, j, info.ContextFlag );
+ ok( info.Machine == tests[i].machine, "%lu:%lu: wrong machine %x\n", i, j, info.Machine );
}
}
#undef ALIGN
@@ -688,22 +689,22 @@ static void enum_modules64( void (*func)(ULONG64,const WCHAR *) )
HANDLE process;
process = OpenProcess( PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId() );
- ok( process != 0, "failed to open current process %u\n", GetLastError() );
+ ok( process != 0, "failed to open current process %lu\n", GetLastError() );
status = pNtWow64ReadVirtualMemory64( process, teb64->Peb, &peb64, sizeof(peb64), NULL );
- ok( !status, "NtWow64ReadVirtualMemory64 failed %x\n", status );
+ ok( !status, "NtWow64ReadVirtualMemory64 failed %lx\n", status );
todo_wine
ok( peb64.LdrData, "LdrData not initialized\n" );
if (!peb64.LdrData) goto done;
status = pNtWow64ReadVirtualMemory64( process, peb64.LdrData, &ldr, sizeof(ldr), NULL );
- ok( !status, "NtWow64ReadVirtualMemory64 failed %x\n", status );
+ ok( !status, "NtWow64ReadVirtualMemory64 failed %lx\n", status );
ptr = ldr.InLoadOrderModuleList.Flink;
for (;;)
{
WCHAR buffer[256];
status = pNtWow64ReadVirtualMemory64( process, ptr, &entry, sizeof(entry), NULL );
- ok( !status, "NtWow64ReadVirtualMemory64 failed %x\n", status );
+ ok( !status, "NtWow64ReadVirtualMemory64 failed %lx\n", status );
status = pNtWow64ReadVirtualMemory64( process, entry.BaseDllName.Buffer, buffer, sizeof(buffer), NULL );
- ok( !status, "NtWow64ReadVirtualMemory64 failed %x\n", status );
+ ok( !status, "NtWow64ReadVirtualMemory64 failed %lx\n", status );
if (status) break;
func( entry.DllBase, buffer );
ptr = entry.InLoadOrderLinks.Flink;
@@ -727,30 +728,30 @@ static ULONG64 get_proc_address64( ULONG64 module, const char *name )
if (!module) return 0;
process = OpenProcess( PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId() );
- ok( process != 0, "failed to open current process %u\n", GetLastError() );
+ ok( process != 0, "failed to open current process %lu\n", GetLastError() );
status = pNtWow64ReadVirtualMemory64( process, module, &dos, sizeof(dos), NULL );
- ok( !status, "NtWow64ReadVirtualMemory64 failed %x\n", status );
+ ok( !status, "NtWow64ReadVirtualMemory64 failed %lx\n", status );
status = pNtWow64ReadVirtualMemory64( process, module + dos.e_lfanew, &nt, sizeof(nt), NULL );
- ok( !status, "NtWow64ReadVirtualMemory64 failed %x\n", status );
+ ok( !status, "NtWow64ReadVirtualMemory64 failed %lx\n", status );
status = pNtWow64ReadVirtualMemory64( process, module + nt.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress,
&exports, sizeof(exports), NULL );
- ok( !status, "NtWow64ReadVirtualMemory64 failed %x\n", status );
+ ok( !status, "NtWow64ReadVirtualMemory64 failed %lx\n", status );
names = calloc( exports.NumberOfNames, sizeof(*names) );
ordinals = calloc( exports.NumberOfNames, sizeof(*ordinals) );
funcs = calloc( exports.NumberOfFunctions, sizeof(*funcs) );
status = pNtWow64ReadVirtualMemory64( process, module + exports.AddressOfNames,
names, exports.NumberOfNames * sizeof(*names), NULL );
- ok( !status, "NtWow64ReadVirtualMemory64 failed %x\n", status );
+ ok( !status, "NtWow64ReadVirtualMemory64 failed %lx\n", status );
status = pNtWow64ReadVirtualMemory64( process, module + exports.AddressOfNameOrdinals,
ordinals, exports.NumberOfNames * sizeof(*ordinals), NULL );
- ok( !status, "NtWow64ReadVirtualMemory64 failed %x\n", status );
+ ok( !status, "NtWow64ReadVirtualMemory64 failed %lx\n", status );
status = pNtWow64ReadVirtualMemory64( process, module + exports.AddressOfFunctions,
funcs, exports.NumberOfFunctions * sizeof(*funcs), NULL );
- ok( !status, "NtWow64ReadVirtualMemory64 failed %x\n", status );
+ ok( !status, "NtWow64ReadVirtualMemory64 failed %lx\n", status );
for (i = 0; i < exports.NumberOfNames && !ret; i++)
{
status = pNtWow64ReadVirtualMemory64( process, module + names[i], buffer, sizeof(buffer), NULL );
- ok( !status, "NtWow64ReadVirtualMemory64 failed %x\n", status );
+ ok( !status, "NtWow64ReadVirtualMemory64 failed %lx\n", status );
if (!strcmp( buffer, name )) ret = module + funcs[ordinals[i]];
}
free( funcs );
@@ -805,24 +806,24 @@ static void test_nt_wow64(void)
ULONG64 res;
HANDLE process = OpenProcess( PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId() );
- ok( process != 0, "failed to open current process %u\n", GetLastError() );
+ ok( process != 0, "failed to open current process %lu\n", GetLastError() );
if (pNtWow64ReadVirtualMemory64)
{
status = pNtWow64ReadVirtualMemory64( process, (ULONG_PTR)str, buffer, sizeof(str), &res );
- ok( !status, "NtWow64ReadVirtualMemory64 failed %x\n", status );
+ ok( !status, "NtWow64ReadVirtualMemory64 failed %lx\n", status );
ok( res == sizeof(str), "wrong size %s\n", wine_dbgstr_longlong(res) );
ok( !strcmp( buffer, str ), "wrong data %s\n", debugstr_a(buffer) );
status = pNtWow64WriteVirtualMemory64( process, (ULONG_PTR)buffer, " bye ", 5, &res );
- ok( !status, "NtWow64WriteVirtualMemory64 failed %x\n", status );
+ ok( !status, "NtWow64WriteVirtualMemory64 failed %lx\n", status );
ok( res == 5, "wrong size %s\n", wine_dbgstr_longlong(res) );
ok( !strcmp( buffer, " bye wow64" ), "wrong data %s\n", debugstr_a(buffer) );
/* current process pseudo-handle is broken on some Windows versions */
status = pNtWow64ReadVirtualMemory64( GetCurrentProcess(), (ULONG_PTR)str, buffer, sizeof(str), &res );
ok( !status || broken( status == STATUS_INVALID_HANDLE ),
- "NtWow64ReadVirtualMemory64 failed %x\n", status );
+ "NtWow64ReadVirtualMemory64 failed %lx\n", status );
status = pNtWow64WriteVirtualMemory64( GetCurrentProcess(), (ULONG_PTR)buffer, " bye ", 5, &res );
ok( !status || broken( status == STATUS_INVALID_HANDLE ),
- "NtWow64WriteVirtualMemory64 failed %x\n", status );
+ "NtWow64WriteVirtualMemory64 failed %lx\n", status );
}
else win_skip( "NtWow64ReadVirtualMemory64 not supported\n" );
@@ -833,48 +834,48 @@ static void test_nt_wow64(void)
status = pNtWow64AllocateVirtualMemory64( process, &ptr, 0, &size,
MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE );
- ok( !status, "NtWow64AllocateVirtualMemory64 failed %x\n", status );
+ ok( !status, "NtWow64AllocateVirtualMemory64 failed %lx\n", status );
ok( ptr, "ptr not set\n" );
ok( size == 0x3000, "size not set %s\n", wine_dbgstr_longlong(size) );
ptr += 0x1000;
status = pNtWow64AllocateVirtualMemory64( process, &ptr, 0, &size,
MEM_RESERVE | MEM_COMMIT, PAGE_READONLY );
- ok( status == STATUS_CONFLICTING_ADDRESSES, "NtWow64AllocateVirtualMemory64 failed %x\n", status );
+ ok( status == STATUS_CONFLICTING_ADDRESSES, "NtWow64AllocateVirtualMemory64 failed %lx\n", status );
ptr = 0;
size = 0;
status = pNtWow64AllocateVirtualMemory64( process, &ptr, 0, &size,
MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE );
ok( status == STATUS_INVALID_PARAMETER || status == STATUS_INVALID_PARAMETER_4,
- "NtWow64AllocateVirtualMemory64 failed %x\n", status );
+ "NtWow64AllocateVirtualMemory64 failed %lx\n", status );
size = 0x1000;
status = pNtWow64AllocateVirtualMemory64( process, &ptr, 22, &size,
MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE );
ok( status == STATUS_INVALID_PARAMETER || status == STATUS_INVALID_PARAMETER_3,
- "NtWow64AllocateVirtualMemory64 failed %x\n", status );
+ "NtWow64AllocateVirtualMemory64 failed %lx\n", status );
status = pNtWow64AllocateVirtualMemory64( process, &ptr, 33, &size,
MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE );
ok( status == STATUS_INVALID_PARAMETER || status == STATUS_INVALID_PARAMETER_3,
- "NtWow64AllocateVirtualMemory64 failed %x\n", status );
+ "NtWow64AllocateVirtualMemory64 failed %lx\n", status );
status = pNtWow64AllocateVirtualMemory64( process, &ptr, 0x3fffffff, &size,
MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE );
todo_wine_if( !is_wow64 )
- ok( !status, "NtWow64AllocateVirtualMemory64 failed %x\n", status );
+ ok( !status, "NtWow64AllocateVirtualMemory64 failed %lx\n", status );
ok( ptr < 0x40000000, "got wrong ptr %s\n", wine_dbgstr_longlong(ptr) );
if (!status && pNtWow64WriteVirtualMemory64)
{
status = pNtWow64WriteVirtualMemory64( process, ptr, str, sizeof(str), &res );
- ok( !status, "NtWow64WriteVirtualMemory64 failed %x\n", status );
+ ok( !status, "NtWow64WriteVirtualMemory64 failed %lx\n", status );
ok( res == sizeof(str), "wrong size %s\n", wine_dbgstr_longlong(res) );
ok( !strcmp( (char *)(ULONG_PTR)ptr, str ), "wrong data %s\n",
debugstr_a((char *)(ULONG_PTR)ptr) );
ptr = 0;
status = pNtWow64AllocateVirtualMemory64( process, &ptr, 0, &size,
MEM_RESERVE | MEM_COMMIT, PAGE_READONLY );
- ok( !status, "NtWow64AllocateVirtualMemory64 failed %x\n", status );
+ ok( !status, "NtWow64AllocateVirtualMemory64 failed %lx\n", status );
status = pNtWow64WriteVirtualMemory64( process, ptr, str, sizeof(str), &res );
todo_wine
ok( status == STATUS_PARTIAL_COPY || broken( status == STATUS_ACCESS_VIOLATION ),
- "NtWow64WriteVirtualMemory64 failed %x\n", status );
+ "NtWow64WriteVirtualMemory64 failed %lx\n", status );
todo_wine
ok( !res || broken(res) /* win10 1709 */, "wrong size %s\n", wine_dbgstr_longlong(res) );
}
@@ -883,14 +884,14 @@ static void test_nt_wow64(void)
MEM_RESERVE | MEM_COMMIT, PAGE_READONLY );
todo_wine
ok( !status || broken( status == STATUS_CONFLICTING_ADDRESSES ),
- "NtWow64AllocateVirtualMemory64 failed %x\n", status );
+ "NtWow64AllocateVirtualMemory64 failed %lx\n", status );
if (!status) ok( ptr == 0x9876540000ull || broken(ptr == 0x76540000), /* win 8.1 */
"wrong ptr %s\n", wine_dbgstr_longlong(ptr) );
ptr = 0;
status = pNtWow64AllocateVirtualMemory64( GetCurrentProcess(), &ptr, 0, &size,
MEM_RESERVE | MEM_COMMIT, PAGE_READONLY );
ok( !status || broken( status == STATUS_INVALID_HANDLE ),
- "NtWow64AllocateVirtualMemory64 failed %x\n", status );
+ "NtWow64AllocateVirtualMemory64 failed %lx\n", status );
}
else win_skip( "NtWow64AllocateVirtualMemory64 not supported\n" );
@@ -901,13 +902,13 @@ static void test_nt_wow64(void)
memset( &sbi, 0xcc, sizeof(sbi) );
status = pNtQuerySystemInformation( SystemBasicInformation, &sbi, sizeof(sbi), &len );
- ok( status == STATUS_SUCCESS, "failed %x\n", status );
- ok( len == sizeof(sbi), "wrong length %d\n", len );
+ ok( status == STATUS_SUCCESS, "failed %lx\n", status );
+ ok( len == sizeof(sbi), "wrong length %ld\n", len );
memset( &sbi2, 0xcc, sizeof(sbi2) );
status = pRtlGetNativeSystemInformation( SystemBasicInformation, &sbi2, sizeof(sbi2), &len );
- ok( status == STATUS_SUCCESS, "failed %x\n", status );
- ok( len == sizeof(sbi2), "wrong length %d\n", len );
+ ok( status == STATUS_SUCCESS, "failed %lx\n", status );
+ ok( len == sizeof(sbi2), "wrong length %ld\n", len );
ok( sbi.HighestUserAddress == (void *)0x7ffeffff, "wrong limit %p\n", sbi.HighestUserAddress);
todo_wine_if( is_wow64 )
@@ -916,15 +917,15 @@ static void test_nt_wow64(void)
memset( &sbi3, 0xcc, sizeof(sbi3) );
status = pNtWow64GetNativeSystemInformation( SystemBasicInformation, &sbi3, sizeof(sbi3), &len );
- ok( status == STATUS_SUCCESS, "failed %x\n", status );
- ok( len == sizeof(sbi3), "wrong length %d\n", len );
+ ok( status == STATUS_SUCCESS, "failed %lx\n", status );
+ ok( len == sizeof(sbi3), "wrong length %ld\n", len );
ok( !memcmp( &sbi2, &sbi3, offsetof(SYSTEM_BASIC_INFORMATION,NumberOfProcessors)+1 ),
"info is different\n" );
memset( &sbi3, 0xcc, sizeof(sbi3) );
status = pNtWow64GetNativeSystemInformation( SystemEmulationBasicInformation, &sbi3, sizeof(sbi3), &len );
- ok( status == STATUS_SUCCESS, "failed %x\n", status );
- ok( len == sizeof(sbi3), "wrong length %d\n", len );
+ ok( status == STATUS_SUCCESS, "failed %lx\n", status );
+ ok( len == sizeof(sbi3), "wrong length %ld\n", len );
ok( !memcmp( &sbi, &sbi3, offsetof(SYSTEM_BASIC_INFORMATION,NumberOfProcessors)+1 ),
"info is different\n" );
@@ -936,21 +937,21 @@ static void test_nt_wow64(void)
{
case SystemNativeBasicInformation:
ok( status == STATUS_INVALID_INFO_CLASS || status == STATUS_INFO_LENGTH_MISMATCH ||
- broken(status == STATUS_NOT_IMPLEMENTED) /* vista */, "%u: %x / %x\n", i, status, expect );
+ broken(status == STATUS_NOT_IMPLEMENTED) /* vista */, "%lu: %lx / %lx\n", i, status, expect );
break;
case SystemBasicInformation:
case SystemCpuInformation:
case SystemEmulationBasicInformation:
case SystemEmulationProcessorInformation:
- ok( status == expect, "%u: %x / %x\n", i, status, expect );
+ ok( status == expect, "%lu: %lx / %lx\n", i, status, expect );
break;
default:
if (is_wow64) /* only a few info classes are supported on Wow64 */
ok( status == STATUS_INVALID_INFO_CLASS ||
broken(status == STATUS_NOT_IMPLEMENTED), /* vista */
- "%u: %x\n", i, status );
+ "%lu: %lx\n", i, status );
else
- ok( status == expect, "%u: %x / %x\n", i, status, expect );
+ ok( status == expect, "%lu: %lx / %lx\n", i, status, expect );
break;
}
}
@@ -971,7 +972,7 @@ static void test_init_block(void)
if ((ptr = GetProcAddress( ntdll, "LdrSystemDllInitBlock" )))
{
init_block = ptr;
- trace( "got init block %08x\n", init_block[0] );
+ trace( "got init block %08lx\n", init_block[0] );
#define CHECK_FUNC(val,func) \
ok( (val) == (ULONG_PTR)GetProcAddress( ntdll, func ), \
"got %p for %s %p\n", (void *)(ULONG_PTR)(val), func, GetProcAddress( ntdll, func ))
@@ -1068,8 +1069,8 @@ static void test_init_block(void)
size = 12 * sizeof(*block64);
break;
default:
- ok( 0, "unknown init block %08x\n", init_block[0] );
- for (i = 0; i < 32; i++) trace("%04x: %08x\n", i, init_block[i]);
+ ok( 0, "unknown init block %08lx\n", init_block[0] );
+ for (i = 0; i < 32; i++) trace("%04lx: %08lx\n", i, init_block[i]);
break;
}
#undef CHECK_FUNC
@@ -1079,7 +1080,7 @@ static void test_init_block(void)
DWORD buffer[64];
HANDLE process = OpenProcess( PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId() );
NTSTATUS status = pNtWow64ReadVirtualMemory64( process, ptr64, buffer, size, NULL );
- ok( !status, "NtWow64ReadVirtualMemory64 failed %x\n", status );
+ ok( !status, "NtWow64ReadVirtualMemory64 failed %lx\n", status );
ok( !memcmp( buffer, init_block, size ), "wrong 64-bit init block\n" );
NtClose( process );
}
@@ -1116,7 +1117,7 @@ static void test_iosb(void)
server = CreateNamedPipeA( pipe_name, PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED,
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
4, 1024, 1024, 1000, NULL );
- ok( server != INVALID_HANDLE_VALUE, "CreateNamedPipe failed: %u\n", GetLastError() );
+ ok( server != INVALID_HANDLE_VALUE, "CreateNamedPipe failed: %lu\n", GetLastError() );
memset( &iosb32, 0x55, sizeof(iosb32) );
iosb64.Pointer = PtrToUlong( &iosb32 );
@@ -1124,17 +1125,17 @@ static void test_iosb(void)
args[0] = (LONG_PTR)server;
status = call_func64( func, ARRAY_SIZE(args), args );
- ok( status == STATUS_PENDING, "NtFsControlFile returned %x\n", status );
- ok( U(iosb32).Status == 0x55555555, "status changed to %x\n", U(iosb32).Status );
- ok( U(iosb64).Pointer == PtrToUlong(&iosb32), "status changed to %x\n", U(iosb64).Status );
+ ok( status == STATUS_PENDING, "NtFsControlFile returned %lx\n", status );
+ ok( U(iosb32).Status == 0x55555555, "status changed to %lx\n", U(iosb32).Status );
+ ok( U(iosb64).Pointer == PtrToUlong(&iosb32), "status changed to %lx\n", U(iosb64).Status );
ok( iosb64.Information == 0xdeadbeef, "info changed to %lx\n", (ULONG_PTR)iosb64.Information );
client = CreateFileA( pipe_name, GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
FILE_FLAG_NO_BUFFERING | FILE_FLAG_OVERLAPPED, NULL );
- ok( client != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError() );
+ ok( client != INVALID_HANDLE_VALUE, "CreateFile failed: %lu\n", GetLastError() );
- ok( U(iosb32).Status == 0, "Wrong iostatus %x\n", U(iosb32).Status );
- ok( U(iosb64).Pointer == PtrToUlong(&iosb32), "status changed to %x\n", U(iosb64).Status );
+ ok( U(iosb32).Status == 0, "Wrong iostatus %lx\n", U(iosb32).Status );
+ ok( U(iosb64).Pointer == PtrToUlong(&iosb32), "status changed to %lx\n", U(iosb64).Status );
ok( iosb64.Information == 0xdeadbeef, "info changed to %lx\n", (ULONG_PTR)iosb64.Information );
memset( &iosb32, 0x55, sizeof(iosb32) );
@@ -1149,15 +1150,15 @@ static void test_iosb(void)
args[9] = sizeof(id);
status = call_func64( func, ARRAY_SIZE(args), args );
- ok( status == STATUS_PENDING || status == STATUS_SUCCESS, "NtFsControlFile returned %x\n", status );
+ ok( status == STATUS_PENDING || status == STATUS_SUCCESS, "NtFsControlFile returned %lx\n", status );
todo_wine
{
- ok( U(iosb32).Status == STATUS_SUCCESS, "status changed to %x\n", U(iosb32).Status );
+ ok( U(iosb32).Status == STATUS_SUCCESS, "status changed to %lx\n", U(iosb32).Status );
ok( iosb32.Information == sizeof(id), "info changed to %lx\n", iosb32.Information );
- ok( U(iosb64).Pointer == PtrToUlong(&iosb32), "status changed to %x\n", U(iosb64).Status );
+ ok( U(iosb64).Pointer == PtrToUlong(&iosb32), "status changed to %lx\n", U(iosb64).Status );
ok( iosb64.Information == 0xdeadbeef, "info changed to %lx\n", (ULONG_PTR)iosb64.Information );
}
- ok( id == GetCurrentProcessId(), "wrong id %x / %x\n", id, GetCurrentProcessId() );
+ ok( id == GetCurrentProcessId(), "wrong id %lx / %lx\n", id, GetCurrentProcessId() );
CloseHandle( client );
CloseHandle( server );
@@ -1166,11 +1167,11 @@ static void test_iosb(void)
server = CreateNamedPipeA( pipe_name, PIPE_ACCESS_INBOUND,
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
4, 1024, 1024, 1000, NULL );
- ok( server != INVALID_HANDLE_VALUE, "CreateNamedPipe failed: %u\n", GetLastError() );
+ ok( server != INVALID_HANDLE_VALUE, "CreateNamedPipe failed: %lu\n", GetLastError() );
client = CreateFileA( pipe_name, GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
FILE_FLAG_NO_BUFFERING | FILE_FLAG_OVERLAPPED, NULL );
- ok( client != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError() );
+ ok( client != INVALID_HANDLE_VALUE, "CreateFile failed: %lu\n", GetLastError() );
memset( &iosb32, 0x55, sizeof(iosb32) );
iosb64.Pointer = PtrToUlong( &iosb32 );
@@ -1179,12 +1180,12 @@ static void test_iosb(void)
args[0] = (LONG_PTR)server;
status = call_func64( func, ARRAY_SIZE(args), args );
- ok( status == STATUS_SUCCESS, "NtFsControlFile returned %x\n", status );
- ok( U(iosb32).Status == 0x55555555, "status changed to %x\n", U(iosb32).Status );
+ ok( status == STATUS_SUCCESS, "NtFsControlFile returned %lx\n", status );
+ ok( U(iosb32).Status == 0x55555555, "status changed to %lx\n", U(iosb32).Status );
ok( iosb32.Information == 0x55555555, "info changed to %lx\n", iosb32.Information );
- ok( U(iosb64).Pointer == STATUS_SUCCESS, "status changed to %x\n", U(iosb64).Status );
+ ok( U(iosb64).Pointer == STATUS_SUCCESS, "status changed to %lx\n", U(iosb64).Status );
ok( iosb64.Information == sizeof(id), "info changed to %lx\n", (ULONG_PTR)iosb64.Information );
- ok( id == GetCurrentProcessId(), "wrong id %x / %x\n", id, GetCurrentProcessId() );
+ ok( id == GetCurrentProcessId(), "wrong id %lx / %lx\n", id, GetCurrentProcessId() );
CloseHandle( client );
CloseHandle( server );
}
@@ -1222,17 +1223,17 @@ static void test_syscalls(void)
event = CreateEventA( NULL, FALSE, FALSE, NULL );
status = NtSetEvent( event, NULL );
- ok( !status, "NtSetEvent failed %x\n", status );
+ ok( !status, "NtSetEvent failed %lx\n", status );
args32[0] = HandleToLong( event );
status = invoke_syscall( "NtClose", args32 );
- ok( !status, "syscall failed %x\n", status );
+ ok( !status, "syscall failed %lx\n", status );
status = NtSetEvent( event, NULL );
- ok( status == STATUS_INVALID_HANDLE, "NtSetEvent failed %x\n", status );
+ ok( status == STATUS_INVALID_HANDLE, "NtSetEvent failed %lx\n", status );
status = invoke_syscall( "NtClose", args32 );
- ok( status == STATUS_INVALID_HANDLE, "syscall failed %x\n", status );
+ ok( status == STATUS_INVALID_HANDLE, "syscall failed %lx\n", status );
args32[0] = 0xdeadbeef;
status = invoke_syscall( "NtClose", args32 );
- ok( status == STATUS_INVALID_HANDLE, "syscall failed %x\n", status );
+ ok( status == STATUS_INVALID_HANDLE, "syscall failed %lx\n", status );
RtlInitUnicodeString( &name, L"\\BaseNamedObjects\\wow64-test");
InitializeObjectAttributes( &attr, &name, OBJ_OPENIF, 0, NULL );
@@ -1243,32 +1244,32 @@ static void test_syscalls(void)
args32[3] = NotificationEvent;
args32[4] = 0;
status = invoke_syscall( "NtCreateEvent", args32 );
- ok( !status, "syscall failed %x\n", status );
+ ok( !status, "syscall failed %lx\n", status );
status = NtSetEvent( event, NULL );
- ok( !status, "NtSetEvent failed %x\n", status );
+ ok( !status, "NtSetEvent failed %lx\n", status );
event2 = (HANDLE)0xdeadbeef;
args32[0] = PtrToUlong( &event2 );
status = invoke_syscall( "NtOpenEvent", args32 );
- ok( !status, "syscall failed %x\n", status );
+ ok( !status, "syscall failed %lx\n", status );
status = NtSetEvent( event2, NULL );
- ok( !status, "NtSetEvent failed %x\n", status );
+ ok( !status, "NtSetEvent failed %lx\n", status );
args32[0] = HandleToLong( event2 );
status = invoke_syscall( "NtClose", args32 );
- ok( !status, "syscall failed %x\n", status );
+ ok( !status, "syscall failed %lx\n", status );
event2 = (HANDLE)0xdeadbeef;
args32[0] = PtrToUlong( &event2 );
status = invoke_syscall( "NtCreateEvent", args32 );
- ok( status == STATUS_OBJECT_NAME_EXISTS, "syscall failed %x\n", status );
+ ok( status == STATUS_OBJECT_NAME_EXISTS, "syscall failed %lx\n", status );
status = NtSetEvent( event2, NULL );
- ok( !status, "NtSetEvent failed %x\n", status );
+ ok( !status, "NtSetEvent failed %lx\n", status );
args32[0] = HandleToLong( event2 );
status = invoke_syscall( "NtClose", args32 );
- ok( !status, "syscall failed %x\n", status );
+ ok( !status, "syscall failed %lx\n", status );
status = NtClose( event );
- ok( !status, "NtClose failed %x\n", status );
+ ok( !status, "NtClose failed %lx\n", status );
if (pNtWow64ReadVirtualMemory64)
{
@@ -1279,11 +1280,11 @@ static void test_syscalls(void)
ULONG args32[] = { HandleToLong( process ), (ULONG)teb64->Peb, teb64->Peb >> 32,
PtrToUlong(&peb64_2), sizeof(peb64_2), 0, PtrToUlong(&res2) };
- ok( process != 0, "failed to open current process %u\n", GetLastError() );
+ ok( process != 0, "failed to open current process %lu\n", GetLastError() );
status = pNtWow64ReadVirtualMemory64( process, teb64->Peb, &peb64, sizeof(peb64), &res );
- ok( !status, "NtWow64ReadVirtualMemory64 failed %x\n", status );
+ ok( !status, "NtWow64ReadVirtualMemory64 failed %lx\n", status );
status = invoke_syscall( "NtWow64ReadVirtualMemory64", args32 );
- ok( !status, "NtWow64ReadVirtualMemory64 failed %x\n", status );
+ ok( !status, "NtWow64ReadVirtualMemory64 failed %lx\n", status );
ok( res2 == res, "wrong len %s / %s\n", wine_dbgstr_longlong(res), wine_dbgstr_longlong(res2) );
ok( !memcmp( &peb64, &peb64_2, res ), "data is different\n" );
NtClose( process );
@@ -1306,14 +1307,14 @@ static void test_cpu_area(void)
ULONG64 args[] = { (ULONG_PTR)&machine, (ULONG_PTR)&context, (ULONG_PTR)&context_ex };
status = call_func64( ptr, ARRAY_SIZE(args), args );
- ok( !status, "RtlWow64GetCpuAreaInfo failed %x\n", status );
+ ok( !status, "RtlWow64GetCpuAreaInfo failed %lx\n", status );
ok( machine == IMAGE_FILE_MACHINE_I386, "wrong machine %x\n", machine );
ok( context == teb64->TlsSlots[WOW64_TLS_CPURESERVED] + 4, "wrong context %s / %s\n",
wine_dbgstr_longlong(context), wine_dbgstr_longlong(teb64->TlsSlots[WOW64_TLS_CPURESERVED]) );
ok( !context_ex, "got context_ex %s\n", wine_dbgstr_longlong(context_ex) );
args[0] = args[1] = args[2] = 0;
status = call_func64( ptr, ARRAY_SIZE(args), args );
- ok( !status, "RtlWow64GetCpuAreaInfo failed %x\n", status );
+ ok( !status, "RtlWow64GetCpuAreaInfo failed %lx\n", status );
}
else win_skip( "RtlWow64GetCpuAreaInfo not supported\n" );
1
0
24 Mar '22
Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com>
---
dlls/ntdll/tests/virtual.c | 313 ++++++++++++++++++++++----------------------
1 file changed, 157 insertions(+), 156 deletions(-)
diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c
index adc9b1ae6dc..2125d2c8971 100644
--- a/dlls/ntdll/tests/virtual.c
+++ b/dlls/ntdll/tests/virtual.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 <stdio.h>
@@ -56,9 +57,9 @@ static HANDLE create_target_process(const char *arg)
winetest_get_mainargs(&argv);
sprintf(cmdline, "%s %s %s", argv[0], argv[1], arg);
ret = CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
- ok(ret, "error: %u\n", GetLastError());
+ ok(ret, "error: %lu\n", GetLastError());
ret = CloseHandle(pi.hThread);
- ok(ret, "error %u\n", GetLastError());
+ ok(ret, "error %lu\n", GetLastError());
return pi.hProcess;
}
@@ -100,21 +101,21 @@ static void test_NtAllocateVirtualMemory(void)
addr1 = NULL;
status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr1, 0, &size,
MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
- ok(status == STATUS_SUCCESS, "NtAllocateVirtualMemory returned %08x\n", status);
+ ok(status == STATUS_SUCCESS, "NtAllocateVirtualMemory returned %08lx\n", status);
/* allocation conflicts because of 64k align */
size = 0x1000;
addr2 = (char *)addr1 + 0x1000;
status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, 0, &size,
MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
- ok(status == STATUS_CONFLICTING_ADDRESSES, "NtAllocateVirtualMemory returned %08x\n", status);
+ ok(status == STATUS_CONFLICTING_ADDRESSES, "NtAllocateVirtualMemory returned %08lx\n", status);
/* it should conflict, even when zero_bits is explicitly set */
size = 0x1000;
addr2 = (char *)addr1 + 0x1000;
status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, 12, &size,
MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
- ok(status == STATUS_CONFLICTING_ADDRESSES, "NtAllocateVirtualMemory returned %08x\n", status);
+ ok(status == STATUS_CONFLICTING_ADDRESSES, "NtAllocateVirtualMemory returned %08lx\n", status);
/* 1 zero bits should zero 63-31 upper bits */
size = 0x1000;
@@ -125,7 +126,7 @@ static void test_NtAllocateVirtualMemory(void)
PAGE_READWRITE);
ok(status == STATUS_SUCCESS || status == STATUS_NO_MEMORY ||
broken(status == STATUS_INVALID_PARAMETER_3) /* winxp */,
- "NtAllocateVirtualMemory returned %08x\n", status);
+ "NtAllocateVirtualMemory returned %08lx\n", status);
if (status == STATUS_SUCCESS)
{
ok(((UINT_PTR)addr2 >> (32 - zero_bits)) == 0,
@@ -133,7 +134,7 @@ static void test_NtAllocateVirtualMemory(void)
size = 0;
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr2, &size, MEM_RELEASE);
- ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory return %08x, addr2: %p\n", status, addr2);
+ ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory return %08lx, addr2: %p\n", status, addr2);
}
for (zero_bits = 2; zero_bits <= 20; zero_bits++)
@@ -145,7 +146,7 @@ static void test_NtAllocateVirtualMemory(void)
PAGE_READWRITE);
ok(status == STATUS_SUCCESS || status == STATUS_NO_MEMORY ||
broken(zero_bits == 20 && status == STATUS_CONFLICTING_ADDRESSES) /* w1064v1809 */,
- "NtAllocateVirtualMemory with %d zero_bits returned %08x\n", (int)zero_bits, status);
+ "NtAllocateVirtualMemory with %d zero_bits returned %08lx\n", (int)zero_bits, status);
if (status == STATUS_SUCCESS)
{
ok(((UINT_PTR)addr2 >> (32 - zero_bits)) == 0,
@@ -153,7 +154,7 @@ static void test_NtAllocateVirtualMemory(void)
size = 0;
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr2, &size, MEM_RELEASE);
- ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory return %08x, addr2: %p\n", status, addr2);
+ ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory return %08lx, addr2: %p\n", status, addr2);
}
}
@@ -163,12 +164,12 @@ static void test_NtAllocateVirtualMemory(void)
status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, 21, &size,
MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
ok(status == STATUS_NO_MEMORY || status == STATUS_INVALID_PARAMETER,
- "NtAllocateVirtualMemory returned %08x\n", status);
+ "NtAllocateVirtualMemory returned %08lx\n", status);
if (status == STATUS_SUCCESS)
{
size = 0;
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr2, &size, MEM_RELEASE);
- ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory return %08x, addr2: %p\n", status, addr2);
+ ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory return %08lx, addr2: %p\n", status, addr2);
}
/* 22 zero bits is invalid */
@@ -177,7 +178,7 @@ static void test_NtAllocateVirtualMemory(void)
status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, 22, &size,
MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
ok(status == STATUS_INVALID_PARAMETER_3 || status == STATUS_INVALID_PARAMETER,
- "NtAllocateVirtualMemory returned %08x\n", status);
+ "NtAllocateVirtualMemory returned %08lx\n", status);
/* zero bits > 31 should be considered as a leading zeroes bitmask on 64bit and WoW64 */
size = 0x1000;
@@ -189,12 +190,12 @@ static void test_NtAllocateVirtualMemory(void)
if (!is_win64 && !is_wow64)
{
- ok(status == STATUS_INVALID_PARAMETER_3, "NtAllocateVirtualMemory returned %08x\n", status);
+ ok(status == STATUS_INVALID_PARAMETER_3, "NtAllocateVirtualMemory returned %08lx\n", status);
}
else
{
ok(status == STATUS_SUCCESS || status == STATUS_NO_MEMORY,
- "NtAllocateVirtualMemory returned %08x\n", status);
+ "NtAllocateVirtualMemory returned %08lx\n", status);
if (status == STATUS_SUCCESS)
{
ok(((UINT_PTR)addr2 & ~get_zero_bits_mask(zero_bits)) == 0 &&
@@ -203,7 +204,7 @@ static void test_NtAllocateVirtualMemory(void)
size = 0;
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr2, &size, MEM_RELEASE);
- ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory return %08x, addr2: %p\n", status, addr2);
+ ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory return %08lx, addr2: %p\n", status, addr2);
}
}
@@ -213,7 +214,7 @@ static void test_NtAllocateVirtualMemory(void)
status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, 0, &size,
MEM_RESERVE | MEM_COMMIT | AT_ROUND_TO_PAGE, PAGE_EXECUTE_READWRITE);
ok(status == STATUS_INVALID_PARAMETER_5 || status == STATUS_INVALID_PARAMETER,
- "NtAllocateVirtualMemory returned %08x\n", status);
+ "NtAllocateVirtualMemory returned %08lx\n", status);
size = 0;
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr1, &size, MEM_RELEASE);
@@ -225,41 +226,41 @@ static void test_NtAllocateVirtualMemory(void)
addr1 = NULL;
status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr1, 0, &size,
MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
- ok(status == STATUS_SUCCESS, "NtAllocateVirtualMemory returned %08x\n", status);
+ ok(status == STATUS_SUCCESS, "NtAllocateVirtualMemory returned %08lx\n", status);
size = 2;
addr2 = (char *)addr1 + 0x1fff;
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr2, &size, MEM_DECOMMIT);
- ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory failed %x\n", status);
- ok( size == 0x2000, "wrong size %lx\n", size );
+ ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory failed %lx\n", status);
+ ok( size == 0x2000, "wrong size %Ix\n", size );
ok( addr2 == (char *)addr1 + 0x1000, "wrong addr %p\n", addr2 );
size = 0;
addr2 = (char *)addr1 + 0x1001;
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr2, &size, MEM_DECOMMIT);
- ok(status == STATUS_FREE_VM_NOT_AT_BASE, "NtFreeVirtualMemory failed %x\n", status);
- ok( size == 0, "wrong size %lx\n", size );
+ ok(status == STATUS_FREE_VM_NOT_AT_BASE, "NtFreeVirtualMemory failed %lx\n", status);
+ ok( size == 0, "wrong size %Ix\n", size );
ok( addr2 == (char *)addr1 + 0x1001, "wrong addr %p\n", addr2 );
size = 0;
addr2 = (char *)addr1 + 0xffe;
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr2, &size, MEM_DECOMMIT);
- ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory failed %x\n", status);
- ok( size == 0 || broken(size == 0x10000) /* <= win10 1709 */, "wrong size %lx\n", size );
+ ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory failed %lx\n", status);
+ ok( size == 0 || broken(size == 0x10000) /* <= win10 1709 */, "wrong size %Ix\n", size );
ok( addr2 == addr1, "wrong addr %p\n", addr2 );
size = 0;
addr2 = (char *)addr1 + 0x1001;
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr2, &size, MEM_RELEASE);
- ok(status == STATUS_FREE_VM_NOT_AT_BASE, "NtFreeVirtualMemory failed %x\n", status);
- ok( size == 0, "wrong size %lx\n", size );
+ ok(status == STATUS_FREE_VM_NOT_AT_BASE, "NtFreeVirtualMemory failed %lx\n", status);
+ ok( size == 0, "wrong size %Ix\n", size );
ok( addr2 == (char *)addr1 + 0x1001, "wrong addr %p\n", addr2 );
size = 0;
addr2 = (char *)addr1 + 0xfff;
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr2, &size, MEM_RELEASE);
- ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory failed %x\n", status);
- ok( size == 0x10000, "wrong size %lx\n", size );
+ ok(status == STATUS_SUCCESS, "NtFreeVirtualMemory failed %lx\n", status);
+ ok( size == 0x10000, "wrong size %Ix\n", size );
ok( addr2 == addr1, "wrong addr %p\n", addr2 );
if (!pNtAllocateVirtualMemoryEx)
@@ -273,12 +274,12 @@ static void test_NtAllocateVirtualMemory(void)
addr1 = NULL;
status = pNtAllocateVirtualMemoryEx(NtCurrentProcess(), &addr1, &size, MEM_RESERVE | MEM_COMMIT,
PAGE_EXECUTE_READWRITE, NULL, 0);
- ok(status == STATUS_SUCCESS, "NtAllocateVirtualMemoryEx returned %08x\n", status);
+ ok(status == STATUS_SUCCESS, "NtAllocateVirtualMemoryEx returned %08lx\n", status);
/* specifying a count of >0 with NULL parameters should fail */
status = pNtAllocateVirtualMemoryEx(NtCurrentProcess(), &addr1, &size, MEM_RESERVE | MEM_COMMIT,
PAGE_EXECUTE_READWRITE, NULL, 1);
- ok(status == STATUS_INVALID_PARAMETER, "NtAllocateVirtualMemoryEx returned %08x\n", status);
+ ok(status == STATUS_INVALID_PARAMETER, "NtAllocateVirtualMemoryEx returned %08lx\n", status);
}
struct test_stack_size_thread_args
@@ -318,39 +319,39 @@ static DWORD WINAPI test_stack_size_thread(void *ptr)
committed = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit;
reserved = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->DeallocationStack;
- todo_wine ok( committed == args->expect_committed || broken(committed == 0x1000), "unexpected stack committed size %x, expected %x\n", committed, args->expect_committed );
- ok( reserved == args->expect_reserved, "unexpected stack reserved size %x, expected %x\n", reserved, args->expect_reserved );
+ todo_wine ok( committed == args->expect_committed || broken(committed == 0x1000), "unexpected stack committed size %lx, expected %lx\n", committed, args->expect_committed );
+ ok( reserved == args->expect_reserved, "unexpected stack reserved size %lx, expected %lx\n", reserved, args->expect_reserved );
addr = (char *)NtCurrentTeb()->DeallocationStack;
status = NtQueryVirtualMemory( NtCurrentProcess(), addr, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
- ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( !status, "NtQueryVirtualMemory returned %08lx\n", status );
ok( mbi.AllocationBase == NtCurrentTeb()->DeallocationStack, "unexpected AllocationBase %p, expected %p\n", mbi.AllocationBase, NtCurrentTeb()->DeallocationStack );
- ok( mbi.AllocationProtect == PAGE_READWRITE, "unexpected AllocationProtect %#x, expected %#x\n", mbi.AllocationProtect, PAGE_READWRITE );
+ ok( mbi.AllocationProtect == PAGE_READWRITE, "unexpected AllocationProtect %#lx, expected %#x\n", mbi.AllocationProtect, PAGE_READWRITE );
ok( mbi.BaseAddress == addr, "unexpected BaseAddress %p, expected %p\n", mbi.BaseAddress, addr );
- todo_wine ok( mbi.State == MEM_RESERVE, "unexpected State %#x, expected %#x\n", mbi.State, MEM_RESERVE );
- todo_wine ok( mbi.Protect == 0, "unexpected Protect %#x, expected %#x\n", mbi.Protect, 0 );
- ok( mbi.Type == MEM_PRIVATE, "unexpected Type %#x, expected %#x\n", mbi.Type, MEM_PRIVATE );
+ todo_wine ok( mbi.State == MEM_RESERVE, "unexpected State %#lx, expected %#x\n", mbi.State, MEM_RESERVE );
+ todo_wine ok( mbi.Protect == 0, "unexpected Protect %#lx, expected %#x\n", mbi.Protect, 0 );
+ ok( mbi.Type == MEM_PRIVATE, "unexpected Type %#lx, expected %#x\n", mbi.Type, MEM_PRIVATE );
force_stack_grow();
committed = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit;
reserved = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->DeallocationStack;
- todo_wine ok( committed == 0x9000, "unexpected stack committed size %x, expected 9000\n", committed );
- ok( reserved == args->expect_reserved, "unexpected stack reserved size %x, expected %x\n", reserved, args->expect_reserved );
+ todo_wine ok( committed == 0x9000, "unexpected stack committed size %lx, expected 9000\n", committed );
+ ok( reserved == args->expect_reserved, "unexpected stack reserved size %lx, expected %lx\n", reserved, args->expect_reserved );
/* reserved area shrinks whenever stack grows */
addr = (char *)NtCurrentTeb()->DeallocationStack;
status = NtQueryVirtualMemory( NtCurrentProcess(), addr, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
- ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( !status, "NtQueryVirtualMemory returned %08lx\n", status );
ok( mbi.AllocationBase == NtCurrentTeb()->DeallocationStack, "unexpected AllocationBase %p, expected %p\n", mbi.AllocationBase, NtCurrentTeb()->DeallocationStack );
- ok( mbi.AllocationProtect == PAGE_READWRITE, "unexpected AllocationProtect %#x, expected %#x\n", mbi.AllocationProtect, PAGE_READWRITE );
+ ok( mbi.AllocationProtect == PAGE_READWRITE, "unexpected AllocationProtect %#lx, expected %#x\n", mbi.AllocationProtect, PAGE_READWRITE );
ok( mbi.BaseAddress == addr, "unexpected BaseAddress %p, expected %p\n", mbi.BaseAddress, addr );
- todo_wine ok( mbi.State == MEM_RESERVE, "unexpected State %#x, expected %#x\n", mbi.State, MEM_RESERVE );
- todo_wine ok( mbi.Protect == 0, "unexpected Protect %#x, expected %#x\n", mbi.Protect, 0 );
- ok( mbi.Type == MEM_PRIVATE, "unexpected Type %#x, expected %#x\n", mbi.Type, MEM_PRIVATE );
+ todo_wine ok( mbi.State == MEM_RESERVE, "unexpected State %#lx, expected %#x\n", mbi.State, MEM_RESERVE );
+ todo_wine ok( mbi.Protect == 0, "unexpected Protect %#lx, expected %#x\n", mbi.Protect, 0 );
+ ok( mbi.Type == MEM_PRIVATE, "unexpected Type %#lx, expected %#x\n", mbi.Type, MEM_PRIVATE );
guard_size = reserved - committed - mbi.RegionSize;
ok( guard_size == 0x1000 || guard_size == 0x2000 || guard_size == 0x3000, "unexpected guard_size %I64x, expected 1000, 2000 or 3000\n", (UINT64)guard_size );
@@ -359,25 +360,25 @@ static DWORD WINAPI test_stack_size_thread(void *ptr)
addr = (char *)NtCurrentTeb()->DeallocationStack + mbi.RegionSize;
status = NtQueryVirtualMemory( NtCurrentProcess(), addr, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
- ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( !status, "NtQueryVirtualMemory returned %08lx\n", status );
ok( mbi.AllocationBase == NtCurrentTeb()->DeallocationStack, "unexpected AllocationBase %p, expected %p\n", mbi.AllocationBase, NtCurrentTeb()->DeallocationStack );
- ok( mbi.AllocationProtect == PAGE_READWRITE, "unexpected AllocationProtect %#x, expected %#x\n", mbi.AllocationProtect, PAGE_READWRITE );
+ ok( mbi.AllocationProtect == PAGE_READWRITE, "unexpected AllocationProtect %#lx, expected %#x\n", mbi.AllocationProtect, PAGE_READWRITE );
ok( mbi.BaseAddress == addr, "unexpected BaseAddress %p, expected %p\n", mbi.BaseAddress, addr );
ok( mbi.RegionSize == guard_size, "unexpected RegionSize %I64x, expected 3000\n", (UINT64)mbi.RegionSize );
- ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
- ok( mbi.Protect == (PAGE_READWRITE|PAGE_GUARD), "unexpected Protect %#x, expected %#x\n", mbi.Protect, PAGE_READWRITE|PAGE_GUARD );
- ok( mbi.Type == MEM_PRIVATE, "unexpected Type %#x, expected %#x\n", mbi.Type, MEM_PRIVATE );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#lx, expected %#x\n", mbi.State, MEM_COMMIT );
+ ok( mbi.Protect == (PAGE_READWRITE|PAGE_GUARD), "unexpected Protect %#lx, expected %#x\n", mbi.Protect, PAGE_READWRITE|PAGE_GUARD );
+ ok( mbi.Type == MEM_PRIVATE, "unexpected Type %#lx, expected %#x\n", mbi.Type, MEM_PRIVATE );
addr = (char *)NtCurrentTeb()->Tib.StackLimit;
status = NtQueryVirtualMemory( NtCurrentProcess(), addr, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
- ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( !status, "NtQueryVirtualMemory returned %08lx\n", status );
ok( mbi.AllocationBase == NtCurrentTeb()->DeallocationStack, "unexpected AllocationBase %p, expected %p\n", mbi.AllocationBase, NtCurrentTeb()->DeallocationStack );
- ok( mbi.AllocationProtect == PAGE_READWRITE, "unexpected AllocationProtect %#x, expected %#x\n", mbi.AllocationProtect, PAGE_READWRITE );
+ ok( mbi.AllocationProtect == PAGE_READWRITE, "unexpected AllocationProtect %#lx, expected %#x\n", mbi.AllocationProtect, PAGE_READWRITE );
ok( mbi.BaseAddress == addr, "unexpected BaseAddress %p, expected %p\n", mbi.BaseAddress, addr );
ok( mbi.RegionSize == committed, "unexpected RegionSize %I64x, expected %I64x\n", (UINT64)mbi.RegionSize, (UINT64)committed );
- ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
- ok( mbi.Protect == PAGE_READWRITE, "unexpected Protect %#x, expected %#x\n", mbi.Protect, PAGE_READWRITE );
- ok( mbi.Type == MEM_PRIVATE, "unexpected Type %#x, expected %#x\n", mbi.Type, MEM_PRIVATE );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#lx, expected %#x\n", mbi.State, MEM_COMMIT );
+ ok( mbi.Protect == PAGE_READWRITE, "unexpected Protect %#lx, expected %#x\n", mbi.Protect, PAGE_READWRITE );
+ ok( mbi.Type == MEM_PRIVATE, "unexpected Type %#lx, expected %#x\n", mbi.Type, MEM_PRIVATE );
#ifdef _WIN64
@@ -386,29 +387,29 @@ static DWORD WINAPI test_stack_size_thread(void *ptr)
addr = (char *)NtCurrentTeb()->Tib.StackLimit + 0x2000;
size = 0x1000;
status = NtAllocateVirtualMemory( NtCurrentProcess(), &addr, 0, &size, MEM_COMMIT, PAGE_READWRITE | PAGE_GUARD );
- ok( !status, "NtAllocateVirtualMemory returned %08x\n", status );
+ ok( !status, "NtAllocateVirtualMemory returned %08lx\n", status );
committed = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit;
- todo_wine ok( committed == 0x6000, "unexpected stack committed size %x, expected 6000\n", committed );
+ todo_wine ok( committed == 0x6000, "unexpected stack committed size %lx, expected 6000\n", committed );
status = NtQueryVirtualMemory( NtCurrentProcess(), (char *)addr - 0x2000, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
- ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( !status, "NtQueryVirtualMemory returned %08lx\n", status );
ok( mbi.RegionSize == 0x2000, "unexpected RegionSize %I64x, expected 2000\n", (UINT64)mbi.RegionSize );
- ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
- ok( mbi.Protect == PAGE_READWRITE, "unexpected Protect %#x, expected %#x\n", mbi.Protect, PAGE_READWRITE );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#lx, expected %#x\n", mbi.State, MEM_COMMIT );
+ ok( mbi.Protect == PAGE_READWRITE, "unexpected Protect %#lx, expected %#x\n", mbi.Protect, PAGE_READWRITE );
status = NtQueryVirtualMemory( NtCurrentProcess(), addr, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
- ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( !status, "NtQueryVirtualMemory returned %08lx\n", status );
ok( mbi.RegionSize == 0x1000, "unexpected RegionSize %I64x, expected 1000\n", (UINT64)mbi.RegionSize );
- ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
- ok( mbi.Protect == (PAGE_READWRITE|PAGE_GUARD), "unexpected Protect %#x, expected %#x\n", mbi.Protect, (PAGE_READWRITE|PAGE_GUARD) );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#lx, expected %#x\n", mbi.State, MEM_COMMIT );
+ ok( mbi.Protect == (PAGE_READWRITE|PAGE_GUARD), "unexpected Protect %#lx, expected %#x\n", mbi.Protect, (PAGE_READWRITE|PAGE_GUARD) );
addr = (char *)NtCurrentTeb()->Tib.StackLimit;
status = NtQueryVirtualMemory( NtCurrentProcess(), addr, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
- ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( !status, "NtQueryVirtualMemory returned %08lx\n", status );
todo_wine ok( mbi.RegionSize == 0x6000, "unexpected RegionSize %I64x, expected 6000\n", (UINT64)mbi.RegionSize );
- ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
- ok( mbi.Protect == PAGE_READWRITE, "unexpected Protect %#x, expected %#x\n", mbi.Protect, PAGE_READWRITE );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#lx, expected %#x\n", mbi.State, MEM_COMMIT );
+ ok( mbi.Protect == PAGE_READWRITE, "unexpected Protect %#lx, expected %#x\n", mbi.Protect, PAGE_READWRITE );
/* guard pages are restored as the stack grows back */
@@ -417,33 +418,33 @@ static DWORD WINAPI test_stack_size_thread(void *ptr)
tmp = (char *)addr - guard_size - 0x1000;
size = 0x1000;
status = NtAllocateVirtualMemory( NtCurrentProcess(), &addr, 0, &size, MEM_COMMIT, PAGE_READWRITE | PAGE_GUARD );
- ok( !status, "NtAllocateVirtualMemory returned %08x\n", status );
+ ok( !status, "NtAllocateVirtualMemory returned %08lx\n", status );
committed = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit;
- todo_wine ok( committed == 0x1000, "unexpected stack committed size %x, expected 1000\n", committed );
+ todo_wine ok( committed == 0x1000, "unexpected stack committed size %lx, expected 1000\n", committed );
status = NtQueryVirtualMemory( NtCurrentProcess(), tmp, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
- ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( !status, "NtQueryVirtualMemory returned %08lx\n", status );
todo_wine ok( mbi.RegionSize == guard_size + 0x1000, "unexpected RegionSize %I64x, expected %I64x\n", (UINT64)mbi.RegionSize, (UINT64)(guard_size + 0x1000) );
- ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
- todo_wine ok( mbi.Protect == PAGE_READWRITE, "unexpected Protect %#x, expected %#x\n", mbi.Protect, PAGE_READWRITE );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#lx, expected %#x\n", mbi.State, MEM_COMMIT );
+ todo_wine ok( mbi.Protect == PAGE_READWRITE, "unexpected Protect %#lx, expected %#x\n", mbi.Protect, PAGE_READWRITE );
force_stack_grow_small();
committed = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit;
- todo_wine ok( committed == 0x2000, "unexpected stack committed size %x, expected 2000\n", committed );
+ todo_wine ok( committed == 0x2000, "unexpected stack committed size %lx, expected 2000\n", committed );
status = NtQueryVirtualMemory( NtCurrentProcess(), tmp, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
- ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( !status, "NtQueryVirtualMemory returned %08lx\n", status );
ok( mbi.RegionSize == 0x1000, "unexpected RegionSize %I64x, expected 1000\n", (UINT64)mbi.RegionSize );
- ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
- todo_wine ok( mbi.Protect == PAGE_READWRITE, "unexpected Protect %#x, expected %#x\n", mbi.Protect, PAGE_READWRITE );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#lx, expected %#x\n", mbi.State, MEM_COMMIT );
+ todo_wine ok( mbi.Protect == PAGE_READWRITE, "unexpected Protect %#lx, expected %#x\n", mbi.Protect, PAGE_READWRITE );
status = NtQueryVirtualMemory( NtCurrentProcess(), (char *)tmp + 0x1000, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
- ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( !status, "NtQueryVirtualMemory returned %08lx\n", status );
ok( mbi.RegionSize == guard_size, "unexpected RegionSize %I64x, expected %I64x\n", (UINT64)mbi.RegionSize, (UINT64)guard_size );
- ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
- todo_wine ok( mbi.Protect == (PAGE_READWRITE|PAGE_GUARD), "unexpected Protect %#x, expected %#x\n", mbi.Protect, (PAGE_READWRITE|PAGE_GUARD) );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#lx, expected %#x\n", mbi.State, MEM_COMMIT );
+ todo_wine ok( mbi.Protect == (PAGE_READWRITE|PAGE_GUARD), "unexpected Protect %#lx, expected %#x\n", mbi.Protect, (PAGE_READWRITE|PAGE_GUARD) );
/* forcing stack limit over guard pages still shrinks the stack on page fault */
@@ -451,20 +452,20 @@ static DWORD WINAPI test_stack_size_thread(void *ptr)
addr = (char *)tmp + guard_size + 0x1000;
size = 0x1000;
status = NtAllocateVirtualMemory( NtCurrentProcess(), &addr, 0, &size, MEM_COMMIT, PAGE_READWRITE | PAGE_GUARD );
- ok( !status, "NtAllocateVirtualMemory returned %08x\n", status );
+ ok( !status, "NtAllocateVirtualMemory returned %08lx\n", status );
NtCurrentTeb()->Tib.StackLimit = (char *)tmp;
status = NtQueryVirtualMemory( NtCurrentProcess(), (char *)tmp + 0x1000, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
- ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( !status, "NtQueryVirtualMemory returned %08lx\n", status );
todo_wine ok( mbi.RegionSize == guard_size + 0x1000, "unexpected RegionSize %I64x, expected %I64x\n", (UINT64)mbi.RegionSize, (UINT64)(guard_size + 0x1000) );
- ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
- todo_wine ok( mbi.Protect == (PAGE_READWRITE|PAGE_GUARD), "unexpected Protect %#x, expected %#x\n", mbi.Protect, (PAGE_READWRITE|PAGE_GUARD) );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#lx, expected %#x\n", mbi.State, MEM_COMMIT );
+ todo_wine ok( mbi.Protect == (PAGE_READWRITE|PAGE_GUARD), "unexpected Protect %#lx, expected %#x\n", mbi.Protect, (PAGE_READWRITE|PAGE_GUARD) );
force_stack_grow_small();
committed = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit;
- todo_wine ok( committed == 0x2000, "unexpected stack committed size %x, expected 2000\n", committed );
+ todo_wine ok( committed == 0x2000, "unexpected stack committed size %lx, expected 2000\n", committed );
/* it works with NtProtectVirtualMemory as well */
@@ -474,30 +475,30 @@ static DWORD WINAPI test_stack_size_thread(void *ptr)
addr = (char *)NtCurrentTeb()->Tib.StackLimit + 0x2000;
size = 0x1000;
status = NtProtectVirtualMemory( NtCurrentProcess(), &addr, &size, PAGE_READWRITE | PAGE_GUARD, &prot );
- ok( !status, "NtProtectVirtualMemory returned %08x\n", status );
- todo_wine ok( prot == PAGE_READWRITE, "unexpected prot %#x, expected %#x\n", prot, PAGE_READWRITE );
+ ok( !status, "NtProtectVirtualMemory returned %08lx\n", status );
+ todo_wine ok( prot == PAGE_READWRITE, "unexpected prot %#lx, expected %#x\n", prot, PAGE_READWRITE );
committed = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit;
- todo_wine ok( committed == 0x6000, "unexpected stack committed size %x, expected 6000\n", committed );
+ todo_wine ok( committed == 0x6000, "unexpected stack committed size %lx, expected 6000\n", committed );
status = NtQueryVirtualMemory( NtCurrentProcess(), (char *)addr - 0x2000, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
- ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( !status, "NtQueryVirtualMemory returned %08lx\n", status );
todo_wine ok( mbi.RegionSize == 0x2000, "unexpected RegionSize %I64x, expected 2000\n", (UINT64)mbi.RegionSize );
- ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
- todo_wine ok( mbi.Protect == PAGE_READWRITE, "unexpected Protect %#x, expected %#x\n", mbi.Protect, PAGE_READWRITE );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#lx, expected %#x\n", mbi.State, MEM_COMMIT );
+ todo_wine ok( mbi.Protect == PAGE_READWRITE, "unexpected Protect %#lx, expected %#x\n", mbi.Protect, PAGE_READWRITE );
status = NtQueryVirtualMemory( NtCurrentProcess(), addr, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
- ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( !status, "NtQueryVirtualMemory returned %08lx\n", status );
ok( mbi.RegionSize == 0x1000, "unexpected RegionSize %I64x, expected 1000\n", (UINT64)mbi.RegionSize );
- ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
- ok( mbi.Protect == (PAGE_READWRITE|PAGE_GUARD), "unexpected Protect %#x, expected %#x\n", mbi.Protect, (PAGE_READWRITE|PAGE_GUARD) );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#lx, expected %#x\n", mbi.State, MEM_COMMIT );
+ ok( mbi.Protect == (PAGE_READWRITE|PAGE_GUARD), "unexpected Protect %#lx, expected %#x\n", mbi.Protect, (PAGE_READWRITE|PAGE_GUARD) );
addr = (char *)NtCurrentTeb()->Tib.StackLimit;
status = NtQueryVirtualMemory( NtCurrentProcess(), addr, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
- ok( !status, "NtQueryVirtualMemory returned %08x\n", status );
+ ok( !status, "NtQueryVirtualMemory returned %08lx\n", status );
todo_wine ok( mbi.RegionSize == 0x6000, "unexpected RegionSize %I64x, expected 6000\n", (UINT64)mbi.RegionSize );
- ok( mbi.State == MEM_COMMIT, "unexpected State %#x, expected %#x\n", mbi.State, MEM_COMMIT );
- todo_wine ok( mbi.Protect == PAGE_READWRITE, "unexpected Protect %#x, expected %#x\n", mbi.Protect, PAGE_READWRITE );
+ ok( mbi.State == MEM_COMMIT, "unexpected State %#lx, expected %#x\n", mbi.State, MEM_COMMIT );
+ todo_wine ok( mbi.Protect == PAGE_READWRITE, "unexpected Protect %#lx, expected %#x\n", mbi.Protect, PAGE_READWRITE );
/* clearing the guard pages doesn't change StackLimit back */
@@ -507,25 +508,25 @@ static DWORD WINAPI test_stack_size_thread(void *ptr)
addr = (char *)NtCurrentTeb()->Tib.StackLimit + 0x2000;
size = 0x1000;
status = NtProtectVirtualMemory( NtCurrentProcess(), &addr, &size, PAGE_READWRITE | PAGE_GUARD, &prot );
- ok( !status, "NtProtectVirtualMemory returned %08x\n", status );
- todo_wine ok( prot == PAGE_READWRITE, "unexpected prot %#x, expected %#x\n", prot, PAGE_READWRITE );
+ ok( !status, "NtProtectVirtualMemory returned %08lx\n", status );
+ todo_wine ok( prot == PAGE_READWRITE, "unexpected prot %#lx, expected %#x\n", prot, PAGE_READWRITE );
committed = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit;
- todo_wine ok( committed == 0x6000, "unexpected stack committed size %x, expected 6000\n", committed );
+ todo_wine ok( committed == 0x6000, "unexpected stack committed size %lx, expected 6000\n", committed );
status = NtProtectVirtualMemory( NtCurrentProcess(), &addr, &size, PAGE_READWRITE, &prot );
- ok( !status, "NtProtectVirtualMemory returned %08x\n", status );
- ok( prot == (PAGE_READWRITE | PAGE_GUARD), "unexpected prot %#x, expected %#x\n", prot, (PAGE_READWRITE | PAGE_GUARD) );
+ ok( !status, "NtProtectVirtualMemory returned %08lx\n", status );
+ ok( prot == (PAGE_READWRITE | PAGE_GUARD), "unexpected prot %#lx, expected %#x\n", prot, (PAGE_READWRITE | PAGE_GUARD) );
committed = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit;
- todo_wine ok( committed == 0x6000, "unexpected stack committed size %x, expected 6000\n", committed );
+ todo_wine ok( committed == 0x6000, "unexpected stack committed size %lx, expected 6000\n", committed );
/* and as we messed with it and it now doesn't fault, it doesn't grow back either */
force_stack_grow();
committed = (char *)NtCurrentTeb()->Tib.StackBase - (char *)NtCurrentTeb()->Tib.StackLimit;
- todo_wine ok( committed == 0x6000, "unexpected stack committed size %x, expected 6000\n", committed );
+ todo_wine ok( committed == 0x6000, "unexpected stack committed size %lx, expected 6000\n", committed );
#endif
ExitThread(0);
@@ -583,23 +584,23 @@ static void test_RtlCreateUserStack(void)
memset(&stack, 0xcc, sizeof(stack));
ret = pRtlCreateUserStack(tests[i].commit, tests[i].reserve, 0,
tests[i].commit_align, tests[i].reserve_align, &stack);
- ok(!ret, "%u: got status %#x\n", i, ret);
+ ok(!ret, "%u: got status %#lx\n", i, ret);
ok(!stack.OldStackBase, "%u: got OldStackBase %p\n", i, stack.OldStackBase);
ok(!stack.OldStackLimit, "%u: got OldStackLimit %p\n", i, stack.OldStackLimit);
ok(!((ULONG_PTR)stack.DeallocationStack & (page_size - 1)),
"%u: got unaligned memory %p\n", i, stack.DeallocationStack);
ok((ULONG_PTR)stack.StackBase - (ULONG_PTR)stack.DeallocationStack == tests[i].expect_reserve,
- "%u: got reserve %#lx\n", i, (ULONG_PTR)stack.StackBase - (ULONG_PTR)stack.DeallocationStack);
+ "%u: got reserve %#Ix\n", i, (ULONG_PTR)stack.StackBase - (ULONG_PTR)stack.DeallocationStack);
todo_wine ok((ULONG_PTR)stack.StackBase - (ULONG_PTR)stack.StackLimit == tests[i].expect_commit,
- "%u: got commit %#lx\n", i, (ULONG_PTR)stack.StackBase - (ULONG_PTR)stack.StackLimit);
+ "%u: got commit %#Ix\n", i, (ULONG_PTR)stack.StackBase - (ULONG_PTR)stack.StackLimit);
pRtlFreeUserStack(stack.DeallocationStack);
}
ret = pRtlCreateUserStack(0x11000, 0x110000, 0, 1, 0, &stack);
- ok(ret == STATUS_INVALID_PARAMETER, "got %#x\n", ret);
+ ok(ret == STATUS_INVALID_PARAMETER, "got %#lx\n", ret);
ret = pRtlCreateUserStack(0x11000, 0x110000, 0, 0, 1, &stack);
- ok(ret == STATUS_INVALID_PARAMETER, "got %#x\n", ret);
+ ok(ret == STATUS_INVALID_PARAMETER, "got %#lx\n", ret);
args.expect_committed = 0x4000;
args.expect_reserved = default_reserve;
@@ -634,7 +635,7 @@ static void test_RtlCreateUserStack(void)
ok( ret == expect_ret || ret == STATUS_NO_MEMORY ||
(ret == STATUS_INVALID_PARAMETER_3 && expect_ret == STATUS_INVALID_PARAMETER) ||
broken( i == 1 && ret == STATUS_INVALID_PARAMETER_3 ), /* win7 */
- "%u: got %x / %x\n", i, ret, expect_ret );
+ "%u: got %lx / %lx\n", i, ret, expect_ret );
if (!ret) pRtlFreeUserStack( stack.DeallocationStack );
ret = pRtlCreateUserThread( GetCurrentProcess(), NULL, FALSE, i,
args.expect_reserved, args.expect_committed,
@@ -642,7 +643,7 @@ static void test_RtlCreateUserStack(void)
ok( ret == expect_ret || ret == STATUS_NO_MEMORY ||
(ret == STATUS_INVALID_PARAMETER_3 && expect_ret == STATUS_INVALID_PARAMETER) ||
broken( i == 1 && ret == STATUS_INVALID_PARAMETER_3 ), /* win7 */
- "%u: got %x / %x\n", i, ret, expect_ret );
+ "%u: got %lx / %lx\n", i, ret, expect_ret );
if (!ret)
{
WaitForSingleObject( thread, INFINITE );
@@ -654,14 +655,14 @@ static void test_RtlCreateUserStack(void)
ret = pRtlCreateUserStack( args.expect_committed, args.expect_reserved, mask, 0x1000, 0x1000, &stack );
ok( ret == expect_ret || ret == STATUS_NO_MEMORY ||
(ret == STATUS_INVALID_PARAMETER_3 && expect_ret == STATUS_INVALID_PARAMETER),
- "%08x: got %x / %x\n", mask, ret, expect_ret );
+ "%08lx: got %lx / %lx\n", mask, ret, expect_ret );
if (!ret) pRtlFreeUserStack( stack.DeallocationStack );
ret = pRtlCreateUserThread( GetCurrentProcess(), NULL, FALSE, mask,
args.expect_reserved, args.expect_committed,
(void *)test_stack_size_thread, &args, &thread, &id );
ok( ret == expect_ret || ret == STATUS_NO_MEMORY ||
(ret == STATUS_INVALID_PARAMETER_3 && expect_ret == STATUS_INVALID_PARAMETER),
- "%08x: got %x / %x\n", mask, ret, expect_ret );
+ "%08lx: got %lx / %lx\n", mask, ret, expect_ret );
if (!ret)
{
WaitForSingleObject( thread, INFINITE );
@@ -703,12 +704,12 @@ static void test_NtMapViewOfSection(void)
size = 0;
offset.QuadPart = 0;
status = NtMapViewOfSection(mapping, process, &ptr, 0, 0, &offset, &size, 1, 0, PAGE_READWRITE);
- ok(status == STATUS_SUCCESS, "NtMapViewOfSection returned %08x\n", status);
+ ok(status == STATUS_SUCCESS, "NtMapViewOfSection returned %08lx\n", status);
ok(!((ULONG_PTR)ptr & 0xffff), "returned memory %p is not aligned to 64k\n", ptr);
ret = ReadProcessMemory(process, ptr, buffer, sizeof(buffer), &result);
ok(ret, "ReadProcessMemory failed\n");
- ok(result == sizeof(buffer), "ReadProcessMemory didn't read all data (%lx)\n", result);
+ ok(result == sizeof(buffer), "ReadProcessMemory didn't read all data (%Ix)\n", result);
ok(!memcmp(buffer, data, sizeof(buffer)), "Wrong data read\n");
/* 1 zero bits should zero 63-31 upper bits */
@@ -718,14 +719,14 @@ static void test_NtMapViewOfSection(void)
offset.QuadPart = 0;
status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, MEM_TOP_DOWN, PAGE_READWRITE);
ok(status == STATUS_SUCCESS || status == STATUS_NO_MEMORY,
- "NtMapViewOfSection returned %08x\n", status);
+ "NtMapViewOfSection returned %08lx\n", status);
if (status == STATUS_SUCCESS)
{
ok(((UINT_PTR)ptr2 >> (32 - zero_bits)) == 0,
"NtMapViewOfSection returned address: %p\n", ptr2);
status = NtUnmapViewOfSection(process, ptr2);
- ok(status == STATUS_SUCCESS, "NtUnmapViewOfSection returned %08x\n", status);
+ ok(status == STATUS_SUCCESS, "NtUnmapViewOfSection returned %08lx\n", status);
}
for (zero_bits = 2; zero_bits <= 20; zero_bits++)
@@ -735,14 +736,14 @@ static void test_NtMapViewOfSection(void)
offset.QuadPart = 0;
status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, MEM_TOP_DOWN, PAGE_READWRITE);
ok(status == STATUS_SUCCESS || status == STATUS_NO_MEMORY,
- "NtMapViewOfSection with %d zero_bits returned %08x\n", (int)zero_bits, status);
+ "NtMapViewOfSection with %d zero_bits returned %08lx\n", (int)zero_bits, status);
if (status == STATUS_SUCCESS)
{
ok(((UINT_PTR)ptr2 >> (32 - zero_bits)) == 0,
"NtMapViewOfSection with %d zero_bits returned address %p\n", (int)zero_bits, ptr2);
status = NtUnmapViewOfSection(process, ptr2);
- ok(status == STATUS_SUCCESS, "NtUnmapViewOfSection returned %08x\n", status);
+ ok(status == STATUS_SUCCESS, "NtUnmapViewOfSection returned %08lx\n", status);
}
}
@@ -752,7 +753,7 @@ static void test_NtMapViewOfSection(void)
offset.QuadPart = 0;
status = NtMapViewOfSection(mapping, process, &ptr2, 21, 0, &offset, &size, 1, 0, PAGE_READWRITE);
ok(status == STATUS_NO_MEMORY || status == STATUS_INVALID_PARAMETER,
- "NtMapViewOfSection returned %08x\n", status);
+ "NtMapViewOfSection returned %08lx\n", status);
/* 22 zero bits is invalid */
ptr2 = NULL;
@@ -760,7 +761,7 @@ static void test_NtMapViewOfSection(void)
offset.QuadPart = 0;
status = NtMapViewOfSection(mapping, process, &ptr2, 22, 0, &offset, &size, 1, 0, PAGE_READWRITE);
ok(status == STATUS_INVALID_PARAMETER_4 || status == STATUS_INVALID_PARAMETER,
- "NtMapViewOfSection returned %08x\n", status);
+ "NtMapViewOfSection returned %08lx\n", status);
/* zero bits > 31 should be considered as a leading zeroes bitmask on 64bit and WoW64 */
ptr2 = NULL;
@@ -771,12 +772,12 @@ static void test_NtMapViewOfSection(void)
if (!is_win64 && !is_wow64)
{
- ok(status == STATUS_INVALID_PARAMETER_4, "NtMapViewOfSection returned %08x\n", status);
+ ok(status == STATUS_INVALID_PARAMETER_4, "NtMapViewOfSection returned %08lx\n", status);
}
else
{
ok(status == STATUS_SUCCESS || status == STATUS_NO_MEMORY,
- "NtMapViewOfSection returned %08x\n", status);
+ "NtMapViewOfSection returned %08lx\n", status);
if (status == STATUS_SUCCESS)
{
ok(((UINT_PTR)ptr2 & ~get_zero_bits_mask(zero_bits)) == 0 &&
@@ -784,7 +785,7 @@ static void test_NtMapViewOfSection(void)
"NtMapViewOfSection returned address %p\n", ptr2);
status = NtUnmapViewOfSection(process, ptr2);
- ok(status == STATUS_SUCCESS, "NtUnmapViewOfSection returned %08x\n", status);
+ ok(status == STATUS_SUCCESS, "NtUnmapViewOfSection returned %08lx\n", status);
}
}
@@ -793,28 +794,28 @@ static void test_NtMapViewOfSection(void)
size = 0;
offset.QuadPart = 0;
status = NtMapViewOfSection(mapping, process, &ptr2, 0, 0, &offset, &size, 1, 0, PAGE_READWRITE);
- ok(status == STATUS_CONFLICTING_ADDRESSES, "NtMapViewOfSection returned %08x\n", status);
+ ok(status == STATUS_CONFLICTING_ADDRESSES, "NtMapViewOfSection returned %08lx\n", status);
/* offset has to be aligned */
ptr2 = ptr;
size = 0;
offset.QuadPart = 1;
status = NtMapViewOfSection(mapping, process, &ptr2, 0, 0, &offset, &size, 1, 0, PAGE_READWRITE);
- ok(status == STATUS_MAPPED_ALIGNMENT, "NtMapViewOfSection returned %08x\n", status);
+ ok(status == STATUS_MAPPED_ALIGNMENT, "NtMapViewOfSection returned %08lx\n", status);
/* ptr has to be aligned */
ptr2 = (char *)ptr + 42;
size = 0;
offset.QuadPart = 0;
status = NtMapViewOfSection(mapping, process, &ptr2, 0, 0, &offset, &size, 1, 0, PAGE_READWRITE);
- ok(status == STATUS_MAPPED_ALIGNMENT, "NtMapViewOfSection returned %08x\n", status);
+ ok(status == STATUS_MAPPED_ALIGNMENT, "NtMapViewOfSection returned %08lx\n", status);
/* still not 64k aligned */
ptr2 = (char *)ptr + 0x1000;
size = 0;
offset.QuadPart = 0;
status = NtMapViewOfSection(mapping, process, &ptr2, 0, 0, &offset, &size, 1, 0, PAGE_READWRITE);
- ok(status == STATUS_MAPPED_ALIGNMENT, "NtMapViewOfSection returned %08x\n", status);
+ ok(status == STATUS_MAPPED_ALIGNMENT, "NtMapViewOfSection returned %08lx\n", status);
/* when an address is passed, it has to satisfy the provided number of zero bits */
ptr2 = (char *)ptr + 0x1000;
@@ -823,14 +824,14 @@ static void test_NtMapViewOfSection(void)
zero_bits = get_zero_bits(((UINT_PTR)ptr2) >> 1);
status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, 0, PAGE_READWRITE);
ok(status == STATUS_INVALID_PARAMETER_4 || status == STATUS_INVALID_PARAMETER,
- "NtMapViewOfSection returned %08x\n", status);
+ "NtMapViewOfSection returned %08lx\n", status);
ptr2 = (char *)ptr + 0x1000;
size = 0;
offset.QuadPart = 0;
zero_bits = get_zero_bits((UINT_PTR)ptr2);
status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, 0, PAGE_READWRITE);
- ok(status == STATUS_MAPPED_ALIGNMENT, "NtMapViewOfSection returned %08x\n", status);
+ ok(status == STATUS_MAPPED_ALIGNMENT, "NtMapViewOfSection returned %08lx\n", status);
if (!is_win64 && !is_wow64)
{
@@ -840,14 +841,14 @@ static void test_NtMapViewOfSection(void)
offset.QuadPart = 0;
status = NtMapViewOfSection(mapping, process, &ptr2, 0, 0, &offset,
&size, 1, AT_ROUND_TO_PAGE, PAGE_READWRITE);
- ok(status == STATUS_CONFLICTING_ADDRESSES, "NtMapViewOfSection returned %08x\n", status);
+ ok(status == STATUS_CONFLICTING_ADDRESSES, "NtMapViewOfSection returned %08lx\n", status);
ptr2 = (char *)ptr + 42;
size = 0;
offset.QuadPart = 0;
status = NtMapViewOfSection(mapping, process, &ptr2, 0, 0, &offset,
&size, 1, AT_ROUND_TO_PAGE, PAGE_READWRITE);
- ok(status == STATUS_CONFLICTING_ADDRESSES, "NtMapViewOfSection returned %08x\n", status);
+ ok(status == STATUS_CONFLICTING_ADDRESSES, "NtMapViewOfSection returned %08lx\n", status);
/* in contrary to regular NtMapViewOfSection, only 4kb align is enforced */
ptr2 = (char *)ptr + 0x1000;
@@ -855,11 +856,11 @@ static void test_NtMapViewOfSection(void)
offset.QuadPart = 0;
status = NtMapViewOfSection(mapping, process, &ptr2, 0, 0, &offset,
&size, 1, AT_ROUND_TO_PAGE, PAGE_READWRITE);
- ok(status == STATUS_SUCCESS, "NtMapViewOfSection returned %08x\n", status);
+ ok(status == STATUS_SUCCESS, "NtMapViewOfSection returned %08lx\n", status);
ok((char *)ptr2 == (char *)ptr + 0x1000,
"expected address %p, got %p\n", (char *)ptr + 0x1000, ptr2);
status = NtUnmapViewOfSection(process, ptr2);
- ok(status == STATUS_SUCCESS, "NtUnmapViewOfSection returned %08x\n", status);
+ ok(status == STATUS_SUCCESS, "NtUnmapViewOfSection returned %08lx\n", status);
/* the address is rounded down if not on a page boundary */
ptr2 = (char *)ptr + 0x1001;
@@ -867,22 +868,22 @@ static void test_NtMapViewOfSection(void)
offset.QuadPart = 0;
status = NtMapViewOfSection(mapping, process, &ptr2, 0, 0, &offset,
&size, 1, AT_ROUND_TO_PAGE, PAGE_READWRITE);
- ok(status == STATUS_SUCCESS, "NtMapViewOfSection returned %08x\n", status);
+ ok(status == STATUS_SUCCESS, "NtMapViewOfSection returned %08lx\n", status);
ok((char *)ptr2 == (char *)ptr + 0x1000,
"expected address %p, got %p\n", (char *)ptr + 0x1000, ptr2);
status = NtUnmapViewOfSection(process, ptr2);
- ok(status == STATUS_SUCCESS, "NtUnmapViewOfSection returned %08x\n", status);
+ ok(status == STATUS_SUCCESS, "NtUnmapViewOfSection returned %08lx\n", status);
ptr2 = (char *)ptr + 0x2000;
size = 0;
offset.QuadPart = 0;
status = NtMapViewOfSection(mapping, process, &ptr2, 0, 0, &offset,
&size, 1, AT_ROUND_TO_PAGE, PAGE_READWRITE);
- ok(status == STATUS_SUCCESS, "NtMapViewOfSection returned %08x\n", status);
+ ok(status == STATUS_SUCCESS, "NtMapViewOfSection returned %08lx\n", status);
ok((char *)ptr2 == (char *)ptr + 0x2000,
"expected address %p, got %p\n", (char *)ptr + 0x2000, ptr2);
status = NtUnmapViewOfSection(process, ptr2);
- ok(status == STATUS_SUCCESS, "NtUnmapViewOfSection returned %08x\n", status);
+ ok(status == STATUS_SUCCESS, "NtUnmapViewOfSection returned %08lx\n", status);
}
else
{
@@ -893,11 +894,11 @@ static void test_NtMapViewOfSection(void)
&size, 1, AT_ROUND_TO_PAGE, PAGE_READWRITE);
todo_wine
ok(status == STATUS_INVALID_PARAMETER_9 || status == STATUS_INVALID_PARAMETER,
- "NtMapViewOfSection returned %08x\n", status);
+ "NtMapViewOfSection returned %08lx\n", status);
}
status = NtUnmapViewOfSection(process, ptr);
- ok(status == STATUS_SUCCESS, "NtUnmapViewOfSection returned %08x\n", status);
+ ok(status == STATUS_SUCCESS, "NtUnmapViewOfSection returned %08lx\n", status);
NtClose(mapping);
@@ -939,7 +940,7 @@ static void test_user_shared_data(void)
unsigned int i;
ok(user_shared_data->NumberOfPhysicalPages == sbi.MmNumberOfPhysicalPages,
- "Got number of physical pages %#x, expected %#x.\n",
+ "Got number of physical pages %#lx, expected %#lx.\n",
user_shared_data->NumberOfPhysicalPages, sbi.MmNumberOfPhysicalPages);
#if defined(__i386__) || defined(__x86_64__)
@@ -948,7 +949,7 @@ static void test_user_shared_data(void)
#endif
ok(user_shared_data->ActiveProcessorCount == NtCurrentTeb()->Peb->NumberOfProcessors
|| broken(!user_shared_data->ActiveProcessorCount) /* before Win7 */,
- "Got unexpected ActiveProcessorCount %u.\n", user_shared_data->ActiveProcessorCount);
+ "Got unexpected ActiveProcessorCount %lu.\n", user_shared_data->ActiveProcessorCount);
ok(user_shared_data->ActiveGroupCount == 1
|| broken(!user_shared_data->ActiveGroupCount) /* before Win7 */,
"Got unexpected ActiveGroupCount %u.\n", user_shared_data->ActiveGroupCount);
@@ -990,24 +991,24 @@ static void test_user_shared_data(void)
"Got unexpected EnabledFeatures %s.\n", wine_dbgstr_longlong(xstate.EnabledFeatures));
ok((xstate.EnabledVolatileFeatures & SUPPORTED_XSTATE_FEATURES) == xstate.EnabledFeatures,
"Got unexpected EnabledVolatileFeatures %s.\n", wine_dbgstr_longlong(xstate.EnabledVolatileFeatures));
- ok(xstate.Size >= 512 + sizeof(XSTATE), "Got unexpected Size %u.\n", xstate.Size);
+ ok(xstate.Size >= 512 + sizeof(XSTATE), "Got unexpected Size %lu.\n", xstate.Size);
if (xstate.CompactionEnabled)
ok(xstate.OptimizedSave, "Got zero OptimizedSave with compaction enabled.\n");
ok(!xstate.AlignedFeatures, "Got unexpected AlignedFeatures %s.\n",
wine_dbgstr_longlong(xstate.AlignedFeatures));
ok(xstate.AllFeatureSize >= 512 + sizeof(XSTATE)
|| !xstate.AllFeatureSize /* win8 on CPUs without XSAVEC */,
- "Got unexpected AllFeatureSize %u.\n", xstate.AllFeatureSize);
+ "Got unexpected AllFeatureSize %lu.\n", xstate.AllFeatureSize);
for (i = 0; i < ARRAY_SIZE(feature_sizes); ++i)
{
ok(xstate.AllFeatures[i] == feature_sizes[i]
|| !xstate.AllFeatures[i] /* win8+ on CPUs without XSAVEC */,
- "Got unexpected AllFeatures[%u] %u, expected %u.\n", i,
+ "Got unexpected AllFeatures[%u] %lu, expected %lu.\n", i,
xstate.AllFeatures[i], feature_sizes[i]);
- ok(xstate.Features[i].Size == feature_sizes[i], "Got unexpected Features[%u].Size %u, expected %u.\n", i,
+ ok(xstate.Features[i].Size == feature_sizes[i], "Got unexpected Features[%u].Size %lu, expected %lu.\n", i,
xstate.Features[i].Size, feature_sizes[i]);
- ok(xstate.Features[i].Offset == feature_offsets[i], "Got unexpected Features[%u].Offset %u, expected %u.\n",
+ ok(xstate.Features[i].Offset == feature_offsets[i], "Got unexpected Features[%u].Offset %lu, expected %lu.\n",
i, xstate.Features[i].Offset, feature_offsets[i]);
}
}
@@ -1062,11 +1063,11 @@ static void test_syscalls(void)
/* initial image */
pNtClose = (void *)GetProcAddress( module, "NtClose" );
handle = CreateEventW( NULL, FALSE, FALSE, NULL );
- ok( handle != 0, "CreateEventWfailed %u\n", GetLastError() );
+ ok( handle != 0, "CreateEventWfailed %lu\n", GetLastError() );
status = pNtClose( handle );
- ok( !status, "NtClose failed %x\n", status );
+ ok( !status, "NtClose failed %lx\n", status );
status = pNtClose( handle );
- ok( status == STATUS_INVALID_HANDLE, "NtClose failed %x\n", status );
+ ok( status == STATUS_INVALID_HANDLE, "NtClose failed %lx\n", status );
/* syscall thunk copy */
ptr = VirtualAlloc( NULL, 0x1000, MEM_COMMIT, PAGE_EXECUTE_READWRITE );
@@ -1074,21 +1075,21 @@ static void test_syscalls(void)
memcpy( ptr, pNtClose, 32 );
pNtClose = ptr;
handle = CreateEventW( NULL, FALSE, FALSE, NULL );
- ok( handle != 0, "CreateEventWfailed %u\n", GetLastError() );
+ ok( handle != 0, "CreateEventWfailed %lu\n", GetLastError() );
status = pNtClose( handle );
- ok( !status, "NtClose failed %x\n", status );
+ ok( !status, "NtClose failed %lx\n", status );
status = pNtClose( handle );
- ok( status == STATUS_INVALID_HANDLE, "NtClose failed %x\n", status );
+ ok( status == STATUS_INVALID_HANDLE, "NtClose failed %lx\n", status );
VirtualFree( ptr, 0, MEM_FREE );
/* new mapping */
GetModuleFileNameW( module, path, MAX_PATH );
file = CreateFileW( path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 );
- ok( file != INVALID_HANDLE_VALUE, "can't open %s: %u\n", wine_dbgstr_w(path), GetLastError() );
+ ok( file != INVALID_HANDLE_VALUE, "can't open %s: %lu\n", wine_dbgstr_w(path), GetLastError() );
mapping = CreateFileMappingW( file, NULL, SEC_IMAGE | PAGE_READONLY, 0, 0, NULL );
- ok( mapping != NULL, "CreateFileMappingW failed err %u\n", GetLastError() );
+ ok( mapping != NULL, "CreateFileMappingW failed err %lu\n", GetLastError() );
ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 0 );
- ok( ptr != NULL, "MapViewOfFile failed err %u\n", GetLastError() );
+ ok( ptr != NULL, "MapViewOfFile failed err %lu\n", GetLastError() );
CloseHandle( mapping );
CloseHandle( file );
delta = (char *)ptr - (char *)module;
@@ -1115,11 +1116,11 @@ static void test_syscalls(void)
{
pNtClose = (void *)((char *)pNtClose + delta);
handle = CreateEventW( NULL, FALSE, FALSE, NULL );
- ok( handle != 0, "CreateEventWfailed %u\n", GetLastError() );
+ ok( handle != 0, "CreateEventWfailed %lu\n", GetLastError() );
status = pNtClose( handle );
- ok( !status, "NtClose failed %x\n", status );
+ ok( !status, "NtClose failed %lx\n", status );
status = pNtClose( handle );
- ok( status == STATUS_INVALID_HANDLE, "NtClose failed %x\n", status );
+ ok( status == STATUS_INVALID_HANDLE, "NtClose failed %lx\n", status );
}
else
{
@@ -1162,7 +1163,7 @@ START_TEST(virtual)
pNtAllocateVirtualMemoryEx = (void *)GetProcAddress(mod, "NtAllocateVirtualMemoryEx");
NtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), NULL);
- trace("system page size %#x\n", sbi.PageSize);
+ trace("system page size %#lx\n", sbi.PageSize);
page_size = sbi.PageSize;
if (!pIsWow64Process || !pIsWow64Process(NtCurrentProcess(), &is_wow64)) is_wow64 = FALSE;
1
0
24 Mar '22
Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com>
---
dlls/ntdll/tests/time.c | 89 ++++++++++++++++++++++++-----------------------
1 file changed, 45 insertions(+), 44 deletions(-)
diff --git a/dlls/ntdll/tests/time.c b/dlls/ntdll/tests/time.c
index 549db5b22b6..37b4d114a2b 100644
--- a/dlls/ntdll/tests/time.c
+++ b/dlls/ntdll/tests/time.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 */
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
@@ -113,18 +114,18 @@ static void test_NtQueryPerformanceCounter(void)
NTSTATUS status;
status = pNtQueryPerformanceCounter(NULL, NULL);
- ok(status == STATUS_ACCESS_VIOLATION, "expected STATUS_ACCESS_VIOLATION, got %08x\n", status);
+ ok(status == STATUS_ACCESS_VIOLATION, "expected STATUS_ACCESS_VIOLATION, got %08lx\n", status);
status = pNtQueryPerformanceCounter(NULL, &frequency);
- ok(status == STATUS_ACCESS_VIOLATION, "expected STATUS_ACCESS_VIOLATION, got %08x\n", status);
+ ok(status == STATUS_ACCESS_VIOLATION, "expected STATUS_ACCESS_VIOLATION, got %08lx\n", status);
status = pNtQueryPerformanceCounter(&counter, (void *)0xdeadbee0);
- ok(status == STATUS_ACCESS_VIOLATION, "expected STATUS_ACCESS_VIOLATION, got %08x\n", status);
+ ok(status == STATUS_ACCESS_VIOLATION, "expected STATUS_ACCESS_VIOLATION, got %08lx\n", status);
status = pNtQueryPerformanceCounter((void *)0xdeadbee0, &frequency);
- ok(status == STATUS_ACCESS_VIOLATION, "expected STATUS_ACCESS_VIOLATION, got %08x\n", status);
+ ok(status == STATUS_ACCESS_VIOLATION, "expected STATUS_ACCESS_VIOLATION, got %08lx\n", status);
status = pNtQueryPerformanceCounter(&counter, NULL);
- ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %08x\n", status);
+ ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %08lx\n", status);
status = pNtQueryPerformanceCounter(&counter, &frequency);
- ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %08x\n", status);
+ ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %08lx\n", status);
}
#if defined(__i386__) || defined(__x86_64__)
@@ -175,8 +176,8 @@ static void test_RtlQueryPerformanceCounter(void)
hsd = NULL;
status = pNtQuerySystemInformation( SystemHypervisorSharedPageInformation, &hsd, sizeof(void *), &len );
- ok( !status, "NtQuerySystemInformation returned %x\n", status );
- ok( len == sizeof(void *), "unexpected SystemHypervisorSharedPageInformation length %u\n", len );
+ ok( !status, "NtQuerySystemInformation returned %lx\n", status );
+ ok( len == sizeof(void *), "unexpected SystemHypervisorSharedPageInformation length %lu\n", len );
ok( !!hsd, "unexpected SystemHypervisorSharedPageInformation address %p\n", hsd );
tsc0 = __rdtsc();
@@ -219,17 +220,17 @@ static void test_RtlQueryPerformanceCounter(void)
#define TIMER_LEEWAY 10
#define CHECK_CURRENT_TIMER(expected) \
do { \
- ok(status == STATUS_SUCCESS, "NtSetTimerResolution failed %x\n", status); \
- ok(cur2 == (expected) || broken(abs((int)((expected) - cur2)) <= TIMER_LEEWAY), "expected new timer resolution %u, got %u\n", (expected), cur2); \
+ ok(status == STATUS_SUCCESS, "NtSetTimerResolution failed %lx\n", status); \
+ ok(cur2 == (expected) || broken(abs((int)((expected) - cur2)) <= TIMER_LEEWAY), "expected new timer resolution %lu, got %lu\n", (expected), cur2); \
set = cur2; \
min2 = min + 20000; \
cur2 = min2 + 1; \
max2 = cur2 + 1; \
status = NtQueryTimerResolution(&min2, &max2, &cur2); \
- ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed %x\n", status); \
- ok(min2 == min, "NtQueryTimerResolution() expected min=%u, got %u\n", min, min2); \
- ok(max2 == max, "NtQueryTimerResolution() expected max=%u, got %u\n", max, max2); \
- ok(cur2 == set, "NtQueryTimerResolution() expected timer resolution %u, got %u\n", set, cur2); \
+ ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed %lx\n", status); \
+ ok(min2 == min, "NtQueryTimerResolution() expected min=%lu, got %lu\n", min, min2); \
+ ok(max2 == max, "NtQueryTimerResolution() expected max=%lu, got %lu\n", max, max2); \
+ ok(cur2 == set, "NtQueryTimerResolution() expected timer resolution %lu, got %lu\n", set, cur2); \
} while (0)
static void test_TimerResolution(void)
@@ -250,35 +251,35 @@ static void test_TimerResolution(void)
cur = min + 1;
max = cur + 1;
status = NtQueryTimerResolution(&min, &max, &cur);
- ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed (%x)\n", status);
+ ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed (%lx)\n", status);
ok(min == 156250 /* 1/64s HPET */ || min == 156001 /* RTC */,
- "unexpected minimum timer resolution %u\n", min);
- ok(0 < max, "invalid maximum timer resolution, should be 0 < %u\n", max);
- ok(max <= cur || broken(max - TIMER_LEEWAY <= cur), "invalid timer resolutions, should be %u <= %u\n", max, cur);
- ok(cur <= min || broken(cur <= min + TIMER_LEEWAY), "invalid timer resolutions, should be %u <= %u\n", cur, min);
+ "unexpected minimum timer resolution %lu\n", min);
+ ok(0 < max, "invalid maximum timer resolution, should be 0 < %lu\n", max);
+ ok(max <= cur || broken(max - TIMER_LEEWAY <= cur), "invalid timer resolutions, should be %lu <= %lu\n", max, cur);
+ ok(cur <= min || broken(cur <= min + TIMER_LEEWAY), "invalid timer resolutions, should be %lu <= %lu\n", cur, min);
status = NtSetTimerResolution(0, FALSE, NULL);
ok(status == STATUS_ACCESS_VIOLATION, "NtSetTimerResolution(,,NULL) success\n");
/* Nothing happens if that pointer is not good */
status = NtSetTimerResolution(cur - 1, TRUE, NULL);
- ok(status == STATUS_ACCESS_VIOLATION, "NtSetTimerResolution() failed %x\n", status);
+ ok(status == STATUS_ACCESS_VIOLATION, "NtSetTimerResolution() failed %lx\n", status);
min2 = min + 10000;
cur2 = min2 + 1;
max2 = cur2 + 1;
status = NtQueryTimerResolution(&min2, &max2, &cur2);
- ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed (%x)\n", status);
- ok(min2 == min, "NtQueryTimerResolution() expected min=%u, got %u\n", min, min2);
- ok(max2 == max, "NtQueryTimerResolution() expected max=%u, got %u\n", max, max2);
- ok(cur2 == cur, "NtQueryTimerResolution() expected timer resolution %u, got %u\n", cur, cur2);
+ ok(status == STATUS_SUCCESS, "NtQueryTimerResolution() failed (%lx)\n", status);
+ ok(min2 == min, "NtQueryTimerResolution() expected min=%lu, got %lu\n", min, min2);
+ ok(max2 == max, "NtQueryTimerResolution() expected max=%lu, got %lu\n", max, max2);
+ ok(cur2 == cur, "NtQueryTimerResolution() expected timer resolution %lu, got %lu\n", cur, cur2);
/* 'fails' until the first valid timer resolution request */
cur2 = 7654321;
status = NtSetTimerResolution(0, FALSE, &cur2);
- ok(status == STATUS_TIMER_RESOLUTION_NOT_SET, "NtSetTimerResolution() failed %x\n", status);
+ ok(status == STATUS_TIMER_RESOLUTION_NOT_SET, "NtSetTimerResolution() failed %lx\n", status);
/* and returns the current timer resolution */
- ok(cur2 == cur, "expected requested timer resolution %u, got %u\n", cur, cur2);
+ ok(cur2 == cur, "expected requested timer resolution %lu, got %lu\n", cur, cur2);
cur2 = 7654321;
@@ -288,18 +289,18 @@ static void test_TimerResolution(void)
/* Rescinds our timer resolution request */
cur2 = 7654321;
status = NtSetTimerResolution(0, FALSE, &cur2);
- ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %x\n", status);
+ ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %lx\n", status);
/* -> the timer resolution was reset to its initial value */
- ok(cur2 == cur, "expected requested timer resolution %u, got %u\n", min, cur2);
+ ok(cur2 == cur, "expected requested timer resolution %lu, got %lu\n", min, cur2);
cur2 = 7654321;
status = NtSetTimerResolution(0, FALSE, &cur2);
- ok(status == STATUS_TIMER_RESOLUTION_NOT_SET, "NtSetTimerResolution() failed %x\n", status);
- ok(cur2 == cur, "expected requested timer resolution %u, got %u\n", cur, cur2);
+ ok(status == STATUS_TIMER_RESOLUTION_NOT_SET, "NtSetTimerResolution() failed %lx\n", status);
+ ok(cur2 == cur, "expected requested timer resolution %lu, got %lu\n", cur, cur2);
cur2 = 7654321;
status = NtSetTimerResolution(min + 1, TRUE, &cur2);
- ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %x\n", status);
+ ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %lx\n", status);
/* This works because:
* - Either cur is the minimum (15.6 ms) resolution already, i.e. the
* closest valid value 'set' is rounded to.
@@ -313,9 +314,9 @@ static void test_TimerResolution(void)
cur2 = 7654321;
set = max < cur ? cur - 1 : max;
status = NtSetTimerResolution(set, TRUE, &cur2);
- ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %x\n", status);
- ok(cur2 <= set || broken(cur2 <= set + TIMER_LEEWAY), "expected new timer resolution %u <= %u\n", cur2, set);
- trace("timer resolution: %u(max) <= %u(cur) <= %u(prev) <= %u(min)\n", max, cur2, cur, min);
+ ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %lx\n", status);
+ ok(cur2 <= set || broken(cur2 <= set + TIMER_LEEWAY), "expected new timer resolution %lu <= %lu\n", cur2, set);
+ trace("timer resolution: %lu(max) <= %lu(cur) <= %lu(prev) <= %lu(min)\n", max, cur2, cur, min);
cur2 = 7654321;
status = NtSetTimerResolution(cur + 1, TRUE, &cur2);
@@ -324,8 +325,8 @@ static void test_TimerResolution(void)
/* Cleanup by rescinding the last request */
cur2 = 7654321;
status = NtSetTimerResolution(0, FALSE, &cur2);
- ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %x\n", status);
- ok(cur2 == cur, "expected requested timer resolution %u, got %u\n", set, cur2);
+ ok(status == STATUS_SUCCESS, "NtSetTimerResolution() failed %lx\n", status);
+ ok(cur2 == cur, "expected requested timer resolution %lu, got %lu\n", set, cur2);
}
static void test_RtlQueryTimeZoneInformation(void)
@@ -345,7 +346,7 @@ static void test_RtlQueryTimeZoneInformation(void)
memset(&tzinfo, 0xcc, sizeof(tzinfo));
status = pRtlQueryDynamicTimeZoneInformation(&tzinfo);
ok(status == STATUS_SUCCESS,
- "RtlQueryDynamicTimeZoneInformation failed, got %08x\n", status);
+ "RtlQueryDynamicTimeZoneInformation failed, got %08lx\n", status);
ok(tzinfo.StandardName[0] == '@' ||
broken(tzinfo.StandardName[0]), /* some win10 2004 */
"standard time zone name isn't an indirect string, got %s\n",
@@ -357,14 +358,14 @@ static void test_RtlQueryTimeZoneInformation(void)
memset(&tzinfo2, 0xcc, sizeof(tzinfo2));
status = pNtQuerySystemInformation( SystemDynamicTimeZoneInformation, &tzinfo2, sizeof(tzinfo2), &len );
- ok( !status, "NtQuerySystemInformation failed %x\n", status );
- ok( len == sizeof(tzinfo2), "wrong len %u\n", len );
+ ok( !status, "NtQuerySystemInformation failed %lx\n", status );
+ ok( len == sizeof(tzinfo2), "wrong len %lu\n", len );
ok( !memcmp( &tzinfo, &tzinfo2, sizeof(tzinfo2) ), "tz data is different\n" );
memset(&tzinfo, 0xcc, sizeof(tzinfo));
status = pRtlQueryTimeZoneInformation((RTL_TIME_ZONE_INFORMATION *)&tzinfo);
ok(status == STATUS_SUCCESS,
- "RtlQueryTimeZoneInformation failed, got %08x\n", status);
+ "RtlQueryTimeZoneInformation failed, got %08lx\n", status);
ok(tzinfo.StandardName[0] == '@' ||
broken(tzinfo.StandardName[0]), /* some win10 2004 */
"standard time zone name isn't an indirect string, got %s\n",
@@ -377,7 +378,7 @@ static void test_RtlQueryTimeZoneInformation(void)
memset(&tzinfo, 0xcc, sizeof(tzinfo));
status = pRtlQueryTimeZoneInformation((RTL_TIME_ZONE_INFORMATION *)&tzinfo);
ok(status == STATUS_SUCCESS,
- "RtlQueryTimeZoneInformation failed, got %08x\n", status);
+ "RtlQueryTimeZoneInformation failed, got %08lx\n", status);
ok(tzinfo.StandardName[0] == '@' ||
broken(tzinfo.StandardName[0]), /* some win10 2004 */
"standard time zone name isn't an indirect string, got %s\n",
@@ -390,8 +391,8 @@ static void test_RtlQueryTimeZoneInformation(void)
memset(&tzinfo2, 0xcc, sizeof(tzinfo2));
status = pNtQuerySystemInformation( SystemCurrentTimeZoneInformation, &tzinfo2,
sizeof(RTL_TIME_ZONE_INFORMATION), &len );
- ok( !status, "NtQuerySystemInformation failed %x\n", status );
- ok( len == sizeof(RTL_TIME_ZONE_INFORMATION), "wrong len %u\n", len );
+ ok( !status, "NtQuerySystemInformation failed %lx\n", status );
+ ok( len == sizeof(RTL_TIME_ZONE_INFORMATION), "wrong len %lu\n", len );
ok( !memcmp( &tzinfo, &tzinfo2, sizeof(RTL_TIME_ZONE_INFORMATION) ), "tz data is different\n" );
}
@@ -469,7 +470,7 @@ static void test_user_shared_data_time(void)
t1 = read_ksystem_time(&user_shared_data->TimeZoneBias);
status = NtQuerySystemInformation(SystemTimeOfDayInformation, &timeofday, sizeof(timeofday), NULL);
- ok(!status, "failed to query time of day, status %#x\n", status);
+ ok(!status, "failed to query time of day, status %#lx\n", status);
ok(timeofday.TimeZoneBias.QuadPart == t1, "got USD bias %I64u, ntdll bias %I64u\n",
t1, timeofday.TimeZoneBias.QuadPart);
}
1
0
24 Mar '22
Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com>
---
dlls/ntdll/tests/thread.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/dlls/ntdll/tests/thread.c b/dlls/ntdll/tests/thread.c
index f381f64dbfe..336e0741e93 100644
--- a/dlls/ntdll/tests/thread.c
+++ b/dlls/ntdll/tests/thread.c
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
#include "ntdll_test.h"
@@ -56,30 +57,30 @@ static void test_dbg_hidden_thread_creation(void)
status = pNtCreateThreadEx( &thread, THREAD_ALL_ACCESS, NULL, GetCurrentProcess(), test_NtCreateThreadEx_proc,
NULL, THREAD_CREATE_FLAGS_CREATE_SUSPENDED, 0, 0, 0, NULL );
- ok( status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status );
+ ok( status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status );
dbg_hidden = 0xcc;
status = NtQueryInformationThread( thread, ThreadHideFromDebugger, &dbg_hidden, sizeof(dbg_hidden), NULL );
- ok( status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status );
+ ok( status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status );
ok( !dbg_hidden, "Got unexpected dbg_hidden %#x.\n", dbg_hidden );
status = NtResumeThread( thread, NULL );
- ok( status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status );
+ ok( status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status );
WaitForSingleObject( thread, INFINITE );
CloseHandle( thread );
status = pNtCreateThreadEx( &thread, THREAD_ALL_ACCESS, NULL, GetCurrentProcess(), test_NtCreateThreadEx_proc,
NULL, THREAD_CREATE_FLAGS_CREATE_SUSPENDED | THREAD_CREATE_FLAGS_HIDE_FROM_DEBUGGER,
0, 0, 0, NULL );
- ok( status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status );
+ ok( status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status );
dbg_hidden = 0xcc;
status = NtQueryInformationThread( thread, ThreadHideFromDebugger, &dbg_hidden, sizeof(dbg_hidden), NULL );
- ok( status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status );
+ ok( status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status );
ok( dbg_hidden == 1, "Got unexpected dbg_hidden %#x.\n", dbg_hidden );
status = NtResumeThread( thread, NULL );
- ok( status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status );
+ ok( status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status );
WaitForSingleObject( thread, INFINITE );
CloseHandle( thread );
@@ -97,7 +98,7 @@ static void test_dbg_hidden_thread_creation(void)
status = RtlCreateProcessParametersEx( ¶ms, &imageW, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, PROCESS_PARAMS_FLAG_NORMALIZED );
- ok( status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status );
+ ok( status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status );
/* NtCreateUserProcess() may return STATUS_INVALID_PARAMETER with some uninitialized data in create_info. */
memset( &create_info, 0, sizeof(create_info) );
@@ -107,13 +108,13 @@ static void test_dbg_hidden_thread_creation(void)
NULL, NULL, 0, THREAD_CREATE_FLAGS_CREATE_SUSPENDED
| THREAD_CREATE_FLAGS_HIDE_FROM_DEBUGGER, params,
&create_info, &ps_attr );
- ok( status == STATUS_INVALID_PARAMETER, "Got unexpected status %#x.\n", status );
+ ok( status == STATUS_INVALID_PARAMETER, "Got unexpected status %#lx.\n", status );
status = NtCreateUserProcess( &process, &thread, PROCESS_ALL_ACCESS, THREAD_ALL_ACCESS,
NULL, NULL, 0, THREAD_CREATE_FLAGS_CREATE_SUSPENDED, params,
&create_info, &ps_attr );
- ok( status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status );
+ ok( status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status );
status = NtTerminateProcess( process, 0 );
- ok( status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status );
+ ok( status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status );
CloseHandle( process );
CloseHandle( thread );
}
1
0
Signed-off-by: Lauri Kenttä <lauri.kentta(a)gmail.com>
---
po/fi.po | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/po/fi.po b/po/fi.po
index f7bb8b6c8f0..585aac2ebe2 100644
--- a/po/fi.po
+++ b/po/fi.po
@@ -3966,13 +3966,11 @@ msgstr ""
#: dlls/jscript/jscript.rc:74
msgid "Cyclic __proto__ value"
-msgstr ""
+msgstr "Syklinen __proto__"
#: dlls/jscript/jscript.rc:75
-#, fuzzy
-#| msgid "Cannot define property '|': object is not extensible"
msgid "Cannot create property for a non-extensible object"
-msgstr "Ominaisuutta '|' ei voi määritellä: objekti ei ole laajennettava"
+msgstr "Ominaisuutta ei voi määritellä, koska objekti ei ole laajennettava"
#: dlls/jscript/jscript.rc:76
msgid "Cannot define property '|': object is not extensible"
--
2.35.1
1
0
[PATCH vkd3d v3 1/2] vkd3d: Use Vulkan timeline semaphores for D3D12 fences.
by Conor McCarthy 24 Mar '22
by Conor McCarthy 24 Mar '22
24 Mar '22
D3D12 supports signalling a fence to a lower value, while Vulkan timeline
semaphores do not. On the GPU side this is handled by simply submitting
the signal anyway, if a test for this passes on device creation, because
working around this is impractical. For CPU signals the Vulkan semaphore
is replaced with a new one at the lower value only if no waits and/or
signals are pending on the GPU. Otherwise, a fixme is emitted.
Partly based on a vkd3d-proton patch by Hans-Kristian Arntzen (not
including the handling of lower fence values).
The old implementation is used if KHR_timeline_semaphore is not
available or GPU signals do not work for a lower value.
Signed-off-by: Conor McCarthy <cmccarthy(a)codeweavers.com>
---
v3: Update required header version, and test for necessary GPU signal
behaviour.
---
README | 2 +-
configure.ac | 2 +-
libs/vkd3d/command.c | 571 ++++++++++++++++++++++++++++++++++---
libs/vkd3d/device.c | 90 ++++++
libs/vkd3d/vkd3d_private.h | 30 ++
libs/vkd3d/vulkan_procs.h | 5 +
tests/d3d12.c | 11 +-
7 files changed, 668 insertions(+), 43 deletions(-)
diff --git a/README b/README
index 066a24bc..721fb123 100644
--- a/README
+++ b/README
@@ -9,7 +9,7 @@ similar, but not identical, to Direct3D 12.
Building vkd3d
==============
-Vkd3d depends on SPIRV-Headers and Vulkan-Headers (>= 1.1.113).
+Vkd3d depends on SPIRV-Headers and Vulkan-Headers (>= 1.1.124).
Vkd3d generates some of its headers from IDL files. If you are using the
release tarballs, then these headers are pre-generated and are included. If
diff --git a/configure.ac b/configure.ac
index 53029d2c..9f0b31b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -81,7 +81,7 @@ AS_IF([test "x$ac_cv_header_spirv_unified1_GLSL_std_450_h" != "xyes" \
-a "x$ac_cv_header_vulkan_GLSL_std_450_h" != "xyes"],
[AC_MSG_ERROR([GLSL.std.450.h not found.])])
-VKD3D_CHECK_VULKAN_HEADER_VERSION([113], [AC_MSG_ERROR([Vulkan headers are too old, 1.1.113 is required.])])
+VKD3D_CHECK_VULKAN_HEADER_VERSION([124], [AC_MSG_ERROR([Vulkan headers are too old, 1.1.124 is required.])])
AC_CHECK_DECL([SpvCapabilityDemoteToHelperInvocationEXT],, [AC_MSG_ERROR([SPIR-V headers are too old.])], [
#ifdef HAVE_SPIRV_UNIFIED1_SPIRV_H
diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c
index 952675cf..772f699a 100644
--- a/libs/vkd3d/command.c
+++ b/libs/vkd3d/command.c
@@ -46,6 +46,9 @@ HRESULT vkd3d_queue_create(struct d3d12_device *device,
object->vk_queue_flags = properties->queueFlags;
object->timestamp_bits = properties->timestampValidBits;
+ object->wait_completion_semaphore = VK_NULL_HANDLE;
+ object->pending_wait_completion_value = 0;
+
object->semaphores = NULL;
object->semaphores_size = 0;
object->semaphore_count = 0;
@@ -61,6 +64,20 @@ HRESULT vkd3d_queue_create(struct d3d12_device *device,
return S_OK;
}
+bool vkd3d_queue_init_timeline_semaphore(struct vkd3d_queue *queue, struct d3d12_device *device)
+{
+ VkResult vr;
+
+ if (device->use_timeline_semaphores && !queue->wait_completion_semaphore
+ && (vr = vkd3d_create_timeline_semaphore(device, 0, &queue->wait_completion_semaphore)) < 0)
+ {
+ WARN("Failed to create timeline semaphore, vr %d.\n", vr);
+ return false;
+ }
+
+ return true;
+}
+
void vkd3d_queue_destroy(struct vkd3d_queue *queue, struct d3d12_device *device)
{
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
@@ -75,6 +92,8 @@ void vkd3d_queue_destroy(struct vkd3d_queue *queue, struct d3d12_device *device)
vkd3d_free(queue->semaphores);
+ VK_CALL(vkDestroySemaphore(device->vk_device, queue->wait_completion_semaphore, NULL));
+
for (i = 0; i < ARRAY_SIZE(queue->old_vk_semaphores); ++i)
{
if (queue->old_vk_semaphores[i])
@@ -268,6 +287,7 @@ static HRESULT vkd3d_enqueue_gpu_fence(struct vkd3d_fence_worker *worker,
}
worker->enqueued_fences[worker->enqueued_fence_count].vk_fence = vk_fence;
+ worker->enqueued_fences[worker->enqueued_fence_count].vk_semaphore = VK_NULL_HANDLE;
waiting_fence = &worker->enqueued_fences[worker->enqueued_fence_count].waiting_fence;
waiting_fence->fence = fence;
waiting_fence->value = value;
@@ -317,6 +337,7 @@ static void vkd3d_fence_worker_remove_fence(struct vkd3d_fence_worker *worker, s
static void vkd3d_fence_worker_move_enqueued_fences_locked(struct vkd3d_fence_worker *worker)
{
unsigned int i;
+ bool timeline;
size_t count;
bool ret;
@@ -325,8 +346,18 @@ static void vkd3d_fence_worker_move_enqueued_fences_locked(struct vkd3d_fence_wo
count = worker->fence_count + worker->enqueued_fence_count;
- ret = vkd3d_array_reserve((void **)&worker->vk_fences, &worker->vk_fences_size,
- count, sizeof(*worker->vk_fences));
+ if ((timeline = worker->device->use_timeline_semaphores))
+ {
+ ret = vkd3d_array_reserve((void **) &worker->vk_semaphores, &worker->vk_semaphores_size,
+ count, sizeof(*worker->vk_semaphores));
+ ret &= vkd3d_array_reserve((void **) &worker->semaphore_wait_values, &worker->semaphore_wait_values_size,
+ count, sizeof(*worker->semaphore_wait_values));
+ }
+ else
+ {
+ ret = vkd3d_array_reserve((void **)&worker->vk_fences, &worker->vk_fences_size,
+ count, sizeof(*worker->vk_fences));
+ }
ret &= vkd3d_array_reserve((void **)&worker->fences, &worker->fences_size,
count, sizeof(*worker->fences));
if (!ret)
@@ -339,7 +370,16 @@ static void vkd3d_fence_worker_move_enqueued_fences_locked(struct vkd3d_fence_wo
{
struct vkd3d_enqueued_fence *current = &worker->enqueued_fences[i];
- worker->vk_fences[worker->fence_count] = current->vk_fence;
+ if (timeline)
+ {
+ worker->vk_semaphores[worker->fence_count] = current->vk_semaphore;
+ worker->semaphore_wait_values[worker->fence_count] = current->waiting_fence.value;
+ }
+ else
+ {
+ worker->vk_fences[worker->fence_count] = current->vk_fence;
+ }
+
worker->fences[worker->fence_count] = current->waiting_fence;
++worker->fence_count;
}
@@ -347,6 +387,66 @@ static void vkd3d_fence_worker_move_enqueued_fences_locked(struct vkd3d_fence_wo
worker->enqueued_fence_count = 0;
}
+static void vkd3d_wait_for_gpu_timeline_semaphores(struct vkd3d_fence_worker *worker)
+{
+ const struct d3d12_device *device = worker->device;
+ const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
+ VkSemaphoreWaitInfoKHR wait_info;
+ VkSemaphore vk_semaphore;
+ uint64_t counter_value;
+ unsigned int i, j;
+ HRESULT hr;
+ int vr;
+
+ if (!worker->fence_count)
+ return;
+
+ wait_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO_KHR;
+ wait_info.pNext = NULL;
+ wait_info.flags = VK_SEMAPHORE_WAIT_ANY_BIT_KHR;
+ wait_info.pSemaphores = worker->vk_semaphores;
+ wait_info.semaphoreCount = worker->fence_count;
+ wait_info.pValues = worker->semaphore_wait_values;
+
+ vr = VK_CALL(vkWaitSemaphoresKHR(device->vk_device, &wait_info, ~(uint64_t)0));
+ if (vr == VK_TIMEOUT)
+ return;
+ if (vr != VK_SUCCESS)
+ {
+ ERR("Failed to wait for Vulkan timeline semaphores, vr %d.\n", vr);
+ return;
+ }
+
+ for (i = 0, j = 0; i < worker->fence_count; ++i)
+ {
+ struct vkd3d_waiting_fence *current = &worker->fences[i];
+
+ vk_semaphore = worker->vk_semaphores[i];
+ if ((vr = VK_CALL(vkGetSemaphoreCounterValueKHR(device->vk_device, vk_semaphore, &counter_value))) < 0)
+ {
+ ERR("Failed to get Vulkan semaphore value, vr %d.\n", vr);
+ }
+ else if (counter_value >= current->value)
+ {
+ TRACE("Signaling fence %p value %#"PRIx64".\n", current->fence, current->value);
+ if (FAILED(hr = d3d12_fence_signal(current->fence, counter_value, VK_NULL_HANDLE)))
+ ERR("Failed to signal D3D12 fence, hr %#x.\n", hr);
+
+ InterlockedDecrement(¤t->fence->pending_worker_operation_count);
+ continue;
+ }
+
+ if (i != j)
+ {
+ worker->vk_semaphores[j] = worker->vk_semaphores[i];
+ worker->semaphore_wait_values[j] = worker->semaphore_wait_values[i];
+ worker->fences[j] = worker->fences[i];
+ }
+ ++j;
+ }
+ worker->fence_count = j;
+}
+
static void vkd3d_wait_for_gpu_fences(struct vkd3d_fence_worker *worker)
{
struct d3d12_device *device = worker->device;
@@ -408,7 +508,7 @@ static void *vkd3d_fence_worker_main(void *arg)
for (;;)
{
- vkd3d_wait_for_gpu_fences(worker);
+ worker->wait_for_gpu_fences(worker);
if (!worker->fence_count || InterlockedAdd(&worker->enqueued_fence_count, 0))
{
@@ -473,6 +573,13 @@ HRESULT vkd3d_fence_worker_start(struct vkd3d_fence_worker *worker,
worker->vk_fences_size = 0;
worker->fences = NULL;
worker->fences_size = 0;
+ worker->vk_semaphores = NULL;
+ worker->vk_semaphores_size = 0;
+ worker->semaphore_wait_values = NULL;
+ worker->semaphore_wait_values_size = 0;
+
+ worker->wait_for_gpu_fences = device->use_timeline_semaphores
+ ? vkd3d_wait_for_gpu_timeline_semaphores : vkd3d_wait_for_gpu_fences;
if ((rc = vkd3d_mutex_init(&worker->mutex)))
{
@@ -535,6 +642,8 @@ HRESULT vkd3d_fence_worker_stop(struct vkd3d_fence_worker *worker,
vkd3d_free(worker->enqueued_fences);
vkd3d_free(worker->vk_fences);
vkd3d_free(worker->fences);
+ vkd3d_free(worker->vk_semaphores);
+ vkd3d_free(worker->semaphore_wait_values);
return S_OK;
}
@@ -684,6 +793,7 @@ static void d3d12_fence_destroy_vk_objects(struct d3d12_fence *fence)
}
d3d12_fence_garbage_collect_vk_semaphores_locked(fence, true);
+ VK_CALL(vkDestroySemaphore(device->vk_device, fence->timeline_semaphore, NULL));
vkd3d_mutex_unlock(&fence->mutex);
}
@@ -802,31 +912,21 @@ static HRESULT d3d12_fence_add_vk_semaphore(struct d3d12_fence *fence,
return hr;
}
-static HRESULT d3d12_fence_signal(struct d3d12_fence *fence, uint64_t value, VkFence vk_fence)
+static bool d3d12_fence_signal_external_events_locked(struct d3d12_fence *fence)
{
struct d3d12_device *device = fence->device;
- struct vkd3d_signaled_semaphore *current;
bool signal_null_event_cond = false;
unsigned int i, j;
- int rc;
-
- if ((rc = vkd3d_mutex_lock(&fence->mutex)))
- {
- ERR("Failed to lock mutex, error %d.\n", rc);
- return hresult_from_errno(rc);
- }
-
- fence->value = value;
for (i = 0, j = 0; i < fence->event_count; ++i)
{
struct vkd3d_waiting_event *current = &fence->events[i];
- if (current->value <= value)
+ if (current->value <= fence->value)
{
if (current->event)
{
- fence->device->signal_event(current->event);
+ device->signal_event(current->event);
}
else
{
@@ -841,9 +941,28 @@ static HRESULT d3d12_fence_signal(struct d3d12_fence *fence, uint64_t value, VkF
++j;
}
}
+
fence->event_count = j;
- if (signal_null_event_cond)
+ return signal_null_event_cond;
+}
+
+static HRESULT d3d12_fence_signal(struct d3d12_fence *fence, uint64_t value, VkFence vk_fence)
+{
+ struct d3d12_device *device = fence->device;
+ struct vkd3d_signaled_semaphore *current;
+ unsigned int i;
+ int rc;
+
+ if ((rc = vkd3d_mutex_lock(&fence->mutex)))
+ {
+ ERR("Failed to lock mutex, error %d.\n", rc);
+ return hresult_from_errno(rc);
+ }
+
+ fence->value = value;
+
+ if (d3d12_fence_signal_external_events_locked(fence))
vkd3d_cond_broadcast(&fence->null_event_cond);
if (vk_fence)
@@ -1069,12 +1188,160 @@ static HRESULT STDMETHODCALLTYPE d3d12_fence_SetEventOnCompletion(ID3D12Fence *i
return S_OK;
}
+static inline bool d3d12_fence_gpu_wait_is_completed(const struct d3d12_fence *fence, unsigned int i)
+{
+ const struct d3d12_device *device = fence->device;
+ const struct vkd3d_vk_device_procs *vk_procs;
+ uint64_t value;
+ VkResult vr;
+
+ vk_procs = &device->vk_procs;
+
+ if ((vr = VK_CALL(vkGetSemaphoreCounterValueKHR(device->vk_device,
+ fence->gpu_waits[i].queue->wait_completion_semaphore, &value))) >= 0)
+ {
+ return value >= fence->gpu_waits[i].pending_value;
+ }
+
+ ERR("Failed to get Vulkan semaphore status, vr %d.\n", vr);
+ return true;
+}
+
+static inline bool d3d12_fence_has_pending_gpu_ops_locked(struct d3d12_fence *fence)
+{
+ const struct d3d12_device *device = fence->device;
+ const struct vkd3d_vk_device_procs *vk_procs;
+ uint64_t value;
+ unsigned int i;
+ VkResult vr;
+
+ for (i = 0; i < fence->gpu_wait_count; ++i)
+ {
+ if (d3d12_fence_gpu_wait_is_completed(fence, i) && i < --fence->gpu_wait_count)
+ fence->gpu_waits[i] = fence->gpu_waits[fence->gpu_wait_count];
+ }
+ if (fence->gpu_wait_count)
+ return true;
+
+ /* Check for pending signals too. */
+ if (fence->value >= fence->pending_timeline_value)
+ return false;
+
+ vk_procs = &device->vk_procs;
+
+ /* Check the actual semaphore value in case fence->value update is lagging. */
+ if ((vr = VK_CALL(vkGetSemaphoreCounterValueKHR(device->vk_device, fence->timeline_semaphore, &value))) < 0)
+ {
+ ERR("Failed to get Vulkan semaphore status, vr %d.\n", vr);
+ return false;
+ }
+
+ return value < fence->pending_timeline_value;
+}
+
+/* Replace the VkSemaphore with a new one to allow a lower value to be set. Ideally apps will
+ * only use this to reset the fence when no operations are pending on the queue. */
+static HRESULT d3d12_fence_reinit_timeline_semaphore_locked(struct d3d12_fence *fence, uint64_t value)
+{
+ const struct d3d12_device *device = fence->device;
+ const struct vkd3d_vk_device_procs *vk_procs;
+ VkSemaphore timeline_semaphore;
+ VkResult vr;
+
+ if (d3d12_fence_has_pending_gpu_ops_locked(fence))
+ {
+ /* This situation is not very likely because it means a fence with pending waits and/or signals was
+ * signalled on the CPU to a lower value. For now, emit a fixme so it can be patched if necessary.
+ * A patch already exists for this but it's not pretty. */
+ FIXME("Unable to re-initialise timeline semaphore to a lower value due to pending GPU ops.\n");
+ return E_FAIL;
+ }
+
+ if ((vr = vkd3d_create_timeline_semaphore(device, value, &timeline_semaphore)) < 0)
+ {
+ WARN("Failed to create timeline semaphore, vr %d.\n", vr);
+ return hresult_from_vk_result(vr);
+ }
+
+ fence->value = value;
+ fence->pending_timeline_value = value;
+
+ WARN("Replacing timeline semaphore with a new object.\n");
+
+ vk_procs = &device->vk_procs;
+
+ VK_CALL(vkDestroySemaphore(device->vk_device, fence->timeline_semaphore, NULL));
+ fence->timeline_semaphore = timeline_semaphore;
+
+ return S_OK;
+}
+
+static HRESULT d3d12_fence_signal_cpu_timeline_semaphore(struct d3d12_fence *fence, uint64_t value)
+{
+ const struct d3d12_device *device = fence->device;
+ VkSemaphoreSignalInfoKHR info;
+ HRESULT hr = S_OK;
+ VkResult vr;
+ int rc;
+
+ if ((rc = vkd3d_mutex_lock(&fence->mutex)))
+ {
+ ERR("Failed to lock mutex, error %d.\n", rc);
+ return hresult_from_errno(rc);
+ }
+
+ /* We must only signal a value which is greater than the current value.
+ * That value can be in the range of current known value (fence->value), or as large as pending_timeline_value.
+ * Pending timeline value signal might be blocked by another synchronization primitive, and thus statically
+ * cannot be that value, so the safest thing to do is to check the current value which is updated by the fence
+ * wait thread continuously. This check is technically racy since the value might be immediately out of date,
+ * but there is no way to avoid this. */
+ if (value > fence->value)
+ {
+ const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
+
+ /* Sanity check against the delta limit. */
+ if (value - fence->value > device->vk_info.timeline_semaphore_properties.maxTimelineSemaphoreValueDifference)
+ {
+ FIXME("Timeline semaphore delta is %"PRIu64", but implementation only supports a delta of %"PRIu64".\n",
+ value - fence->value, device->vk_info.timeline_semaphore_properties.maxTimelineSemaphoreValueDifference);
+ }
+
+ info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO_KHR;
+ info.pNext = NULL;
+ info.semaphore = fence->timeline_semaphore;
+ info.value = value;
+ if ((vr = VK_CALL(vkSignalSemaphoreKHR(device->vk_device, &info))) >= 0)
+ {
+ fence->value = value;
+ if (value > fence->pending_timeline_value)
+ fence->pending_timeline_value = value;
+ }
+ else
+ {
+ ERR("Failed to signal timeline semaphore, vr %d.\n", vr);
+ hr = hresult_from_vk_result(vr);
+ }
+ }
+ else if (value < fence->value)
+ {
+ hr = d3d12_fence_reinit_timeline_semaphore_locked(fence, value);
+ }
+
+ d3d12_fence_signal_external_events_locked(fence);
+
+ vkd3d_mutex_unlock(&fence->mutex);
+ return hr;
+}
+
static HRESULT STDMETHODCALLTYPE d3d12_fence_Signal(ID3D12Fence *iface, UINT64 value)
{
struct d3d12_fence *fence = impl_from_ID3D12Fence(iface);
TRACE("iface %p, value %#"PRIx64".\n", iface, value);
+ if (fence->timeline_semaphore)
+ return d3d12_fence_signal_cpu_timeline_semaphore(fence, value);
return d3d12_fence_signal(fence, value, VK_NULL_HANDLE);
}
@@ -1108,6 +1375,7 @@ static struct d3d12_fence *unsafe_impl_from_ID3D12Fence(ID3D12Fence *iface)
static HRESULT d3d12_fence_init(struct d3d12_fence *fence, struct d3d12_device *device,
UINT64 initial_value, D3D12_FENCE_FLAGS flags)
{
+ VkResult vr;
HRESULT hr;
int rc;
@@ -1136,6 +1404,16 @@ static HRESULT d3d12_fence_init(struct d3d12_fence *fence, struct d3d12_device *
fence->events_size = 0;
fence->event_count = 0;
+ fence->timeline_semaphore = VK_NULL_HANDLE;
+ if (device->use_timeline_semaphores && (vr = vkd3d_create_timeline_semaphore(device, initial_value,
+ &fence->timeline_semaphore)) < 0)
+ {
+ WARN("Failed to create timeline semaphore, vr %d.\n", vr);
+ return hresult_from_vk_result(vr);
+ }
+ fence->pending_timeline_value = initial_value;
+ fence->gpu_wait_count = 0;
+
list_init(&fence->semaphores);
fence->semaphore_count = 0;
@@ -1172,6 +1450,25 @@ HRESULT d3d12_fence_create(struct d3d12_device *device,
return S_OK;
}
+VkResult vkd3d_create_timeline_semaphore(const struct d3d12_device *device, uint64_t initial_value,
+ VkSemaphore *timeline_semaphore)
+{
+ const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
+ VkSemaphoreTypeCreateInfoKHR type_info;
+ VkSemaphoreCreateInfo info;
+
+ info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
+ info.pNext = &type_info;
+ info.flags = 0;
+
+ type_info.sType = VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO_KHR;
+ type_info.pNext = NULL;
+ type_info.semaphoreType = VK_SEMAPHORE_TYPE_TIMELINE_KHR;
+ type_info.initialValue = initial_value;
+
+ return VK_CALL(vkCreateSemaphore(device->vk_device, &info, NULL, timeline_semaphore));
+}
+
/* Command buffers */
static void d3d12_command_list_mark_as_invalid(struct d3d12_command_list *list,
const char *message, ...)
@@ -6138,18 +6435,88 @@ static void STDMETHODCALLTYPE d3d12_command_queue_EndEvent(ID3D12CommandQueue *i
FIXME("iface %p stub!\n", iface);
}
+static HRESULT d3d12_fence_update_gpu_signal_timeline_semaphore(struct d3d12_fence *fence, uint64_t value)
+{
+ const struct d3d12_device *device = fence->device;
+ int rc;
+
+ if ((rc = vkd3d_mutex_lock(&fence->mutex)))
+ {
+ ERR("Failed to lock mutex, error %d.\n", rc);
+ return hresult_from_errno(rc);
+ }
+
+ /* If we're attempting to async signal a fence with a value which is not strictly increasing the payload value,
+ * warn about this case. Do not treat this as an error since it works at least with RADV and Nvidia drivers and
+ * there's no workaround on the GPU side. */
+ if (value <= fence->pending_timeline_value)
+ {
+ WARN("Fence %p values are not strictly increasing. Pending values: old %"PRIu64", new %"PRIu64".\n",
+ fence, fence->pending_timeline_value, value);
+ }
+ /* Sanity check against the delta limit. Use the current fence value. */
+ else if (value - fence->value > device->vk_info.timeline_semaphore_properties.maxTimelineSemaphoreValueDifference)
+ {
+ FIXME("Timeline semaphore delta is %"PRIu64", but implementation only supports a delta of %"PRIu64".\n",
+ value - fence->value, device->vk_info.timeline_semaphore_properties.maxTimelineSemaphoreValueDifference);
+ }
+ fence->pending_timeline_value = value;
+
+ vkd3d_mutex_unlock(&fence->mutex);
+
+ return S_OK;
+}
+
+static HRESULT vkd3d_enqueue_timeline_semaphore(struct vkd3d_fence_worker *worker, VkSemaphore vk_semaphore,
+ struct d3d12_fence *fence, uint64_t value, struct vkd3d_queue *queue)
+{
+ struct vkd3d_waiting_fence *waiting_fence;
+ int rc;
+
+ TRACE("worker %p, fence %p, value %#"PRIx64".\n", worker, fence, value);
+
+ if ((rc = vkd3d_mutex_lock(&worker->mutex)))
+ {
+ ERR("Failed to lock mutex, error %d.\n", rc);
+ return hresult_from_errno(rc);
+ }
+
+ if (!vkd3d_array_reserve((void **)&worker->enqueued_fences, &worker->enqueued_fences_size,
+ worker->enqueued_fence_count + 1, sizeof(*worker->enqueued_fences)))
+ {
+ ERR("Failed to add GPU timeline semaphore.\n");
+ vkd3d_mutex_unlock(&worker->mutex);
+ return E_OUTOFMEMORY;
+ }
+
+ worker->enqueued_fences[worker->enqueued_fence_count].vk_semaphore = vk_semaphore;
+ waiting_fence = &worker->enqueued_fences[worker->enqueued_fence_count].waiting_fence;
+ waiting_fence->fence = fence;
+ waiting_fence->value = value;
+ waiting_fence->queue = queue;
+ ++worker->enqueued_fence_count;
+
+ InterlockedIncrement(&fence->pending_worker_operation_count);
+
+ vkd3d_cond_signal(&worker->cond);
+ vkd3d_mutex_unlock(&worker->mutex);
+
+ return S_OK;
+}
+
static HRESULT STDMETHODCALLTYPE d3d12_command_queue_Signal(ID3D12CommandQueue *iface,
ID3D12Fence *fence_iface, UINT64 value)
{
struct d3d12_command_queue *command_queue = impl_from_ID3D12CommandQueue(iface);
+ VkTimelineSemaphoreSubmitInfoKHR timeline_submit_info;
const struct vkd3d_vk_device_procs *vk_procs;
VkSemaphore vk_semaphore = VK_NULL_HANDLE;
VkFence vk_fence = VK_NULL_HANDLE;
struct vkd3d_queue *vkd3d_queue;
+ uint64_t sequence_number = 0;
struct d3d12_device *device;
struct d3d12_fence *fence;
VkSubmitInfo submit_info;
- uint64_t sequence_number;
VkQueue vk_queue;
VkResult vr;
HRESULT hr;
@@ -6162,10 +6529,21 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_queue_Signal(ID3D12CommandQueue *
fence = unsafe_impl_from_ID3D12Fence(fence_iface);
- if ((vr = d3d12_fence_create_vk_fence(fence, &vk_fence)) < 0)
+ if (device->use_timeline_semaphores)
{
- WARN("Failed to create Vulkan fence, vr %d.\n", vr);
- goto fail_vkresult;
+ if (FAILED(hr = d3d12_fence_update_gpu_signal_timeline_semaphore(fence, value)))
+ return hr;
+
+ vk_semaphore = fence->timeline_semaphore;
+ assert(vk_semaphore);
+ }
+ else
+ {
+ if ((vr = d3d12_fence_create_vk_fence(fence, &vk_fence)) < 0)
+ {
+ WARN("Failed to create Vulkan fence, vr %d.\n", vr);
+ goto fail_vkresult;
+ }
}
if (!(vk_queue = vkd3d_queue_acquire(vkd3d_queue)))
@@ -6175,7 +6553,8 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_queue_Signal(ID3D12CommandQueue *
goto fail;
}
- if ((vr = vkd3d_queue_create_vk_semaphore_locked(vkd3d_queue, device, &vk_semaphore)) < 0)
+ if (!device->use_timeline_semaphores && (vr = vkd3d_queue_create_vk_semaphore_locked(vkd3d_queue,
+ device, &vk_semaphore)) < 0)
{
ERR("Failed to create Vulkan semaphore, vr %d.\n", vr);
vk_semaphore = VK_NULL_HANDLE;
@@ -6191,7 +6570,19 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_queue_Signal(ID3D12CommandQueue *
submit_info.signalSemaphoreCount = vk_semaphore ? 1 : 0;
submit_info.pSignalSemaphores = &vk_semaphore;
- if ((vr = VK_CALL(vkQueueSubmit(vk_queue, 1, &submit_info, vk_fence))) >= 0)
+ if (device->use_timeline_semaphores)
+ {
+ timeline_submit_info.sType = VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO_KHR;
+ timeline_submit_info.pNext = NULL;
+ timeline_submit_info.pSignalSemaphoreValues = &value;
+ timeline_submit_info.signalSemaphoreValueCount = submit_info.signalSemaphoreCount;
+ timeline_submit_info.waitSemaphoreValueCount = 0;
+ timeline_submit_info.pWaitSemaphoreValues = NULL;
+ submit_info.pNext = &timeline_submit_info;
+ }
+
+ vr = VK_CALL(vkQueueSubmit(vk_queue, 1, &submit_info, vk_fence));
+ if (!device->use_timeline_semaphores && vr >= 0)
{
sequence_number = ++vkd3d_queue->submitted_sequence_number;
@@ -6208,6 +6599,9 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_queue_Signal(ID3D12CommandQueue *
goto fail_vkresult;
}
+ if (device->use_timeline_semaphores)
+ return vkd3d_enqueue_timeline_semaphore(&device->fence_worker, vk_semaphore, fence, value, vkd3d_queue);
+
if (vk_semaphore && SUCCEEDED(hr = d3d12_fence_add_vk_semaphore(fence, vk_semaphore, vk_fence, value)))
vk_semaphore = VK_NULL_HANDLE;
@@ -6243,32 +6637,27 @@ fail_vkresult:
hr = hresult_from_vk_result(vr);
fail:
VK_CALL(vkDestroyFence(device->vk_device, vk_fence, NULL));
- VK_CALL(vkDestroySemaphore(device->vk_device, vk_semaphore, NULL));
+ if (!device->use_timeline_semaphores)
+ VK_CALL(vkDestroySemaphore(device->vk_device, vk_semaphore, NULL));
return hr;
}
-static HRESULT STDMETHODCALLTYPE d3d12_command_queue_Wait(ID3D12CommandQueue *iface,
- ID3D12Fence *fence_iface, UINT64 value)
+static HRESULT d3d12_command_queue_wait_binary_semaphore(struct d3d12_command_queue *command_queue,
+ struct d3d12_fence *fence, uint64_t value)
{
static const VkPipelineStageFlagBits wait_stage_mask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
- struct d3d12_command_queue *command_queue = impl_from_ID3D12CommandQueue(iface);
const struct vkd3d_vk_device_procs *vk_procs;
struct vkd3d_signaled_semaphore *semaphore;
uint64_t completed_value = 0;
struct vkd3d_queue *queue;
- struct d3d12_fence *fence;
VkSubmitInfo submit_info;
VkQueue vk_queue;
VkResult vr;
HRESULT hr;
- TRACE("iface %p, fence %p, value %#"PRIx64".\n", iface, fence_iface, value);
-
vk_procs = &command_queue->device->vk_procs;
queue = command_queue->vkd3d_queue;
- fence = unsafe_impl_from_ID3D12Fence(fence_iface);
-
semaphore = d3d12_fence_acquire_vk_semaphore(fence, value, &completed_value);
if (!semaphore && completed_value >= value)
{
@@ -6346,6 +6735,122 @@ fail:
return hr;
}
+static inline void d3d12_fence_update_gpu_wait(struct d3d12_fence *fence, const struct vkd3d_queue *queue)
+{
+ unsigned int i;
+ bool found;
+ int rc;
+
+ if ((rc = vkd3d_mutex_lock(&fence->mutex)))
+ {
+ ERR("Failed to lock mutex, error %d.\n", rc);
+ return;
+ }
+
+ for (i = 0, found = false; i < fence->gpu_wait_count; ++i)
+ {
+ if (fence->gpu_waits[i].queue == queue)
+ {
+ fence->gpu_waits[i].pending_value = queue->pending_wait_completion_value;
+ found = true;
+ }
+ else if (d3d12_fence_gpu_wait_is_completed(fence, i) && i < --fence->gpu_wait_count)
+ {
+ fence->gpu_waits[i] = fence->gpu_waits[fence->gpu_wait_count];
+ }
+ }
+
+ if (!found)
+ {
+ if (fence->gpu_wait_count < ARRAY_SIZE(fence->gpu_waits))
+ {
+ fence->gpu_waits[fence->gpu_wait_count].queue = queue;
+ fence->gpu_waits[fence->gpu_wait_count++].pending_value = queue->pending_wait_completion_value;
+ }
+ else
+ {
+ FIXME("Unable to track GPU fence wait.\n");
+ }
+ }
+
+ vkd3d_mutex_unlock(&fence->mutex);
+}
+
+static HRESULT d3d12_command_queue_wait_timeline_semaphore(struct d3d12_command_queue *command_queue,
+ struct d3d12_fence *fence, uint64_t value)
+{
+ static const VkPipelineStageFlagBits wait_stage_mask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
+ VkTimelineSemaphoreSubmitInfoKHR timeline_submit_info;
+ const struct vkd3d_vk_device_procs *vk_procs;
+ struct vkd3d_queue *queue;
+ VkSubmitInfo submit_info;
+ VkQueue vk_queue;
+ VkResult vr;
+
+ vk_procs = &command_queue->device->vk_procs;
+ queue = command_queue->vkd3d_queue;
+
+ assert(fence->timeline_semaphore);
+ timeline_submit_info.sType = VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO_KHR;
+ timeline_submit_info.pNext = NULL;
+ timeline_submit_info.signalSemaphoreValueCount = 0;
+ timeline_submit_info.pSignalSemaphoreValues = NULL;
+ timeline_submit_info.waitSemaphoreValueCount = 1;
+ timeline_submit_info.pWaitSemaphoreValues = &value;
+
+ if (!(vk_queue = vkd3d_queue_acquire(queue)))
+ {
+ ERR("Failed to acquire queue %p.\n", queue);
+ return E_FAIL;
+ }
+
+ submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
+ submit_info.pNext = &timeline_submit_info;
+ submit_info.waitSemaphoreCount = 1;
+ submit_info.pWaitSemaphores = &fence->timeline_semaphore;
+ submit_info.pWaitDstStageMask = &wait_stage_mask;
+ submit_info.commandBufferCount = 0;
+ submit_info.pCommandBuffers = NULL;
+ submit_info.signalSemaphoreCount = 0;
+ submit_info.pSignalSemaphores = NULL;
+
+ ++queue->pending_wait_completion_value;
+
+ submit_info.signalSemaphoreCount = 1;
+ submit_info.pSignalSemaphores = &queue->wait_completion_semaphore;
+ timeline_submit_info.signalSemaphoreValueCount = 1;
+ timeline_submit_info.pSignalSemaphoreValues = &queue->pending_wait_completion_value;
+
+ d3d12_fence_update_gpu_wait(fence, queue);
+
+ vr = VK_CALL(vkQueueSubmit(vk_queue, 1, &submit_info, VK_NULL_HANDLE));
+
+ vkd3d_queue_release(queue);
+
+ if (vr < 0)
+ {
+ WARN("Failed to submit wait operation, vr %d.\n", vr);
+ return hresult_from_vk_result(vr);
+ }
+
+ return S_OK;
+}
+
+static HRESULT STDMETHODCALLTYPE d3d12_command_queue_Wait(ID3D12CommandQueue *iface,
+ ID3D12Fence *fence_iface, UINT64 value)
+{
+ struct d3d12_command_queue *command_queue = impl_from_ID3D12CommandQueue(iface);
+ struct d3d12_fence *fence = unsafe_impl_from_ID3D12Fence(fence_iface);
+
+ TRACE("iface %p, fence %p, value %#"PRIx64".\n", iface, fence_iface, value);
+
+ if (command_queue->device->use_timeline_semaphores)
+ return d3d12_command_queue_wait_timeline_semaphore(command_queue, fence, value);
+
+ FIXME_ONCE("KHR_timeline_semaphore is not available or incompatible. Some wait commands may be unsupported.\n");
+ return d3d12_command_queue_wait_binary_semaphore(command_queue, fence, value);
+}
+
static HRESULT STDMETHODCALLTYPE d3d12_command_queue_GetTimestampFrequency(ID3D12CommandQueue *iface,
UINT64 *frequency)
{
diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c
index bd471a72..6f58b611 100644
--- a/libs/vkd3d/device.c
+++ b/libs/vkd3d/device.c
@@ -129,6 +129,7 @@ static const struct vkd3d_optional_extension_info optional_device_extensions[] =
VK_EXTENSION(KHR_MAINTENANCE3, KHR_maintenance3),
VK_EXTENSION(KHR_PUSH_DESCRIPTOR, KHR_push_descriptor),
VK_EXTENSION(KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE, KHR_sampler_mirror_clamp_to_edge),
+ VK_EXTENSION(KHR_TIMELINE_SEMAPHORE, KHR_timeline_semaphore),
/* EXT extensions */
VK_EXTENSION(EXT_CALIBRATED_TIMESTAMPS, EXT_calibrated_timestamps),
VK_EXTENSION(EXT_CONDITIONAL_RENDERING, EXT_conditional_rendering),
@@ -790,6 +791,7 @@ struct vkd3d_physical_device_info
VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT texel_buffer_alignment_properties;
VkPhysicalDeviceTransformFeedbackPropertiesEXT xfb_properties;
VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT vertex_divisor_properties;
+ VkPhysicalDeviceTimelineSemaphorePropertiesKHR timeline_semaphore_properties;
VkPhysicalDeviceProperties2KHR properties2;
@@ -801,6 +803,7 @@ struct vkd3d_physical_device_info
VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT texel_buffer_alignment_features;
VkPhysicalDeviceTransformFeedbackFeaturesEXT xfb_features;
VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT vertex_divisor_features;
+ VkPhysicalDeviceTimelineSemaphoreFeaturesKHR timeline_semaphore_features;
VkPhysicalDeviceFeatures2 features2;
};
@@ -812,10 +815,12 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i
VkPhysicalDeviceDescriptorIndexingPropertiesEXT *descriptor_indexing_properties;
VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT *vertex_divisor_properties;
VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT *buffer_alignment_properties;
+ VkPhysicalDeviceTimelineSemaphorePropertiesKHR *timeline_semaphore_properties;
VkPhysicalDeviceDescriptorIndexingFeaturesEXT *descriptor_indexing_features;
VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT *vertex_divisor_features;
VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT *buffer_alignment_features;
VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT *demote_features;
+ VkPhysicalDeviceTimelineSemaphoreFeaturesKHR *timeline_semaphore_features;
VkPhysicalDeviceDepthClipEnableFeaturesEXT *depth_clip_features;
VkPhysicalDeviceMaintenance3Properties *maintenance3_properties;
VkPhysicalDeviceTransformFeedbackPropertiesEXT *xfb_properties;
@@ -834,6 +839,8 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i
buffer_alignment_properties = &info->texel_buffer_alignment_properties;
vertex_divisor_features = &info->vertex_divisor_features;
vertex_divisor_properties = &info->vertex_divisor_properties;
+ timeline_semaphore_features = &info->timeline_semaphore_features;
+ timeline_semaphore_properties = &info->timeline_semaphore_properties;
xfb_features = &info->xfb_features;
xfb_properties = &info->xfb_properties;
@@ -853,6 +860,8 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i
vk_prepend_struct(&info->features2, xfb_features);
vertex_divisor_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT;
vk_prepend_struct(&info->features2, vertex_divisor_features);
+ timeline_semaphore_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES_KHR;
+ vk_prepend_struct(&info->features2, timeline_semaphore_features);
if (vulkan_info->KHR_get_physical_device_properties2)
VK_CALL(vkGetPhysicalDeviceFeatures2KHR(physical_device, &info->features2));
@@ -871,6 +880,8 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i
vk_prepend_struct(&info->properties2, xfb_properties);
vertex_divisor_properties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT;
vk_prepend_struct(&info->properties2, vertex_divisor_properties);
+ timeline_semaphore_properties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES_KHR;
+ vk_prepend_struct(&info->properties2, timeline_semaphore_properties);
if (vulkan_info->KHR_get_physical_device_properties2)
VK_CALL(vkGetPhysicalDeviceProperties2KHR(physical_device, &info->properties2));
@@ -1459,6 +1470,7 @@ static HRESULT vkd3d_init_device_caps(struct d3d12_device *device,
vulkan_info->rasterization_stream = physical_device_info->xfb_properties.transformFeedbackRasterizationStreamSelect;
vulkan_info->transform_feedback_queries = physical_device_info->xfb_properties.transformFeedbackQueries;
vulkan_info->max_vertex_attrib_divisor = max(physical_device_info->vertex_divisor_properties.maxVertexAttribDivisor, 1);
+ vulkan_info->timeline_semaphore_properties = physical_device_info->timeline_semaphore_properties;
device->feature_options.DoublePrecisionFloatShaderOps = features->shaderFloat64;
device->feature_options.OutputMergerLogicOp = features->logicOp;
@@ -1581,6 +1593,8 @@ static HRESULT vkd3d_init_device_caps(struct d3d12_device *device,
vulkan_info->EXT_shader_demote_to_helper_invocation = false;
if (!physical_device_info->texel_buffer_alignment_features.texelBufferAlignment)
vulkan_info->EXT_texel_buffer_alignment = false;
+ if (!physical_device_info->timeline_semaphore_features.timelineSemaphore)
+ vulkan_info->KHR_timeline_semaphore = false;
vulkan_info->texel_buffer_alignment_properties = physical_device_info->texel_buffer_alignment_properties;
@@ -1929,6 +1943,75 @@ static bool d3d12_is_64k_msaa_supported(struct d3d12_device *device)
&& info.Alignment <= 0x10000;
}
+/* A lower value can be signalled on a D3D12 fence. Vulkan timeline semaphores
+ * do not support this, but test if it works anyway. */
+static bool d3d12_is_timeline_semaphore_supported(const struct d3d12_device *device)
+{
+ const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
+ VkTimelineSemaphoreSubmitInfoKHR timeline_submit_info;
+ VkSemaphore timeline_semaphore;
+ VkSubmitInfo submit_info;
+ bool result = false;
+ uint64_t value = 0;
+ VkQueue vk_queue;
+ VkResult vr;
+
+ if (!device->vk_info.KHR_timeline_semaphore)
+ return false;
+
+ if ((vr = vkd3d_create_timeline_semaphore(device, 1, &timeline_semaphore)) < 0)
+ {
+ WARN("Failed to create timeline semaphore, vr %d.\n", vr);
+ return false;
+ }
+
+ if (!(vk_queue = vkd3d_queue_acquire(device->direct_queue)))
+ {
+ ERR("Failed to acquire queue %p.\n", device->direct_queue);
+ VK_CALL(vkDestroySemaphore(device->vk_device, timeline_semaphore, NULL));
+ return false;
+ }
+
+ submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
+ submit_info.pNext = &timeline_submit_info;
+ submit_info.waitSemaphoreCount = 0;
+ submit_info.pWaitSemaphores = NULL;
+ submit_info.pWaitDstStageMask = NULL;
+ submit_info.commandBufferCount = 0;
+ submit_info.pCommandBuffers = NULL;
+ submit_info.signalSemaphoreCount = 1;
+ submit_info.pSignalSemaphores = &timeline_semaphore;
+
+ timeline_submit_info.sType = VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO_KHR;
+ timeline_submit_info.pNext = NULL;
+ timeline_submit_info.pSignalSemaphoreValues = &value;
+ timeline_submit_info.signalSemaphoreValueCount = 1;
+ timeline_submit_info.waitSemaphoreValueCount = 0;
+ timeline_submit_info.pWaitSemaphoreValues = NULL;
+
+ vr = VK_CALL(vkQueueSubmit(vk_queue, 1, &submit_info, VK_NULL_HANDLE));
+
+ if (vr >= 0)
+ {
+ if ((vr = VK_CALL(vkQueueWaitIdle(vk_queue))) < 0)
+ WARN("Failed to wait for queue, vr %d.\n", vr);
+
+ if ((vr = VK_CALL(vkGetSemaphoreCounterValueKHR(device->vk_device, timeline_semaphore, &value))) < 0)
+ ERR("Failed to get Vulkan semaphore status, vr %d.\n", vr);
+ else if (!(result = !value))
+ WARN("Disabling timeline semaphore use due to incompatible behaviour.\n");
+ }
+ else
+ {
+ WARN("Failed to submit signal operation, vr %d.\n", vr);
+ }
+
+ vkd3d_queue_release(device->direct_queue);
+ VK_CALL(vkDestroySemaphore(device->vk_device, timeline_semaphore, NULL));
+
+ return result;
+}
+
static HRESULT vkd3d_create_vk_device(struct d3d12_device *device,
const struct vkd3d_device_create_info *create_info)
{
@@ -2027,6 +2110,13 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device,
}
device->feature_options4.MSAA64KBAlignedTextureSupported = d3d12_is_64k_msaa_supported(device);
+ if ((device->use_timeline_semaphores = d3d12_is_timeline_semaphore_supported(device))
+ && (!vkd3d_queue_init_timeline_semaphore(device->direct_queue, device)
+ || !vkd3d_queue_init_timeline_semaphore(device->compute_queue, device)
+ || !vkd3d_queue_init_timeline_semaphore(device->copy_queue, device)))
+ {
+ device->use_timeline_semaphores = false;
+ }
TRACE("Created Vulkan device %p.\n", vk_device);
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h
index c28eb234..053482a1 100644
--- a/libs/vkd3d/vkd3d_private.h
+++ b/libs/vkd3d/vkd3d_private.h
@@ -59,6 +59,7 @@
#define VKD3D_MAX_SHADER_EXTENSIONS 3u
#define VKD3D_MAX_SHADER_STAGES 5u
#define VKD3D_MAX_VK_SYNC_OBJECTS 4u
+#define VKD3D_MAX_FENCE_WAITING_QUEUES 4u
#define VKD3D_MAX_DESCRIPTOR_SETS 64u
/* D3D12 binding tier 3 has a limit of 2048 samplers. */
#define VKD3D_MAX_DESCRIPTOR_SET_SAMPLERS 2048u
@@ -125,6 +126,7 @@ struct vkd3d_vulkan_info
bool KHR_maintenance3;
bool KHR_push_descriptor;
bool KHR_sampler_mirror_clamp_to_edge;
+ bool KHR_timeline_semaphore;
/* EXT device extensions */
bool EXT_calibrated_timestamps;
bool EXT_conditional_rendering;
@@ -149,6 +151,8 @@ struct vkd3d_vulkan_info
VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT texel_buffer_alignment_properties;
+ VkPhysicalDeviceTimelineSemaphorePropertiesKHR timeline_semaphore_properties;
+
unsigned int shader_extension_count;
enum vkd3d_shader_spirv_extension shader_extensions[VKD3D_MAX_SHADER_EXTENSIONS];
@@ -347,6 +351,7 @@ struct vkd3d_fence_worker
struct vkd3d_enqueued_fence
{
VkFence vk_fence;
+ VkSemaphore vk_semaphore;
struct vkd3d_waiting_fence waiting_fence;
} *enqueued_fences;
size_t enqueued_fences_size;
@@ -356,6 +361,12 @@ struct vkd3d_fence_worker
size_t vk_fences_size;
struct vkd3d_waiting_fence *fences;
size_t fences_size;
+ VkSemaphore *vk_semaphores;
+ size_t vk_semaphores_size;
+ uint64_t *semaphore_wait_values;
+ size_t semaphore_wait_values_size;
+
+ void (*wait_for_gpu_fences)(struct vkd3d_fence_worker *worker);
struct d3d12_device *device;
};
@@ -510,6 +521,12 @@ struct vkd3d_signaled_semaphore
bool is_acquired;
};
+struct vkd3d_pending_fence_wait
+{
+ const struct vkd3d_queue *queue;
+ uint64_t pending_value;
+};
+
/* ID3D12Fence */
struct d3d12_fence
{
@@ -529,6 +546,11 @@ struct d3d12_fence
size_t events_size;
size_t event_count;
+ VkSemaphore timeline_semaphore;
+ uint64_t pending_timeline_value;
+ struct vkd3d_pending_fence_wait gpu_waits[VKD3D_MAX_FENCE_WAITING_QUEUES];
+ unsigned int gpu_wait_count;
+
struct list semaphores;
unsigned int semaphore_count;
@@ -544,6 +566,9 @@ struct d3d12_fence
HRESULT d3d12_fence_create(struct d3d12_device *device, uint64_t initial_value,
D3D12_FENCE_FLAGS flags, struct d3d12_fence **fence);
+VkResult vkd3d_create_timeline_semaphore(const struct d3d12_device *device, uint64_t initial_value,
+ VkSemaphore *timeline_semaphore);
+
/* ID3D12Heap */
struct d3d12_heap
{
@@ -1283,6 +1308,9 @@ struct vkd3d_queue
VkQueueFlags vk_queue_flags;
uint32_t timestamp_bits;
+ VkSemaphore wait_completion_semaphore;
+ uint64_t pending_wait_completion_value;
+
struct
{
VkSemaphore vk_semaphore;
@@ -1297,6 +1325,7 @@ struct vkd3d_queue
VkQueue vkd3d_queue_acquire(struct vkd3d_queue *queue);
HRESULT vkd3d_queue_create(struct d3d12_device *device, uint32_t family_index,
const VkQueueFamilyProperties *properties, struct vkd3d_queue **queue);
+bool vkd3d_queue_init_timeline_semaphore(struct vkd3d_queue *queue, struct d3d12_device *device);
void vkd3d_queue_destroy(struct vkd3d_queue *queue, struct d3d12_device *device);
void vkd3d_queue_release(struct vkd3d_queue *queue);
@@ -1455,6 +1484,7 @@ struct d3d12_device
VkDescriptorPoolSize vk_pool_sizes[VKD3D_DESCRIPTOR_POOL_COUNT];
struct vkd3d_vk_descriptor_heap_layout vk_descriptor_heap_layouts[VKD3D_SET_INDEX_COUNT];
bool use_vk_heaps;
+ bool use_timeline_semaphores;
};
HRESULT d3d12_device_create(struct vkd3d_instance *instance,
diff --git a/libs/vkd3d/vulkan_procs.h b/libs/vkd3d/vulkan_procs.h
index 60556735..34e0ab4b 100644
--- a/libs/vkd3d/vulkan_procs.h
+++ b/libs/vkd3d/vulkan_procs.h
@@ -195,6 +195,11 @@ VK_DEVICE_EXT_PFN(vkGetDescriptorSetLayoutSupportKHR)
/* VK_KHR_push_descriptor */
VK_DEVICE_EXT_PFN(vkCmdPushDescriptorSetKHR)
+/* VK_KHR_timeline_semaphore */
+VK_DEVICE_EXT_PFN(vkGetSemaphoreCounterValueKHR)
+VK_DEVICE_EXT_PFN(vkWaitSemaphoresKHR)
+VK_DEVICE_EXT_PFN(vkSignalSemaphoreKHR)
+
/* VK_EXT_calibrated_timestamps */
VK_DEVICE_EXT_PFN(vkGetCalibratedTimestampsEXT)
diff --git a/tests/d3d12.c b/tests/d3d12.c
index 29bd40c8..2059b182 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -33240,7 +33240,9 @@ static void test_queue_wait(void)
command_list = context.list;
queue = context.queue;
- queue2 = create_command_queue(device, D3D12_COMMAND_LIST_TYPE_DIRECT, D3D12_COMMAND_QUEUE_PRIORITY_NORMAL);
+ /* 'queue2' must not map to the same command queue as 'queue', or Wait() before GPU signal will fail.
+ * Using a compute queue fixes this on most hardware, but it may still fail on low spec hardware. */
+ queue2 = create_command_queue(device, D3D12_COMMAND_LIST_TYPE_COMPUTE, D3D12_COMMAND_QUEUE_PRIORITY_NORMAL);
event = create_event();
ok(event, "Failed to create event.\n");
@@ -33305,12 +33307,6 @@ static void test_queue_wait(void)
check_readback_data_uint(&rb, NULL, 0xff00ff00, 0);
release_resource_readback(&rb);
- if (!vkd3d_test_platform_is_windows())
- {
- skip("Wait() is not implemented yet.\n"); /* FIXME */
- goto skip_tests;
- }
-
/* Wait() before CPU signal */
update_buffer_data(cb, 0, sizeof(blue), &blue);
queue_wait(queue, fence, 2);
@@ -33386,7 +33382,6 @@ static void test_queue_wait(void)
check_readback_data_uint(&rb, NULL, 0xff00ff00, 0);
release_resource_readback(&rb);
-skip_tests:
/* Signal() and Wait() in the same command queue */
update_buffer_data(cb, 0, sizeof(blue), &blue);
queue_signal(queue, fence, 7);
--
2.34.1
2
2
24 Mar '22
Signed-off-by: Francois Gouget <fgouget(a)free.fr>
---
programs/cmd/tests/test_builtins.cmd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd
index 56a682577bd..3f410e55166 100644
--- a/programs/cmd/tests/test_builtins.cmd
+++ b/programs/cmd/tests/test_builtins.cmd
@@ -380,7 +380,7 @@ rem test : echo i1|tmp.cmd i2|tmp.cmd i3|tmp.cmd i4
rem result: i4:[i3:[i2:[i1,i2],i3],i4]@or_broken(a)i4:[i3:[i2:,i3],i4]@or_broken(a)i4:[i3:,i4]
del tmp.cmd
echo --- chain else
-rem Command arguments are gready and eat up the 'else' unless terminated by
+rem Command arguments are greedy and eat up the 'else' unless terminated by
rem brackets, which means the 'else' can only be recognized when the
rem 'if true' command chain ends with brackets.
if 1==1 if 2==2 if 3==3 (echo a1) else (echo a2) else echo a3
--
2.30.2
2
1