Commit graph

7043 commits

Author SHA1 Message Date
Jinoh Kang 14d4a896bd ntdll: 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: 954bf9e050
2023-08-05 10:45:04 +09:00
Francois Gouget abdca2f74b ntdll/tests: Fix the basic file informations failure messages.
Set the messages to accurately reflect what is being tested, make them
unique and trace bad values.
2023-07-31 18:26:50 +09:00
Francois Gouget 541695ae00 ntdll/tests: Fix the spelling of some exception ok() messages. 2023-07-27 16:36:09 +09:00
Francois Gouget 2f57803114 ntdll/tests: Fix the NtSetInformationFile() test on Windows 10 <= 1709.
It does not support FileDispositionInformationEx and returns various
error codes.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55331
2023-07-27 13:12:06 +09:00
Paul Gofman c77642ec52 ntdll: Match Windows used block filling.
Test rewritten by Rémi Bernon.
2023-07-27 13:12:06 +09: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
Billy Laws a9d0988d01 ntdll: Avoid storing a second ctx copy in the aarch64 raise trampoline.
CFI directives allow the context that was stored on the stack by
raise_func_trampoline to be used to unwind to any exception handlers as
required when dispatching an exception. However, as the dispatcher may change
its input context in e.g. BTCpuResetToConsistentState and these changes also
need to be used when unwinding, have the trampoline CFI directly refer to the
input context rather than a copy of it.
2023-07-21 21:27:44 +02:00
Billy Laws b7d6e0a416 ntdll: Add aarch64 DWARF register definitions. 2023-07-21 21:27:44 +02:00
Alexandre Julliard 59ee798d51 ntdll/tests: Use nameless unions/structs. 2023-07-20 21:48:39 +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 f311bb5fba ntdll/tests: Add test for async cancel on pipe's last process handle close. 2023-07-20 21:48:39 +02:00
Billy Laws 1ed5dd7e8a ntdll/tests: Test that NtContinue restores all register state on arm64. 2023-07-18 15:26:13 +02:00
Brendan Shanks c1958ddc7a ntdll: Don't release address space on 64-bit macOS. 2023-07-18 15:15:24 +02:00
Jinoh Kang 057467bff9 ntdll: Fix restoring X16 and X17 in ARM64 syscall dispatcher.
Today, NtContinue() on ARM64 does not restore X16 and X17 from the
context.

This is because the values for X16 and X17 are overwritten when the
current thread returns to the "user mode" (PE side) via
__wine_syscall_dispatcher, which in turn uses them as scratch registers
for restoring SP and PC respectively.

We cannot avoid using scratch registers when restoring SP and PC.  This
is because ARMv8 does not have an unprivileged (EL0) instruction that
loads SP and PC from memory or non-GPR architectural state.

Fix this by making ARM64 __wine_syscall_dispatcher perform a full
context restore via raise(SIGUSR2) when NtContinue() is used.

Since raising a signal is quite expensive, it should be done only when
necessary. To achieve this, split the ARM64 syscall dispatcher's
returning behaviour into a fast path (that does not involve signals) and
a slow path (that involves signals):

- If CONTEXT_INTEGER is not set, the dispatcher takes the fast path:
  the X16 and X17 registers are clobbered as usual.

- If X16 == PC and X17 == SP, the dispatcher also takes the fast path:
  it can safely use X16 and X17 without corrupting the register values,
  since those two registers already have the desired values.

  This fast path is used in call_user_apc_dispatcher(),
  call_user_exception_dispatcher(), and call_init_thunk().

- Otherwise, the dispatcher takes the slow path: it raises SIGUSR2 and
  does full context restore in the signal handler.

Fixes: 88e336214d
2023-07-17 11:11:44 +02:00
Jinoh Kang 86893ce299 ntdll: Fail loudly if RtlActivateActivationContextEx fails to allocate memory.
Many built-in callers of ActivateActCtx() just assume that it will
always succeed.  If it ever fails, then DeactivateActCtx() will notice
that the cookie is invalid and raise an exception anyway.
2023-07-13 23:42:46 +02:00
Alexandre Julliard 2436da5cef include: Add some new information classes. 2023-07-13 18:41:13 +02:00
Billy Laws 88e336214d ntdll: Fix NtContinue from within exception context on ARM64.
When handling an exception, NtContinue can be called from within the signal
handler, in which case the raise(SIGUSR2) call ends up getting eaten and
integer register context never ends up getting restored. Switch to the
method used on X86 to avoid these issues.
2023-07-12 19:01:13 +02:00
Sven Baars 1663454c4b ntdll/tests: Update some more todos that succeed with the new wow64 architecture. 2023-07-11 18:34:17 +02:00
Sven Baars 235e3e522e ntdll: Test against the correct limit in get_extended_params(). 2023-07-11 18:34:17 +02:00
Alexandre Julliard 257221843f ntdll: Implement RtlWow64GetSharedInfoProcess(). 2023-07-11 18:34:17 +02:00
Alexandre Julliard fb5cfacce5 ntdll: Return the 32-bit PEB for NtQueryInformationProcess(ProcessWow64Information). 2023-07-11 13:43:26 +02:00
Alexandre Julliard 7e521b4db3 ntdll: Fix returned length for some info classes in NtQueryInformationProcess(). 2023-07-11 13:41:13 +02:00
Torge Matthies 7026effe95 ntdll: Implement efficiency class reporting for Intel hybrid CPUs.
Signed-off-by: Torge Matthies <tmatthies@codeweavers.com>
2023-07-10 20:33:21 +02:00
Billy Laws 954bf9e050 ntdll: Avoid using SOL_IPX to detect whether IPX is supported.
4.18+ Linux kernels remove support for IPX but keep SOL_IPX defined, which
causes compilation errors as wine unconditionally uses IPX structures if
this is the case. Instead check for IPX_MTU to determine IPX support as it is
defined within the ipx.h header itself.
2023-07-04 20:52:17 +02:00
Ally Sommers 7b2e7c8075 ntdll/unix: Skip address conversion for SOCK_STREAM sockets in try_send(). 2023-07-03 22:15:42 +02:00
Alexandre Julliard 959dea0c09 ntdll: Implement RtlIsCurrentProcess/Thread. 2023-07-03 22:15:42 +02:00
Alexandre Julliard a5ff427acb ntdll: Implement NtQueryVirtualMemory(MemoryImageInformation). 2023-07-03 12:16:49 +02:00
Alexandre Julliard 9bdd08579e ntdll/tests: Add some tests for NtQueryVirtualMemory(MemoryImageInformation). 2023-06-29 21:06: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 0e6b5811c8 ntdll/tests: Add tests for FILE_DISPOSITION_POSIX_SEMANTICS.
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 d89ee7c030 ntdll/tests: Add tests for FILE_DISPOSITION_ON_CLOSE.
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 cbc1e4423e ntdll/tests: Add tests for FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE.
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
Joel Holdsworth dedd130d9e include: Define FILE_DISPOSITION_INFORMATION_EX and friends.
Signed-off-by: Joel Holdsworth <joel@airwebreathe.org.uk>
2023-06-27 12:05:05 +02:00
Jacek Caban dcf0bf1f38 ntdll: Inherit ConsoleHandle only by CUI processes. 2023-06-26 15:04:26 +02:00
Tim Clem 1b310a5aba ntdll: Treat read faults on readable pages as write faults on macOS.
Working around a Rosetta bug on Apple Silicon - faults for certain
instructions (e.g. lock cmpxchg8b) are misreported, which can break
VPROT_WRITEWATCH handling.
2023-06-22 10:10:55 +02:00
Alexandre Julliard bef61e293c ntdll: Implement _errno(). 2023-06-21 18:15:43 +02:00
Alexandre Julliard 2b6e32f358 ntdll: Don't define stdcall functions on non-i386. 2023-06-14 18:53:36 +02:00
Alexandre Julliard 3c4be9856d ntdll: Make only the necessary pages writable in the ARM64EC code map. 2023-06-13 22:10:56 +02:00
Alexandre Julliard f473e31341 ntdll: Load modules with a high base address in high memory. 2023-06-13 22:10:56 +02:00
Alexandre Julliard a82238fad5 ntdll: Allocate 64-bit and kernel stacks in high memory. 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
Etaash Mathamsetty 6ecca8cf63 ntdll: Allow RtlAllocateHeap to crash with invalid handle. 2023-06-12 21:21:35 +02:00
Alexandre Julliard 931292f1a6 ntdll: Use the sysv ABI for __wine_syscall_dispatcher_return().
Missing from b337c5b1a1, spotted by Fan
WenJie.
2023-06-09 23:37:14 +02:00
Alexandre Julliard d12b125b4e ntdll: Update the reserved range on 64-bit to match the preloader.
cf. 6b0836e3f1.
2023-06-08 13:29:39 +02:00
Alexandre Julliard bf1606cf35 ntdll: Use the full 4Gb for large address aware applications on Wow64. 2023-06-08 13:21:45 +02:00
Alexandre Julliard 78ffde79fe ntdll: Report the remaining part of the 64K after a view as free.
To avoid returning non-aligned reserved regions.
2023-06-08 13:21:10 +02:00
Alexandre Julliard 8b992fecad ntdll: Reimplement virtual_release_address_space() without using a callback. 2023-06-08 13:20:45 +02:00