Commit Graph

6344 Commits

Author SHA1 Message Date
Andrey Gusev 93b7c335d6 ntdll: Fix a variable name in TRACE() message.
Signed-off-by: Andrey Gusev <andrey.goosev@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-21 16:52:22 +01:00
Paul Gofman 6b78bcff92 ntdll: Restore FP status words from MSVCRT_JUMP_BUFFER on x64.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-21 16:52:07 +01:00
Paul Gofman 652dc00578 ntdll: Don't set socket IO status after queuing async.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-17 19:33:14 +01:00
Jacek Caban d0413d833f ntdll: Don't use inline assembly in do_cpuid.
Avoids problems on old GCC.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51862
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-17 17:17:54 +01:00
Eric Pouech 594036d620 ntdll: Use proper names for magic constants.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-17 17:17:49 +01:00
Alexandre Julliard b75caec103 ntdll/tests: Mark a failing test as todo.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-16 16:17:21 +01:00
Alexandre Julliard 311c0e91c0 ntdll/tests: Fix some wow64 test failures on Windows.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-15 17:01:53 +01:00
Alexandre Julliard 1887df5cd8 ntdll/tests: Fix some directory test failures on Windows.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-15 16:19:08 +01:00
Alexandre Julliard c372d155ec ntdll/tests: Fix some exception test failures on Windows.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-15 15:57:01 +01:00
Alexandre Julliard 8125687441 ntdll: Fix the RtlCreateTimer() argument order.
Found by Dávid Török.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-14 21:48:44 +01:00
Paul Gofman e36c6f04ce ntdll: Add stub for NtSetDebugFilterState().
Eternal Return benefited from this function present as .spec file
stub which was removed by 52202224d9.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-14 14:18:53 +01:00
Jinoh Kang 4ef4864672 ntdll/tests: Fix access denied error in unprivileged mode.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52161
Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-13 11:28:57 +01:00
Alexandre Julliard 40d706caba ntdll/tests: Mark a failing test as todo.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51380
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-12 15:41:02 +01:00
Francois Gouget 1558b21a9d ntdll/tests: Fix the spelling of a comment.
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-10 22:00:18 +01:00
Zebediah Figura 4b00dd097d server: Handle the entire IOCTL_AFD_POLL ioctl on the server side.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-10 22:00:17 +01:00
Zebediah Figura 7747bf9551 ntdll: Make the afd_transmit_params structure WoW64-compatible.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-10 22:00:17 +01:00
Zebediah Figura b3fd1ca20e ntdll: Handle WoW64 translation in IOCTL_AFD_WINE_SENDMSG.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-10 22:00:17 +01:00
Zebediah Figura 6697759b99 ntdll: Make the afd_recvmsg_params structure WoW64-compatible.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-10 22:00:17 +01:00
Zebediah Figura 737f6952da ntdll: Handle WoW64 control message translation.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-10 22:00:17 +01:00
Zebediah Figura a0b57b9baa ntdll: Handle WoW64 translation in IOCTL_AFD_RECV.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-10 22:00:17 +01:00
Zebediah Figura e3e860e536 ntdll: Handle WoW64 WSABUF pointers in sock_recv().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-10 22:00:17 +01:00
Zebediah Figura 7bea24f6e1 ntdll: Factor out in_wow64_call().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-10 22:00:17 +01:00
Zebediah Figura 6fe23ed8c3 ntdll: Do not fill the IOSB in NtDeviceIoControlFile() if the NT status denotes error.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-10 22:00:17 +01:00
Jinoh Kang e60fdbf124 ntdll: Properly test for LLVM libunwind error codes.
Commit f37b953e07 (ntdll: Support both HP-UX-like libunwind and LLVM
libunwind error codes., 2021-12-10) made an unsuccessful attempt to fix
UNW_ENOINFO detection on LLVM libunwind.  It turns out that UNW_ENOINFO
is actually negative in LLVM, so there's no need to flip the sign.

Fix this by flipping the return value sign only when UNW_ENOINFO < 0
(LLVM libunwind), and then comparing it against the negated error code.
Overall, all flavours of libunwind return a negative value on error.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-10 22:00:17 +01:00
Jinoh Kang f37b953e07 ntdll: Support both HP-UX-like libunwind and LLVM libunwind error codes.
HP-UX libunwind uses the sign of error code to indicate whether the
operation was successful; however, LLVM always returns positive error
codes.

Normalise the sign of the error code so that it handles all flavours of
libunwind.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 18:43:51 +01:00
Alexandre Julliard 411592bf45 configure: Assume that sys/wait.h is available on Unix.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 18:43:51 +01:00
Alexandre Julliard e5d69d9ee6 configure: Assume that sys/ioctl.h is available on Unix.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 18:43:51 +01:00
Alexandre Julliard b3ca48f39c configure: Assume that sys/time.h is available on Unix.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 18:43:51 +01:00
Alexandre Julliard a7ac3de3b3 configure: Assume that sys/socket.h is available on Unix.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 18:43:51 +01:00
Alexandre Julliard e3001b6a7c configure: Assume that sys/mman.h is available on Unix.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 18:43:51 +01:00
Alexandre Julliard 13ec7952e0 configure: Assume that unistd.h is available on Unix.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 18:43:51 +01:00
Alexandre Julliard 7d5af65591 configure: Assume that termios.h is available on Unix.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 18:43:50 +01:00
Alexandre Julliard 4f58d8144c ntdll: Remove __wine_init_unix_lib() and the old Unix library interface.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 17:14:59 +01:00
Jinoh Kang 1886b3d322 ntdll: Fix valid frame address range in ARM/ARM64.
Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 17:14:59 +01:00
Jinoh Kang 3e2f443003 server: Fix querying debug port with restricted DACL.
Today, Wine uses NtQueryInformationProcess/ProcessDebugPort to detect
whether the current process is being debugged.  If it is, the process
issues a breakpoint to yield control to the debugger.

Some debuggers (e.g. latest CDB) appear to create debug handles with
restricted DACL, which causes querying debug port to fail with
STATUS_ACCESS_DENIED.  This results in the debuggee erroneously
skipping the initial breakpoint.

Fix this by not requiring DEBUG_ALL_ACCESS when opening the debug port
object.  Instead, use MAXIMUM_ALLOWED for the access mask.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52184
Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 17:14:59 +01:00
Jinoh Kang ee4d38c3b1 ntdll/tests: Add tests for DebugPort* info query with security checks.
Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 17:14:59 +01:00
Jacek Caban 1facdbbdcb ntdll: Temporarily allow KeUserModeCallback calls from client stack.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 10:47:41 +01:00
Paul Gofman d2e35b04fb ntdll: Remove a special case for entry point not in executable section in map_image_into_view().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-08 22:14:44 +01:00
Alexandre Julliard 0b3d65f822 ntdll: Don't restore the %fs register for exceptions happening inside system calls.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-08 15:02:58 +01:00
Alexandre Julliard cdafebed15 include: Document remaining fields in the SYSTEM_PROCESS_INFORMATION structure.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-08 13:19:48 +01:00
Damjan Jovanovic 36af18a4f1 ntdll: Implement fill_battery_state() on FreeBSD.
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-07 21:54:57 +01:00
Alexandre Julliard 456e76185d ntdll: Don't return a default Unix handle for modules that don't have a Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-07 16:19:48 +01:00
Bernhard Übelacker c488f29122 server: Return ReadDataAvailable value for FilePipeLocalInformation.
Makes Cygwin mintty.exe or script.exe show output, if the
stack issues got worked around.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47808
Signed-off-by: Bernhard Übelacker <bernhardu@mailbox.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-06 22:55:07 +01:00
Jactry Zeng 03649e5fb4 ntdll: Fix compilation for ARM64 Apple platform.
Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Jactry Zeng <jzeng@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-06 16:36:51 +01:00
Paul Gofman c338a6ff99 ntdll: Support THREAD_CREATE_FLAGS_HIDE_FROM_DEBUGGER thread creation flag.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-06 12:20:34 +01:00
Paul Gofman 3f20261eaf ntdll: Set rcx on exit from syscall dispatcher on x64.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-03 19:31:55 +01:00
Brendan Shanks e7afddd2c1 ntdll: Rename THREAD_DESCRIPTION_INFORMATION to THREAD_NAME_INFORMATION.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-02 20:20:40 +01:00
Brendan Shanks 65dd060a67 ntdll: Rename ThreadDescription to ThreadNameInformation.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-02 20:20:40 +01:00
Vijay Kiran Kamuju 78fbea1672 ntdll: Add stub RtlLookupElementGenericTable function.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49426
Signed-off-by: Vijay Kiran Kamuju <infyquest@gmail.com>
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-02 20:20:39 +01:00
Vijay Kiran Kamuju 87c7648f15 ntdll: Add stub RtlGetElementGenericTable function.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49426
Signed-off-by: Vijay Kiran Kamuju <infyquest@gmail.com>
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-02 20:20:39 +01:00
Vijay Kiran Kamuju df678a4ec6 ntdll: Implement RtlNumberGenericTableElements.
Signed-off-by: Vijay Kiran Kamuju <infyquest@gmail.com>
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-02 20:20:39 +01:00
Vijay Kiran Kamuju 82a4f2e0ec ntdll: Implement RtlInitializeGenericTable.
Signed-off-by: Vijay Kiran Kamuju <infyquest@gmail.com>
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-02 20:20:39 +01:00
Alexandre Julliard a041075cd2 makefiles: Support per-platform values for EXTRADLLFLAGS.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-02 20:20:39 +01:00
Alexandre Julliard d10410eac2 ntdll: Add fallback implementations for the Unix library functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-02 20:20:39 +01:00
Alexandre Julliard 1b447409cb ntdll: Set the TEB offset for Wow64 mode also in 64-bit.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-02 20:20:39 +01:00
Alexandre Julliard 679a2f531b ntdll: Don't try to convert binaries to 64-bit in Wow64 mode.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-02 20:20:39 +01:00
Paul Gofman 4094767634 ntdll/tests: Fix iret to invalid selector test on x64.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-01 18:13:53 +01:00
Alexandre Julliard 47f59be21f ntdll: Don't clear x86-64 registers when receiving a 32-bit context.
They can still be valid if running in Wow64 mode.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-01 18:13:53 +01:00
Alexandre Julliard e5e857c290 ntdll: Add support for dispatching exception from 32-bit code in Wow64 mode.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-01 18:13:53 +01:00
Zebediah Figura 518a175cba ntdll: Remove the no longer used "mutex" argument to server_select().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-01 09:59:37 +01:00
Huw Davies 3ac41371f9 ntdll: Move the FILE ptr into the blocks that use it.
This is to prevent compiler warnings on non-linux platforms.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-30 22:07:21 +01:00
Alexandre Julliard 035f8ad8ad ntdll: Export some Unicode string functions for use in other Unix libraries.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-30 22:07:20 +01:00
Jinoh Kang a4ffa1e7e2 ntdll: Implement NtCompareObjects.
Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-29 23:25:46 +01:00
Jinoh Kang 47c365606f ntdll/tests: Add tests for NtCompareObjects.
Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-29 23:25:46 +01:00
Jinoh Kang 3b37584316 server: Implement the \??\GLOBALROOT symbolic link.
\??\GLOBALROOT is a well-known NT symbolic link that allows applications
to access the NT object manager's root namespace via Win32 APIs.

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-25 21:43:49 +01:00
Jinoh Kang 9f0df41a6c ntdll: Save/restore FPU context in arm64 signal handlers.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51996
Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-25 21:35:20 +01:00
Paul Gofman 6747ecdefd ntdll: Fix context arch flag cleanup for AMD64 in context_from_server().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-25 21:24:59 +01:00
Zebediah Figura bfbccf1a03 ntdll: Prevent loading Wine system dependencies in place of identically named application DLLs.
That is, load Wine system dependencies only when they are imported from Wine
builtins or other system dependencies, and do not match a Wine system dependency
by its base name when looking for already-loaded modules.

The reasoning is that it is possible for an application to ship, and expect to
use, a newer version of a MinGW-compiled library, or one with custom patches, or
possibly an unrelated library with the same name. We don't want to offer Wine's
system dependencies in place of the application's, or vice versa.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-24 15:30:10 +01:00
Zebediah Figura 7e926a9aa9 ntdll: Allow loading system DLLs from a path specified at configure time.
Many distributions provide MinGW-compiled system DLLs which are currently
bundled with Wine. Unfortunately, while MinGW pkg-config can be used to detect
the linking path, there is no standardized runtime path, and many distributions
in fact use different paths.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-24 15:30:09 +01:00
Alexandre Julliard f10a85de60 ntdll: Merge the calls to find_builtin_without_file().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-24 14:58:12 +01:00
Alexandre Julliard afb6f1696e ntdll: Add a helper function to append .dll to a module name.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-24 14:58:12 +01:00
Alexandre Julliard eb6a9151d6 ntdll: Add a helper function to build an import dll name.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-24 14:58:12 +01:00
Alexandre Julliard 95931fcd36 ntdll: Fix a buffer overflow in environment variable expansion.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52093
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-23 21:02:11 +01:00
Nick Fox ef26f7bd5c ntdll: Fix LdrGetDllPath with LOAD_WITH_ALTERED_SEARCH_PATH without a path.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26350
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51821
Signed-off-by: Nick Fox <nick@foxsec.net>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-22 22:20:50 +01:00
Jan Sikorski 064dd051d8 ntdll: Save status from attaching dependencies in process_attach().
Signed-off-by: Jan Sikorski <jsikorski@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-22 22:20:50 +01:00
Matteo Bruni e86b4015ff ntdll: Call usleep() instead of NtYieldExecution() in NtDelayExecution().
This implements the general fix from
b1a79c6b9c (in particular, making sure
that Sleep(0) will not immediately resume execution of the thread if
there are no other runnable threads) while preserving the existing
behavior of NtYieldExecution() / SwitchToThread(). Thanks Rémi for the
idea.

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-22 22:20:50 +01:00
Matteo Bruni 3203f05668 Revert "ntdll: Implement NtYieldExecution() as usleep().".
Rémi found a regression caused by that patch. His analysis suggests
that it's probably correct for NtYieldExecution() to map to
sched_yield().

Let's revert the patch and fix the issue in a slightly different way.

This reverts commit b1a79c6b9c.

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-22 22:20:50 +01:00
Alexandre Julliard 0907d8cc6d ntdll/tests: Fix a test failure on older Windows versions.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52069
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-22 22:20:50 +01:00
Alexandre Julliard 62d335053f makefiles: Don't append .fake extension to fake dlls.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-20 13:07:47 +01:00
Alexandre Julliard 470ac022f2 ntdll: Fix a compiler warning on macOS.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-19 15:36:30 +01:00
Alexandre Julliard 7d2a7b94aa ntdll: Fix handling of zero size with MEM_DECOMMIT.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52023
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-19 11:17:24 +01:00
Henri Verbeet deff68bb72 ntdll: Only add a module dependency if import_dll() returned a modref.
In particular, if import_dll() skips an unused import, it will return TRUE,
but set *pwm to NULL. This fixes a regression in 3DMark03 version 3.4.0,
introduced by commit 0dd37b02f9.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-18 20:15:19 +01:00
Zebediah Figura f3e9498740 ntdll: Reimplement SRW locks on top of Win32 futexes.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-18 11:09:25 +01:00
Zebediah Figura 87164ee333 ntdll: Get rid of the direct futex path for condition variables.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-18 11:09:16 +01:00
Zebediah Figura c577ce2671 ntdll: Reimplement the critical section fast path on top of Win32 futexes.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-18 11:09:07 +01:00
Zebediah Figura 6bdb914a25 ntdll: Reimplement Win32 futexes on top of thread-ID alerts.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-18 11:08:49 +01:00
Zebediah Figura 842ecb45f4 ntdll: Implement thread-ID alerts using Mach semaphores on Mac.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-18 11:08:16 +01:00
Zebediah Figura 9d79f72142 ntdll: Implement thread-ID alerts using futexes if possible.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-17 17:59:26 +01:00
Zebediah Figura 6d19056a8c ntdll/tests: Add basic tests for thread-id alert functions.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-17 17:59:26 +01:00
Zebediah Figura 0e931fa5fd ntdll: Implement NtAlertThreadByThreadId and NtWaitForAlertByThreadId.
These will be used to implement RtlWaitOnAddress() and other in-process
synchronization primitives, as they are on Windows.

These patches went through quite a few revisions in order to ensure that they
had sufficient performance and correctness compared to the current
implementation. I am particularly grateful to Etienne Juvigny and Dmitry
Skvortsov for performing extensive testing.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-17 16:36:01 +01:00
Martin Storsjö 1fb4ce83f4 ntdll: Subtract an offset from pc if dispatch->ControlPcIsUnwound on arm.
This fixes unwinding from functions ending with a call to a function
that won't return. This matches what is done on the PE side in the
call to lookup_function_info.

Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-15 19:59:54 +01:00
Martin Storsjö d00c897749 ntdll: Error out if unwinding isn't progressing on arm.
In PE builds of wine, there's no unwind info (as LLVM hasn't
implemented generating SEH unwind info for ARM yet).

On startup of wine, an exception of the type RPC_S_SERVER_UNAVAILABLE
is raised. In a PE build of Wine, the unwind would get stuck in
an infinite loop.

This still loops for a short while; after returning the error
STATUS_INVALID_DISPOSITION, KiUserExceptionDispatcher ends up
calling RtlRaiseStatus with this status, which then tries to
unwind again, getting stuck similarly. However by recursively
trying to unwind multiple times, the process crashes fairly soon
after running out of stack.

Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-15 19:59:44 +01:00
Dmitry Timoshkov 33bc90e687 ntdll: Return correct status when manifest could not be loaded from file.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-12 22:42:51 +01:00
Martin Storsjö 3ef9a04f91 ntdll: Implement __C_specific_handler and __jump_unwind for arm.
Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-09 22:02:56 +01:00
Martin Storsjö bdb3608811 ntdll: Implement stack unwinding on arm.
This is a very close copy of the arm64 implementation.

Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-09 22:02:56 +01:00
Martin Storsjö 77e9095435 ntdll: Remove stack gap in syscalls on arm.
Store the original stack pointer (on entry to the syscall dispatcher)
in syscall_frame; the stack pointer itself is incremented by
"pop {r0-r3}" right before calling the syscall itself.

This fixes unwinding from functions set up by syscalls, like
KiUserExceptionDispatcher.

Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-09 22:02:56 +01:00
Martin Storsjö b2934dd98f ntdll: Include d0-d15 in RtlCaptureContext.
We ideally should back up all of d0-d31, but when building in ELF
form, only d0-d15 are normally available (with common distributions'
default compilers), unless object files are built with flags to enable
support for d16-d31 (with e.g. -mfpu=neon).

Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-09 22:02:56 +01:00
Martin Storsjö 611911ca05 ntdll: Save context->Lr in the arm version of RtlRaiseException.
RtlCaptureContext doesn't set context->Lr, which is needed for
being able to unwind from the context.

This matches what is done in the arm64 version.

Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-09 22:02:56 +01:00
Martin Storsjö 324150c0ae ntdll: Fix arm call_user_exception_dispatcher with kernel stack for syscalls.
This does the same as 23b44e8df6,
but for arm:

Don't call KiUserExceptionDispatcher directly on the stack pointer
stored in the CONTEXT, but use the one stored in syscall_frame
(which includes the stack allocation in e.g. RtlRaiseException).

Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-09 22:02:56 +01:00
Martin Storsjö 0dc34ad87a ntdll/tests: Add tests for RtlVirtualUnwind for arm.
Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-09 22:02:55 +01:00
Martin Storsjö dd1c560752 ntdll: Implement RtlVirtualUnwind for arm.
Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-09 22:02:55 +01:00
Martin Storsjö 7b7a2af5ee ntdll: Don't blindly increment Sp by 8 in leaf functions on arm64.
This doesn't fix (or break) any case known to me, but the code seems
wrong.

Leaf functions on arm (either 32 or 64) don't generally have any
default/implicit stack allocation.

Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-09 22:02:55 +01:00
Martin Storsjö 4463ccb267 ntdll: Print an error if unable to unwind due to missing libunwind on arm64.
Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-09 22:02:55 +01:00
Martin Storsjö e9939c9301 ntdll/tests: Remove an accidental, unused macro in arm64 exception tests.
Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-09 22:02:55 +01:00
Alexandre Julliard 8dc6987ba5 ntdll: Create a remote thread in DbgUiIssueRemoteBreakin().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-09 22:02:54 +01:00
Paul Gofman 1722615b06 ntdll: Don't constraint TEB address to 2GB for native x64 process.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-04 22:36:28 +01:00
Damjan Jovanovic fbb633750f ntdll: Populate MEMORY_WORKING_SET_EX_INFORMATION on FreeBSD.
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-03 21:06:48 +01:00
Damjan Jovanovic c67c50f282 ntdll: Implement vm counters on FreeBSD.
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-03 21:06:48 +01:00
Damjan Jovanovic 26d8701ae2 ntdll: Implement get_device_mount_point() on FreeBSD.
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-03 21:06:48 +01:00
Damjan Jovanovic d5406d028b ntdll: Implement setting SYSTEM_PERFORMANCE_INFORMATION.IdleTime on FreeBSD.
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-03 21:06:48 +01:00
Damjan Jovanovic 478a7dbc90 ntdll: Implement setting SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION.IdleTime on FreeBSD.
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-03 21:06:48 +01:00
Paul Gofman aa234f3a58 ntdll: Don't add dependencies for system dlls.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-03 21:06:48 +01:00
Paul Gofman 250c113169 ntdll: Factor out is_import_dll_system() function.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-03 21:06:48 +01:00
Paul Gofman 0dd37b02f9 ntdll: Store module dependencies in DDAG structure.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-03 21:06:48 +01:00
Paul Gofman 06f925c599 ntdll: Pass DDAG node to process_attach().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-03 21:06:48 +01:00
Paul Gofman 41c7652bbe ntdll: Allocate DDAG node for module.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-03 21:06:48 +01:00
Huw Davies 6fdae1979b configure: Stop checking for poll.h and sys/poll.h - always use poll.h.
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-31 17:56:54 +01:00
Paul Gofman 98a5466380 ntdll: Implement SystemExtendedProcessInformation system info class.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:50 +02:00
Paul Gofman bb6aa6c773 ntdll: Factor out get_system_process_info() function.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:50 +02:00
Paul Gofman b5f3ddd185 ntdll: Return sufficient info size at once from NtQuerySystemInformation(SystemProcessInformation).
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:50 +02:00
Zebediah Figura 17f6252849 ntdll/tests: Add some tests for Rtl* resources.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:50 +02:00
Zebediah Figura 127ad286ce ntdll/tests: Move some tests to a new sync.c file.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:50 +02:00
Zebediah Figura f4672a6f0f ntdll: Merge critsection.c into sync.c.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 11:37:39 +02:00
Paul Gofman e73bb07ff5 ntdll: Fix alignment mask size in RtlInitializeExtendedContext2().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-26 22:52:00 +02:00
Alexandre Julliard 1b9ada6cab ntdll: Remove math functions from the unixlib interface.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-26 10:39:34 +02:00
Alexandre Julliard 2e4c090c5e ntdll: Copy sqrt() implementation from msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-26 10:39:34 +02:00
Alexandre Julliard 140cd3553c ntdll: Copy pow() implementation from msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-26 10:39:34 +02:00
Alexandre Julliard 0c0915e985 ntdll: Copy log() implementation from msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-26 10:39:34 +02:00
Alexandre Julliard 90bd048786 ntdll: Copy tan() implementation from msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-26 10:39:34 +02:00
Alexandre Julliard e4737d285b ntdll: Copy sin() and cos() implementation from msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-26 10:39:34 +02:00
Alexandre Julliard 9eb3adbc85 ntdll: Copy fabs() implementation from msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-26 10:39:34 +02:00
Alexandre Julliard f0d3a7d33b ntdll: Copy floor() implementation from msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-26 10:39:34 +02:00
Alexandre Julliard fca34420f6 ntdll: Copy ceil() implementation from msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-26 10:39:34 +02:00
Alexandre Julliard bb9e068bab ntdll: Copy atan() implementation from msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-26 10:39:34 +02:00
Alexandre Julliard c7454eef0b ntdll: Move math functions to a separate file.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-26 10:39:34 +02:00
Rémi Bernon a602bdd326 ntdll: Use the unrolled memset from msvcrt.
Although less frequently used, heap allocations are zeroed out with
ntdll memset and they don't benefit from the msvcrt memset optimisation.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-25 21:16:50 +02:00
Damjan Jovanovic 70f486c28f ntdll: Use sysctl instead of /proc/curproc/file on FreeBSD.
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-25 18:50:59 +02:00
Alexandre Julliard 747b97539b ntdll: Use the standard va_list instead of __ms_va_list.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-22 11:12:17 +02:00
Paul Gofman 1ab32c6b3b ntdll: Store module check sum in WINE_MODREF.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-20 20:19:32 +02:00
Paul Gofman c310c8050d ntdll: Fix size comparison in NtQuerySystemInformation(SystemCodeIntegrityInformation).
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-20 20:11:23 +02:00
Alexandre Julliard 832724282b ntdll: Avoid including wine/port.h.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-20 16:16:07 +02:00
Jacek Caban 8f31eb1edb ntdll: Export RtlNtStatusToDosError from Unix lib.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-12 18:29:22 +02:00
Jacek Caban 116cf7dfcb ntdll: Move error mapping to a header file.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-12 18:29:22 +02:00
Alexandre Julliard edba76c826 include: Don't define math functions or constants in wine/port.h.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-11 11:25:35 +02:00
Alexandre Julliard ea2c743668 configure: Define _GNU_SOURCE in config.h.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-11 11:22:53 +02:00
Huw Davies 5689ec7bba ntdll: Return a failure if the unix call funcs don't exist.
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 16:55:20 +02:00
Matteo Bruni b1a79c6b9c ntdll: Implement NtYieldExecution() as usleep().
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 18:03:11 +02:00
Jacek Caban e0a934d0ef ntdll: Handle Unix lib exception outside Unix stack.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 18:03:11 +02:00
Jacek Caban 2ec2e136bf ntdll: Allow Unix libraries to use exception macros.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 18:03:11 +02:00
Jacek Caban 1be12eaa94 ntdll: Provide some Unicode helpers for Unix libs.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 13:52:42 +02:00