NtSetEventBoostPriority stub regression fixes for: https://bugs.winehq.org/show_bug.cgi?id=58688
Regressive commit: ed9f31120b68e7d684c1544c05d94c38b25cb759
Other stubs were also changed by regress commit and may still be broken.
I'll test the other stubs and fix if necessary.
In the meantime I'm submitting this merge for review in case I missed anything that may be needed for the other stub fixes.
-- v7: ntdll/tests: NtSetEventBoostPriority() tests added for bug #58688 ntdll: NtSetEventBoostPriority() implemented for bug #58688
From: Stian Low wineryyyyy@gmail.com
--- dlls/ntdll/ntdll.spec | 4 ++-- dlls/ntdll/ntsyscalls.h | 5 ++--- dlls/ntdll/unix/sync.c | 9 +++++++++ dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 ++ dlls/wow64/sync.c | 10 ++++++++++ include/winternl.h | 1 + 6 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 604c342ba35..64f35d0b54d 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -386,7 +386,7 @@ @ stdcall -syscall NtSetDefaultUILanguage(long) @ stdcall -syscall NtSetEaFile(long ptr ptr long) @ stdcall -syscall=0x000e NtSetEvent(long ptr) -@ stub -syscall=0x002d NtSetEventBoostPriority +@ stdcall -syscall=0x002d NtSetEventBoostPriority(long) # @ stub NtSetHighEventPair # @ stub NtSetHighWaitLowEventPair @ stdcall -syscall NtSetInformationDebugObject(long long ptr long ptr) @@ -1454,7 +1454,7 @@ @ stdcall -private ZwSetDefaultUILanguage(long) NtSetDefaultUILanguage @ stdcall -private ZwSetEaFile(long ptr ptr long) NtSetEaFile @ stdcall -private ZwSetEvent(long ptr) NtSetEvent -@ stdcall -private ZwSetEventBoostPriority() NtSetEventBoostPriority +@ stdcall -private ZwSetEventBoostPriority(long) NtSetEventBoostPriority # @ stub ZwSetHighEventPair # @ stub ZwSetHighWaitLowEventPair @ stdcall -private ZwSetInformationDebugObject(long long ptr long ptr) NtSetInformationDebugObject diff --git a/dlls/ntdll/ntsyscalls.h b/dlls/ntdll/ntsyscalls.h index cc88ec87850..94ef1c52781 100644 --- a/dlls/ntdll/ntsyscalls.h +++ b/dlls/ntdll/ntsyscalls.h @@ -46,7 +46,7 @@ SYSCALL_ENTRY( 0x002a, NtUnmapViewOfSection, 8 ) \ SYSCALL_ENTRY( 0x002b, NtReplyWaitReceivePortEx, 20 ) \ SYSCALL_ENTRY( 0x002c, NtTerminateProcess, 8 ) \ - SYSCALL_ENTRY( 0x002d, NtSetEventBoostPriority, 0 ) \ + SYSCALL_ENTRY( 0x002d, NtSetEventBoostPriority, 4 ) \ SYSCALL_ENTRY( 0x002e, NtReadFileScatter, 36 ) \ SYSCALL_ENTRY( 0x002f, NtOpenThreadTokenEx, 20 ) \ SYSCALL_ENTRY( 0x0030, NtOpenProcessTokenEx, 16 ) \ @@ -311,7 +311,7 @@ SYSCALL_ENTRY( 0x002a, NtUnmapViewOfSection, 16 ) \ SYSCALL_ENTRY( 0x002b, NtReplyWaitReceivePortEx, 40 ) \ SYSCALL_ENTRY( 0x002c, NtTerminateProcess, 16 ) \ - SYSCALL_ENTRY( 0x002d, NtSetEventBoostPriority, 0 ) \ + SYSCALL_ENTRY( 0x002d, NtSetEventBoostPriority, 8 ) \ SYSCALL_ENTRY( 0x002e, NtReadFileScatter, 72 ) \ SYSCALL_ENTRY( 0x002f, NtOpenThreadTokenEx, 40 ) \ SYSCALL_ENTRY( 0x0030, NtOpenProcessTokenEx, 32 ) \ @@ -530,7 +530,6 @@ SYSCALL_STUB( NtApphelpCacheControl ) \ SYSCALL_STUB( NtCreateProcessEx ) \ SYSCALL_STUB( NtMapUserPhysicalPagesScatter ) \ - SYSCALL_STUB( NtSetEventBoostPriority ) \ SYSCALL_STUB( NtTraceEvent ) \ SYSCALL_STUB( NtWaitForMultipleObjects32 ) \ SYSCALL_STUB( NtWorkerFactoryWorkerReady ) diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index acdb7b3d9f8..c9ee3fb30c2 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -644,6 +644,15 @@ NTSTATUS WINAPI NtSetEvent( HANDLE handle, LONG *prev_state ) }
+/****************************************************************************** + * NtSetEventBoostPriority (NTDLL.@) + */ +NTSTATUS WINAPI NtSetEventBoostPriority( HANDLE handle ) +{ + return NtSetEvent(handle, NULL); +} + + /****************************************************************************** * NtResetEvent (NTDLL.@) */ diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 95ba78f6a24..4426e5066e0 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -829,6 +829,7 @@ @ stdcall NtRequestWaitReplyPort(ptr ptr ptr) @ stdcall NtSetEaFile(long ptr ptr long) @ stdcall NtSetEvent(long ptr) +@ stdcall NtSetEventBoostPriority(long) @ stdcall NtSetInformationFile(long ptr ptr long long) @ stdcall NtSetInformationProcess(long long ptr long) @ stdcall NtSetInformationThread(long long ptr long) @@ -1518,6 +1519,7 @@ @ stdcall -private ZwSetDefaultUILanguage(long) NtSetDefaultUILanguage @ stdcall -private ZwSetEaFile(long ptr ptr long) NtSetEaFile @ stdcall ZwSetEvent(long ptr) NtSetEvent +@ stdcall -private ZwSetEventBoostPriority(long) NtSetEventBoostPriority @ stdcall -private ZwSetInformationFile(long ptr ptr long long) NtSetInformationFile @ stdcall -private ZwSetInformationJobObject(long long ptr long) NtSetInformationJobObject @ stdcall -private ZwSetInformationKey(long long ptr long) NtSetInformationKey diff --git a/dlls/wow64/sync.c b/dlls/wow64/sync.c index 537e695cc87..c2936e8f9ea 100644 --- a/dlls/wow64/sync.c +++ b/dlls/wow64/sync.c @@ -1392,6 +1392,16 @@ NTSTATUS WINAPI wow64_NtSetEvent( UINT *args ) }
+/********************************************************************** + * wow64_NtSetEventBoostPriority + */ +NTSTATUS WINAPI wow64_NtSetEventBoostPriority( UINT *args ) +{ + HANDLE handle = get_handle( &args ); + return NtSetEventBoostPriority(handle); +} + + /********************************************************************** * wow64_NtSetInformationDebugObject */ diff --git a/include/winternl.h b/include/winternl.h index 96b018ea8d9..36c24b01e56 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -4720,6 +4720,7 @@ NTSYSAPI NTSTATUS WINAPI NtSetDefaultLocale(BOOLEAN,LCID); NTSYSAPI NTSTATUS WINAPI NtSetDefaultUILanguage(LANGID); NTSYSAPI NTSTATUS WINAPI NtSetEaFile(HANDLE,PIO_STATUS_BLOCK,PVOID,ULONG); NTSYSAPI NTSTATUS WINAPI NtSetEvent(HANDLE,LONG*); +NTSYSAPI NTSTATUS WINAPI NtSetEventBoostPriority(HANDLE); NTSYSAPI NTSTATUS WINAPI NtSetHighEventPair(HANDLE); NTSYSAPI NTSTATUS WINAPI NtSetHighWaitLowEventPair(HANDLE); NTSYSAPI NTSTATUS WINAPI NtSetHighWaitLowThread(VOID);
From: Stian Low wineryyyyy@gmail.com
--- dlls/ntdll/tests/sync.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/dlls/ntdll/tests/sync.c b/dlls/ntdll/tests/sync.c index 8837ac16edf..926d5df8023 100644 --- a/dlls/ntdll/tests/sync.c +++ b/dlls/ntdll/tests/sync.c @@ -45,6 +45,7 @@ static NTSTATUS (WINAPI *pNtReleaseMutant)( HANDLE, LONG * ); static NTSTATUS (WINAPI *pNtReleaseSemaphore)( HANDLE, ULONG, ULONG * ); static NTSTATUS (WINAPI *pNtResetEvent)( HANDLE, LONG * ); static NTSTATUS (WINAPI *pNtSetEvent)( HANDLE, LONG * ); +static NTSTATUS (WINAPI *pNtSetEventBoostPriority)( HANDLE ); static NTSTATUS (WINAPI *pNtWaitForAlertByThreadId)( void *, const LARGE_INTEGER * ); static NTSTATUS (WINAPI *pNtWaitForKeyedEvent)( HANDLE, const void *, BOOLEAN, const LARGE_INTEGER * ); static BOOLEAN (WINAPI *pRtlAcquireResourceExclusive)( RTL_RWLOCK *, BOOLEAN ); @@ -146,6 +147,20 @@ static void test_event(void) ok( prev_state == 1, "prev_state = %lx\n", prev_state );
pNtClose(event); + + status = pNtCreateEvent(&event, GENERIC_ALL, &attr, SynchronizationEvent, 0); + ok( status == STATUS_SUCCESS, "NtCreateEvent failed %08lx\n", status ); + + status = pNtSetEventBoostPriority( event ); + ok( status == STATUS_SUCCESS, "NtSetEventBoostPriority failed: %08lx\n", status ); + + memset(&info, 0xcc, sizeof(info)); + status = pNtQueryEvent(event, EventBasicInformation, &info, sizeof(info), NULL); + ok( status == STATUS_SUCCESS, "NtQueryEvent failed %08lx\n", status ); + ok( info.EventState == 1, + "NtQueryEventBoostPriority failed, expected 1, got %ld\n", info.EventState ); + + pNtClose(event); }
static const WCHAR keyed_nameW[] = L"\BaseNamedObjects\WineTestEvent"; @@ -1148,6 +1163,7 @@ START_TEST(sync) pNtReleaseSemaphore = (void *)GetProcAddress(module, "NtReleaseSemaphore"); pNtResetEvent = (void *)GetProcAddress(module, "NtResetEvent"); pNtSetEvent = (void *)GetProcAddress(module, "NtSetEvent"); + pNtSetEventBoostPriority = (void *)GetProcAddress(module, "NtSetEventBoostPriority"); pNtWaitForAlertByThreadId = (void *)GetProcAddress(module, "NtWaitForAlertByThreadId"); pNtWaitForKeyedEvent = (void *)GetProcAddress(module, "NtWaitForKeyedEvent"); pRtlAcquireResourceExclusive = (void *)GetProcAddress(module, "RtlAcquireResourceExclusive");
On Thu Sep 18 15:00:33 2025 +0000, Nikolay Sivov wrote:
When pushing a rebase make sure to update your local branch, squash changes if needed, check commit message, and use git push --force. At the end MR should show only your new commits. Regarding exception tests, it's up to you. But it's likely something already known, if it wow64 specific.
Thanks for the pointers @nsivov
Hopefully everything is cleaned up now.
I only added a brief NtSetEventBoostPriority test at the end of NtSetEvent tests since NtSetEventBoostPriority just calls NtSetEvent at this time which are already tested prior.
Perhaps @mzent recommendation to include `NtYieldExecution` will eventually be needed. For now It just calls NtSetEvent unconditionally until `NtYieldExecution` is looked into further.
Retesting Xenia Canary yields the same test results as before so all seems well as far as the bug report goes.