Commit Graph

299 Commits

Author SHA1 Message Date
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
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 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 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 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
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
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 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 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 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
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
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
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 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 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 3e0c90e4c7 ntdll: Avoid using wine_get_build/data_dir() from libwine.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-27 12:35:19 +02:00
Jacek Caban c4dab9b76e server: Block by waiting on context handle in get_thread_context.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48052
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45546
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-22 16:47:41 +02:00
Jacek Caban aa0c4bb5e7 server: Don't wait for client thread to enter suspended state in set_thread_context.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-22 16:47:41 +02:00
Jacek Caban 4f9cc93108 server: Introduce a separated type for user APCs.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-13 12:14:50 +02:00
Alexandre Julliard 6169cacd0d ntdll: Move support for getting LDT entries to the platform-specific files.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-01 12:33:29 +02:00
Paul Gofman 9689d07740 ntdll: Fill NumberOfPhysicalPages field in user shared data area.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48387
Signed-off-by: Paul Gofman <gofmanp@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-17 20:26:45 +01:00
Nikolay Sivov b0951ba860 ntdll: Add support for querying thread suspend count.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-03 21:27:14 +01:00
Nikolay Sivov 7082ebc608 ntdll: Use better type for thread description info structure.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-03 21:27:14 +01:00
Nikolay Sivov b934f6626e ntdll: Implement thread description as information class.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-26 16:32:32 +01:00
Alexandre Julliard 608d086f1b ntdll: Move some initializations out of thread_init().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-07 17:05:56 +01:00
Alexandre Julliard cac9599207 kernel32: Move process name initialization to ntdll.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-22 23:04:26 +02:00
Naveen Narayanan de5392bfe7 ntdll: Set pthread stack guard size to 0 for NetBSD.
pthread_attr_setstack(3) in NetBSD 8.0 and newer sets the guard size
to 65536 and extends the stack beyond the specified range.

Signed-off-by: Naveen Narayanan <zerous@nocebo.space>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-13 20:27:06 +02:00
Alexandre Julliard 21d91ef04b ntdll: Initialize filesystem redirects before kernel32 is loaded.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-07-02 12:36:05 +02:00
Zebediah Figura 90c3b78bec ntdll: Implement RtlCreateUserStack() and RtlFreeUserStack().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-17 20:50:10 +02:00
Rémi Bernon 00451d5edf ntdll: Clarify NtAllocateVirtualMemory zero_bits parameter semantics.
This parameter was misinterpreted as an alignment parameter for the
lower bits of the allocated memory region, although it is a constraint
on the higher bits.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-13 20:55:35 +02:00
Martin Storsjo 044461e8a6 ntdll: Avoid truncating a nonzero exit code to zero in unix.
On Windows, the exit codes can use the full 32 bit range, while
on unix, they are truncated to the lowest 8 bits. If the intended
exit code is nonzero, to indicate failure, but the lower 8 bits
are zero (like when winedbg tries to exit with EXCEPTION_WINE_STUB,
80000100), the observed exit code used to be zero, indicating
successful execution.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-15 22:04:39 +02:00
Alexandre Julliard c9bf52502c ntdll: Store offsets instead of pointers in the debug_info structure.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-03 19:28:19 +02:00
Alexandre Julliard b3c8d5d368 ntdll: Use static debug info before initialization is done.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-03 10:02:04 +02:00
Alexandre Julliard 50f0ed75ef ntdll: Also create the initial process parameters with RtlCreateProcessParametersEx().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-13 12:48:36 +01:00
Alexandre Julliard 7a122604ea ntdll: Reimplement init_user_process_params() using RtlCreateProcessParametersEx().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-12 11:31:53 +01:00
Alexandre Julliard ae7ccbba48 ntdll: Fixup size of the current directory in RtlCreateProcessParametersEx().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-16 20:45:55 +02:00
Alexandre Julliard 03e05c1f57 ntdll: Implement RtlSetUnhandledExceptionFilter().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-09 14:49:54 +02:00
Alexandre Julliard 2cab0ec389 server: Don't return the process exe file to the client.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-24 22:41:30 +02:00
Alexandre Julliard 0fd450af5b server: Specify the process in which to create a new thread.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-20 14:50:48 +02:00
Alexandre Julliard 4a328e08ac server: Allow specifying the security descriptor for a new thread.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-20 13:06:12 +02:00
Roger Zoellner 575c1c9066 ntdll: Relax checks for valid affinity mask in NtSetInformationThread().
Signed-off-by: Roger Zoellner <zoellner.roger@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-14 14:12:06 +02:00
Alexandre Julliard 36371075f8 ntdll: Pass the server context to get/set_thread_context().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-06-12 14:01:35 +02:00
Andrew Wesie 4fda046323 ntdll: Implement NtCreateThreadEx.
Signed-off-by: Andrew Wesie <awesie@gmail.com>
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-03-08 13:07:36 -06:00
Alexandre Julliard 12276796c9 ntdll: Hardcode the windows and system directories.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-02-19 19:38:29 +01:00
Alexandre Julliard 4a5890811d ntdll: Block signals during process-wide exit.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-02-05 16:43:34 +01:00
Alexandre Julliard 3e80093410 ntdll: Implement RtlPushFrame, RtlPopFrame and RtlGetFrame.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-22 16:26:13 +01:00
Alexandre Julliard 6fe15e6c41 ntdll: Round the pthread stack size to a page boundary.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-12-26 10:14:38 +01:00
Alexandre Julliard 6eab1e93f3 ntdll: Define PTHREAD_STACK_MIN if it's missing.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-12-14 20:28:48 +01:00
Alexandre Julliard 7e9f1878db ntdll: Run the thread/process detach code on the thread stack.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-12-14 10:54:56 +01:00
Alexandre Julliard 23ec3ce2a3 ntdll: Start process execution directly at the kernel32 process entry point.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-12-04 15:03:55 +01:00
Alexandre Julliard 70b69f3e5f ntdll: Don't return from attach_dlls on failure.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-30 19:06:44 +01:00
Alexandre Julliard 6c61ea6a13 ntdll: Suspend a thread with its start context explicitly before attaching dlls.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-30 12:15:51 +01:00
Alexandre Julliard 53e4c36ef8 ntdll: Add a platform-specific helper for starting a thread.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-29 20:15:30 +01:00
Alexandre Julliard f8e0bd1b0d ntdll: Put the initial pthread stack at the end of the Win32 stack.
Create a separate view for it so that the main stack can be freed
independently.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-29 10:44:21 +01:00
Alexandre Julliard 93eceba03e ntdll: Move freeing the thread stack to a common helper.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-29 10:43:39 +01:00
Alexandre Julliard 822e142403 ntdll: Support magic \1 prefix in debug format for relay traces.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-25 12:05:40 +01:00
Alexandre Julliard 9e093936e2 ntdll: Use a separate stack when starting new threads.
Based on a patch by Sebastian Lackner.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-21 15:05:50 +01:00
Alexandre Julliard 8477ae27a8 ntdll: Fixup imports in the first thread that runs, even if it's not the main one.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-11-20 20:24:39 +01:00
Alexandre Julliard a003f0aed8 ntdll: Store the kernel32 process entry point in a global variable.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-09-19 11:59:58 +02:00
Alexandre Julliard b31583770f ntdll: Store the PEB lock pointer in the PEB.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-08-31 10:08:01 +02:00
Alexandre Julliard b87c66dd65 ntdll: Move the plaform-independent thread data to the GdiTebBatch TEB field.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-07-19 19:13:29 +02:00
Alexandre Julliard ce46de5a94 ntdll: Move NtGetContextThread implementation to the platform-specific files.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-07-18 20:43:32 +02:00
Alexandre Julliard 675e8218f0 ntdll: Move NtSetContextThread implementation to the platform-specific files.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-07-18 20:43:32 +02:00
Alexandre Julliard 1e48417567 ntdll: Add helper functions for getting and setting thread context through the server.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-07-18 20:43:32 +02:00
Alexandre Julliard d3bbd03c8f ntdll: Also store dynamic loader information in the PEB on Linux.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-25 20:53:04 +02:00
Michael Müller a345265614 ntdll: Mark LDR data as initialized.
Signed-off-by: Michael Müller <michael@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-24 11:08:50 +02:00
Piotr Caban 05ab8b98be ntdll: Add stub implementation of NtQueryInformationThread(ThreadIsIoPending).
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-08 10:53:32 +01:00
Andrew Wesie a39d67d8c9 ntdll: Prevent NULL dereference in NtSuspendThread.
Overwatch calls NtSuspendThread directly, and expects to be able to pass in a
NULL pointer for the count argument.

Signed-off-by: Andrew Wesie <awesie@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-03 19:05:10 +01:00
Dmitry Timoshkov d039d188f4 ntdll: Add support for fs segment in ThreadDescriptorTableEntry query.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-07-15 11:16:59 +09:00
Sebastian Lackner 12a00ea349 ntdll: Initialize Reserved_0 bit in NtQueryInformationThread.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-05-01 11:55:41 +09:00
Sebastian Lackner 56b4d35d52 ntdll: Preinitialize OS version data in thread_init.
Fixes a regression introduced by bd17022c90.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-04-13 21:43:03 +09:00
Alex Henrie 48f3bacb0b ntdll: Avoid double initialization.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-01-22 22:25:39 +09:00
Sebastian Lackner 7c468f8eca ntdll: Receive debug registers from server on x86_64.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-01-06 15:50:42 +01:00
Jacek Caban 19e16319b8 ntdll: Initialize PEB SessionId to 1.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-10-08 21:32:40 +09:00
Michael Müller 55ae09068b ntdll: Implement ThreadGroupInformation class.
Signed-off-by: Michael Müller <michael@fds-team.de>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
2015-10-02 18:11:31 +09:00
Sebastian Lackner 6d9cf49103 ntdll: Ignore higher bits in selector for ThreadDescriptorTableEntry info query.
Fixes a random test failure in kernel32/thread tests caused by the
uninitialized HIWORD.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
2015-09-25 21:03:17 +02:00
Sebastian Lackner 845164004b ntdll: Implement ThreadQuerySetWin32StartAddress info class in NtQueryInformationThread. 2015-07-29 21:44:03 +02:00
Sebastian Lackner 6ab494ceb5 ntdll: Implement ThreadQuerySetWin32StartAddress info class in NtSetInformationThread. 2015-07-29 21:44:03 +02:00
Sebastian Lackner 6156cf3134 server: Use a separate wineserver call to fetch thread times. 2015-07-29 21:44:03 +02:00
Charles Davis 97bda9a05f ntdll: Support 64-bit Mac OS. 2015-02-06 22:35:17 +09:00
Hans Leidekker faf70e2fbd ntdll: Fix calculation of process and thread affinity masks on systems with a large number of processors. 2015-01-21 15:31:16 +01:00
Sebastian Lackner 2fcecdb72e ntdll: Avoid leaking activation context in RtlCreateUserThread. (Valgrind). 2014-06-23 10:18:23 +02:00
Sebastian Lackner cfd09b0967 ntdll: Fix leaking activation context when terminating via exit_thread(). (Valgrind). 2014-06-23 10:17:26 +02:00
Alexandre Julliard 598c5816d9 kernel32: Don't allocate FLS index 0. 2014-03-28 17:46:03 +01:00
Jacek Caban 93920c3893 ntdll: Reserve TLS slot 0 for broken apps that compare index to 0 instead of TLS_OUT_OF_INDEXES. 2014-03-28 16:19:55 +01:00
Alexandre Julliard e54503f708 ntdll: Allocate TLS data in all running threads on module load. 2013-12-23 18:39:58 +01:00
Ken Thomases 22cf68e1bc ntdll: On Mac, store the dyld image info address in the PEB. 2013-12-05 12:40:56 +01:00
Nikolay Sivov 93c59714c0 ntdll: Inherit default activation context from creation thread. 2013-09-05 13:23:50 +02:00
Alexandre Julliard fcb3e60332 ntdll: Implement the RunOnce functions. 2013-08-28 22:27:31 +02:00
Alexandre Julliard 5c0b5f4dcb ntdll: Move the select and APC support to server.c. 2013-08-26 20:36:56 +02:00
Dmitry Timoshkov 94336f1aab ntdll: Thread creation control is now taken care by server. 2013-05-17 12:29:43 +02:00
Dmitry Timoshkov 59a23fb42f ntdll: Refuse to create new thread if the target process is being terminated. 2013-04-22 12:37:51 +02:00
André Hentschel 579f4f9da0 ntdll: Exit when we can't map the shared user data. 2012-11-28 20:14:51 +01:00
Daniel Jelinski 6ec731b65c ntdll: Add missing parameters to syscall call. 2012-05-30 11:21:45 +02:00
Detlef Riekenberg 979099a441 ntdll: Read the current processor with the __NR_getcpu syscall. 2012-05-21 11:33:55 +02:00