Commit Graph

200 Commits

Author SHA1 Message Date
Alexandre Julliard 39e4b788d6 ntdll: Use the standard Interlocked* functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-02 15:10:04 +02:00
Gijs Vermeulen d8ec1fb894 ntdll: Remove unused function fast_wait_cv().
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-01 22:03:16 +02:00
Jacek Caban eaad238000 ntdll: Leave critical section before blocking in RtlWaitOnAddress.
Fixes regression from commit 4f673d5386.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-20 12:38:05 +02:00
Jacek Caban 7a1069e9bd ntdll: Remove APC handling from RtlWaitOnAddress.
It uses non-alertable wait anyway.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-20 12:36:40 +02:00
Jacek Caban 5e7ccd182e ntdll: Use select request to pass suspend context to server.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-16 22:10:04 +02:00
Zebediah Figura a6e70c6074 ntdll: Handle unaligned SRW locks when using futexes.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-14 11:23:04 +02:00
Zebediah Figura 28619e6035 ntdll: Handle unaligned SRW locks when using keyed events.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-14 11:23:02 +02:00
Zebediah Figura aceff21022 ntdll: Handle unaligned condition variables when using futexes.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48389
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-14 11:22:59 +02:00
Jacek Caban 4f673d5386 ntdll: Use server_select in RtlWaitOnAddress.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-13 12:14:55 +02:00
Jacek Caban 8701260768 ntdll: Factor out server_select.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-13 12:14:51 +02:00
Piotr Caban 321d26cbb4 server: Use correct clock in select.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-09 21:04:04 +02:00
Piotr Caban 6d2d3595c0 server: Use monotonic clock in waitable timers.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-09 21:04:04 +02:00
Rémi Bernon 544fd9504a ntdll: Process system APCs while the signals are blocked.
This makes sure that system APC, such as APC_BREAK_PROCESS do not get
interrupted in the middle of their execution, and that the APC
completion notification is always correctly sent back to the caller.

Otherwise DbgBreakProcess sometimes did not return until
WaitForDebugEvent/ContinueDebugEvent are called, because of a race
condition between the APC servicing thread, and the newly created
exception thread.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-05 21:28:26 +01:00
Rémi Bernon 2dc99bfb30 ntdll: Handle system APCs in a separate inner loop.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-05 21:28:24 +01:00
Rémi Bernon 3ffa355d2b ntdll: Use the status to tell user APC from system APC.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-05 21:28:21 +01:00
Rémi Bernon 6cb2336217 ntdll: Reorder code to make the select logic clearer.
The wait_select_reply call may return STATUS_USER_APC/STATUS_KERNEL_APC,
depending on which APC is about to be returned but the apc call will
always be APC_NONE right after the wait. It needs an additional select
request to actually return the call.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-05 21:28:18 +01:00
Rémi Bernon 676ad9b0af server: Use STATUS_KERNEL_APC to indicate system APCs.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-05 21:28:15 +01:00
Rémi Bernon d03420da12 ntdll: Don't change RtlWaitOnAddress size after user invoke_apc.
This makes the next iteration to immediately return STATUS_SUCCESS
because of compare_addr returning FALSE with size == 0.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-01-29 20:42:16 +01:00
Francois Gouget 101be282a6 ntdll: Fix the spelling of some comments.
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-12 23:17:05 +01:00
Zebediah Figura 07e86d3c9d ntdll: Try to avoid an unnecessary syscall in fast_release_srw_exclusive().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-11 18:20:31 +02:00
Zebediah Figura e2411ebecb ntdll: Add a futex-based implementation of SRW locks.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-11 18:20:24 +02:00
Zebediah Figura d741296676 ntdll: Remove no longer used interlocked_dec_if_nonzero().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-11 18:19:40 +02:00
Jacek Caban 7ba361b47b ntdll: Add support for returning previous state argument in event functions.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-03-12 20:34:35 +01:00
Jacek Caban d3660e5901 ntdll: Fix event op functions declarations.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-03-12 20:33:41 +01:00
Paul Gofman ba42efdb14 ntdll: Pass async parameter to add_fd_completion server call.
Signed-off-by: Paul Gofman <gofmanp@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-21 16:07:07 +01:00
Zebediah Figura be541f1b0c ntdll: Add a direct futex-based implementation of condition variables.
While the current path for condition variables will ultimately use futexes if
they are available, the path for address waits is vulnerable to several
spurious wakes, which can be obviated by using condition variables as futexes
directly.

This greatly improves performance for Path of Exile.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45524
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-11 11:52:00 +01:00
Zebediah Figura 954ed39584 ntdll: Reimplement condition variables on top of RtlWaitOnAddress().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46208
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-08 22:18:16 +01:00
Zebediah Figura cc8f9b6419 ntdll: Add a futex-based implementation of WaitOnAddress().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-06 10:48:04 +01:00
Zebediah Figura 6060d2703c ntdll: Use a critical section to ensure that RtlWaitOnAddress compares and queues atomically.
Currently a wake may occur between calling compare_addr() and performing the
select request; in that case the thread will never be woken. Prevent this by
taking a CS around both operations.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46099
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-12-04 16:13:10 +01:00
Zebediah Figura 0ea963a406 ntdll: Call the select request directly in RtlWaitOnAddress().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-12-04 16:13:10 +01:00
Zebediah Figura e09248d363 ntdll: Don't write more IOCP entries than requested.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45948
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-19 10:17:48 +01:00
Zebediah Figura fbde01335f ntdll: Only wait on the completion port if no entries were returned.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-19 10:17:48 +01:00
Alexandre Julliard a0050be13f ntdll: Use the default keyed event when the handle is null.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-26 12:45:45 +02:00
Daniel Lehman 25acfbb40b ntdll: Implement RtlWaitOnAddress functions.
Signed-off-by: Daniel Lehman <dlehman25@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-26 11:16:54 +02:00
Zebediah Figura ef2471ec0f ntdll: Implement NtRemoveIoCompletionEx().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-01 19:12:20 -07:00
Alexandre Julliard be40b01c37 server: Align object attributes to a DWORD-boundary.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-20 12:59:32 +02:00
Jonathan Doron fbf2631dcb ntdll: Apply owner and group regardless of the SE_OWNER_DEFAULTED or SE_GROUP_DEFAULTED flags.
Signed-off-by: Jonathan Doron <jond@wizery.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-09-13 08:41:29 +02:00
Michael Müller 62ae2ae1a1 ntdll: Add stub for JobObjectBasicAccountingInformation and JobObjectBasicProcessIdList.
Signed-off-by: Michael Müller <michael@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-24 11:09:46 +02:00
Nikolay Sivov 7de025c970 ntdll: Fix its vs it's typos.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-01 20:57:23 -05:00
Daniel Lehman 4c89d567f6 ntdll: Remove stub from trace.
Signed-off-by: Daniel Lehman <dlehman25@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-05-05 17:18:32 +09:00
Daniel Lehman ad83e2cd57 ntdll: Add trace for NtQueryEvent/Semaphore.
Signed-off-by: Daniel Lehman <dlehman25@gmail.com>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-05-04 01:03:27 +09:00
Daniel Lehman 7950562e9e ntdll: Fix prev_count from NtReleaseMutant.
Signed-off-by: Daniel Lehman <dlehman25@gmail.com>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-05-04 01:03:27 +09:00
Daniel Lehman 142730ea66 ntdll: Add NtQueryMutant.
Signed-off-by: Daniel Lehman <dlehman25@gmail.com>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-05-04 01:03:26 +09:00
Nikolay Sivov ce093a2acf ntdll: Remove redundant NULL check (Coverity).
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-02-06 12:26:18 +09:00
Alexandre Julliard 6fe37f35bf ntdll: Add tests for the length of the object attributes structure.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-01-30 00:30:25 +09:00
Alexandre Julliard fe0924625f ntdll: Add a helper to validate attributes in open calls, and use a common pattern in all calls.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-01-29 21:25:11 +09:00
Alexandre Julliard b3064d748b server: Implement NtOpenJobObject.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-01-29 16:38:53 +09:00
Alexandre Julliard 8b2ba27c86 ntdll: Add tests for kernel object names in the various open functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-01-29 00:41:30 +09:00
Alexandre Julliard cd6e9c38e4 server: Fix constraints on the length of NT object names.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-01-19 20:48:08 +09:00
Alexandre Julliard 1eb69be36f server: Pass full object attributes in the create_completion request.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-01-18 00:17:30 +09:00