Commit Graph

4987 Commits (master)

Author SHA1 Message Date
Alexandre Julliard 42bd67b576 ntdll: Don't call terminate_thread request if not necessary.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-29 16:17:32 +02:00
Martin Storsjo e0c8c4c3cd ntdll: Implement RtlRaiseException in assembly to fix continuing from exceptions.
If the handlers returned ExceptionContinueExecution and we restore
the stored context, make sure it's a context that ends up returning
from the RtlRaiseException function.

This matches how it's done on x86_64.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-28 20:18:32 +02:00
Martin Storsjo 763f15ccde ntdll: Fix unwinding through raise_generic_exception.
Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-28 20:18:32 +02:00
Martin Storsjo a8a944c220 ntdll: Keep the previous iteration of NonVolatileRegisters in call_function_handlers.
Some language specific handlers, called by call_handler, can use
the NonVolatileRegisters to restore the context before running
code, and that assumes that NonVolatileRegisters contains the frame
pointer as it was within the function (before unwinding).

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-28 20:18:32 +02:00
Martin Storsjo 6c11d1d745 ntdll: Implement RtlRestoreContext.
Call the consolidate frame callback before resuming. Before
calling the callback, fill in ExceptionInformation[10] with the
equivalent of dispatch.NonVolatileRegisters.

This fixes unwinding of MSVC C++ exceptions in a lot of cases.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-28 20:18:32 +02:00
Martin Storsjo babbf352b6 ntdll: Fix unwinding functions that end with a branch instruction.
This happens with functions that aren't intended to return e.g. like
_Unwind_Resume. In these cases, the return address is outside of the
function (the first instruction in the next function).

Set the flag CONTEXT_UNWOUND_TO_CALL after unwinding to a callsite,
and if this flag is set, look up a RUNTIME_FUNCTION based on
Control.Pc - 4.

This isn't a complete (nor probably entirely correct) implementation
of the flag CONTEXT_UNWOUND_TO_CALL, but it practically seems to
work fine and fixes a large number of unwinding cases.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-28 20:18:32 +02:00
Martin Storsjo 42a5885669 ntdll: Store the real stack pointer in RtlCaptureContext.
In most cases, unwinding will use the frame pointer anyway, so it
doesn't make much of a difference, but for cases where it won't,
capture the actual stack pointer.

(In most cases on arm64, calling the RtlCaptureContext won't cause
anything extra to be pushed on the stack at that point anyway).

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-28 20:18:32 +02:00
Martin Storsjo 8e4f0b2a15 ntdll: Pass a nonnull handler_data in when continuing after a collided unwind.
This matches what was done for RtlUnwindEx in
93ecc54ae5, applying the same change
in call_function_handlers (when called from raise_exception).

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-28 20:18:32 +02:00
Martin Storsjo d6e9795223 ntdll: Fix byte vs register units in unwind_packed_data.
restore_regs and restore_fpregs take offsets in units of registers,
not bytes.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-28 20:18:32 +02:00
Martin Storsjo 8477f61b9f ntdll: Fix handling of the save_lrpair unwind opcode.
The register offset should be multiplied by 2, and the second
register is always Lr.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-28 20:18:32 +02:00
Alex Henrie fef9849aae ntdll/tests: Make RtlIpv6AddressToString test data static and constant.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-28 20:10:54 +02:00
Alexandre Julliard f5e703042a ntdll: Fix off-by-one buffer size error.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49262
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-27 16:08:12 +02:00
Huw Davies 51c9db55e6 ntdll: Remove unnecessary page variable.
get_page_vprot() doesn't require the base address.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-27 00:14:14 +02:00
Huw Davies a98dd5a63e ntdll: Use the correct size when the read spans a page boundary.
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-27 00:14:13 +02:00
Alexandre Julliard 54a7e592e4 ntdll: Implement ProcessImageInformation class in NtQueryInformationProcess().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-26 15:58:13 +02:00
Alex Henrie 0af08318b7 ntdll: Implement RtlIpv6AddressToString(Ex)[AW].
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46788
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-26 10:12:12 +02:00
Alex Henrie e5f69e81f3 ntdll/tests: Add more RtlIpv6AddressToString tests.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-26 10:10:28 +02:00
Alex Henrie 917002c88f ntdll/tests: Drop RTL function workarounds for Windows <= 2000.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-26 10:10:22 +02:00
Alex Henrie e3d2d852a4 include: Add more RTL functions.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-26 10:10:15 +02:00
Alex Henrie bab2de00aa ntdll: Increase size of IPv6 address string buffers.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-26 10:07:27 +02:00
Paul Gofman ca56ef6739 ntdll: Fill ActiveGroupCount field in _KUSER_SHARED_DATA.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-25 20:23:31 +02:00
Paul Gofman 1306bd941b ntdll: Fill ActiveProcessorCount field in _KUSER_SHARED_DATA.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-25 20:23:29 +02:00
Thomas Faber 2a2607e2a3 ntdll/tests: Fix a test failure on Server 2003.
Signed-off-by: Thomas Faber <thomas.faber@reactos.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-25 20:21:12 +02:00
Damjan Jovanovic 8c3e6c378d ntdll: Reserve the area whenever possible in reserve_area() on FreeBSD.
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-25 20:21:00 +02:00
Matteo Bruni 2e5c2c7cdb ntdll: Use memcpy() in set_float_reg().
The source address might not be aligned although the compiler can
expect alignment when using a plain assignment.

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-25 20:20:09 +02:00
Gijs Vermeulen 676b6b0fd7 ntdll: Fix number of arguments passed to mmap_remove_reserved_area in apple_create_wine_thread.
This fixes a regression introduced by 625209433f

Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-22 19:50:48 +02:00
Alexandre Julliard 9b8fabf4b0 ntdll: Silence a va_start compiler warning.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-22 14:32:02 +02:00
Alexandre Julliard 6bed2b427b kernel32: Move the *PreferredUILanguages functions to kernelbase and ntdll.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-22 14:31:55 +02:00
Alexandre Julliard 75e2f79b68 ntdll: Implement SystemTimeAdjustmentInformation class.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-22 14:31:55 +02:00
Alexandre Julliard 7cc9ccbd22 kernel32: Move GetProcessTimes() implementation to kernelbase and ntdll.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-22 14:31:55 +02:00
Alexandre Julliard cd215bb49b kernel32: Use the user shared data to implement GetTickCount().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-21 19:36:52 +02:00
Alexandre Julliard 9b12068c6c ntdll: Use the user shared data to implement RtlQueryUnbiasedInterruptTime().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-21 19:36:52 +02:00
Alexandre Julliard cc5953048e ntdll: Use the user shared data to implement NtGetTickCount().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-21 19:36:52 +02:00
Alexandre Julliard 0936606c38 ntdll: Centralize initialization of the user shared data.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-21 19:36:52 +02:00
Alexandre Julliard ab350866e4 ntdll: Add some more CPU feature flags.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-21 17:06:04 +02:00
Alexandre Julliard ca13f489e1 ntdll: Make the windows directory a global variable.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-21 17:06:04 +02:00
Alexandre Julliard acd209d603 ntdll: Move setting the process name to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-20 16:16:40 +02:00
Alexandre Julliard 3d3545b12f ntdll: Move the Unix codepage initialization to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-20 16:16:40 +02:00
Alexandre Julliard dec38ffb07 ntdll: Move the wineserver exec support to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-19 17:40:08 +02:00
Alexandre Julliard 67bc4a6d76 ntdll: Don't use libwine during the Unix library initialization.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-19 14:08:30 +02:00
Alexandre Julliard fb310724f6 ntdll: Move the wineloader exec support to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-19 14:08:16 +02:00
Alexandre Julliard e619429035 ntdll: Move configuration paths setup to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-19 12:35:54 +02:00
Zebediah Figura 4cb95848fd ntdll: Remove extraneous newline from debugstr_ObjectAttributes().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-19 11:04:46 +02:00
Alon Barzilai 058f86958c ntdll: Add missing RtlQueryEnvironmentVariable function.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48773
Signed-off-by: Alon Barzilai <alon.barzilai@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-18 19:48:34 +02:00
Martin Storsjo 5f14b6357b ntdll: Properly restore x29/x30 for arm64 packed unwind data with local stack.
For the CR == 3 case, x29/x30 should be restored from x29, not from
sp, which may have been decremented further for local stack storage.

This fixes uwinding the stack for C++ exceptions in code generated
by MSVC.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-18 15:12:49 +02:00
Martin Storsjo 93ecc54ae5 ntdll: Pass a nonnull handler_data when continuing after a collided unwind on arm64.
This fixes crashes when handling GNU/mingw style SEH based C++
exceptions on arm64; in these cases unwind_full_data ended up
where it tries to write handler_rva + 1 to *handler_data.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-18 15:12:45 +02:00
Martin Storsjo 93082b3d52 ntdll: Fix arm64 unwind across ELF/PE boundaries.
The previous implementation might have given the impression of
working, as long in some cases where the PE code actually used frame
pointers, but turned out to be subly wrong.

This essentially reverts the functional aspects of 1c9fdaab0f.

Use the new value of the Lr register, after fetching the registers
from unw_step, as the return value.

To make single-stepping unwinding work properly, treat the registers
consistently:

- Make RtlCaptureContext store the current values of x29/Fp and x30/Lr
from within the function, not the ones backed up from the stack.

- After unwinding one step, first fetch the new values of all registers,
including the new value of Lr - then use this value of Lr to set the
new value of Pc (the address to actually return to).

This makes the unwinding actually coherent in reading unwind opcodes and
return addresses from one single function; previously these were out of
sync where the return address ended up being read from the function
one step further up in the call stack.

This fixes unwinding for setjmp for binaries compiled with clang
(in mingw mode).

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-18 15:12:41 +02:00
André Hentschel 44274d172b ntdll: Fix SystemRecommendedSharedDataAlignment on ARM.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=43961
Signed-off-by: André Hentschel <nerv@dawncrow.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-18 12:09:08 +02:00
Damjan Jovanovic 0fd3f0266e ntdll: Fix ELF initializer address calculations on FreeBSD.
dlinfo() doesn't conform to a standard, each platform implements in differently,
if at all. On GNU and NetBSD its l_addr field returned is the "relocbase",
the relative offset between addresses wanted by the file and addresses obtained
in memory (==0 when no relocation occurred), which we add to d_un.d_ptr to
obtain the memory address where the initializer is. On FreeBSD (and possibly
Solaris) this won't work, as l_addr is the "mapbase" instead, the absolute
starting memory address where the binary was loaded, resulting in wrong
calculations and crashes on startup as we call into wrong addresses.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49139
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-18 12:08:36 +02:00
Alexandre Julliard 45a63e5b3c ntdll: Store main() arguments in the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-17 16:54:39 +02:00
Alexandre Julliard 50134cce82 ntdll: Do the pre-exec checks in the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-17 16:54:39 +02:00
Alexandre Julliard 9b8afa0f83 ntdll: Move the Wine version functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-17 16:54:39 +02:00
Alexandre Julliard 2424742d07 ntdll: Move the debug functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-17 11:09:52 +02:00
Alexandre Julliard aaa654abd6 ntdll: Store reserved areas in the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-17 11:07:44 +02:00
Alexandre Julliard 625209433f ntdll: Move the mmap reserved area functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-17 11:07:39 +02:00
Dmitry Timoshkov a0772da5cf ntdll: Don't try to map the PE file past the size of the backing file.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=42125
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-15 11:42:22 +02:00
Alexandre Julliard 7e6a67d8c9 ntdll: Set up virtual memory layout in the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-14 23:12:31 +02:00
Alexandre Julliard b7150570d3 ntdll: Allow ntdll.so to be loaded before wine_init() has run.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-14 23:12:31 +02:00
Alexandre Julliard b7b1ad0962 ntdll: Initial version of the ntdll.so Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-14 23:12:31 +02:00
Alexandre Julliard 6a12d93b88 ntdll: Handle already relocated .dynamic entries.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49139
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-14 20:59:36 +02:00
Alexandre Julliard adb52247e3 ntdll: Fix __sync_bool_compare_and_swap() usage.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-14 20:59:36 +02:00
Alexandre Julliard 604e49056b ntdll: Initialize server directory on macOS when sending Mach port.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-14 20:59:36 +02:00
Alex Henrie 474d1f0b2d ntdll: Implement RtlIpv6StringToAddress(Ex)[AW].
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-14 20:59:36 +02:00
Brendan Shanks b11afa1725 ntdll: Fix length calculation of generated SMBIOS tables.
An extra byte for a null-terminator was added for every string, but not
used when the string was empty. This resulted in extra bytes at the end
of the buffer, causing parse errors in dmidecode.

Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-14 11:40:25 +02:00
Alexandre Julliard 3214ca84d0 ntdll/tests: Add tests for RtlFormatMessage().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-13 20:22:26 +02:00
Alexandre Julliard 497358bbb9 ntdll/tests: Add some printf tests.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-13 14:43:27 +02:00
Alexandre Julliard 5bb9f86dbe ntdll: Implement RtlFormatMessage().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-13 14:43:27 +02:00
Alexandre Julliard b3a0a39356 ntdll: Merge new features from msvcrt's printf implementation.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-13 09:37:14 +02:00
Alexandre Julliard f44e90d284 ntdll: Add a few printf functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-12 23:07:06 +02:00
Rémi Bernon 16e32e3b77 ntdll: Reduce USD section size to 0x1000.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-12 10:58:07 +02:00
Rémi Bernon a1c46c3806 server: Add USD support with timestamp updates.
The USD page is created when the first process (wineboot.exe) completes
its creation, using its provided user_shared_data for initialization.

The server maps the page write-only and the clients map it read-only,
then the server updates the timestamps every 16 ms.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=29168
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-12 10:57:56 +02:00
Rémi Bernon dadf93f409 ntdll/tests: Add tests for USD memory basic info.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-12 10:57:54 +02:00
Rémi Bernon 89c242840d ntdll/tests: Add tests for USD timestamp updates.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-12 10:48:38 +02:00
Alexandre Julliard 8045167117 ntdll/tests: Enable RtlDowncaseUnicodeString() test.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-11 21:24:58 +02:00
Zebediah Figura e012bd5811 ntdll: Avoid leaking the previous environment in RtlSetCurrentEnvironment().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-07 11:30:11 +02:00
Zebediah Figura d98b87a317 ntdll/tests: Add tests for RtlSetCurrentEnvironment().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-07 11:30:09 +02:00
Jacek Caban 93d1eecb6a ntdll: Export _chkstk from importlib.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-05 20:53:02 +02:00
Alexandre Julliard a10f1e9d7b kernel32: Move FlushProcessWriteBuffers() stub to ntdll.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-05 20:53:02 +02:00
Zebediah Figura 74f820fccc ntdll: Export RtlCopyMemoryNonTemporal.
Needed by Blindwrite 7's kernel driver.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-04 12:39:09 +02:00
Alexandre Julliard 39e4b788d6 ntdll: Use the standard Interlocked* functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-02 15:10:04 +02:00
Gijs Vermeulen d8ec1fb894 ntdll: Remove unused function fast_wait_cv().
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-01 22:03:16 +02:00
Alexandre Julliard 2af035f53f ntdll: Remove support for custom virtual memory alignments.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-30 12:37:27 +02:00
Alexandre Julliard dee934c0ff ntdll: Allocate TEBs out of a larger memory block.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-30 12:37:27 +02:00
Alexandre Julliard 5dcb9ddff7 ntdll: Get rid of obsolete KERN_THALTSTACK sysctl.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-30 12:37:27 +02:00
Alexandre Julliard 53b305c35e ntdll: Use server_enter_uninterrupted_section() for LDT locking.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-29 19:53:57 +02:00
Alexandre Julliard bd9a1e23f2 ntdll: Move TEB allocation to the common code.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-28 14:03:26 +02:00
Alexandre Julliard 9650f1d3a1 ntdll: Move signal stack size computation to the common code.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-28 13:34:06 +02:00
Alexandre Julliard ffb7c595c6 ntdll: Add a helper for platform-specific threading initialization.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-28 13:17:07 +02:00
Alexandre Julliard 69f068bfb1 ntdll: Remove VFAT_IOCTL_READDIR_BOTH kernel bugs workarounds.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-28 12:33:11 +02:00
Alexandre Julliard 6b4de51027 ntdll: Don't use a custom alignment for large heap blocks.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-28 12:33:11 +02:00
Alexandre Julliard f5f1737456 ntdll: Store the pending free list in the main process heap.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-28 12:33:11 +02:00
Alexandre Julliard 9fd2330a96 ntdll: Add a helper to exec wineloader.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-28 11:28:29 +02:00
Alexandre Julliard 68a425b19c ntdll: Add a helper to exec wineserver.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-28 11:28:25 +02:00
Alexandre Julliard ba1495f7c2 ntdll: Avoid using wine_dll_enum_load_path() from libwine.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-27 12:35:39 +02:00
Alexandre Julliard 3e0c90e4c7 ntdll: Avoid using wine_get_build/data_dir() from libwine.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-27 12:35:19 +02:00
Alexandre Julliard 9122bc1096 ntdll: Avoid using wine_get_user_name() from libwine.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-27 12:34:45 +02:00
Alexandre Julliard 73211637c1 ntdll: Avoid using wine_get_server_dir() from libwine.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-27 12:34:30 +02:00
Alexandre Julliard e5030a4ac0 ntdll: Avoid using wine_get_config_dir() from libwine.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-27 12:34:07 +02:00
Rémi Bernon daa120309e server: Make sure pids/tids are multiples of four.
Street Fighter V unpacker relies on it when validating other processes
for its anti-debug checks, it uses (PID&0xfffffffc)>>2 as an array index
and then checks back indexes against PIDs, and terminates early if some
PIDs do not match.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-27 12:01:44 +02:00
Rémi Bernon 8bb684c63e ntdll/tests: Test that ptids are multiples of four.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-27 12:01:40 +02:00
Zebediah Figura ea753c384e include: Rename the other In*OrderModuleList fields to In*OrderLinks for consistency.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-24 10:13:49 +02:00
Zebediah Figura 09db718d99 include: Rename BaseAddress to DllBase.
To match Microsoft's public definition.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-24 10:13:46 +02:00
Zebediah Figura 4b3e820e07 include: Rename InMemoryOrderModuleList to InMemoryOrderLinks.
To match Microsoft's public definition.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-24 10:13:43 +02:00
Zebediah Figura feeb1c7c24 include: Rename LDR_MODULE to LDR_DATA_TABLE_ENTRY.
This name is used in Microsoft's public winternl.h.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-24 10:13:39 +02:00
Serge Gautherie 340bc136a7 ntdll: Reorder DECLSPEC_NORETURN on raise_status().
Signed-off-by: Serge Gautherie <winehq-git_serge_180711@gautherie.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-23 12:57:43 +02:00
Paul Gofman b0d3b5b69c ntdll: Return STATUS_PENDING from NtReadFile() for async read in case of EOF.
Fixes crashes in "Planet Zoo" during character or game save.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-23 12:55:32 +02:00
Martin Storsjo ea9f47a767 ntdll: Properly return errors when failing to unwind.
If libunwind is unavailable, make libunwind_virtual_unwind return an
error. Likewise if there was no PE exception info and we didn't try
unwinding using libunwind, we need to return an error when realizing
we were unable to unwind, instead of just warning and returning
success.

This fixes hangs/infinite loops on crashes when unwinding fails.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: André Hentschel <nerv@dawncrow.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-22 17:23:39 +02:00
Jacek Caban c4dab9b76e server: Block by waiting on context handle in get_thread_context.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48052
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45546
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-22 16:47:41 +02:00
Jacek Caban aa0c4bb5e7 server: Don't wait for client thread to enter suspended state in set_thread_context.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-22 16:47:41 +02:00
Alexandre Julliard d2b70aa57a ntdll: Add a helper function to allocate module dependencies.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-22 16:02:10 +02:00
Alexandre Julliard 68e675d73d ntdll: The builtin load callback is no longer used for ntdll itself.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-22 15:51:23 +02:00
Alexandre Julliard 6f4272ce3e ntdll: Call TLS callbacks also for the main exe.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48971
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-22 14:14:40 +02:00
Alexandre Julliard 62807be8c9 makefiles: Explicitly import libwine where necessary.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-21 12:00:08 +02:00
Alexandre Julliard 3872dc55ef ntdll: Support loading ntdll without a constructor.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-21 11:27:11 +02:00
Alexandre Julliard 0a72ec1dac ntdll: Make sure we don't try to attach the main exe a second time.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48961
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-21 11:23:15 +02:00
Alexandre Julliard abb33fb90e ntdll: Also ignore missing directories in NtGetNlsSectionPtr().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48966
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-20 20:54:21 +02:00
Alexandre Julliard fecaa443b5 ntdll: Don't abort directory search in single entry mode when a file is ignored.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48960
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-20 20:54:21 +02:00
Sven Baars 1cfaf1425a ntdll: Fix a memory leak in fork_and_exec.
Signed-off-by: Sven Baars <sbaars@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-20 17:19:11 +02:00
Sven Baars 9ce4383128 ntdll: Fix a string leak in init_user_process_params (Valgrind).
Signed-off-by: Sven Baars <sbaars@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-20 12:49:11 +02:00
Gerald Pfeifer 973138c068 ntdll: Fix call_constructor build on FreeBSD.
Signed-off-by: Gerald Pfeifer <gerald@pfeifer.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-20 12:49:11 +02:00
Jacek Caban eaad238000 ntdll: Leave critical section before blocking in RtlWaitOnAddress.
Fixes regression from commit 4f673d5386.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-20 12:38:05 +02:00
Jacek Caban 7a1069e9bd ntdll: Remove APC handling from RtlWaitOnAddress.
It uses non-alertable wait anyway.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-20 12:36:40 +02:00
Alistair Leslie-Hughes ccce5f769d ntdll: Correct compile error under macos.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-17 14:15:13 +02:00
Jacek Caban 7f9eb22af8 ntdll: Use server_select to pass context to server in send_debug_event.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-16 22:10:04 +02:00
Jacek Caban 137fd7d3a0 ntdll: Block signals in send_debug_event.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-16 22:10:04 +02:00
Jacek Caban 96cc6950f0 ntdll: Use select request instead of get_suspend_context to transfer context back to client.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-16 22:10:04 +02:00
Jacek Caban 5e7ccd182e ntdll: Use select request to pass suspend context to server.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-16 22:10:04 +02:00
Jacek Caban e70b684ded server: Allow passing suspend context in select request.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-16 22:10:04 +02:00
Alexandre Julliard 52bf0fbd47 ntdll: Export Unix user name in WINEUSERNAME variable.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-16 22:10:04 +02:00
Alexandre Julliard 081c8e1c73 ntdll: Execute .so constructors during module initialization.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-16 22:10:03 +02:00
Alexandre Julliard 3935acd4da ntdll: Use a Wine-specific field in WINE_MODREF for the .so handle.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-16 22:10:03 +02:00
Alexandre Julliard 0a3e42e271 ntdll: Load .so builtin modules without using libwine.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-16 22:10:03 +02:00
Alexandre Julliard 6ac357667e ntdll: Support loading builtin modules that don't use a constructor.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-15 19:50:21 +02:00
Jacek Caban b66e13ef24 kernelbase: Implement CreateThreadpoolIo.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-15 11:40:49 +02:00
Alexandre Julliard a55feef63a ntdll: Always use the loaded path as builtin module file name.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-14 22:04:07 +02:00
Alexandre Julliard 19c48204bb ntdll: Allow the module file name to not be null-terminated.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-14 21:59:19 +02:00
Alexandre Julliard fd7992972b ntdll: Don't call entry point for the main process so that we don't need to check the dll flag.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48817
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-14 12:55:38 +02:00
Zebediah Figura a6e70c6074 ntdll: Handle unaligned SRW locks when using futexes.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-14 11:23:04 +02:00
Zebediah Figura 28619e6035 ntdll: Handle unaligned SRW locks when using keyed events.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-14 11:23:02 +02:00
Zebediah Figura aceff21022 ntdll: Handle unaligned condition variables when using futexes.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48389
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-14 11:22:59 +02:00
Jacek Caban 0308c9599d ntdll: Directly use server_select in send_debug_event.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-13 12:15:00 +02:00
Jacek Caban 0ab9e00ef6 ntdll: Directly use server_select in wait_suspend.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-13 12:14:58 +02:00
Jacek Caban 4f673d5386 ntdll: Use server_select in RtlWaitOnAddress.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-13 12:14:55 +02:00
Jacek Caban 8701260768 ntdll: Factor out server_select.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-13 12:14:51 +02:00
Jacek Caban 4f9cc93108 server: Introduce a separated type for user APCs.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-13 12:14:50 +02:00
Zebediah Figura 320a025882 ntdll/tests: Add tests for kernel32 threadpool I/O functions.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-13 11:57:49 +02:00
Zebediah Figura 75e8c4493a ntdll: Implement threadpool I/O queues.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-13 11:57:46 +02:00
Zebediah Figura 74d830755c ntdll: Factor out object_is_finished().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-13 11:57:43 +02:00
Piotr Caban 321d26cbb4 server: Use correct clock in select.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-09 21:04:04 +02:00
Piotr Caban 6d2d3595c0 server: Use monotonic clock in waitable timers.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-09 21:04:04 +02:00