Commit graph

3172 commits

Author SHA1 Message Date
Brendan Shanks 9b4e3718ed server: Replace sprintf with snprintf to avoid deprecation warnings on macOS. 2024-03-28 19:51:35 +01:00
Brendan Shanks 4e04b2d528 server: Replace some malloc/sprintf/strcpy calls with asprintf. 2024-03-28 19:51:35 +01:00
Brendan Shanks 617b29c402 server: Simplify creation of the server directory. 2024-03-27 22:19:25 +01:00
Alexandre Julliard 84d5614b11 server: Add a helper to trace uint64 arrays. 2024-03-22 16:54:09 +01:00
Rémi Bernon b053e924e8 server: Process internal messages when checking queue status. 2024-03-21 22:19:58 +01:00
Rémi Bernon a84517418e server: Check for internal hardware messages before others. 2024-03-21 22:19:58 +01:00
Rémi Bernon 994021da99 server: Send WM_WINE_SETCURSOR message only when necessary. 2024-03-21 22:19:58 +01:00
Rémi Bernon 1604d8a202 server: Send WM_WINE_CLIPCURSOR message only when necessary. 2024-03-21 22:19:58 +01:00
Rémi Bernon 5d91ab65fa server: Avoid removing thread twice from its desktop thread list. 2024-03-21 22:19:58 +01:00
Jinoh Kang a4ef56e1d9 server: Check for DELETE access in NtMakeTemporaryObject(). 2024-03-20 23:16:24 +01:00
Paul Gofman 4d56a33ab0 server: Ignore some ICMP-originated socket errors for connectionless sockets. 2024-03-15 23:48:52 +01:00
Jinoh Kang e368515eef server: Generalize server request make_temporary to set_object_permanence.
Required for implementing NtMakePermanentObject().
2024-03-15 15:06:33 +01:00
Brendan Shanks befd7abe10 server: Remove support for msg_accrights FD passing. 2024-03-11 18:12:03 +01:00
Rémi Bernon 28c52d4ac3 server: Remove desktop from their winstation list before looking for another input desktop. 2024-03-08 17:40:03 +01:00
Zebediah Figura e92ba2de43 server: Create processes using a limited administrator token by default.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=40613
2024-03-08 09:49:52 +01:00
Zebediah Figura 95a91bd816 ntdll: Implement NtSetInformationProcess(ProcessAccessToken). 2024-03-08 09:49:52 +01:00
Rémi Bernon 24ad74ee26 server: Send emulated mouse messages on primary pointer updates. 2024-03-06 19:20:09 +01:00
Rémi Bernon 40b65e28a7 server: Continuously send pointer update messages while it's down. 2024-03-06 19:20:09 +01:00
Rémi Bernon d8b8ac85eb server: Generate WM_POINTERENTER / WM_POINTERLEAVE messages. 2024-03-06 19:20:09 +01:00
Rémi Bernon 5b833c83be server: Stop waiting on LL-hooks for non-injected input. 2024-03-06 19:19:47 +01:00
Rémi Bernon 61d1c18957 server: Add support for sending and receiving WM_POINTER* messages. 2024-03-05 20:50:07 +01:00
Rémi Bernon bb5f0e122f win32u: Use a custom struct hid_input for NtUserSendHardwareInput. 2024-03-05 20:50:06 +01:00
Rémi Bernon 9591a36ee8 server: Dispatch rawinput messages using the rawinput process list. 2024-02-28 19:51:20 +01:00
Rémi Bernon c43b1ecbc3 server: Keep a list of processes that can receive rawinput messages. 2024-02-28 19:51:20 +01:00
Rémi Bernon f7303cf7b6 server: Keep a list of threads connected to each desktop. 2024-02-28 19:51:20 +01:00
Rémi Bernon 496eed7aaf server: Send hardware input to the visible input desktop.
When hwnd is specified, it is because it received a direct host input,
so switch the input desktop to match the one that is receiving it.

We don't validate that the sending thread uses the same desktop as the
target window: it may not even be the case for drivers with a separate
thread that listens on input events.
2024-02-28 19:51:20 +01:00
Rémi Bernon a1d63d109d server: Keep track of the winstation input desktop. 2024-02-28 19:51:20 +01:00
Eric Pouech 9897719562 server: Allow 0-write length in WriteProcessMemory().
Adapt to Win >= 10 behavior.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56357
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-02-26 22:44:35 +01:00
Rémi Bernon 74bf784b29 server: Use the startup info to connect the process winstation.
This changes the todos in the tests as it fixes the thread input not
being attached, but then exposes a different todo.
2024-02-23 17:11:00 +01:00
Marc-Aurel Zent 1eb8f41e54 server: Improve formatting in mach init_tracing_mechanism(). 2024-02-14 23:17:23 +01:00
Marc-Aurel Zent dee10199cc server: Use bootstrap_register2() instead of bootstrap_register(). 2024-02-14 23:17:23 +01:00
Marc-Aurel Zent 52f34cf976 server: Use __pthread_kill() syscall wrapper. 2024-02-14 23:17:23 +01:00
Zhiyi Zhang ca97cb8700 server: Inherit internal desktop flags when creating desktops.
Based on Rémi's idea.

CEF applications create their own desktops and so is_virtual_desktop() could incorrectly
report that virtual desktop is off if DF_WINE_VIRTUAL_DESKTOP is not inherited.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55810
2024-02-13 22:37:50 +01:00
Zhiyi Zhang 2990a4f8c3 include: Rename DF_WINE_CREATE_DESKTOP to DF_WINE_VIRTUAL_DESKTOP. 2024-02-13 22:37:50 +01:00
Rémi Bernon 1664ad7d50 server: Fix rawinput buffer sizes and alignment on WoW64. 2024-02-09 11:14:07 +01:00
Rémi Bernon 2eb8950392 server: Move rawinput message conversion from win32u.
Appending the entire RAWMOUSE / RAWKEYBOARD / RAWHID + report structs
after the hardware message data, instead of using a custom intermediate
structure.
2024-02-09 11:14:07 +01:00
Rémi Bernon c8bf3ba2da server: Stop using hardware_msg_data in rawinput_message. 2024-02-08 23:31:24 +01:00
Rémi Bernon f86cca3897 server: Stop using union rawinput in hw_input_t. 2024-02-08 23:31:24 +01:00
Rémi Bernon c62ca2e1aa server: Combine HID usage page and usage together. 2024-02-08 23:31:24 +01:00
Alexandre Julliard de988eeea0 server: Add hybrid flag in image mapping information. 2024-02-08 17:07:22 +01:00
Alexandre Julliard e05c6c8211 server: Don't update the entry point in the image information for ARM64EC modules. 2024-02-08 17:07:22 +01:00
Alexandre Julliard bd703632fd server: Don't update the machine in the image information for ARM64EC modules. 2024-02-08 13:05:28 +01:00
Alexandre Julliard 4022fb9ba3 server: Don't report alternate 64-bit machines as supported. 2024-02-07 22:28:00 +01:00
Eric Pouech 626b2f1898 server: Preserve handle flags when inheriting a std handle.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-02-06 11:39:58 +01:00
Eric Pouech 1c7e1f1fc6 server: Implement support for DUPLICATE_SAME_ATTRIBUTES in DuplicateHandle().
This flag is documented on MSDN in ZwDuplicateObject() but not in
DuplicateHandle(). Yet functional on both.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-02-06 11:39:58 +01:00
Paul Gofman da6e707850 server: Check if we have waiting asyncs in sock_dispatch_asyncs() before clearing POLLOUT. 2024-02-02 13:02:04 +01:00
Paul Gofman aac0998262 server: Check if we have waiting asyncs in (send_socket) before enforcing blocking send. 2024-02-02 13:01:55 +01:00
Gabriel Brand 6361a20c52 server: Return failure in bind if the address is not found. 2024-01-25 21:00:06 +01:00
Bernhard Übelacker 26e383c8df server: Avoid unloading of HKU .Default registry branch.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55000
2024-01-25 20:30:53 +01:00
Bernhard Übelacker 702aeb3acb server: Allow VirtualQueryEx on "limited" handle.
A handle created with just PROCESS_QUERY_LIMITED_INFORMATION
should allow VirtualQueryEx / APC_VIRTUAL_QUERY.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56093
2024-01-18 18:08:48 +01:00
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