Wine-Devel
Threads by month
- ----- 2026 -----
- April
- March
- February
- January
- ----- 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
- 4 participants
- 84517 discussions
March 24, 2022
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
[PATCH] dlls/ntdll/tests/virtual.c: enable compilation with long types
by Eric Pouech March 24, 2022
by Eric Pouech March 24, 2022
March 24, 2022
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
March 24, 2022
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
March 24, 2022
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 March 24, 2022
by Conor McCarthy March 24, 2022
March 24, 2022
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
March 24, 2022
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
March 24, 2022
We would like to build Wine modules with Rust, using winebuild for the
link stage.
Rust uses the ".rlib" extension for intermediate libraries which it
passes to the linker. Detect them through signature so that winegcc will
not try to compile it.
Signed-off-by: Tatsuyuki Ishi <ishitatsuyuki(a)gmail.com>
---
v2: Update the ar signature to the canonical (and more correct) one.
v3: Add sign-off.
---
tools/winegcc/utils.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/winegcc/utils.c b/tools/winegcc/utils.c
index 409ae26cd82..4b4498a59fa 100644
--- a/tools/winegcc/utils.c
+++ b/tools/winegcc/utils.c
@@ -63,6 +63,7 @@ file_type get_file_type(const char* filename)
/* see tools/winebuild/res32.c: check_header for details */
static const char res_sig[] = { 0,0,0,0, 32,0,0,0, 0xff,0xff, 0,0, 0xff,0xff, 0,0, 0,0,0,0, 0,0, 0,0, 0,0,0,0, 0,0,0,0 };
static const char elf_sig[4] = "\177ELF";
+ static const char ar_sig[8] = "!<arch>\n";
char buf[sizeof(res_sig)];
int fd, cnt;
@@ -83,6 +84,7 @@ file_type get_file_type(const char* filename)
if (strendswith(filename, ".spec")) return file_spec;
if (strendswith(filename, ".rc")) return file_rc;
if (cnt >= sizeof(elf_sig) && !memcmp(buf, elf_sig, sizeof(elf_sig))) return file_so; /* ELF lib */
+ if (cnt >= sizeof(ar_sig) && !memcmp(buf, ar_sig, sizeof(ar_sig))) return file_arh;
if (cnt >= sizeof(unsigned int) &&
(*(unsigned int *)buf == 0xfeedface || *(unsigned int *)buf == 0xcefaedfe ||
*(unsigned int *)buf == 0xfeedfacf || *(unsigned int *)buf == 0xcffaedfe))
--
2.35.1
1
0
March 24, 2022
Signed-off-by: Francois Gouget <fgouget(a)free.fr>
---
dlls/ncrypt/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/ncrypt/main.c b/dlls/ncrypt/main.c
index d7a79faecce..f8fb3135f56 100644
--- a/dlls/ncrypt/main.c
+++ b/dlls/ncrypt/main.c
@@ -171,7 +171,7 @@ SECURITY_STATUS WINAPI NCryptCreatePersistedKey(NCRYPT_PROV_HANDLE provider, NCR
if (!provider) return NTE_INVALID_HANDLE;
if (!algid) return HRESULT_FROM_WIN32(RPC_X_NULL_REF_POINTER);
- if (name) FIXME("Persistant keys not supported\n");
+ if (name) FIXME("Persistent keys are not supported\n");
if (!lstrcmpiW(algid, BCRYPT_RSA_ALGORITHM))
{
--
2.30.2
1
0
March 23, 2022
We would like to build Wine modules with Rust, using winebuild for the
link stage.
Rust uses the ".rlib" extension for intermediate libraries which it
passes to the linker. Detect them through signature so that winegcc will
not try to compile it.
v2: Update the ar signature to the canonical (and more correct) one.
---
tools/winegcc/utils.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/winegcc/utils.c b/tools/winegcc/utils.c
index 409ae26cd82..4b4498a59fa 100644
--- a/tools/winegcc/utils.c
+++ b/tools/winegcc/utils.c
@@ -63,6 +63,7 @@ file_type get_file_type(const char* filename)
/* see tools/winebuild/res32.c: check_header for details */
static const char res_sig[] = { 0,0,0,0, 32,0,0,0, 0xff,0xff, 0,0, 0xff,0xff, 0,0, 0,0,0,0, 0,0, 0,0, 0,0,0,0, 0,0,0,0 };
static const char elf_sig[4] = "\177ELF";
+ static const char ar_sig[8] = "!<arch>\n";
char buf[sizeof(res_sig)];
int fd, cnt;
@@ -83,6 +84,7 @@ file_type get_file_type(const char* filename)
if (strendswith(filename, ".spec")) return file_spec;
if (strendswith(filename, ".rc")) return file_rc;
if (cnt >= sizeof(elf_sig) && !memcmp(buf, elf_sig, sizeof(elf_sig))) return file_so; /* ELF lib */
+ if (cnt >= sizeof(ar_sig) && !memcmp(buf, ar_sig, sizeof(ar_sig))) return file_arh;
if (cnt >= sizeof(unsigned int) &&
(*(unsigned int *)buf == 0xfeedface || *(unsigned int *)buf == 0xcefaedfe ||
*(unsigned int *)buf == 0xfeedfacf || *(unsigned int *)buf == 0xcffaedfe))
--
2.35.1
1
0