Commit graph

2915 commits

Author SHA1 Message Date
Alexandre Julliard bd5edbe1eb server: Create new keys in the parent of a shared key.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53343
2022-07-13 12:50:07 +02:00
Alexandre Julliard 569c27945e server: Use standard named object functions for registry keys.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-07-07 19:10:02 +02:00
Alexandre Julliard b79ff648ef server: Implement lookup_name() for registry keys.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-07-07 19:10:02 +02:00
Alexandre Julliard 6a7a7bbe97 server: Implement link_name() for registry keys.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-07-07 19:10:02 +02:00
Alexandre Julliard 721cd6e636 server: Move some functions to avoid forward declarations.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-07-07 19:10:02 +02:00
Alexandre Julliard 5414f648ee server: Implement unlink_name() for registry keys.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-07-06 16:02:48 +02:00
Alexandre Julliard 617cc989f0 server: Store the key parent in the standard object name structure.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-07-06 16:02:48 +02:00
Alexandre Julliard e3c32904b2 server: Use the standard object name for registry keys.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-07-06 16:02:48 +02:00
Alexandre Julliard 6bed417bb7 server: Store a pointer to the Wow6432Node subkey.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-07-06 16:02:48 +02:00
Alexandre Julliard 9c551448cb server: Prevent infinite symlink recursion in lookup_named_object().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-07-05 14:33:55 +02:00
Alexandre Julliard 248231468d server: Avoid potential NULL dereference in create_named_object().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-07-05 14:33:33 +02:00
Alexandre Julliard 68a69b51bb server: Return the standard status code when the key exists in NtCreateKey.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-07-05 14:19:00 +02:00
Alexandre Julliard ec8edb66df server: Fix access check for NtQueryKey.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-07-05 14:08:43 +02:00
Paul Gofman 07d3c82395 server: Allow IOCTL_AFD_POLL for sockets without unix fd.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
2022-07-05 10:00:18 +02:00
Alexandre Julliard 194e09baec makefiles: Add separate variables for Unix flags and libraries.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-06-29 23:23:41 +02:00
Nikolay Sivov 1fb6f27144 ntdll: Implement NtRenameKey().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2022-06-28 15:54:15 +02:00
Alexandre Julliard 3af0258795 ntdll: Fix returned status code for paths with a trailing slash.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-06-28 13:20:15 +02:00
David Curtiss 68d4643a67 ws2_32: Allow getsockname after AcceptEx.
.NET 6's HTTP/Socket code queries this. Winsock allows getsockname
on the AcceptEx AcceptSocket, but only if SO_UPDATE_ACCEPT_CONTEXT
is set.

Signed-off-by: David Curtiss <david.curtiss@ni.com>
2022-06-20 23:26:50 +02:00
Rémi Bernon c57eda2432 server: Avoid using pointer value after realloc.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-06-15 11:57:08 +02:00
Piotr Caban 0c7928061c server: Don't reset socket error in IOCTL_AFD_GET_SO_ERROR.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
2022-06-13 21:33:54 +02:00
Piotr Caban 73648f901c server: Don't reset socket error in poll_socket.
Otherwise socket error may be cleared in poll_socket causing ioctl SO_ERROR calls to return no error.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51433
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
2022-06-13 21:33:54 +02:00
Piotr Caban 9d1085c8d3 server: Always return Win32 error code from IOCTL_AFD_GET_SO_ERROR.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
2022-06-13 21:33:54 +02:00
Paul Gofman 7c597313f8 ntdll: Cancel asyncs when thread is terminated.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
2022-06-09 13:20:13 +02:00
Zebediah Figura 5a4e39795f server: Remove a redundant call to set_fd_events().
We will always call set_fd_events() again in sock_reselect().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-06 12:06:41 +02:00
Zebediah Figura 753fbb28d5 server: Do not signal accept bits if there are accept asyncs queued.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-05 18:36:28 +02:00
Zebediah Figura bff228c198 server: Do not signal write bits if there are write asyncs alerted.
Asyncs which are alerted but not "waiting" may still fill the pipe, and we
shouldn't signal AFD_POLL_WRITE in that case.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-05 18:36:22 +02:00
Zebediah Figura c5541f8a08 server: Don't poll for POLLOUT if there are alerted write asyncs.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-05 18:36:15 +02:00
Zebediah Figura 30a56639fd server: Do not signal read bits if there are read asyncs alerted.
Asyncs which are alerted but not "waiting" may still consume all data, and we
shouldn't signal AFD_POLL_READ or AFD_POLL_OOB in that case.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-05 18:36:09 +02:00
Zebediah Figura 04b33ef098 server: Don't poll for POLLIN or POLLPRI if there are alerted read asyncs.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-05 18:36:03 +02:00
Zebediah Figura cafd260014 server: Do not signal read/write bits if there are read/write asyncs waiting.
This is validated by tests introduced in
59beffb46c etc. This commit alone doesn't fix said
tests, because:

* on this poll, we will alert the waiting async;

* when reselecting, we will still request POLLIN, because the AFD_POLL_READ
  request is still active,

* when POLLIN is subsequently signaled, we do not remove it in
  sock_dispatch_asyncs(), because we check async_waiting(), not async_queued().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-05 18:35:56 +02:00
Zebediah Figura 683d46a2cd server: Clear only returned events in IOCTL_AFD_GET_EVENTS.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-04 21:59:22 +02:00
Zebediah Figura ad078be430 server: Send AFD_POLL_READ messages before AFD_POLL_WRITE.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-04 21:51:23 +02:00
Zebediah Figura 677eee8e7d server: Return void from sock_reselect().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-27 11:54:08 +02:00
Rémi Bernon 68b6e876f0 server: Create message queue and thread input in get_key_state.
This removes the fallback to desktop async keystate and uses instead the
keystate synchronization logic in all cases.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26269
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=27238
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=31899
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35907
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45385
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-26 13:53:29 +02:00
Rémi Bernon f076e5f854 server: Lock thread input keystate whenever it is modified.
And synchronize it with desktop async keystate, on GetKeyState calls,
if it is not locked yet.

Based on a patch from Sebastian Lackner <sebastian@fds-team.de>.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26269
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=27238
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=31899
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35907
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45385
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-26 13:53:26 +02:00
Rémi Bernon ff74d5c244 server: Create message queue and thread input in set_key_state.
This marks one test case as todo, but it was an outlier, and the 'X' key
state is now wrong in all cases. Overall this makes the tests results
more coherent.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26269
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=27238
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=31899
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35907
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45385
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-26 13:53:18 +02:00
Alexandre Julliard dd99319cde server: Return the full token group for TokenLogonSid.
Based on a patch by Fabian Maurer.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52845
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-25 13:24:02 +02:00
Alexandre Julliard 1a0f082682 server: Store the full group attributes.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-25 12:53:19 +02:00
Zebediah Figura 0c7dcd9088 ntdll: Return the required length from NtQueryDirectoryObject().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-13 16:25:44 +02:00
Zebediah Figura 2d147ce985 server: Return STATUS_BUFFER_TOO_SMALL instead of STATUS_BUFFER_OVERFLOW from get_directory_entry.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-12 22:13:05 +02:00
Eric Pouech 95202ea4da server: Use negative values for console pseudo handles.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-12 21:39:42 +02:00
Jinoh Kang 731a968003 server: Replace redundant send_socket status fields with force_async boolean field.
The 'status' field of send_socket_request is always either
STATUS_PENDING or STATUS_DEVICE_NOT_READY, and the 'total' field is
always zero.

Replace the 'status' field with 'force_async' boolean field, and get rid
of the 'total' field entirely.

Also, clean up the send_socket handler code a bit.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-25 18:30:28 +01:00
Jinoh Kang 0ac256eacc server: Ensure datagram sockets are bound in send_socket.
If the type of the socket is SOCK_DGRAM, it shall always be bound to an
address if we ever attempt to send datagrams through the socket, whether
the attempt succeeds or not.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-25 18:30:28 +01:00
Jinoh Kang 65d12984f2 server: Attempt to complete I/O request immediately in send_socket.
Make send_socket alert the async immediately if poll() call detects that
there are incoming data in the socket, bypassing the wineserver's main
polling loop.

For sock_transmit, we always mark the async as pending and set the IOSB
(unless async allocation has failed).

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-25 18:30:28 +01:00
Jinoh Kang 1c6c90c7e1 server: Defer clearing events until async is completed in send_socket handler.
This allows the initial I/O to be performed after the send_socket
handler is called.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-25 18:28:37 +01:00
Jinoh Kang e81c2a6af4 server: Allow async completion callback to retrieve status on synchronous failure.
This also makes async_handoff() behaviour more consistent with
async_set_result() for handling I/O failures.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-25 18:28:24 +01:00
Jinoh Kang 5d98ffe982 server: Generalise async completion callback to be called on synchronous failure.
Today, async_set_completion_callback() is used to register a function
that is called when the async I/O is completed.  It is assumed that the
async will eventually be queued when such callback is registered.

However, this incurs extra complexity in future code that needs the
completion logic to be invoked even if the async is never actually
queued (e.g. when the I/O failed synchronously before async_handoff).

Generalise async completion callback by calling it in async_handoff()
when the I/O status indicates failure.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-25 18:28:18 +01:00
Jinoh Kang be9a875fc1 server: Add mark_pending field to set_async_direct_result request.
The client can set mark_pending to indicate that the full-blown I/O
completion mechanism shall be triggered (asynchronous completion) even
if the status indicates failure.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-22 18:38:18 +01:00
Jinoh Kang d162a3e2f1 server: Ensure initial status is set in async_set_result().
Shift the resposibility of setting initial status from
set_async_direct_result request handler to async_set_result().

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-22 18:36:38 +01:00
Jinoh Kang b632ddedcd server: Actually set initial status in set_async_direct_result handler.
Commit 15483b1a12 (server: Allow calling async_handoff() with status
code STATUS_ALERTED., 2022-02-10) introduced the set_async_direct_result
handler which calls async_set_initial_status().

However, the async_set_initial_status() call does nothing since
async->terminated is set, leaving the async in a confusing state
(unknown_status = 1 but pending/completed).

So far, this issue is unlikely to have been a problem in practice for
the following reasons:

1. async_set_initial_status() would have unset unknown_status, but it
   remains set instead.  This is usually not a problem, since
   unknown_status is usually ever read by code paths effectively
   unreachable for non-device (e.g. socket) asyncs.

   It would still potentially allow set_async_direct_result to be called
   multiple times, but it wouldn't actually happen in practice unless
   something goes wrong.

2. async_set_initial_status() would have set initial_status; however,
   it is left with the default value STATUS_PENDING.  If the actual
   status is something other than that, the handler closes the wait
   handle and async_satisfied (the only real consumer of initial_status)
   would never be called anyway.

For reasons above, this issue is not effectively observable or testable.
Nonetheless, the current code does leave the async object in an
inconsistent state.

Fix this by removing the !async->terminated check in
async_set_initial_status().

Also, remove assert( async->unknown_status ).  The client can now
trigger the assert() by calling set_async_direct_result on a device
async, thereby causing async_set_initial_status() to be called twice.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-22 18:36:32 +01:00