Commit graph

3060 commits

Author SHA1 Message Date
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