Commit graph

3172 commits

Author SHA1 Message Date
Alexandre Julliard 1d81a5cb4c server: Remove WINESERVER documentation from the man page.
That variable is not used by the server.
2024-01-02 14:04:29 +01:00
Brendan Shanks 6b4eae4088 server: Fix compile error on FreeBSD/NetBSD.
F_GETPATH is currently only implemented on macOS.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56047
2023-12-27 12:14:14 +01:00
Rémi Bernon d1789fbb40 server: Change desktop cursor only when inside the thread's windows.
Getting rid of the desktop cursor handle at the same time.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55961
2023-12-21 18:39:04 +01:00
Rémi Bernon 9dc80b13be server: Introduce a new get_desktop_cursor_thread_input helper.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55961
2023-12-21 18:39:04 +01:00
Brendan McGrath fa873804fb server: Always release internal hardware messages. 2023-12-21 18:38:59 +01:00
Rémi Bernon 2e90c01696 server: Ignore the capture window wrt desktop cursor changes.
This partially reverts commit c3dcf1e269.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55306
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56046
2023-12-18 22:14:57 +01:00
Rémi Bernon bb496ea847 server: Always queue mouse messages delivered to another window.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55306
2023-12-18 22:14:57 +01:00
Rémi Bernon c3dcf1e269 server: Use the capture window as cursor window if it is set.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55306
2023-12-15 21:10:17 +01:00
Rémi Bernon 82642e34e1 server: Update the desktop cursor position / window on click.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55306
2023-12-15 21:10:17 +01:00
Alexandre Julliard 24f7869e93 server: Enforce a mapping size limit instead of relying on the Unix file system.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55667
2023-12-15 10:11:22 +01:00
Rémi Bernon 19ad5bd598 server: Peek wine internal driver messages regardless of filter.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55774
2023-12-13 19:13:01 +01:00
Alexandre Julliard d96864eb4f server: Leave some free space between modules in ASLR mode.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55993
2023-12-11 23:11:19 +01:00
Fabian Maurer 13928e0855 server: Check socket flags after all sockets got processed.
In rare cases we get an event during the second iteration of the loop,
changing the first element. This would lead to an assertion later.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55054
2023-12-01 18:51:49 +01:00
Fabian Maurer c55cce6fcb server: Initialize pe image struct padding to avoid Valgrind warning. 2023-12-01 17:21:39 +01:00
Paul Gofman 4c9b39964c ntdll: Implement NtQueryInformationThread(ThreadIsTerminated). 2023-11-29 20:46:55 +01:00
Marc-Aurel Zent 7b1fe26bb0 server: Add cross-platform get_path_from_fd function. 2023-11-28 22:58:42 +01:00
Zebediah Figura 2f0153df7c server: Translate AFD_POLL_RESET to FD_CLOSE plus WSAECONNABORTED in window messages. 2023-11-22 20:03:04 +01:00
Zebediah Figura a866d16ff8 server: Return ERROR_CONNECTION_RESET when trying to recv() on a reset socket. 2023-11-22 20:03:04 +01:00
Zebediah Figura 25f8698fcd server: Only set sock->event when the event is first noticed.
Do not set it every time another event is polled.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55838
2023-10-31 18:52:07 +01:00
Alexandre Julliard 663e93e61f server: Only create Wow64 system directories for 32-bit platforms. 2023-10-31 14:07:16 +01:00
Alexandre Julliard afb16d3ee2 server: Fix returned error when creating an existing symlink.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55839
2023-10-30 13:33:28 +01:00
Alexandre Julliard 4e9f1a41b9 makefiles: Always use the global SOURCES variable for .man.in files. 2023-10-14 13:44:07 +02:00
Rémi Bernon 2581e0b3ea server: Send WM_WINE_SETCURSOR with the thread input cursor handle.
Which may be different from the last desktop cursor handle.

This makes the behavior better match the old winex11 behavior, which queried
the current thread input cursor handle on every mouse move to sync it with X11,
although it contradicts MSDN documentation which states that the cursor handle
is global.

This fixes the X11 cursor being visible in "Deus Ex: GOTY Edition".
2023-10-11 20:30:04 +02:00
Alexandre Julliard 93a5dce013 server: Remove some leftover code from a failed rebase. 2023-10-06 11:24:23 +02:00
Joel Holdsworth e916255216 ntdll: Add support for FILE_{RENAME,LINK}_IGNORE_READONLY_ATTRIBUTE.
Signed-off-by: Joel Holdsworth <joel@airwebreathe.org.uk>
2023-10-05 18:49:44 +02:00
Joel Holdsworth a8489d12eb server: Don't allow read-only files to be replaced by File{Rename,Link}Information{,Ex}.
Signed-off-by: Joel Holdsworth <joel@airwebreathe.org.uk>
2023-10-05 18:49:44 +02:00
Alexandre Julliard ec3de12825 ntdll: Relocate dynamic base modules when mapping them. 2023-10-05 18:49:44 +02:00
Alexandre Julliard efd03f40e6 server: Assign a system-wide mapping address for dynamic base modules. 2023-10-05 18:49:44 +02:00
Alexandre Julliard 4847c1d8e4 server: Set the dynamically relocated flag when relocations are present. 2023-10-05 18:49:44 +02:00
Ally Sommers 3582ba9dc4 server: Move getpeername() implementation from ntdll/unix.
This brings getpeername() in line with getsockname(), which
is also implemented in wineserver. It also allows getpeername()
to return a possibly-more-accurate peer name, as in the case of
AF_UNIX sockets.
2023-10-05 10:03:23 +02:00
Paul Gofman 2c2740629b server: Hold socket reference in sock_poll_event(). 2023-10-05 09:59:24 +02:00
Joel Holdsworth c7b1551e8f ntdll: Initial implementation of FileRenameInformationEx.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54997
Signed-off-by: Joel Holdsworth <joel@airwebreathe.org.uk>
2023-10-03 21:44:04 +02:00
Alexandre Julliard 2569779739 server: Require ASLR support on non-x86 platforms. 2023-09-25 22:47:03 +02:00
Alexandre Julliard 4d417076e4 server: Don't zero out the PE optional header regardless of specified size. 2023-09-25 11:07:03 +02:00
Ally Sommers 998febf7cf server: Return WSAEOPNOTSUPP on listen() if the socket's type is SOCK_DGRAM. 2023-09-18 20:35:58 +02:00
Jacek Caban a25ac1edb9 server: Store both contexts in pending context object.
And discard irrelevant parts in select request.
2023-09-14 13:02:01 +02:00
Paul Gofman 578fc9c96f server: Don't set SO_RCVBUF below Windows default value on Unix socket. 2023-09-12 20:34:14 +02:00
Dmitry Timoshkov d289dfc2c0 server: Write terminating '\0' in the strings.
I have an application that creates its special registry key using
NtCreateKey(parent, "Something\0"), and then expects to be able to
open this key with NtOpenKey("Something\0") on start up. Currently
this fails because terminating '\0' in the key name doesn't survive
saving/loading the registry. parse_strW() helper already supports
loading such key names.

As the tests show after creating a kernel object with the name "Something\0"
it's possible to only open it as "Something\0", and an attempt opening it
as "Something" fails with STATUS_OBJECT_NAME_NOT_FOUND, and vice versa.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
2023-09-12 09:40:52 +02:00
Paul Gofman 733e4ca06e server: Support FileStandardInformation for pipes. 2023-09-11 13:15:15 +02:00
Brendan Shanks 126363ea5f server: Remove the fallback epoll() syscalls. 2023-09-08 22:37:45 +02:00
Dmitry Timoshkov a52cf805d2 ntdll: Implement NtCreateToken().
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
2023-08-31 19:53:16 +02:00
Zebediah Figura dbe7788817 server: Signal AFD_POLL_BIT_WRITE at the same time as AFD_POLL_BIT_CONNECT.
Wine-Bug: https://bugs.winehq.org//show_bug.cgi?id=55333
2023-08-28 11:22:22 +02:00
Eric Pouech 82b0bb3c24 server: Separate console and new group flag (CreateProcess).
We were using bit 1 of RTL_USER_PROCESS_PARAMETERS for two different cases:
- rightfully, as a sign to block ctrl-c events from being processed by
  handlers (and by default, terminating the process)
- But this was also used to request for the creation of a new process group.

This patch properly separates the two use cases, by using the
ProcessGroupId field in RTL_USER_PROCESS_PARAMETERS (checked that Win10
behaves as this patch in RtlCreateUserProcess wrt.
RTL_USER_PROCESS_PARAMETERS ProcessGroupId usage input/output).

Introduce process_group_id in startup_info_t and use it to pass it to
server. ProcessGroupId field in RTL_USER_PROCESS_PARAMETERS is now properly
set.

Note: this will change some external behavior.
- before this patch, a child process created with Ctrl-C disabled
  (ConsoleFlags set), couldn't turn it on as the process was detached
  from unix console.
- now, SIGINT handling is moved to kernelbase (and can be turned on/off at
  application will),
- when creating a new windows group id, the child will be detached from
  unix console, so will no longer receives the SIGINT from ctrl-c in unix
  console (if parent was attached to this unix console).

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-08-23 17:38:51 +02:00
Torge Matthies 91f8926023 server: Don't consider non-pending poll requests when reselecting socket.
Signed-off-by: Torge Matthies <openglfreak@googlemail.com>
2023-08-14 13:32:26 +02:00
Tim Clem b2a099b3ce server: Avoid a mach port leak on Apple Silicon.
Check for Rosetta before extracting the port right, since we won't need
it in that case anyway.
2023-08-10 10:02:35 +09:00
Jinoh Kang 915c391014 server: Avoid relying on linux/ipx.h to define SOL_IPX.
musl libc doesn't supply any definitions for IPX, such as the SOL_IPX
macro.  However, it still provides linux/ipx.h from Linux uAPI header
files if it exists.

Linux kernel wouldn't drop linux/ipx.h from uAPI headers until 5.15,
although IPX support has already been marked obsolete since 2018.

Fix this by not defining HAS_IPX if linux/ipx.h has been included but
nothing defines the SOL_IPX macro.

Status of IPX support from other libcs are noted below:

- bionic: netipx/ipx.h does not exist.  linux/ipx.h may or may not
  exist.  Note that sys/socket.h defines SOL_IPX even if linux/ipx.h is
  missing.

- glibc: netipx/ipx.h exists.  In this case, Wine assumes IPX support
  even if the operating system does not support it in runtime.

- BSD variants: netipx/ipx.h may or may not exist.  linux/ipx.h does not
  exist.  Some BSDs supply SO_DEFAULT_HEADERS instead of SOL_IPX.

Fixes: 41cc117b3f
2023-08-05 10:45:10 +09:00
Zebediah Figura 01afb21bf2 ws2_32: Move the event reset in WSAEnumNetworkEvents() to the server.
So that it is done atomically with retrieving events.

Wine-Bug: https://bugs.winehq.org//show_bug.cgi?id=52474
2023-07-24 22:51:06 +02:00
Zebediah Figura 0a33ac4a53 server: Move the implementation of IOCTL_AFD_GET_EVENTS to a dedicated server call. 2023-07-24 22:51:00 +02:00
Paul Gofman 03c1930b74 server: Cancel pipe asyncs when the last handle in process is closed. 2023-07-20 21:48:39 +02:00
Paul Gofman 57095a91b0 server: Cancel socket asyncs when the last handle in process is closed. 2023-07-20 21:48:39 +02:00
Billy Laws 41cc117b3f server: Avoid using SOL_IPX to detect whether IPX is supported. 2023-07-04 20:55:34 +02:00
Zhiyi Zhang cd771fa713 server: Allow creating a real explorer desktop window for invisible window stations.
The graphics driver information is stored as a property in the desktop window. When the server
get_desktop_window handler simply returns a window handle when the window station is invisible,
the window handle doesn't have the graphics driver property, which is set in desktop_window_proc()
when handling WM_NCCREATE. Removing the invisible window station check allows an invisible explorer
desktop window to be created and with the required property.
2023-07-03 22:15:42 +02:00
Alexandre Julliard a5ff427acb ntdll: Implement NtQueryVirtualMemory(MemoryImageInformation). 2023-07-03 12:16:49 +02:00
Joel Holdsworth 1ccd037e00 ntdll: Implement FILE_DISPOSITION_POSIX_SEMANTICS.
Both the Msys2 and Cygwin runtimes make use of
FILE_DISPOSITON_POSIX_SEMANTICS in their implementations of the unlink()
system call. This enables these routines to behave similarly to POSIX where are
unlisted from the directory, if handles are still open.

https://github.com/msys2/msys2-runtime/blob/msys2-3.4.3/winsup/cygwin/syscalls.cc#L722
https://www.cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/syscalls.cc#l724

Signed-off-by: Joel Holdsworth <joel@airwebreathe.org.uk>
2023-06-27 22:14:15 +02:00
Joel Holdsworth f10383e9d0 server: Replace unlink member of closed_fd with disp_flags.
In order to implement FILE_DISPOSITION_POSIX_SEMANTICS, it will be necessary
to add additional flags to closed_fd. In preparation for this, the unlink
member variable has been replaced with disp_flags which directly reflects the
flags defined in the FILE_DISPOSITION_INFORMATION_EX structure.

Signed-off-by: Joel Holdsworth <joel@airwebreathe.org.uk>
2023-06-27 22:14:15 +02:00
Joel Holdsworth 146333fed2 ntdll: Implement FILE_DISPOSITION_ON_CLOSE.
The FILE_DELETE_ON_CLOSE can be used with the FILE_DISPOSITION_ON_CLOSE flag
of FileDispositionInformationEx.

Signed-off-by: Joel Holdsworth <joel@airwebreathe.org.uk>
2023-06-27 22:14:15 +02:00
Joel Holdsworth 91e442b060 ntdll: Implement FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE.
Both the Msys2 and Cygwin runtimes make use of
FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE in their implementations of the
unlink() system call. This enables these routines to delete a read-only file
without first modifying the attributes.

https://github.com/msys2/msys2-runtime/blob/msys2-3.4.3/winsup/cygwin/syscalls.cc#L724
https://www.cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/syscalls.cc#l726

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50771
Signed-off-by: Joel Holdsworth <joel@airwebreathe.org.uk>
2023-06-27 22:14:15 +02:00
Joel Holdsworth cc1d0e493d ntdll: Initial implementation of FileDispositionInformationEx.
This is required by Msys2 when running gpg-agent.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54996
Signed-off-by: Joel Holdsworth <joel@airwebreathe.org.uk>
2023-06-27 22:14:15 +02:00
Rémi Bernon 8d2de5dbe1 win32u: Use a specific flag instead of shrinking the clip rect.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55047
2023-06-16 21:42:44 +02:00
Rémi Bernon ab9b99c4a5 server: Pass set_cursor flags in WM_WINE_CLIPCURSOR wparam.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55047
2023-06-16 21:35:58 +02:00
Rémi Bernon f4cb3230d8 server: Update the DF_WINE_CREATE_DESKTOP desktop flag on opening.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55047
2023-06-15 22:10:51 +02:00
Rémi Bernon 25906eedd8 server: Introduce and send new WM_WINE_SETCURSOR hardware message. 2023-06-13 22:10:56 +02:00
Rémi Bernon b04ef19930 server: Keep track of the current desktop cursor handle. 2023-06-13 22:10:56 +02:00
Rémi Bernon 10f5ff7f06 server: Update desktop cursor window when cursor pos changes. 2023-06-13 22:10:56 +02:00
Alexandre Julliard 11cd51139d ntdll: Support the lower memory limit in MEM_ADDRESS_REQUIREMENTS. 2023-06-13 22:10:56 +02:00
Alexandre Julliard 2705e6c319 server: Also enforce the size of varargs data structures. 2023-06-13 22:10:56 +02:00
Rémi Bernon 6ac82b2a24 server: Use hardware message category when checking filter. 2023-06-12 21:21:41 +02:00
Rémi Bernon 3ae2dc4648 server: Pass the message code to get_hardware_msg_bit. 2023-06-12 21:21:41 +02:00
Rémi Bernon 5ebb1ed132 server: Queue a hardware WM_WINE_CLIPCURSOR message to the foreground thread.
When applying a new cursor clipping rect, or to the previous foreground
thread when foreground changes, to notify it of the cursor clipping rect
being reset.
2023-06-07 22:48:27 +02:00
Rémi Bernon bd06c87b5b server: Use a separate helper to merge WM_MOUSEMOVE messages. 2023-06-07 22:48:27 +02:00
Rémi Bernon 2101d4d6ad server: Use the helper to reset the clip rect when the desktop size changes. 2023-06-07 22:48:27 +02:00
Alexandre Julliard 6b5561b601 server: Send the APC call data as vararg in the select request. 2023-06-06 21:51:43 +02:00
Alexandre Julliard e3049f11fa server: Send the APC call data as vararg in the queue_apc request.
To make it possible to support a larger structure.
2023-06-06 21:51:37 +02:00
Rémi Bernon 88cbc08b7f server: Don't reset cursor clipping on foreground thread exit.
It will be reset on foreground input changes, when it happens.
2023-06-02 21:08:34 +02:00
Jinoh Kang 078b0219aa server: Update parent window region when exposing previously invisible window.
Fixes: 33617af814
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54949
2023-06-02 20:47:28 +02:00
Rémi Bernon 900ba82654 win32u: Use WM_WINE_CLIPCURSOR / TRUE for empty clipping rect. 2023-05-31 22:50:10 +02:00
Rémi Bernon 8f9610fdff server: Use get_hardware_msg_bit consistently to classify messages. 2023-05-31 21:19:35 +02:00
Rémi Bernon 26c6386de9 server: Move set_cursor desktop local variable to wider scope. 2023-05-30 12:25:25 +02:00
Rémi Bernon 61dbfea452 server: Assume the internal clip message to be WM_WINE_CLIPCURSOR. 2023-05-30 12:25:25 +02:00
Paul Gofman fce615a2c3 ntdll: Support MEM_PRESERVE_PLACEHOLDER in NtUnmapViewOfSectionEx(). 2023-05-30 12:12:09 +02:00
Alexandre Julliard 30040cc9d7 ntdll: Also update the entry point address when loading an ARM64X binary. 2023-05-26 21:24:08 +02:00
Alexandre Julliard f6f38e2490 server: Return STATUS_IMAGE_MACHINE_TYPE_MISMATCH when the mapping's machine differs from the process. 2023-05-25 16:21:17 +02:00
Alexandre Julliard c306e76645 server: Add a separate request to create a memory view for an image mapping. 2023-05-25 16:21:17 +02:00
Alexandre Julliard 4356fe0d83 ntdll: Support the PS_ATTRIBUTE_MACHINE_TYPE attribute for new processes. 2023-05-24 15:43:54 +02:00
Alexandre Julliard ebc1b09915 ntdll: Support the machine extended parameter in NtMapViewOfSectionEx(). 2023-05-23 13:24:32 +02:00
Alexandre Julliard 1d368b3789 server: Move the Wine-specific flags out of the image_flags field. 2023-05-12 17:50:48 +02:00
Alexandre Julliard 8f9c0c825d server: Add a separate request to create a memory view for a .so builtin. 2023-05-12 17:50:26 +02:00
Alexandre Julliard 4b8f3dd9a5 ntdll: Support extended address requirements in NtMapViewOfSectionEx(). 2023-05-10 17:08:48 +02:00
Alexandre Julliard 17a0e19489 server: Make x86_64 a supported architecture on ARM64. 2023-05-09 14:28:04 +02:00
Alexandre Julliard 5b6e82f0f9 ntdll: Handle the extended memory attributes in NtAllocateVirtualMemoryEx(). 2023-05-09 14:28:04 +02:00
Eric Pouech 4b28127157 wow64: Move filter of (un)load DLL debug events to client side.
Code is duplicated in ntdll.dll (for 32bit only and old Wow configuration)
and wow64.dll for new Wow64 configurations.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-03-22 20:03:51 +01:00
Alexandre Julliard fa47ea7400 server: Determine the native thread context flags on the client side. 2023-03-08 12:43:20 +01:00
Henry Goffin 0e85ac17a4 win32u: Invalidate all cached keys after input.
This patch addresses an issue in Second Life and potentially other
multi-threaded applications which process WM_KEYDOWN in one thread
and then verify that the key is "still down" with GetAsyncKeyState
from another thread. Wine uses a per-thread key cache, resulting
in inconsistent views of key status. Caches are now invalidated
when an input event is injected by the driver or via SendInput.
2023-03-02 10:20:01 +01:00
Alex Henrie f3e1d897ca server: Annotate allocation functions with __WINE_(ALLOC_SIZE|DEALLOC|MALLOC). 2023-03-01 21:39:30 +01:00
Alexandre Julliard 14967933ec server: Fix another buffer overflow compiler warning. 2023-03-01 21:39:30 +01:00
Paul Gofman 74240a3545 server: Set TCP SYN count on sockets. 2023-02-21 11:21:27 +01:00
Paul Gofman 4e6a5d62ad server: Retry socket connection on ECONNABORTED error. 2023-02-21 11:21:05 +01:00
Alexandre Julliard 1b9db99417 ntdll: Return the correct IOSB information when creating a named pipe. 2023-02-21 11:17:17 +01:00
Alexandre Julliard d74b084e45 ntdll: Pass the NtCreateNamedPipeFile disposition to the server. 2023-02-21 10:48:16 +01:00
Brendan Shanks 93fde56b49 server: On macOS, fake debug registers when running under Rosetta.
Based on a patch by Tim Clem <tclem@codeweavers.com>.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54367
2023-02-17 11:18:52 +01:00
Alex Henrie 94d6e616e2 server: Fix buffer overrun in map_view handler.
Because of padding at the end of the struct, sizeof(*view) is greater
than offsetof(struct memory_view, name[0]). Change the allocation to
overallocate slightly instead of underallocating slightly.
2023-02-01 17:11:10 +01:00
Eric Pouech e8c7920919 conhost.exe: Handle ctrl-\ in Wine.
Let conhost handle ctrl-\ instead of Unix tty, and pretend it's a
ctrl-pause/break key stroke.  This allows CUI application in processed
input mode not to close upon ctrl-\.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54141
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-01-25 10:04:02 +01:00
Eric Pouech fda954dfd4 conhost.exe: Handle ctrl-pause/break key strokes.
Note: this patch should be extended by adding insertion
of the CTRL_BREAK_EVENT into processes' crtl handler
(as it's done for CTRL_C_EVENT).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-01-25 10:04:00 +01:00
Zebediah Figura 03391aab24 server: Inherit the SO_RCVTIMEO value in accept_socket(). 2022-12-13 12:47:21 +01:00
Zebediah Figura 418dff0c01 server: Inherit the SO_SNDTIMEO value in accept_socket(). 2022-12-13 12:47:21 +01:00
Zebediah Figura 1ef2cc0f64 server: Inherit the SO_RCVBUF value in accept_socket().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53911
2022-12-13 12:47:21 +01:00
Zebediah Figura a58cd78ca9 server: Inherit the SO_SNDBUF value in accept_socket(). 2022-12-13 12:47:21 +01:00
Zebediah Figura ddc6c3fb23 server: Inherit address reuse flags in accept_socket(). 2022-12-13 12:47:21 +01:00
Rémi Bernon 37478a8695 server: Set missing error status for get_process_image_name. 2022-11-22 18:27:31 +01:00
Sven Baars fe8b10f8c8 server: Don't return the actual 32-bit Software\Classes key. 2022-11-18 13:55:21 +01:00
Sven Baars b8d7434e33 server: Recursively obtain the Wow6432Node parent. 2022-11-18 13:55:21 +01:00
Aric Stewart c937155ff6 server: Take into account extra_size in get_rawinput_buffer. 2022-11-17 21:51:42 +01:00
Rémi Bernon 9804210966 server: Remove no-op raw_msg.foreground release.
It's previously set to NULL and never updated.
2022-11-14 13:17:31 +01:00
Paul Gofman 17328f4f5c ntdll: Support specified alignment in NtAllocateVirtualMemoryEx(). 2022-11-11 17:21:18 +01:00
Paul Gofman 7e8bb68f95 ntdll: Support HighestEndingAddress in NtAllocateVirtualMemoryEx(). 2022-11-10 22:00:35 +01:00
Jinoh Kang 33617af814 server: Don't invalidate the newly exposed child region on the parent if it doesn't clip children.
This partly reverts e42eaaaf3a.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
2022-11-04 19:23:56 +01:00
Jinoh Kang c310e975f4 server: Redraw composited window child when its z-order changes.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53153
Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
2022-11-04 19:23:56 +01:00
Jinoh Kang 17e6ef6d7e server: Correctly expose composited parent window and its child on position change.
Skip redrawing the composited child window when the window rect and
visible region stays the same, since we're taking the union of the old
and new visible regions.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53153
Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
2022-11-04 19:23:56 +01:00
Paul Gofman a9ae1e041c server: Support SO_EXCLUSIVEADDRUSE socket option. 2022-11-04 19:23:55 +01:00
Paul Gofman 003ee6202b server: Do not translate loopback addr in ipv4addr_from_v6(). 2022-11-04 19:23:55 +01:00
Paul Gofman 0328ba93f3 server: Use htonl() with INADDR_ANY in ipv4addr_from_v6(). 2022-11-04 19:23:55 +01:00
Paul Gofman 6992f2cba5 server: Set error in check_addr_usage(). 2022-11-04 19:23:55 +01:00
Paul Gofman 9163d3420f server: Use struct bound_addr as a key to bound_addresses_tree. 2022-11-04 19:23:54 +01:00
Paul Gofman 12b604926e server: Make SO_REUSEADDR and SO_EXCLUSIVEADDRUSE mutually exclusive. 2022-11-04 19:23:54 +01:00
Paul Gofman d656cb2024 ws2_32: Track SO_EXCLUSIVEADDRUSE option value. 2022-11-04 19:23:54 +01:00
Paul Gofman ef7de1fc1f server: Set Unix SO_REUSEADDR on all the TCP sockets.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50955
2022-10-31 20:41:45 +01:00
Paul Gofman 382ec78db3 server: Track SO_REUSEADDR value. 2022-10-31 20:41:45 +01:00
Paul Gofman 039f8b16f6 ntdll: Move SO_REUSEADDR handling to server. 2022-10-31 20:41:45 +01:00
Brendan Shanks 0d21e1cbcf server: Only require THREAD_SET_LIMITED_INFORMATION access to set thread description. 2022-10-31 12:13:32 +01:00
Michael Stefaniuc c2d800f1db server: Use ARRAY_SIZE instead of open coding it. 2022-10-25 10:58:49 +02:00
Daniel Lehman 0a02b6a86a ntdll: Implement NtCancelSynchronousIoFile.
Signed-off-by: Daniel Lehman <dlehman25@gmail.com>
2022-10-17 11:22:41 +02:00
Brendan Shanks 5cf574998e server: Use correct context struct and thread flavor when setting debug registers on macOS. 2022-09-15 13:47:45 +02:00
Brendan Shanks 774769671c server: Write to correct context struct when getting debug registers on macOS. 2022-09-15 13:47:45 +02:00
Brendan Shanks 2075a78ed3 server: Report errors on macOS when getting/setting debug registers. 2022-09-15 13:47:45 +02:00
Brendan Shanks 28ec3090fa server: Remove 32-bit-specific macOS #ifdefs. 2022-09-15 13:47:45 +02:00
Jinoh Kang a115feab9c server: Always prefer synchronous I/O in nonblocking mode.
foobar2000.exe's UPnP Media Renderer component (foo_out_upnp.dll)
expects that, if a select() call completes successfully with a non-empty
writefds set, any immediately following send() call on a socket in the
writefds set never fails with WSAEWOULDBLOCK.

On Wine, the Winsock select() and send() implementations both call the
Unix poll(2) under the hood to test if I/O is possible on the socket.
As it turns out, it's entirely possible that Linux poll() may yield
POLLOUT on the first call (by select) but *not* the second (by send),
even if no send() call has been made in the meanwhile.

On Linux (as of v5.19), a connected (ESTABLISHED) TCP socket that has
not been shut down indicates (E)POLLOUT only if the ratio of
sk_wmem_queued (the amount of bytes queued in the send buffer) to
sk_sndbuf (the size of send buffer size itself, which can be retrieved
via SO_SNDBUF) is below a certain threshold.  Therefore, a falling edge
in POLLOUT can be triggered due to a number of reasons:

1. TCP fragmentation.  Once a TCP packet is split out from a larger
   sk_buff, it incurs extra bookkeeping overhead (e.g. sk_buff header)
   that is counted in sk_wmem_queued alongside application data.
   See also: tcp_fragment(), tso_fragment() (Linux 5.19).

2. Control packets (e.g. MTU probing).  Such packets share the same
   buffer with application-initiated packets, and thus counted in
   sk_wmem_queued.
   See also: sk_wmem_queued_add() callers (Linux 5.19).

3. Memory pressure.  This causes sk_sndbuf to shrink.
   See also: sk_stream_moderate_sndbuf() callers (Linux 5.19).

Fix this by always attempting synchronous I/O first if req->force_async
is unset and the nonblocking flag is set.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53486
2022-08-24 09:06:37 -05:00
Jinoh Kang 13fb500cbb server: Use check_fd_events() instead of calling poll() directly. 2022-08-24 09:06:37 -05:00
Jinoh Kang 78f1dd8967 server: Use POLLIN instead of POLLPRI if the socket is in oobinline mode. 2022-08-24 09:06:37 -05:00
Rémi Bernon 28aa321f36 server: Avoid reallocating rawinput device array with zero size.
It actually frees the pointer.
2022-08-08 18:50:54 +02:00
Rémi Bernon a2395ecf96 server: Use the client provided rawinput registered device array. 2022-07-28 20:08:58 +02:00
Rémi Bernon 1587e9db88 win32u: Implement NtUserGetRegisteredRawInputDevices on the client side. 2022-07-28 20:08:58 +02:00
Zebediah Figura 7961e00e74 server: Properly implement AFD_POLL_RESET. 2022-07-25 09:38:21 +02:00
Zebediah Figura 1d0e21db29 server: Move sock->error setting completely out of sock_dispatch_events(). 2022-07-21 20:21:46 +02:00
Zebediah Figura 41cdc6674c server: Report the socket error in sock_poll_event() on POLLERR or POLLHUP.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52815
2022-07-21 20:21:45 +02:00
Zebediah Figura a2f2b773fb server: Record the error for connected and connectionless sockets sockets in sock_error().
As long as we do it for connecting and listening sockets, do it here for the
remaining socket types as well.
2022-07-21 20:21:44 +02:00
Zebediah Figura a1fd99cfbb server: Clear sock->errors[AFD_POLL_BIT_CONNECT_ERR] in sock_poll_event().
Give sock_dispatch_events() a more consistent scope.
2022-07-21 20:21:42 +02:00
Zebediah Figura 236476417a server: Use sock_poll_event() in poll_socket().
In multiple cases errors may be reported only once by the host socket
implementation, but should persist for Windows sockets. These cases are
currently not handled by poll_socket().

poll_socket() also does not include logic for filtering out events when asyncs
are queued or alerted on the relevant socket.

Hence, instead of duplicating more logic, remove the logic already duplicated,
and just call sock_poll_event(), so that there is one central place where events
are translated.

Mark the currently active poll async with a special "pending" field so that
poll_socket() does not attempt to complete it before all sockets are checked.
2022-07-20 22:33:44 +02:00
Zebediah Figura f234341ca1 server: Always wake up pending read or write asyncs on POLLHUP or POLLERR.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52815
2022-07-20 22:33:44 +02:00
Zebediah Figura 07b66768b1 Revert "server: Explicitly shutdown destroyed sockets to force pending poll() calls to return.".
This reverts commit 24b64534e5.

We no longer perform any blocking waits on the client side, so shutdown() is no
longer necessary.

Moreover, shutting down is not always correct. Under some conditions, closing a
TCP socket should trigger RST without FIN (namely, when SO_LINGER is on but has
a zero timeout). By reverting this commit we match Windows behaviour in this
respect.
2022-07-20 22:33:44 +02:00
Jinoh Kang 9090229e67 server: Use the token owner instead of the token user for default object owner.
Also, replace the token user with the token owner for the default DACL
as well.  Wine currently selects domain_users_sid as the token owner, so
use that.  This is required to pass the advapi32:security test which
expects the security descriptor owner SID to be referenced in the DACL
as well.
2022-07-20 22:33:44 +02:00