Commit Graph

5648 Commits

Author SHA1 Message Date
Alexandre Julliard 0b3db9dfa2 ntdll: Handle page faults happening during a syscall without dispatching the exception.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-24 11:46:22 +02:00
Zebediah Figura 8bd95a80f2 ntdll: Read the condition variable and manipulate the lock on the PE side.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49712
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-24 11:17:04 +02:00
Paul Gofman 057e7f1940 ntdll: Also save unwind info for rbp in call_consolidate_callback() on x64.
Fixes Bloons TD 6 crash on start.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-24 11:16:40 +02:00
Martin Storsjo 32c618b7c5 ntdll: Add initial tests for arm64 RtlVirtualUnwind.
Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-24 11:16:03 +02:00
Paul Gofman 601175822e ntdll: Restore AVX registers in NtSetContextThread() on i386.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-21 16:54:39 +02:00
Paul Gofman 9aa885bf37 ntdll: Support AVX context in fault exceptions on Linux i386.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-21 16:54:38 +02:00
Paul Gofman 2c3719c7a9 ntdll: Restore AVX registers in NtSetContextThread() on x86_64.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-21 16:54:38 +02:00
Paul Gofman 16ed88a952 ntdll: Support AVX context in fault exceptions on Linux x86_64.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-21 16:54:38 +02:00
Paul Gofman 3f562e0b91 ntdll/tests: Add test for xstate in extended context.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-21 15:36:49 +02:00
Martin Storsjo 5b3842451b include: Update ARM64 context flag definitions to match current SDKs.
CONTEXT_FLOATING_POINT should be included in CONTEXT_FULL, and
there's a new flag CONTEXT_ARM64_X18 (not available without
the arch specific prefix) that only is part of CONTEXT_ALL.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-21 15:01:56 +02:00
Paul Gofman a4af2b2b70 kernel32: Implement GetEnabledXStateFeatures().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-20 21:14:15 +02:00
Paul Gofman 97b5ad7597 wineboot: Initialize XState features in user_shared_data.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-20 18:50:02 +02:00
Paul Gofman de1cb029f6 include: Define _XSAVE_FORMAT structure.
The structure is defined for both x86_64 and i386 (along with
M128A) in (newer) Windows SDK.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-20 18:49:38 +02:00
Paul Gofman 25d4c50db3 ntdll: Remove redundant ldmxcsr in set_full_cpu_context() on x86_64.
Mxcsr will be overwritten anyway by consequent fxrstor.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-20 18:49:26 +02:00
Alexandre Julliard 77fbf3a9fd ntdll: Unwind the syscall frame in NtSetContextThread().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-20 18:45:53 +02:00
Alexandre Julliard a686759f1d ntdll: Unwind the syscall frame when calling KiUserApcDispatcher().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-20 18:45:53 +02:00
Alexandre Julliard 53e0bf2f9f ntdll: Don't expect LdrInitializeThunk() to return to the Unix side.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-20 18:45:53 +02:00
Alexandre Julliard 4a7cd0f492 ntdll: Call NtContinue() from LdrInitializeThunk() instead of returning.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-20 18:23:44 +02:00
Paul Gofman f332f2e4e2 ntdll: Don't transfer xmm registers explicitly during context save and restore on x64.
fxsave / fxrstor already do that.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-19 10:16:57 +02:00
Paul Gofman 525e7078a8 ntdll: Report newer vector processor features on x86 / x64.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-19 10:15:45 +02:00
Martin Storsjo 8f3bd63b52 ntdll: Fix arm64 sigcontext access for darwin.
Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-18 22:33:39 +02:00
Martin Storsjo 7f8224411c ntdll: Fix the arm64 use of libunwind for macOS.
MacOS uses the LLVM libunwind, which doesn't expose quite as much
internals of the cursor as GNU libunwind, and uses slightly different
names for the arch specific register enums (for get/set registers).

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-18 22:33:34 +02:00
Martin Storsjo cffd06ea67 ntdll: Trust libunwind's returned pc value on arm64.
Use this instead of manually copying LR to PC. With GNU libunwind,
both registers are equal after unw_step.

With the LLVM libunwind (which Apple uses), the return address isn't
reflected at all in LR, only in UNW_REG_IP.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-18 22:32:27 +02:00
Serge Gautherie 743ed29af5 winapi_test: Update generated.c files.
Signed-off-by: Serge Gautherie <winehq-git_serge_180711@gautherie.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-14 22:04:03 +02:00
Martin Storsjo e8f2c2464a ntdll: Only call putenv() if we are going to call exec().
If we aren't going to exec (if pre_exec() returns zero), we will
continue using the envp pointer we got from the caller. However,
the putenv() call does update the environment, and this can in
some cases overwrite the array that the old (stale, potentially
dangling) envp pointer points to.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-14 22:04:02 +02:00
Martin Storsjo 00b4a51fcc ntdll: Remove a stray duplicate instruction.
Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-14 22:02:04 +02:00
Paul Gofman 71090bdc2f ntdll: Don't mind epilog in RtlVirtualUnwind() in case of zero op count on x64.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-14 22:02:04 +02:00
Paul Gofman ae07938ba6 ntdll: Support nested exceptions on x64.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-14 22:02:04 +02:00
Paul Gofman c76dc32fef ntdll: Fix unwind from call_consolidate_callback() for PE build on x64.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49698
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-13 12:28:32 +02:00
Paul Gofman 76556bc588 ntdll: Support UWOP_PUSH_MACHFRAME opcode in RtlVirtualUnwind() on x64.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-13 12:27:03 +02:00
Paul Gofman d4052e0d70 ntdll/tests: Always remove hook trampoline in test_kiuserexceptiondispatcher().
As it is not removed by the hook itself if the hook is not called in the last
test.

Fixes test failures on Win 2003.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-13 12:26:34 +02:00
Rémi Bernon 26c078a2a6 ntdll/tests: Run RtlRaiseException tests on x86_64.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-12 11:04:40 +02:00
Rémi Bernon 94ee270972 ntdll/tests: Add broken FltSave results for w2008 / w8.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-12 11:00:46 +02:00
Rémi Bernon f804d1ac70 ntdll/tests: Fix w2008 debugger test results.
Changing Eip has an effect there, so offset it just a little bit so that
it still falls within code.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-12 11:00:42 +02:00
Brendan Shanks fd80e0300c ntdll: Pad HEAP structure so 'flags' offset matches recent Windows.
Needed for Red Dead Redemption 2 to pass anti-debugger checks, it
accesses 'flags' and 'force_flags' at a fixed offset of the ProcessHeap.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49666
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-11 18:20:20 +02:00
Alexandre Julliard 9b7f14f1b4 ntdll: Unwind the syscall frame when calling KiRaiseUserExceptionDispatcher().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-11 17:56:10 +02:00
Alexandre Julliard 1e7e21534e ntdll: Unwind the syscall frame when calling KiUserExceptionDispatcher().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-11 17:56:10 +02:00
Alexandre Julliard 13abe9e2bd ntdll/tests: Run exception tests under the debugger on all platforms.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-11 17:56:10 +02:00
Serge Gautherie 99c0ab2ea1 winapi_test: Restore horizontal alignment of macro defines.
Signed-off-by: Serge Gautherie <winehq-git_serge_180711@gautherie.fr>
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-10 21:26:15 +02:00
Serge Gautherie c26d7470cc winapi_test: Horizontally align TEST_TYPE_SIGNED() parameter.
Signed-off-by: Serge Gautherie <reactos-git_serge_171003@gautherie.fr>
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-10 21:25:56 +02:00
Alexandre Julliard 7a71f98640 ntdll: Use KiUserApcDispatcher() to call user APCs.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-06 19:31:24 +02:00
Alexandre Julliard 2a08e0e290 ntdll: Implement KiUserApcDispatcher().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-06 19:31:06 +02:00
Mikołaj Zalewski 9014dae8fb ntdll: Return from Thumb to ARM mode after assembling raise_func_trampoline_thumb.
Without it, Raspbian gcc thinks the next function
(raise_func_trampoline_arm) is in Thumb and will create its own
trampoline to to execute it as Thumb (bad).

Signed-off-by: Mikołaj Zalewski <mikolaj@zalewski.pl>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-06 11:39:48 +02:00
Daniel Lehman 93fa2e0ab8 ntdll/tests: Handle 32 cores.
Signed-off-by: Daniel Lehman <dlehman25@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-06 11:38:48 +02:00
Brendan Shanks f7895ef25a ntdll: Generate "system boot information" SMBIOS table.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-05 22:52:03 +02:00
Brendan Shanks 734a7120b6 ntdll: Add additional fields to generated SMBIOS chassis info table.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-05 22:52:00 +02:00
Brendan Shanks d29c33a35c ntdll: Add additional fields to generated SMBIOS baseboard info table.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-05 22:51:57 +02:00
Alexandre Julliard 1d3e3a1c8d ntdll: Avoid importing RtlEnterCriticalSection/RtlLeaveCriticalSection from the Unix side.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-05 15:28:31 +02:00
Brendan Shanks 2b76b9f234 ntdll: End generated SMBIOS tables with the end-of-table structure.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-04 22:08:13 +02:00
Brendan Shanks 0720c6cfd0 ntdll: Use unique handle numbers in generated SMBIOS tables.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-04 22:08:11 +02:00
Jacek Caban b59bf31f61 ntdll: Move InterlockedCompareExchange128 support to winnt.h.
Also properly declare intrinsic on msvc.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-04 20:22:38 +02:00
Evgeny Litvinenko 69f1b12a30 ntdll: Add check for totalram, mem_unit in struct sysinfo.
Signed-off-by: Evgeny Litvinenko <evgeny.v.litvinenko@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-03 15:52:15 +02:00
Alexandre Julliard 2c903e9e9b ntdll: Move the critical section fallback code out of the Unix library.
This partially reverts commit ff19f21913.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-03 15:52:15 +02:00
Alexandre Julliard 647c54e539 ntdll: Fix wcsncpy() implementation now that length is unsigned.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49206
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-03 13:00:53 +02:00
Zebediah Figura 31800a1414 server: Use a separate object for each opened mailslot device file.
This is essentially a straight port of 2600ecd4ed.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-03 10:20:03 +02:00
Zebediah Figura f4e5556547 ntdll/tests: Add more tests for object names.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-01 10:02:16 +02:00
Zebediah Figura b7e51a1653 ntdll: Append ntdll.dll to the builtin_modules list.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49626
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-29 21:28:31 +02:00
Zebediah Figura 3f8d60e2ac ntdll: Compare builtins by their device and inode number directly.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-29 21:27:49 +02:00
Alexandre Julliard eee92591bc ntdll/tests: Add thread context test for ARM platforms.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-28 14:16:53 +02:00
Alexandre Julliard 06c09fca31 ntdll/tests: Add tests for RtlCaptureContext() and NtGetContextThread() on x86_64.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-28 14:13:48 +02:00
Alexandre Julliard 8e5c11b964 ntdll/tests: Enable more exception tests on ARM platforms.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-28 14:13:48 +02:00
Alexandre Julliard 94ca95a6d4 ntdll/tests: Fix vectored exception handler usage.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-28 14:13:48 +02:00
Alexandre Julliard d775b9fd93 ntdll: Reimplement RtlRaiseException() to build a correct context on ARM.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-28 13:51:44 +02:00
Alexandre Julliard 57f419993e ntdll: Use a syscall thunk for NtGetContextThread().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-28 13:51:44 +02:00
Alexandre Julliard 15b3584603 winebuild: Store the syscall frame in the thread data on ARM64.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-28 13:35:30 +02:00
Alexandre Julliard 28e443d9e2 winebuild: Store the syscall frame in the thread data on ARM.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-28 13:31:59 +02:00
Alexandre Julliard 9a7c56d9e7 winebuild: Store the syscall frame in the thread data on x86_64.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-28 13:10:28 +02:00
Alexandre Julliard 8e3b5183cc winebuild: Store the syscall frame in the thread data on i386.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-28 13:00:50 +02:00
Matteo Bruni b37371bf20 ntdll: Don't read current CPU frequency on Linux.
On the Linux boxes I tested, reading scaling_cur_freq usually takes
about 12 ms per core.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47128
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-24 18:26:18 +02:00
Alexandre Julliard d18b566995 ntdll: Store the filesystem redirection flag in the 64-bit TEB.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-24 18:26:18 +02:00
Alexandre Julliard a865a4f61d ntdll: Allocate 64-bit TEB and PEB in WoW64 mode.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-24 18:26:18 +02:00
Alexandre Julliard e3b059b5ba ntdll: Store the thread startup info in the ntdll_thread_data structure.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-24 18:26:18 +02:00
Alexandre Julliard 0bf52b09f2 ntdll: Update the TEB and PEB structures for newer Windows versions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-23 23:21:08 +02:00
Alexandre Julliard 9018a37735 ntdll: Call virtual_set_large_address_space() directly from the Unix side.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-22 14:38:40 +02:00
Alexandre Julliard 131e53a1fc ntdll: Avoid private Unix functions in RtlCreateUserStack().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-22 14:38:40 +02:00
Alexandre Julliard 1372d8fc2c ntdll: Implement NtSetInformationProcess(ProcessThreadStackAllocation).
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-22 14:22:16 +02:00
Alexandre Julliard d41b1c28c3 ntdll: Avoid private Unix functions in RtlExitUserThread().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-22 14:22:16 +02:00
Alexandre Julliard 78c772e9d8 ntdll: Use a syscall thunk for NtQueryPerformanceCounter().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-21 18:30:08 +02:00
Alexandre Julliard 4752e252ea ntdll: Use a syscall thunk for NtClose().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-21 18:30:08 +02:00
Alexandre Julliard 5eefbc6db9 ntdll: Implement KiRaiseUserExceptionDispatcher().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-21 18:30:08 +02:00
Alexandre Julliard 688799b1f7 ntdll: Map errno to a status also in directory functions.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49523
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-21 18:30:08 +02:00
Alexandre Julliard f8d42a31c6 ntdll: Set a better exit status when the main image fails to load.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49593
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-21 15:23:28 +02:00
Alexandre Julliard 9def213de3 ntdll: Move the locale system calls to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-20 20:14:41 +02:00
Alexandre Julliard 0e45f7b4cd ntdll: Move various stub functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-20 20:14:41 +02:00
Alexandre Julliard f298db7254 ntdll: Move the security system calls to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-20 20:14:18 +02:00
Alexandre Julliard dd77ff754b ntdll: Move the token functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-20 17:58:12 +02:00
Alexandre Julliard a47f4daf8f ntdll: Move the LPC port syscall stubs to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-20 17:58:12 +02:00
Zebediah Figura ff9ce43c01 ntdll/tests: Make info.c less verbose by default.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-20 11:47:36 +02:00
Zebediah Figura 17785690c0 ntdll/tests: Remove some unnecessary checks in test_query_logicalprocex().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-20 11:47:34 +02:00
Zebediah Figura 9dd1eaab44 ntdll/tests: Return early if ThreadHideFromDebugger isn't supported.
We're not testing anything interesting in this case.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-20 11:47:29 +02:00
Zebediah Figura 519f86d5aa ntdll/tests: Remove todo_wine for tests that now succeed.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-20 11:47:26 +02:00
Zebediah Figura 8ac77cfbf9 ntdll/tests: Remove some workarounds for no longer supported versions of Windows.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-20 11:47:22 +02:00
Gerald Pfeifer f3ca16379d ntdll: Include <signal.h> for sigset_t.
Signed-off-by: Gerald Pfeifer <gerald@pfeifer.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-20 11:46:20 +02:00
Alexandre Julliard b1af31b47a ntdll: Fix a memory leak.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-20 11:45:58 +02:00
Jacek Caban 180f7cf412 ntdll: Always use GNU _CI* functions implementation on clang.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 23:16:52 +02:00
Alexandre Julliard e0a2f85b78 ntdll: Move some power stub functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 23:16:51 +02:00
Alexandre Julliard e7c60141d6 ntdll: Move some timer stub functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 23:16:51 +02:00
Alexandre Julliard 398cfe4807 ntdll: Move some system stub functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 23:16:51 +02:00
Alexandre Julliard 0eae5d3abc ntdll: Move the atom system calls to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 23:16:51 +02:00
Alexandre Julliard 76e48978a9 ntdll: Move more object manager functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 23:16:51 +02:00
Alexandre Julliard 28bf959c5c ntdll: Move the remaining file functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 23:16:51 +02:00
Alexandre Julliard 7053b7c615 ntdll: Move the registry system calls to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 23:16:51 +02:00
Zebediah Figura de1eaee480 ntdll/tests: Fix a copy-paste error.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 11:00:57 +02:00
Zebediah Figura 2a53947028 ntdll/tests: Use wide character string literals in om.c.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 11:00:55 +02:00
Zebediah Figura 5e240cdf50 ntdll/tests: Convert DIR_TEST_CREATE_OPEN into a function.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 11:00:53 +02:00
Zebediah Figura d7e12831b0 ntdll/tests: Remove some workarounds for no longer supported versions of Windows.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 11:00:52 +02:00
Paul Gofman 2aa58e43a0 ntdll/tests: Test KiUserExceptionDispatcher with RtlUnwind on i386.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 00:04:13 +02:00
Paul Gofman 12dba1b2ae ntdll: Fix PE unwind info for %rsi, %rdi in KiUserExceptionDispatcher.
Fixes StarCraft crash on start.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 00:04:13 +02:00
Zebediah Figura 77e74fb1db ntdll: Implement NtMakeTemporaryObject().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 00:04:13 +02:00
Alexandre Julliard 0534beb331 ntdll: Use syscall thunks for object manager functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 00:04:13 +02:00
Alexandre Julliard 40d403c926 ntdll: Use syscall thunks for system functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 00:04:13 +02:00
Alexandre Julliard e3e477e6a1 ntdll: Use syscall thunks for virtual memory functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 00:04:13 +02:00
Alexandre Julliard 3b4c2ffb7b ntdll: Use syscall thunks for file functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 00:04:13 +02:00
Alexandre Julliard 635e914bde ntdll: Use syscall thunks for process functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 00:04:13 +02:00
Alexandre Julliard 00e7d50f8b ntdll: Use syscall thunks for thread functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 00:04:13 +02:00
Alexandre Julliard c5f66fc784 ntdll: Use syscall thunks for I/O completion functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 00:04:13 +02:00
Alexandre Julliard eb45a75a2e ntdll: Use syscall thunks for keyed event functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 00:04:13 +02:00
Alexandre Julliard 9f8acda167 ntdll: Use syscall thunks for wait functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 00:04:13 +02:00
Alexandre Julliard aa08e15415 ntdll: Use syscall thunks for timer functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 00:04:13 +02:00
Alexandre Julliard 66e6d87ab8 ntdll: Use syscall thunks for job functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 00:04:13 +02:00
Alexandre Julliard 3f51cb6304 ntdll: Use syscall thunks for mutex functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 00:04:13 +02:00
Alexandre Julliard f4c403d1f2 ntdll: Use syscall thunks for event functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 00:04:13 +02:00
Alexandre Julliard bc2164e074 ntdll: Use syscall thunks for semaphore functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 00:04:13 +02:00
Alexandre Julliard 14994715e9 ntdll: Avoid buffer underflow in find_dos_device().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-17 00:04:13 +02:00
Jacek Caban 42cb7d2ad1 ntdll: Silence server_ioctl_file debug traces.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-15 22:57:57 +02:00
Alexandre Julliard 704d0662be ntdll: Fix RtlSizeHeap() error value for 64-bit.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-15 16:33:02 +02:00
Alexandre Julliard 82dc024a35 ntdll: Use separate handlers for SIGSEGV/SIGILL/SIGBUS on ARM64.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-15 16:33:02 +02:00
Alexandre Julliard 7b79532448 ntdll: Send debug event before pushing exception data on x86_64.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-15 15:22:36 +02:00
Alexandre Julliard 3889c374a1 ntdll: Send debug event before pushing exception data on x86.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-15 15:22:36 +02:00
Alexandre Julliard ae15a4ca5a ntdll: Send debug event before pushing exception data on ARM64.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-15 15:22:30 +02:00
Alexandre Julliard adb4e74b47 ntdll: Send debug event before pushing exception data on ARM.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-15 10:36:23 +02:00
Alexandre Julliard 1e4865ffcf ntdll: Handle signals on the signal stack also on ARM.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-15 10:34:18 +02:00
Alexandre Julliard 485c8566f1 ntdll: Build the exception record on the signal stack first.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-15 10:31:19 +02:00
Alexandre Julliard ca45eda758 ntdll: Add a helper function to push the exception data to the thread stack.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-15 10:30:45 +02:00
Alexandre Julliard 9a9fb47e24 ntdll: Also handle stack guard page faults in virtual_handle_fault().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-15 10:29:50 +02:00
Alexandre Julliard f1e4c54104 ntdll: Add a helper function to grow the stack on guard page faults.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-15 10:28:57 +02:00
Alexandre Julliard 432d504118 ntdll: Pass the stack address to the virtual_handle_fault() function.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-15 10:28:26 +02:00
Alexandre Julliard 5a68254c13 ntdll: Handle faults inside the signal handler also on ARM.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-15 10:23:52 +02:00
Alexandre Julliard f30ba2cf25 ntdll: Add support for FPU registers in signal context on ARM.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-15 10:23:34 +02:00
Alexandre Julliard 99851ca4c2 ntdll: Initialize the thread signal stack in the common code.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-15 10:23:00 +02:00
Myah Caron 4617f83fcf ntdll/tests: Add test to check if GetTickCount is updated after sleeping.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49564
Signed-off-by: Myah Caron <qsniyg@protonmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-14 18:27:59 +02:00
Piotr Caban a6fb7be678 ntdll: Ignore L length specifier in printf.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-14 18:27:59 +02:00
Alexandre Julliard 20bc32cddc ntdll: Use malloc() to allocate temporary system information.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-14 10:35:27 +02:00
Alexandre Julliard 242dc8989a ntdll: Use malloc() to allocate the system processor information.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-14 10:35:14 +02:00
Alexandre Julliard fe7b8d70d5 ntdll: Use malloc() to allocate the logical processor information.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-14 10:34:31 +02:00
Alexandre Julliard 42a2ad202e ntdll: Use malloc() to allocate temporary process data.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-14 10:33:57 +02:00
Alexandre Julliard 83f9e784e4 ntdll: Use malloc() to allocate temporary filename buffers.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-14 10:33:47 +02:00
Alexandre Julliard e9abe3f739 ntdll: Use malloc() to allocate the directory cache.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-14 10:33:18 +02:00
Alexandre Julliard b2d38f1531 ntdll: Use malloc() to allocate the buffer in get_device_mount_point().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-14 10:33:05 +02:00
Alexandre Julliard 9ec5be2cea ntdll: Use malloc() to allocate the buffer in server_get_unix_name().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-14 10:32:55 +02:00
Alexandre Julliard 1037bf54bf ntdll: Use malloc() to allocate the buffer in nt_to_unix_file_name() and related helpers.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-14 10:32:31 +02:00
Alexandre Julliard ef01f6ac13 ntdll: Use malloc() to allocate the buffer in unix_to_nt_file_name().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-14 10:32:04 +02:00
Paul Gofman fdb3d9ae32 ntdll: Use MAP_FIXED_NOREPLACE flag in try_map_free_area() if available.
Avoids actual mapping followed by unmapping back if the memory range is
already mapped.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-13 21:26:23 +02:00
Paul Gofman 5498ebd8c0 ntdll: Stop search on mmap() error in try_map_free_area().
The anon mmap errors do not depend on start address hint. Ignoring them
makes the search take incredible time until it fails.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-13 21:26:23 +02:00
Alexandre Julliard 052e8dbf59 ntdll: Use a pthread mutex for the wait on address section.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-13 21:22:14 +02:00
Alexandre Julliard 85db4f7ec2 ntdll: Use a pthread mutex for the current directory section.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-13 21:22:14 +02:00
Alexandre Julliard d7ef680e95 ntdll: Use a pthread mutex for the drive info section.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-13 21:22:14 +02:00
Alexandre Julliard 3b745f17b5 ntdll: Use a pthread mutex for the mount info section.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-13 21:22:14 +02:00
Alexandre Julliard 99520e1997 ntdll: Use a pthread mutex for the timezone section.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-13 21:22:13 +02:00
Alexandre Julliard 992bdd77a0 ntdll: Use a pthread mutex for the CD-ROM cache section.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-13 21:22:13 +02:00
Alexandre Julliard fdb09f4523 ntdll: Move the activation context initialization out of NtCreateThreadEx().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-13 21:22:13 +02:00
Alexandre Julliard c71da19d24 ntdll: Implement RtlActivateActivationContextEx().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-13 21:22:13 +02:00
Alexandre Julliard c6fea822a9 ntdll: Return the TEB pointer in NtCreateThreadEx().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-13 21:22:13 +02:00
Zebediah Figura fb8a44f3ee ntdll: Don't translate Unix virtual disks to FILE_DEVICE_VIRTUAL_DISK.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=36546
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-10 13:19:27 +02:00
Alexandre Julliard 63b66c9955 ntdll: Avoid using RtlQueueWorkItem() in the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-10 13:19:27 +02:00
Alexandre Julliard afb1654567 ntdll: Avoid using LdrQueryProcessModuleInformation() in the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-10 07:58:35 +02:00
Alexandre Julliard bcc3410732 ntdll: Avoid using RtlDosPathNameToNtPathName_U() in the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-10 07:58:14 +02:00
Alexandre Julliard 0357d2ca75 ntdll: Avoid using RtlInitUnicodeString() in the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-10 07:57:59 +02:00
Alexandre Julliard 9ac3f24f74 ntdll: Move the FSCTL_PIPE_IMPERSONATE semi-stub to the server.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-10 07:57:07 +02:00
Alexandre Julliard 4a49af0cbe ntdll: Add a local helper function to check DOS 8.3 names.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-10 07:56:39 +02:00
Alexandre Julliard eccd21e387 ntdll: Add a helper function to retrieve the NT headers of the main exe.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-10 07:56:18 +02:00
Alexandre Julliard 9ec262ebcc ntdll: Add a helper function to open a file from its Unix path.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-10 07:56:02 +02:00
Alexandre Julliard a2e77268f2 ntdll: Silence a noisy error.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-10 07:55:28 +02:00
Paul Gofman 095b0f5acc ntdll: Fix stack adjustment condition in call_user_exception_dispatcher on x86_64.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-09 19:41:40 +02:00
Paul Gofman e722660114 ntdll: Fixup instruction pointer for EXCEPTION_BREAKPOINT in the Unix part on x86/x86_64.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-09 19:41:40 +02:00
Zebediah Figura 829c759513 ntdll: Fill the VM counters in NtQuerySystemInformation(SystemProcessInformation).
Process Hacker displays this information.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-09 17:39:58 +02:00
Alexandre Julliard b14eee69c7 ntdll: Use stack buffers to retrieve the drive info from mountmgr.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-09 15:34:00 +02:00
Alexandre Julliard 113e9811c4 ntdll: Clear the reply data on error in virtual_locked_server_call().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-09 15:34:00 +02:00
Alexandre Julliard 6f862a1ad8 ntdll: Allocate the buffer in the caller for wine_unix_to_nt_file_name().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-09 15:34:00 +02:00
Alexandre Julliard 5ebdeaaa37 ntdll: Use char pointers instead of ANSI/UNICODE_STRING in unix_to_nt_file_name().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-09 13:04:05 +02:00
Alexandre Julliard 368e3a93b8 ntdll: Allocate the return buffer in the caller for wine_nt_to_unix_file_name().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-09 13:04:05 +02:00
Alexandre Julliard d0a16b7dc9 ntdll: Return a char pointer instead of an ANSI_STRING in nt_to_unix_file_name().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-09 13:04:05 +02:00
Alexandre Julliard 49fcd632e4 ntdll: Disallow relative paths in wine_unix_to_nt_file_name(), handle them in the caller.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-08 16:05:49 +02:00
Alexandre Julliard f8699c0a71 kernel32: Move RemoveDirectoryA/W() implementation to kernelbase.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-08 16:05:26 +02:00
Alexandre Julliard 518decf16b ntdll: Move NtQueryObject/NtSetInformationObject to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-08 14:38:23 +02:00
Zebediah Figura 82cd85b079 ntdll: Set the thread creation time in NtQuerySystemInformation(SystemProcessInformation).
Process Hacker displays this information.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-08 07:57:41 +02:00
Zebediah Figura 8297392734 ntdll: Set the process creation time in NtQuerySystemInformation(SystemProcessInformation).
Process Hacker displays this information.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-08 07:57:34 +02:00
Paul Gofman 8898a69519 ntdll: Use case sensitive search for \??\unix file names only.
Fixes crash on start in Planet Zoo and Jurassic World Evolution.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-07 19:40:28 +02:00
Alexandre Julliard 2d38551dd9 ntdll: Use macros to define both A and W printf functions.
This is similar to what msvcrt does.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-07 19:24:27 +02:00
Alexandre Julliard 1a43c5de71 ntdll: Use proper flags instead of characters for printf flags.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-07 19:24:27 +02:00
Zebediah Figura 8622eb326f ntdll: Reimplement NtQuerySystemInformation(SystemProcessInformation) using a single server call.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-07 19:24:27 +02:00
Alexandre Julliard ec3cdaba4f ntdll/tests: Enable a few tests on all platforms.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-07 13:10:13 +02:00
Paul Gofman af3aee8a5a ntdll: Don't call NtRaiseException() on x64 if debugger is not present.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-07 13:07:23 +02:00
Paul Gofman c198390c78 ntdll: Fix KiUserExceptionDispatcher ABI on x86.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-07 13:07:23 +02:00
Alexandre Julliard dfa48037ec ntdll: Use syscalls for NtCreateFile() and NtOpenFile().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-07 13:07:23 +02:00
Thomas Crider 031c744a1f ntdll: Add missing LC_NUMERIC locale setting to init_locale.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49489
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49417
Signed-off-by: Thomas Crider <gloriouseggroll@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-06 22:39:32 +02:00
Zebediah Figura 5376bc5ee4 ntdll: Correct a comment referring to fd_cache_section.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-06 21:08:56 +02:00
Piotr Caban 1d093acc1f ntdll: Fix 64-bit values printing in relay.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-06 21:04:45 +02:00
Alexandre Julliard 086072ca6a ntdll: Reserve memory areas on all platforms.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-05 09:25:17 +02:00
Alexandre Julliard 695bf7a645 ntdll: Update working set limit also when loading a builtin dll.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-04 19:07:36 +02:00
Alexandre Julliard b64208df0d ntdll: The loader is named wine64 only on platforms that support WoW64.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49438
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-03 19:44:15 +02:00
Alexandre Julliard e9951dbe37 ntdll: Use malloc() to allocate async I/O data.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-03 12:04:40 +02:00
Alexandre Julliard a07cff77d3 ntdll: Use malloc() to allocate the object attributes buffer.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-03 12:04:02 +02:00
Alexandre Julliard 72fc2ceaa6 ntdll: Use pthread mutexes for uninterrupted sections in the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-03 12:02:58 +02:00
Paul Gofman c02b63fb60 ntdll: Add PE frame handling to KiUserExceptionDispatcher() on x64.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-02 18:01:21 +02:00
Paul Gofman 69b6572338 ntdll: Don't reset rsp to context->Rsp until exception data is copied.
Context record may be stored on stack below context stack. This
happens, e. g., with RtlRaiseException().

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-02 14:17:36 +02:00
Huw Davies 25d6abb951 ntdll: Pass the start of the string to compose_string().
Fixes a regression caused by 520040dc4a.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-02 11:57:00 +02:00
Paul Gofman 824f40596c ntdll/tests: Add test for x86_64 KiUserExceptionDispatcher().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-01 15:07:33 +02:00
Paul Gofman 887332f9c7 ntdll: Fix KiUserExceptionDispatcher ABI on x86_64.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49436
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-01 15:07:33 +02:00
Alexandre Julliard 21f1fa82a8 ntdll: Fix uninitialized buffer in locale initialization.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49494
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-01 15:07:15 +02:00
Alexandre Julliard 520040dc4a ntdll: Avoid importing the codepage functions from the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-01 10:59:35 +02:00
Alexandre Julliard 8885a51347 ntdll: Get rid of DllMain in the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-01 10:59:35 +02:00
Zebediah Figura 2d5bd21f31 ntdll: Fill the PrivateUsage field of VM_COUNTERS_EX.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-01 10:59:35 +02:00
Zebediah Figura acc52bc90e include: Use the public VM_COUNTERS and VM_COUNTERS_EX structure definitions.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-01 10:59:35 +02:00
Gijs Vermeulen b6722aa752 ntdll: Don't use WCHAR in unix_to_win_locale().
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-30 17:51:29 +02:00
Biswapriyo Nath d324014d42 ntdll/unix: Use Pc instead of Rip in signal_arm64.
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-30 17:51:22 +02:00
Alexandre Julliard 3df16c0b70 ntdll: Use the exported name directly for a few more functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-30 12:25:08 +02:00
Alexandre Julliard 70fceaa2fe ntdll: Use the standard C library names for the wide char functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-30 12:25:08 +02:00
Alexandre Julliard cfc9da22f5 ntdll: Use the standard C library names for the string functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-30 12:25:08 +02:00
Alexandre Julliard 4478ba258e ntdll: Use the standard C library names for the printf functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-30 12:25:08 +02:00
Alexandre Julliard 8a169390c9 ntdll: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-30 12:25:08 +02:00
Alexandre Julliard f89f7a54c2 ntdll: Support loading a PE-format ntdll.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-30 12:21:15 +02:00
Alexandre Julliard 4fcf20d1d1 ntdll: Move part of the PE image mapping code into virtual_map_section().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-30 12:21:15 +02:00
Alexandre Julliard 64731a8e9f ntdll: Fix a few more thread information access rights.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-30 11:05:53 +02:00
Rémi Bernon e1e34cdc37 ntdll: Correctly implement ThreadHideFromDebugger.
At least, store the thread information, instead of pretending and
failing to correctly validate handles and access rights.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-30 11:05:53 +02:00
Rémi Bernon eef527723f ntdll/tests: Add more HideFromDebugger tests.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-30 11:05:53 +02:00
Francois Gouget 1aa64a30be ntdll: Fix wording of a comment.
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-29 21:07:43 +02:00
Alexandre Julliard 43be3507c0 ntdll: Setup the main thread before initializing ntdll.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-29 19:51:47 +02:00
Alexandre Julliard 83a4549e9b ntdll: Remove support for being loaded directly from libwine.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-29 19:51:47 +02:00
Alexandre Julliard 15c3eaafbb ntdll: Move retrieving the startup info to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-29 19:51:47 +02:00
Alexandre Julliard f1ff598e2a ntdll: Update the __wine_ldt_copy pointer directly from the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-29 19:51:47 +02:00
Alexandre Julliard 2334f4e645 ntdll: Stop sharing the thread counter with the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-29 19:51:47 +02:00
Alexandre Julliard 067648cd2b ntdll: Reimplement the string functions to avoid depending on libc.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-29 19:51:47 +02:00
Alexandre Julliard bc8745851e ntdll: Reimplement the ctype functions to avoid depending on libc.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-29 19:51:47 +02:00
Alexandre Julliard 716cf7d342 ntdll: Avoid a compiler warning when fetching the return address.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-29 19:51:47 +02:00
Alexandre Julliard 38c78a9682 ntdll: Avoid some Unix dependencies.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-29 19:51:47 +02:00
Alexandre Julliard b9f531a0e8 ntdll: Move the console handle initialization to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-29 19:51:46 +02:00
Michael Müller ed566a8723 ntdll: Return process times in NtQuerySystemInformation(SystemProcessInformation).
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-29 19:51:46 +02:00
Michael Müller 69e9651c1a ntdll: Return thread times in NtQuerySystemInformation(SystemProcessInformation).
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-29 19:51:46 +02:00
Sebastian Lackner 847b93c740 ntdll: Implement NtQueryInformationThread(ThreadTimes) using procfs.
Based on a patch by Ray Hinchliffe <ray@pobox.co.uk>.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=20230
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-29 19:51:46 +02:00
Jacek Caban d2a3104f5f ntdll: Support CONIN$ and CONOUT$ in RtlIsDosDeviceName_U.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-26 21:52:10 +02:00
Alexandre Julliard 8b36885973 ntdll: Fix some stdcall/cdecl calling convention mismatches.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-26 20:53:33 +02:00
Alexandre Julliard dde38fda6e ntdll: Use Windows APIs to handle the dll overrides variable.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-26 20:53:33 +02:00
Alexandre Julliard e605919198 ntdll: Move the math functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-26 09:12:11 +02:00
Alexandre Julliard b8dc6b2412 ntdll: Move RtlGetSystemTimePrecise() to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-25 23:08:30 +02:00
Alexandre Julliard 13c1f008c0 ntdll: Move the timezone detection code to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-25 23:08:30 +02:00
Alexandre Julliard 7161dcd426 ntdll: Return the current time and timezone bias in NtQuerySystemInformation(SystemTimeOfDayInformation).
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-25 23:08:30 +02:00
Alexandre Julliard c031662fd0 ntdll: Always set the thread context through NtSetContextThread().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-25 23:08:30 +02:00
Alexandre Julliard 10dbd1edd1 ntdll: Move the libunwind support to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-25 23:08:30 +02:00
Paul Gofman 1f6423f778 ntdll: Call TLS callbacks for main exe on thread detach.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-24 22:36:21 +02:00
Paul Gofman 1dc3383389 ntdll: Call TLS callbacks also for main exe on thread attach.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49007
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49098
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49041
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-24 22:36:19 +02:00
Rémi Bernon f5a8ed47a3 ntdll: Leave some space around DbgBreakPoint and DbgUserBreakPoint.
CoD: Black Ops 3 and CoD: WWII modify these (and several others) and
expect to have enough space for a few instructions.

It then verifies later that the patches are still in place, and
terminates if the byte sequence do not match. Having small symbols can
make the patches to overlap and the check to fail.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-24 18:31:09 +02:00
Alexandre Julliard 438abad27c ntdll: Set the Wine paths environment variables from the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-24 18:31:09 +02:00
Alexandre Julliard 36e55720b6 ntdll: Store home directory and username at init time in the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-24 09:20:33 +02:00
Paul Gofman 01143089f0 ntdll: Also call fsync() for FD_TYPE_CHAR in NtFlushBuffersFile().
Fixes a regression introduced by
3078f10d43. Files of FD_TYPE_CHAR
were also flushed by fsync() on server before referenced commit.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-23 22:38:05 +02:00
Alexandre Julliard 9b9845e43e ntdll: Move the system information functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-23 20:23:55 +02:00
Alexandre Julliard 577b392440 ntdll: Move searching for builtin dlls to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-23 20:15:53 +02:00
Alexandre Julliard 31538a79a9 ntdll: Move the loading of .so dlls to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-23 20:09:42 +02:00
Alexandre Julliard 99649d7892 ntdll: Add a common helper for building a modref.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-23 19:31:18 +02:00
Rémi Bernon b7ccb9d06a ntdll: Only raise EXCEPTION_INVALID_HANDLE if debugger is present.
CoD: WWII writes to PEB->BeingDebugged field, so we cannot completely
trust it, but we can double check with ProcessDebugPort.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-23 10:16:14 +02:00
Rémi Bernon 537bb7a8ae ntdll: Refine NtSetInformationThread ThreadHideFromDebugger stubs.
CoD: Black Ops 3 and CoD: WWII do each one of these calls and terminate
if they return unexpected results.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-23 10:12:31 +02:00
Alex Henrie 449b8c7e92 include: Add RTL_GENERIC_TABLE.
And fix RtlInitializeGenericTable's return type while updating the ntdll
functions to use the newly added typedefs.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-22 21:04:40 +02:00
Paul Gofman 6d712a42ca ntdll: Increment num_busy_workers when queuing TP object.
Otherwise two consequative submits may have the same
num_busy_workers value if threadpool_worker_proc did not
have a chance to pick the work in between. A new thread is
not created in tp_submit() for the second submit and if the
first submit queues an (infinitely long) wait
the next submitted callback is not called for indefinite
time period.

Fixes hang on exit in Detroit Become Human.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-22 16:43:12 +02:00
Alexandre Julliard 67949d96a7 ntdll: Make the client cpu constant global.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-22 16:43:12 +02:00
Alexandre Julliard 9e3893cc29 ntdll: Use FSCTL_GET_OBJECT_ID to compare file identities.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-22 12:06:19 +02:00
Alexandre Julliard 251335cdf3 ntdll: Implement FSCTL_GET_OBJECT_ID to retrieve a file id.
It can be used instead of FileIdInformation to avoid depending on
mountmgr.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-22 12:05:15 +02:00
Alexandre Julliard 6ff0bb786c ntdll: Set the Unix current directory also in the exec process case.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49425
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-22 12:04:35 +02:00
Alexandre Julliard c468a36903 ntdll: Use unix_to_nt_file_name() to convert Unix paths in RtlGetFullPathName_U().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-21 16:48:24 +02:00
Alexandre Julliard a2c890c1e1 ntdll: Actually return an NT path in wine_unix_to_nt_file_name() for relative paths.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-19 18:34:40 +02:00
André Hentschel 5f9f827fd4 ntdll: Change master/slave to more neutral words.
Signed-off-by: André Hentschel <nerv@dawncrow.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-18 19:56:43 +02:00
Alexandre Julliard 78532a0c09 ntdll: Move the directory change functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-18 19:56:43 +02:00
Alexandre Julliard 7e3d265469 ntdll: Move the volume information functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-18 19:56:43 +02:00
Alexandre Julliard a0b7fb9bb2 ntdll: Move the image address initialization to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-18 14:48:15 +02:00
Alexandre Julliard 2e6a2cf9c6 ntdll: Move the WoW64 thread context functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-18 14:48:15 +02:00
Alexandre Julliard e84ec36a62 ntdll: Move the thread get/set information functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-18 14:48:15 +02:00
Alexandre Julliard 44a230937b ntdll: Move the remaining process functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-18 14:48:15 +02:00
Alexandre Julliard 2ec86fc20a ntdll: Remove support for PPC32.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-17 16:46:14 +02:00
Alexandre Julliard df5e476487 ntdll: Move the current directory initialization to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-17 16:27:24 +02:00
Alexandre Julliard c1dc5021ac ntdll: Dynamically load callback functions from the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-17 16:27:24 +02:00
Alexandre Julliard 7e9ccbe68f ntdll: Move the Unix to NT file name conversion support to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-17 00:05:40 +02:00
Alexandre Julliard f6bfb4ce00 ntdll: Move the device I/O control functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-16 18:36:30 +02:00
Alexandre Julliard 888d66a237 ntdll: Move the file read/write functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-16 18:36:30 +02:00
Alexandre Julliard e9e5c95058 ntdll: Move the process information functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-16 18:36:30 +02:00
Alexandre Julliard c4c3b06e83 ntdll: Move the NtCreateUserProcess() implementation to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-16 12:04:13 +02:00
Gerald Pfeifer a20b997b34 ntdll: Include <signal.h> where needed in the Unix library.
Signed-off-by: Gerald Pfeifer <gerald@pfeifer.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-15 11:21:34 +02:00
Alexandre Julliard 98eab245d3 ntdll: Initialize file redirects only after the server is connected.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49380
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-14 19:35:20 +02:00
Alexandre Julliard c3e2013b61 ntdll: Move the get/set file information functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-14 19:35:20 +02:00
Alexandre Julliard 07248fc500 ntdll: Move the job functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-13 13:46:01 +02:00
Alexandre Julliard 06fa3d32a7 ntdll: Move the IO completion functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-13 11:56:30 +02:00
Nikolay Sivov dd9295b415 ntdll: Create class section for proxy-stub interface entries.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-12 17:16:25 +02:00
Alexandre Julliard 9ed9512662 ntdll: Move a few file functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-12 17:16:25 +02:00
Alexandre Julliard e0fca94511 ntdll: Move the directory functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-12 16:42:24 +02:00
Alexandre Julliard 573be7e602 ntdll: Load the case mapping table in the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-12 14:32:11 +02:00
Alexandre Julliard 412555e0cd ntdll: Move fork and exec support to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-12 14:32:11 +02:00
Nikolay Sivov 72d055854b ntdll: Use single field for misc flags in ComClass redirection section.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-11 21:03:34 +02:00
Nikolay Sivov d4c2b61c48 ntdll: Fix a typo in security descriptor flags.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-11 21:03:31 +02:00
Alexandre Julliard b86dc3926b ntdll: Move the locales initialization to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-11 15:51:18 +02:00
Alexandre Julliard ee5c842e53 ntdll: Move the creation of the initial environment to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-11 15:51:18 +02:00
Alexandre Julliard a4ce2f652d ntdll: Move Nt system time functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-11 15:51:18 +02:00
Alexandre Julliard 84d25135b3 ntdll: Implement NtCreateUserProcess().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-10 22:38:49 +02:00
Alexandre Julliard df513b95ec ntdll: Avoid referencing security descriptor functions from the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-10 08:50:35 +02:00
Damjan Jovanovic f728a5f3f9 ntdll: Interpretation of l_addr depends on FreeBSD version.
FreeBSD changed l_addr to mean the relocation offset like it
does on other OSes, and provided a dynamic linker symbol,
"_rtld_version_laddr_offset", that can be used to check the
meaning.

Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-10 08:32:33 +02:00
Paul Gofman 3078f10d43 ntdll: Perform fsync() in client for files and directories.
Fixes stuttering in Assetto Corsa Competizione (multiplayer mode).

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 21:23:33 +02:00
Derek Lesho d8d6a6b2e6 server: Partially implement JobObjectBasicAccountingInformation.
Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 21:23:33 +02:00
Daniel Lehman a302ab44ac server: Fail if non-empty directory marked for deletion.
Signed-off-by: Daniel Lehman <dlehman25@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 21:23:33 +02:00
Jacek Caban f2e886a006 ntdll: Export builtin functions as cdecl.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 21:23:33 +02:00
Jacek Caban a8f02f0091 ntdll/tests: Add long long builtins tests.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 21:23:33 +02:00
Jacek Caban 04117dc8d4 ntdll: Reimplement _allmul using 32-bit arithmetic.
Based on compiler-rt.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 21:23:33 +02:00
Jacek Caban 0547da64a3 ntdll: Reimplement _allrem using 32-bit arithmetic.
Based on compiler-rt.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 21:23:33 +02:00
Jacek Caban 8f144eb566 ntdll: Reimplement _alldiv using 32-bit arithmetic.
Based on compiler-rt.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 21:23:33 +02:00
Jacek Caban 744843ed01 ntdll: Reimplement _aullrem using 32-bit arithmetic.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 21:23:33 +02:00
Jacek Caban d53672c6ec ntdll: Reimplement _aulldiv using 32-bit arithmetic.
Based on compiler-rt.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 21:23:33 +02:00
Alexandre Julliard a240abf12b ntdll: Avoid overflowing the command line buffer.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49314
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 21:23:33 +02:00
Alexandre Julliard ff19f21913 ntdll: Move the futex-based critical section implementation to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 21:23:33 +02:00
Alexandre Julliard 552bc8aa47 ntdll: Move the wait on address implementation to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 15:47:30 +02:00
Alexandre Julliard 509ad75adb ntdll: Move the futex-based condition variable implementation to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 15:47:30 +02:00
Alexandre Julliard 246dedaa09 ntdll: Move the futex-based SRW lock implementation to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 15:25:52 +02:00
Alexandre Julliard 4d70266274 ntdll: Move some more thread functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 15:25:52 +02:00
Alexandre Julliard 2333099c52 ntdll: Move signal handlers to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 15:25:52 +02:00
Gerald Pfeifer 0c14b1a962 ntdll: Replicate InterlockedCompareExchange64 to the Unix library.
This fixes the build on FreeBSD/i386 with GCC 9.

Signed-off-by: Gerald Pfeifer <gerald@pfeifer.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-08 21:01:32 +02:00
Zebediah Figura 19007cf31f ntdll: Avoid leaking "drive" on error paths from get_mountmgr_fs_info() (Valgrind).
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-08 21:01:32 +02:00
Alexandre Julliard 683583faf2 ntdll: Remove support for setting custom signal handlers.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-06 16:45:36 +02:00
Alexandre Julliard 20c91c5e80 ntdll: Use NtContinue() to set the thread initial context.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-06 15:41:38 +02:00
Alexandre Julliard 7f28a1c521 ntdll: Use NtContinue() to restore context after an exception.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-06 15:17:07 +02:00
Alexandre Julliard 95e2d05e5d ntdll: Implement NtContinue() in the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-06 15:16:38 +02:00
Alexandre Julliard e561ce4b92 ntdll: Move NtRaiseException() implementation to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-06 14:31:00 +02:00
Alexandre Julliard 8e5d304278 ntdll: Move DbgUiIssueRemoteBreakin() to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-05 16:54:35 +02:00
Alexandre Julliard 245efd04e1 ntdll: Move NtCreateThreadEx() to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-05 16:40:53 +02:00
Alexandre Julliard 33c750f50f ntdll: Use NtCreateThreadEx() for remote thread creation.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-05 15:23:37 +02:00
Alexandre Julliard 39e7f25e09 ntdll: Implement RtlCreateUserThread() on top of NtCreateThreadEx().
Based on a patch by Andrew Wesie.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-05 15:09:53 +02:00
Alexandre Julliard ca3ca7b046 ntdll: Move the rest of the thread creation code to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-05 14:25:36 +02:00
Alexandre Julliard cdfc45859c ntdll: Move the section object functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-04 22:36:39 +02:00
Alexandre Julliard f1276b25ae ntdll: Move the keyed event functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-04 22:36:38 +02:00
Alexandre Julliard 65edacf934 ntdll: Move the timer functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-04 22:36:38 +02:00
Alexandre Julliard 8b87d6b814 ntdll: Move the mutex functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-04 22:36:38 +02:00
Alexandre Julliard efd59e378c ntdll: Move the event functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-04 22:36:38 +02:00
Alexandre Julliard 39915c9bc4 ntdll: Move the semaphore functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-04 22:36:38 +02:00
Alexandre Julliard a184449841 ntdll: Move some wait functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-04 22:36:38 +02:00
Alexandre Julliard 4ffe39573b ntdll: Move mapping of the user shared data to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-04 22:36:38 +02:00
Alexandre Julliard cd0c598802 ntdll: Consolidate some of the init routines into the init_threading() entry point.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-04 22:36:38 +02:00
Alexandre Julliard f1d40d4824 ntdll: Move more of the thread exit code to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-03 21:26:47 +02:00
Alexandre Julliard 35b063a404 ntdll: Move the thread creation code to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-03 21:09:13 +02:00
Alexandre Julliard be0eb9c92e ntdll: Move the thread startup code to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-03 20:01:16 +02:00
Alexandre Julliard 9fe61171e5 ntdll: Use the local server_send_fd() function in the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-02 17:39:28 +02:00
Alexandre Julliard c96ef78b6d ntdll: Move the virtual memory functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-02 17:19:12 +02:00
Alexandre Julliard 7c32b2dd93 ntdll: Move NtGetContextThread() implementation to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-02 14:23:21 +02:00
Alexandre Julliard ac90898f72 ntdll: Move NtSetContextThread() implementation to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-02 14:01:10 +02:00
Gerald Pfeifer b4a868b8ad ntdll: Include <stdarg.h> in unix/debug.c.
Signed-off-by: Gerald Pfeifer <gerald@pfeifer.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-02 11:13:59 +02:00
Alexandre Julliard 87fa906a84 ntdll: Properly reset the stack environment at thread exit on ARM64.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49301
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-01 22:10:28 +02:00
Alexandre Julliard c0319e0eab ntdll: Move server wait functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-01 22:10:28 +02:00
Alexandre Julliard b925dd78b8 ntdll: Use the actual zero_bits parameter in the server requests.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-01 22:10:28 +02:00
Alexandre Julliard 3e9f8c87e5 ntdll: Move the threading initialization functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-01 22:10:28 +02:00
Alexandre Julliard 704975f58d ntdll: Add missing server_init_process_done() call.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49295
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-01 22:10:28 +02:00
Alexandre Julliard 04f41e87a3 ntdll: Move NtClose() and NtDuplicateObject() to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-01 22:10:28 +02:00
Rémi Bernon 1f25c6edf7 ntdll: Use the free ranges in find_reserved_free_area.
Instead of the view rbtree.

Testing shows a 20% FPS increase in We Happy Few, from 80-100fps to
100-120fps right after starting a new game.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-30 13:46:04 +02:00
Rémi Bernon eb716839e1 ntdll: Introduce free_ranges indexing sequence.
This is an ordered range sequence used to keep track of free address
ranges.

The sequence contains an entry for every free address range, with base
pointing to the first free address and end pointing to the next first
used address. It is initialized to [0, ~0] for convenience, so that
there's always a range before or after a view.

In the worst case scenario, where memory is entirely fragmented, there's
going to be one more range than allocated views, but in general there's
much less. In any case, because of cache locality, iterating in the
contiguous sequence is much faster than traversing the view rbtree.

In theory there can be a performance hit when allocating or deleting a
view, as we may have to move the end of the sequence when a range is
split or merged. But in practice and given the usually low number of
ranges, this is not an issue.

The default and maximum sequence size can hold up to 65536 ranges, which
is much more than enough in general, and performance is probably going
to be bad before reaching the limit anyway. The code currently asserts
when reaching the limit, although we could possibly grow the sequence.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-30 13:45:55 +02:00
Alexandre Julliard 01150d7f8d ntdll: Move server call functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-29 20:05:30 +02:00
Alexandre Julliard 1a743c9af3 ntdll: Move fd cache functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-29 20:05:30 +02:00
Alexandre Julliard 8a63b688ac ntdll: Move server initialization functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-29 20:05:30 +02:00
Alexandre Julliard e6e2f2325a ntdll: Don't include ntdll_misc.h from the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-29 16:17:32 +02:00
Alexandre Julliard e854ea34cc ntdll: Create user shared data section in the server, and initialize it in wineboot.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-29 16:17:32 +02:00
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