Commit Graph

2892 Commits

Author SHA1 Message Date
Zebediah Figura 9bc5bc7c66 server: Remove the socket from the polling loop if it was aborted.
Don't use rd_shutdown and wr_shutdown to determine this. On the one hand, it's
possible to have pending asyncs even if rd_shutdown && wr_shutdown, which will
be cheerfully completed upon receiving data. On the other hand, RST doesn't
cause WSAESHUTDOWN, but rather WSAECONNRESET.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-26 20:14:16 +02:00
Zebediah Figura 361435f609 server: Remove the socket from the polling loop if both it and the peer have SHUT_WR.
Based on a patch by Torge Matthies.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51319
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-26 20:14:14 +02:00
Zebediah Figura ec07f285e2 server: Separate SD_RECEIVE and hangup conditions.
This patch does result in one functional change: if we are selecting for
AFD_POLL_READ on a socket which has had SD_RECEIVE and there are no asyncs, we
will now respond to POLLIN instead of ignoring it. Neither this nor the previous
behaviour matches Windows, which instead puts the socket into an aborted state
and sends RST to the peer if any data is received after SD_RECEIVE or if
SD_RECEIVE is done while there is pending data.

Apart from this there is no functional change, as the places where rd_shutdown
alone is checked can't be reached if there was a hangup. It is instead for
semantic clarity.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-26 20:14:12 +02:00
Zebediah Figura a9ddbc0cbc server: Also return STATUS_PIPE_DISCONNECTED for shutdown nonblocking sockets.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-26 20:14:09 +02:00
Zebediah Figura d04c5f4b1b server: Do not accept sizeof(struct WS_sockaddr_in6_old).
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-23 19:03:13 +02:00
Zebediah Figura c06e5693cb server: Validate the output size of IOCTL_AFD_BIND against the input address size rather than sizeof(struct sockaddr).
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-23 19:02:55 +02:00
Zebediah Figura 06dd08ee44 server: Map ENODEV to STATUS_INVALID_ADDRESS_COMPONENT.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-22 13:16:27 +02:00
Zebediah Figura 9b257ed63f server: Support passing to bind a zero sin6_scope_id.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-22 13:16:20 +02:00
Zebediah Figura d3b64637a0 server: Avoid leaking the ifaddrs structure in bind_to_interface().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-22 13:15:45 +02:00
Alexandre Julliard 649f70aba7 server: Don't generate dll load event for native binaries on Wow64.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-09 22:15:30 +02:00
Zebediah Figura 3b33a6b487 server: Explicitly forbid connecting a listening or connected socket.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51381
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-07 11:33:17 +02:00
Zebediah Figura ddb9223915 server: Clear the connection error after a successful connection.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-07 11:33:04 +02:00
Zebediah Figura 53e69130cc server: Report AFD_POLL_CONNECT_ERR if a previous connection attempt failed.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51331
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51366
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-06 09:57:28 +02:00
Zebediah Figura c86ba5d09d server: Separate a poll_single_socket() helper.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-06 09:57:15 +02:00
Zebediah Figura 026b192018 server: Return a Win32 error code from IOCTL_AFD_WINE_GET_SO_ERROR.
Fixes: fb3956fcf9
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-06 09:56:57 +02:00
Zebediah Figura e2b9131bd9 server: Remove special handling of STATUS_MORE_PROCESSING_REQUIRED.
This was used to implement AcceptEx() using multiple APCs, and made obsolete by
0bbd3f6617.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-05 19:55:18 +02:00
Zebediah Figura bedd92ca06 server: Explicitly return whether a select request was immediately signaled.
This fixes a regression introduced by 97afac469f.

If we make a request on an asynchronous device handle, and the IRP handler
returns STATUS_PENDING, wait_async() will return STATUS_PENDING, as intended.
However, if the async object is signaled before the user has a chance to call
wait_async() [e.g. if get_next_device_request is called quickly enough], select
will return STATUS_PENDING immediately, which causes server_select() to think
the object is not signaled, and wait for a select reply forever.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51277
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51295
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-05 19:55:18 +02:00
Zebediah Figura a17469b165 server: Call the close_handle callback and release_object_from_handle() in the same loop.
Several server objects check if the last handle is being closed in their
close_handle callback. If a process holds the last two handles to an object,
this code path currently won't be triggered.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-05 19:54:56 +02:00
Zebediah Figura 3f04fdd876 server: Don't check the user data for NULL in async_terminate().
This semantically reverts 481517178f.

That commit was used to implement NtFlushBuffersFile, which at the time didn't
use a callback function. 9050b58f07 changed it to
use irp_completion(), since the result of a blocking flush needed to be taken
from the IOSB.

As of 97afac469f that's not true anymore, but on
the other hand it is theoretically possible for a device driver to touch the
Information member of the IOSB, and we don't seem to lose anything by making
all asyncs take a common path.

Since all asyncs pass user data and there's no clear reason for them not to,
let's get rid of a bit of extra code complexity that's no longer used.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-05 19:54:53 +02:00
Alexandre Julliard eb69da2a9c ntdll: Implement NtQueryInformationToken(TokenSessionId).
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46595
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-01 22:34:31 +02:00
Alexandre Julliard 2b5cefc92e server: Store the session id in the process token.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-01 22:34:31 +02:00
Alexandre Julliard b20cbd0d57 ntdll: Return the session id in NtQuerySystemInformation(SystemProcessInformation).
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-01 22:34:31 +02:00
Alexandre Julliard bf4105b731 ntdll: Implement NtQueryInformationProcess(ProcessSessionInformation).
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-01 22:34:31 +02:00
Alexandre Julliard ad93413c71 server: Store session id in the process and return it at process init time.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-01 22:34:31 +02:00
Zebediah Figura 089b2528c2 server: Return STATUS_KEY_DELETED when trying to retrieve the full name of a deleted key.
This fixes a server crash that can be triggered by deleting a key and then
trying to retrieve its name. In that case key->parent is NULL.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-01 22:34:31 +02:00
Zebediah Figura e759da260e server: Use a separate request to retrieve the object name.
A deleted key returns STATUS_KEY_DELETED when ObjectNameInformation is
requested, but succeeds when ObjectBasicInformation is requested.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-01 22:34:31 +02:00
Zebediah Figura 4cca8b67d0 server: Create linked tokens as impersonation tokens.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51347
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-30 18:46:16 +02:00
Zebediah Figura 20c1990372 ws2_32: Handle SO_SNDTIMEO in the server.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-30 09:19:42 +02:00
Zebediah Figura 0072c72512 server: Introduce IOCTL_AFD_WINE_GET_SO_SNDBUF.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-30 09:19:37 +02:00
Zebediah Figura a0bb5564eb server: Introduce IOCTL_AFD_WINE_SET_SO_SNDBUF.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-30 09:19:29 +02:00
Zebediah Figura f4df896e06 ws2_32: Handle SO_RCVTIMEO in the server.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-29 19:55:22 +02:00
Alexandre Julliard cc63b76833 server: Remove the no longer used pid/tid fields in the init_thread request.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-29 15:25:42 +02:00
Qian Hong be55038f3d server: Forbid shrinking files which are mapped to memory.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-29 12:39:35 +02:00
Qian Hong 4e84a553a8 ntdll: Truncate files through the server.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-29 12:37:25 +02:00
Zebediah Figura 1a2b1d75a8 server: Introduce IOCTL_AFD_WINE_GET_SO_RCVBUF.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-28 19:43:28 +02:00
Zebediah Figura b83a8b2da5 server: Introduce IOCTL_AFD_WINE_SET_SO_RCVBUF.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-28 19:43:28 +02:00
Qian Hong 73d0bb7740 server: Forbid deleting files with an open mapping.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-28 19:43:27 +02:00
Alexandre Julliard 8ac411ed6d server: Support both native and wow64 register contexts.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-27 11:42:32 +02:00
Alexandre Julliard 6e2ca647ba server: Trace extended registers as 128-bit entities.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-24 21:44:49 +02:00
Alexandre Julliard 6b86b41912 server: Simplify the naming of the YMM regs.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-24 21:41:21 +02:00
Alexandre Julliard f626349c0a server: Use separate handles for thread and context in get_thread_context.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-24 11:00:24 +02:00
Alexandre Julliard 2ff7a7676c server: Add a native_machine global variable.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-24 11:00:24 +02:00
Zebediah Figura f7ffd71f3c server: Remove the no longer used get_socket_event request.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-24 10:27:05 +02:00
Zebediah Figura 8211c3ab36 server: Introduce IOCTL_AFD_WINE_GET_SO_ERROR.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-24 10:26:32 +02:00
Zebediah Figura 697f9e979e server: Introduce IOCTL_AFD_WINE_GET_SO_ACCEPTCONN.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-23 20:44:58 +02:00
Zebediah Figura 5b47e4ac0b server: Remove the no longer used get_socket_info request.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-21 10:45:15 +02:00
Zebediah Figura a4b3ed9f2a server: Introduce IOCTL_AFD_WINE_GET_INFO.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-21 10:45:05 +02:00
Zebediah Figura 9827081305 server: Remove the no longer used set_socket_deferred request.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-18 10:12:41 +02:00
Zebediah Figura 4d30a0e15c server: Introduce IOCTL_AFD_WINE_DEFER.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-18 10:12:21 +02:00
Zebediah Figura 93d001fa81 ws2_32: Check if the socket is bound in ConnectEx() in the server.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-17 09:19:19 +02:00
Zebediah Figura 5295cc273e ws2_32: Pass a Win32 socket address to IOCTL_AFD_WINE_CONNECT.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-17 09:19:13 +02:00
Zebediah Figura f0b42b2ffa ws2_32: Check if the socket is bound in listen() in the server.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-17 09:18:51 +02:00
Zebediah Figura 43a1a248c3 server: Correctly access the sir_lsap_sel field.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-17 09:18:41 +02:00
Zebediah Figura a997c3980f server: Return STATUS_ADDRESS_ALREADY_ASSOCIATED from IOCTL_AFD_BIND if the socket is already bound.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-16 09:03:20 +02:00
Zebediah Figura dd147ed65a server: Return the socket address from IOCTL_AFD_BIND.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-16 09:03:20 +02:00
Zebediah Figura 02309b72f7 server: Implement IOCTL_AFD_GETSOCKNAME.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-16 09:03:20 +02:00
Zebediah Figura f98ea26c67 server: Partially implement IOCTL_AFD_BIND.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-16 09:03:20 +02:00
Zebediah Figura 43e67ebddc server: Remove the no longer used set_socket_event request.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-15 20:43:18 +02:00
Zebediah Figura ce31d1253d server: Introduce IOCTL_AFD_WINE_MESSAGE_SELECT.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-15 20:43:05 +02:00
Zebediah Figura 2daf76432e server: Do not poll sockets for POLLPRI unless we are selecting for AFD_POLL_OOB.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-15 20:42:57 +02:00
Zebediah Figura 69549fc0c7 server: Implement IOCTL_AFD_GET_EVENTS.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-15 20:42:52 +02:00
Zebediah Figura 9bbf3ab96b server: Implement IOCTL_AFD_EVENT_SELECT.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-14 10:07:52 +02:00
Zebediah Figura e6258c544d server: Store the socket errors as an array of Unix errno values.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-14 10:07:45 +02:00
Zebediah Figura bbb126dc75 server: Use AFD_POLL_* flags internally.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-14 10:07:30 +02:00
Zebediah Figura aa61e519d5 server: Free the old process image name if a second process image is mapped (Valgrind).
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-14 10:07:06 +02:00
Zebediah Figura 00eb00f6d6 server: Do not bother clearing events in IOCTL_AFD_LISTEN.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-11 10:53:32 +02:00
Zebediah Figura 139e95df61 server: Do not bother clearing events in IOCTL_AFD_WINE_CONNECT.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-11 10:53:28 +02:00
Zebediah Figura a7577014fa server: Use an enum to store socket connection state.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-11 10:53:22 +02:00
Zebediah Figura 5eaba82a77 server: Use separate fields to track socket shutdown state.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-11 10:53:03 +02:00
Zebediah Figura 5ee78d3460 server: Make FD_WINE_NONBLOCKING into a separate field.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-11 10:52:51 +02:00
Zebediah Figura 830fc41fbb server: Do not return the socket state from get_socket_event.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-11 10:52:39 +02:00
Zebediah Figura 9344a490a4 server: Fail with WSAEINVAL or WSAEALREADY when trying to connect a socket that is already connecting via nonblocking connect().
Fixes connection in Mortal Kombat 11; reported by Thomas Crider.

Fixes: a891713f48
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-10 20:50:32 +02:00
Zebediah Figura 7326b21241 server: Return STATUS_INVALID_PARAMETER when trying to call connect() on a socket with an active ConnectEx() async.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-10 20:50:22 +02:00
Damjan Jovanovic 31e984a09d server: The owner of a securable object should have all the standard access rights.
Cygwin fork() fails in NtCreateSymbolicLinkObject(). We successfully
create the link but then fail to alloc_handle() with STATUS_ACCESS_DENIED,
because the requested access rights exceed what the owner is allowed.
Allow it more.

Thank you to Dmitry Timoshkov for debugging the security details from
alloc_handle() onwards.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48891
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-08 22:28:44 +02:00
Zebediah Figura 8c26fca5c2 server: Don't rely on async_is_blocking() to determine whether IOCTL_AFD_WINE_ADDRESS_LIST_CHANGE should block.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-07 21:41:15 +02:00
Zebediah Figura 810a9da935 server: Remove the no longer used enable_socket_event request.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-02 20:16:08 +02:00
Zebediah Figura bd2e5ff939 server: Introduce IOCTL_AFD_WINE_FIONBIO.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-02 20:16:07 +02:00
Rémi Bernon fc64aa7e7c server: Send HID report data with the WM_INPUT messages.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-31 12:31:21 +02:00
Rémi Bernon 109de60873 server: Support variable sized hardware_msg_data allocation.
The RIM_TYPEHID messages will have to carry the variable length HID
report.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-31 12:30:49 +02:00
Rémi Bernon 1128a37e77 user32: Implement WM_INPUT / RIM_TYPEHID message dispatch.
Without any HID report data for now.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-31 12:30:41 +02:00
Rémi Bernon e8498788e8 server: Add hardware_msg_data size for variable size messages.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-31 12:30:36 +02:00
Paul Gofman e1c3ee6d51 server: Do not allow parenting non-empty job.
Fixes a regression introduced by 21f5597de4

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-27 21:24:59 +02:00
Zebediah Figura 85a615f136 ntdll: Introduce IOCTL_AFD_WINE_SENDMSG.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-27 11:34:56 +02:00
Zebediah Figura e634cc7f48 server: Clear FD_OOB instead of FD_READ when receiving OOB data.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-27 11:34:27 +02:00
Zebediah Figura b5e264a4a2 server: Pass -1 to set_fd_events() if the socket is not yet initialized or a not yet used TCP socket.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-27 11:33:29 +02:00
Zebediah Figura 89f77a93a6 server: Mark the socket as cacheable when it is connected, marked listening, or created as connectionless.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-27 11:33:27 +02:00
Paul Gofman 385142bb9e server: Check for system regs before suspending for ptrace.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-26 21:30:30 +02:00
Alexandre Julliard e1716530d9 server: Use a standard user APC also for timers.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-25 21:13:00 +02:00
Zebediah Figura 834e2f04c6 ntdll: Implement IOCTL_AFD_POLL.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50975
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-25 09:35:23 +02:00
Zebediah Figura 30fd3019e1 server: Allow opening the Afd device with a file name.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50974
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-25 09:31:28 +02:00
Alexandre Julliard 4e8fcc41ca ntdll: Replace __wine_make_process_system by a Wine-specific NtSetInformationProcess() class.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-24 18:31:27 +02:00
Zebediah Figura b8f4061df0 ntdll: Implement IOCTL_AFD_RECV.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50366
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-24 11:34:32 +02:00
Zebediah Figura 97afac469f ntdll: Avoid accessing the I/O status block in wait_async().
Steam uses WSASend() with completion ports, reusing OVERLAPPED structures as
soon as they are returned from GetQueuedCompletionStatus(). Since completion is
queued during the select request in wait_async(), the I/O status block can be
reused even before the call to NtDeviceIoControl exits.

This works fine with current Wine, because WSASend() doesn't access the I/O
status block after queuing completion. However, a patch that changes it to use
wait_async() like other async requests causes NtDeviceIoControlFile to
consistently return garbage status codes.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-24 11:32:28 +02:00
Zebediah Figura a5b6e90d48 server: Don't change the status of an already terminated async.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-24 11:32:26 +02:00
Paul Gofman d430efb64a server: Support process job lists.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-20 21:48:57 +02:00
Paul Gofman ddd161f339 ntdll: Validate job handles at process creation.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-20 21:48:57 +02:00
Paul Gofman de0dc0e8ac server: Send completions for existing job processes when adding completion port.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-19 10:40:41 +02:00
Paul Gofman 21f5597de4 server: Support nested jobs.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-19 10:40:21 +02:00
Zebediah Figura e68f41e4fe server: Introduce IOCTL_AFD_WINE_SHUTDOWN.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-19 10:32:59 +02:00
Zebediah Figura 4256253419 server: Introduce IOCTL_AFD_WINE_CONNECT.
I was able to reverse-engineer a native CONNECT ioctl, with code 0x801; but I
was not able to find a valid set of parameters which would allow us to
implement either connect() or ConnectEx(). In particular, I could not find a
way to make the ioctl respect nonblocking mode, and I could not find a way to
specify an initial buffer to be sent.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-18 09:56:25 +02:00
Zebediah Figura 737fe1f993 server: Allow polling on an fd after it was removed.
In particular, so that we can wait for POLLOUT on a connecting socket multiple
times, in case the first connection fails, without polling on it while it is
unconnected.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-18 09:56:23 +02:00
Zebediah Figura 609dfea1fd server: Also clear pending events in set_socket_event.
In particular, prevent FD_CONNECT from being reported when not selected for.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-17 17:42:15 +02:00
Zebediah Figura 6ccf61fbc7 server: Implement IOCTL_AFD_LISTEN.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-14 11:57:52 +02:00
Zebediah Figura 98d1dc31fb include: Rename Wine-specific socket ioctls.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-14 11:54:11 +02:00
Zebediah Figura 21efebbdc1 server: Always clear pending messages in sock_wake_up().
Instead of clearing all messages when any match.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-14 11:53:59 +02:00
Zebediah Figura aa6b2482cc server: Poll for FD_CLOSE even if we cannot receive more data.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-14 11:53:54 +02:00
Alexandre Julliard 5864bc88de ntdll: Always send the native PEB pointer to the server.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-13 16:45:28 +02:00
Alexandre Julliard 4dca2cc797 ntdll: Always send the native TEB pointer to the server.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-13 16:45:28 +02:00
Alexandre Julliard d743c1e6c3 server: Send TEB and PEB in the process_init_done request.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-13 16:45:28 +02:00
Zebediah Figura 4c409f8a3b server: Post socket events only if selecting for them.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-13 10:41:54 +02:00
Zebediah Figura 037fccc0df server: Do not send messages for events that are not currently being selected for.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-13 10:41:25 +02:00
Zebediah Figura 44a3c70d77 server: Reset the reported event mask in set_socket_event only when using window messages.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-13 10:41:12 +02:00
Zebediah Figura 0214c73d46 server: Rename "hmask" to "reported_events".
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-12 10:43:07 +02:00
Zebediah Figura 30c02f67ce server: Rename "pmask" to "pending_events".
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-12 10:43:07 +02:00
Zebediah Figura ccbc17c9f6 server: Add a helper to post socket events.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-12 10:43:07 +02:00
Rémi Bernon 4e956dc0fe server: Implement WM_INPUT_DEVICE_CHANGE message dispatch.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-11 21:51:46 +02:00
Rémi Bernon 3481dc05e9 server: Broadcast rawinput messages when desktop is NULL.
HID rawinput hardware messages are sent from winedevice.exe, which is
attached to the services desktop. We need to broadcast its messages to
all (interactive) desktops instead.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-11 21:51:44 +02:00
Rémi Bernon 371be0bc1c server: Add support for RIDEV_DEVNOTIFY rawinput flag.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-11 21:51:42 +02:00
Rémi Bernon 2d8f98fd4e server: Add an explicit message field in rawinput_message.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-11 21:51:40 +02:00
Rémi Bernon 427168ba5a server: Add process argument to find_rawinput_device.
And use it to find registered HID rawinput devices.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-11 21:51:37 +02:00
Rémi Bernon 37c7923a31 server: Add RIM_TYPEHID type / hid member to rawinput union.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-10 22:02:52 +02:00
Rémi Bernon 6d167b91ad server: Add rawinput union to hw_input_t / INPUT_HARDWARE.
When msg is WM_INPUT_DEVICE_CHANGE.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-10 22:02:27 +02:00
Zebediah Figura afad281dd1 server: Do not call sock_reselect() on an uninitialized socket.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-10 20:33:34 +02:00
Zebediah Figura 920f654ffb server: Avoid calling get_unix_fd() in IOCTL_AFD_CREATE.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-10 20:33:34 +02:00
Alexandre Julliard 6a296592aa server: Send the zero_bits parameter for remote NtCreateThreadEx() calls.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-07 22:22:49 +02:00
Zebediah Figura 15aceec067 server: Map EINPROGRESS to STATUS_DEVICE_NOT_READY.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-06 08:12:18 +02:00
Zebediah Figura 523032e6f1 server: Map EFAULT to STATUS_ACCESS_VIOLATION.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-06 08:11:54 +02:00
Zebediah Figura d6d4fa4bd1 server: Map ENOTCONN to STATUS_INVALID_CONNECTION.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-06 08:11:44 +02:00
Zebediah Figura 12f3e27bbb server: Map EADDRINUSE to STATUS_SHARING_VIOLATION.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-05 10:20:00 +02:00
Zebediah Figura 4f4dc095f6 server: Return a proper NTSTATUS from IOCTL_AFD_ADDRESS_LIST_CHANGE.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-05 10:19:37 +02:00
Zebediah Figura a0cc341559 server: Return a proper NTSTATUS from IOCTL_AFD_ACCEPT.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-05 10:19:33 +02:00
Alexandre Julliard 734e3a91ac server: Only the first mapping needs to be an image in NtAreMappedFilesTheSame().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=37488
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-30 22:59:30 +02:00
Alexandre Julliard 384c042fea server: Don't return a handle for user apcs.
Reported by David Torok.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-30 19:32:30 +02:00
Alexandre Julliard f3d41cc789 server: Don't bother queuing APC_NONE apcs.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-30 19:32:30 +02:00
Paul Gofman 02e3327f06 ntdll: Implement NtGetNextThread().
Largely based on a patch by Nikolay Sivov for NtGetNextProcess().

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-29 10:48:59 +02:00
Zebediah Figura 904c05d3d3 include: Do not include winsock.h in winsock2.h.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-27 18:55:24 +02:00
Alexandre Julliard ea2d9c0406 server: Create the Wow64 key and system directory for all supported architectures.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-27 10:43:35 +02:00
Alexandre Julliard 339ed57643 server: Get rid of the CPU type and functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-27 10:42:04 +02:00
Alexandre Julliard 308bd35746 server: Store a machine ID instead of a CPU in the context structure.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-27 10:40:53 +02:00
Alexandre Julliard 94d19eff22 server: Use a 64-bit machine for IL executables.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51067
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-27 10:39:57 +02:00
Alexandre Julliard 8d50c34655 server: Check the supported machines list to validate an image mapping.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-27 10:35:16 +02:00
Alexandre Julliard a51f26badf server: Return the process machine from the main exe instead of a CPU flag.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-23 20:02:06 +02:00
Alexandre Julliard 96865eb7e7 server: Return a list of supported machines instead of a CPU bitmask.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-23 15:17:54 +02:00
Alexandre Julliard 191fd47e38 server: Get rid of the remaining PowerPC support.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-23 12:41:45 +02:00
Zebediah Figura a17cd35d6d server: Map a SD group to Unix group modes if the SD owner is present anywhere in the current user's token.
Instead of requiring the SD owner to match the token user.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=44691
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-22 21:12:57 +02:00
Rémi Bernon 769a2616ae server: Track desktop users per thread instead of per process.
As some thread may use a different desktop from their process.

This fixes the user32 win tests, which leaks a desktop that never gets
closed. The test_shell_window test creates a new desktop, which spawns
explorer.exe process, incrementing the desktop user count to 1, then
associates the desktop to a thread, which closes it on exit.

Never the user count is incremented to 2, and closing the thread desktop
doesn't either check whether the desktop process should be terminated.

Reversely, it is possible to create a desktop, associate it with a
thread /and/ a process, and this time the desktop process would be
terminated when the process exits, although the thread may still be
using it.

Tracking the users per thread is more robust and fixes the problem as
set_thread_desktop increments the desktop user count, and thread exit
decrements it.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-21 21:00:33 +02:00
Alexandre Julliard 828077e3b3 server: Pass the NT process flags to the new_process request.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-16 12:07:51 +02:00
Rémi Bernon 2fcc1d0ecd server: Split the fallback to desktop async keystate.
When current thread doesn't have a message queue. It's going to be
removed later anyway.

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>
2021-04-02 22:52:34 +02:00
Rémi Bernon 6444e4fade server: Remove tid from set_key_state request.
As it is always set to GetCurrentThreadId().

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>
2021-04-02 22:51:50 +02:00
Rémi Bernon 626870abe2 server: Remove tid from get_key_state request.
And replace it with an async param if we want the global async keystate.

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>
2021-04-02 22:51:21 +02:00
Paul Gofman 672df33f7d server: Add sigkill timer even if msg_fd is closed.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-31 22:16:25 +02:00
Paul Gofman df066eabdc server: Do not cancel process sigkill in kill_process().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-31 22:16:25 +02:00
Alexandre Julliard 34884bf5d0 ntdll: Remove the no longer needed exec_process() function.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-24 20:43:49 +01:00
Zebediah Figura 101082253f server: Do not forbid closing fd handles in other processes.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-23 12:29:10 +01:00
Zebediah Figura 5df0f5f6fb ntdll: Use a kernel APC to call NtDuplicateObject() if DUPLICATE_CLOSE_SOURCE is used on another process.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-23 12:29:10 +01:00
Zebediah Figura e69d5b9f46 server: Cancel asyncs before closing handles when a process is destroyed.
test_exit_process_async() essentially validates this. The only reason it
currently succeeds (instead of incorrectly returning ERROR_BROKEN_PIPE) is that
due to the use of DuplicateHandle() the source handle is never actually closed.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-23 12:29:10 +01:00
Alexandre Julliard cc9446f874 server: Don't change the reported machine for COM+ images.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50826
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-19 22:09:23 +01:00
Zebediah Figura 4c0a69f586 server: Remove a no longer relevant "see below" from a comment.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-18 22:04:01 +01:00
Zebediah Figura 9922b5210b server: Fix a copy-paste error in a comment.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-18 22:04:01 +01:00
Zebediah Figura 731339cd60 server: Use default_fd_signaled() for sockets.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-18 22:04:01 +01:00
Zebediah Figura fe9e2f070b server: Make pulse_event() static.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-18 22:04:01 +01:00
Zebediah Figura 340cc46287 server: Do not allow selecting on the ifchange object.
We never pass a handle to this object to the client anyway.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-18 22:04:01 +01:00
Alexandre Julliard 86947587d2 server: Remove the redundant cpu field in the PE image information.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-17 11:49:23 +01:00
Alexandre Julliard 6531f262e3 server: Return the file name for image mappings in the get_mapping_info request.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-15 11:02:20 +01:00
Alexandre Julliard 4ece7d409a server: Don't return image information for a terminated process.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-11 21:52:17 +01:00
Alexandre Julliard 3c9b5379d1 server: Store a copy of the image file name in the process.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-11 21:52:17 +01:00
Alexandre Julliard d316d548c2 server: Only keep the running processes in the global process list.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-11 18:10:42 +01:00
Rafał Harabień 77481d36d3 ntdll: Allow getting/setting x86_64 context of x86 processes in wine64.
WoW64 process has two separate contexts:
- x86 context used most of the time (e.g. by application code)
- x86_64 context used by system when it quits x86 emulation and jumps to
  the kernel code
A notable exception are debug registers - their state is shared. Some
debuggers make use of that fact and sets/gets debug registers of x86
processes using x86_64 thread context.

Add support for setting and getting debug registers using x86_64
thread context. Getting other registers is allowed too and will return
values from x86 thread context.

Fixes hardware breakpoints in IDA 7.0 disassembler (x86_64 app) when
debugging x86 (32 bit) applications.

Signed-off-by: Rafał Harabień <rafalh92@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-09 21:33:43 +01:00
Dmitry Timoshkov 050dc49b38 server: Set error to STATUS_UNSUCCESSFUL when the server fails to queue APC for a thread.
I've left another case of returning STATUS_PROCESS_IS_TERMINATING since
that's not covered by the tests.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50704
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-03 21:54:44 +01:00
Torge Matthies 102a0b189b server: Fix page size calculation in write access check.
Signed-off-by: Torge Matthies <openglfreak@googlemail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-25 08:57:59 +01:00
Zebediah Figura 44fc44880f server: Always set the async result when the APC object is destroyed.
This can happen if the async is terminated while there is no thread to queue
the APC to (as in the relevant test), or if the client dies before getting the
APC, or before transferring the APC results back to the server.

This also fixes a leak of async objects present since 61abc500f5. If a process
dies while accept asyncs are pending, the asyncs will be terminated but will
not find a valid thread to queue the APC to, and thus async_set_result() and
the completion callback are never called.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-25 08:54:41 +01:00
Zebediah Figura 33a80885ce ntdll: Fill the object type index in System(Extended)HandleInformation.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-18 10:18:51 +01:00
Zebediah Figura 1f1d4da5f6 ntdll: Fill the handle attributes in System(Extended)HandleInformation.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-18 10:18:39 +01:00
Akihiro Sagawa 70c77cdfee server: Prevent unloading a registry hive while the key is in use.
Otherwise, RegUnLoadKey(HKEY_USERS, "S-1-5-21-0-0-0-1000") erases all
HKCU registry. The call is actually done by a certain installer.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-17 22:21:13 +01:00
Akihiro Sagawa d6d99e59e3 ntdll: ObjectName should also be used in NtUnloadKey.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-17 22:21:13 +01:00
Alexandre Julliard 6f7b56a198 server: Merge the various token information queries.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-17 21:42:18 +01:00
Zebediah Figura ec9244f056 ntdll: Implement NtQueryInformationToken(TokenLinkedToken).
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-17 21:41:59 +01:00
Zebediah Figura c96749790b ntdll: Implement NtQueryInformationToken(TokenElevationType).
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-17 16:28:13 +01:00
Alexandre Julliard 584427fc89 server: Avoid redefining the DuplicateHandle() constants.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-16 21:20:47 +01:00
Alexandre Julliard d3df2b12ce server: Remove support for process-local handle tables.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-16 11:13:41 +01:00
Erich E. Hoover a656ca5e32 ntoskrnl.exe: Implement volume information queries for device files.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-15 16:20:42 +01:00
Erich E. Hoover 61d7629ba4 server: Allow volume information queries to be asynchronous.
Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-15 16:09:03 +01:00
Alexandre Julliard 9ce326eea0 server: Store a filename for memory views of .so dlls.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-15 12:24:15 +01:00
Alexandre Julliard e7fa4fd147 server: Remove the load/unload_dll requests and the dll list.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-11 16:31:30 +01:00
Alexandre Julliard ea33192660 server: Report load dll events upon mapping a SEC_IMAGE view.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-11 16:31:30 +01:00
Alexandre Julliard 4f2ed66a5f server: Use TEB->ArbitraryUserPointer to store the loaded dll names.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-11 11:49:41 +01:00
Alexandre Julliard bd0a3c1a59 kernelbase: Implement GetMappedFileNameA/W.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-11 11:02:26 +01:00
Alexandre Julliard 3472387777 server: Implement NtQueryVirtualMemory(MemorySectionName).
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-10 16:30:18 +01:00
Zebediah Figura 61abc500f5 server: Use a callback to free the accept_req structure.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-10 15:35:46 +01:00
Zebediah Figura 12783dabbc server: Hold a reference to both sockets in the accept_req structure.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-10 15:35:46 +01:00
Zebediah Figura 27db283449 server: Terminate accept asyncs when the last socket handle is closed.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-10 15:35:46 +01:00
Zebediah Figura d1270a27f0 server: Hold a reference to the iosb in the accept_req structure.
For convenience. Mirrors struct pipe_message.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-10 15:35:46 +01:00
Alexandre Julliard 146ed693d6 server: Return the NT name for the list_processes request.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-09 18:15:03 +01:00
Alexandre Julliard 3bb5381587 server: Return the NT name for the ProcessImageFileName query.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-09 18:15:03 +01:00
Alexandre Julliard bb00942671 server: Store the NT name in the fd object.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-09 14:17:51 +01:00
Alexandre Julliard 9e255ba4e0 ntdll: Pass the NT name in the set_fd_name_info request.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-09 13:40:56 +01:00
Alexandre Julliard 76b3284388 ntdll: Pass the NT name in the create_file request.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-09 13:29:57 +01:00
Rémi Bernon 50798b1320 server: Grow rawinput buffer instead of allocating its maximum size.
Call of Duty: WWII call GetRawInputBuffer with very large client buffer,
so the maximum buffer size may be large and it causes an unnecessary
load on wineserver when it allocates and clears the reply buffer.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-09 11:39:47 +01:00
Alexandre Julliard a3c92a02cc server: Get the process entry point from the exe image info.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-08 12:10:49 +01:00
Alexandre Julliard 52d733b5c4 server: Implement retrieving the debug object of a process.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-08 12:09:44 +01:00