mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 09:35:52 +00:00
ntdll: Initialize Unix calls early during startup.
This commit is contained in:
parent
bef0969722
commit
0538557512
|
@ -2187,22 +2187,17 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
|
||||||
*
|
*
|
||||||
* Build the module data for the initially-loaded ntdll.
|
* Build the module data for the initially-loaded ntdll.
|
||||||
*/
|
*/
|
||||||
static void build_ntdll_module(void)
|
static void build_ntdll_module( HMODULE module )
|
||||||
{
|
{
|
||||||
MEMORY_BASIC_INFORMATION meminfo;
|
|
||||||
UNICODE_STRING nt_name;
|
UNICODE_STRING nt_name;
|
||||||
WINE_MODREF *wm;
|
WINE_MODREF *wm;
|
||||||
|
|
||||||
RtlInitUnicodeString( &nt_name, L"\\??\\C:\\windows\\system32\\ntdll.dll" );
|
RtlInitUnicodeString( &nt_name, L"\\??\\C:\\windows\\system32\\ntdll.dll" );
|
||||||
NtQueryVirtualMemory( GetCurrentProcess(), build_ntdll_module, MemoryBasicInformation,
|
wm = alloc_module( module, &nt_name, TRUE );
|
||||||
&meminfo, sizeof(meminfo), NULL );
|
|
||||||
wm = alloc_module( meminfo.AllocationBase, &nt_name, TRUE );
|
|
||||||
assert( wm );
|
assert( wm );
|
||||||
wm->ldr.Flags &= ~LDR_DONT_RESOLVE_REFS;
|
wm->ldr.Flags &= ~LDR_DONT_RESOLVE_REFS;
|
||||||
node_ntdll = wm->ldr.DdagNode;
|
node_ntdll = wm->ldr.DdagNode;
|
||||||
if (TRACE_ON(relay)) RELAY_SetupDLL( meminfo.AllocationBase );
|
if (TRACE_ON(relay)) RELAY_SetupDLL( module );
|
||||||
NtQueryVirtualMemory( GetCurrentProcess(), meminfo.AllocationBase, MemoryWineUnixFuncs,
|
|
||||||
&ntdll_unix_handle, sizeof(ntdll_unix_handle), NULL );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4112,10 +4107,16 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
|
||||||
|
|
||||||
if (!imports_fixup_done)
|
if (!imports_fixup_done)
|
||||||
{
|
{
|
||||||
|
MEMORY_BASIC_INFORMATION meminfo;
|
||||||
ANSI_STRING func_name;
|
ANSI_STRING func_name;
|
||||||
WINE_MODREF *kernel32;
|
WINE_MODREF *kernel32;
|
||||||
PEB *peb = NtCurrentTeb()->Peb;
|
PEB *peb = NtCurrentTeb()->Peb;
|
||||||
|
|
||||||
|
NtQueryVirtualMemory( GetCurrentProcess(), LdrInitializeThunk, MemoryBasicInformation,
|
||||||
|
&meminfo, sizeof(meminfo), NULL );
|
||||||
|
NtQueryVirtualMemory( GetCurrentProcess(), meminfo.AllocationBase, MemoryWineUnixFuncs,
|
||||||
|
&ntdll_unix_handle, sizeof(ntdll_unix_handle), NULL );
|
||||||
|
|
||||||
peb->LdrData = &ldr;
|
peb->LdrData = &ldr;
|
||||||
peb->FastPebLock = &peb_lock;
|
peb->FastPebLock = &peb_lock;
|
||||||
peb->TlsBitmap = &tls_bitmap;
|
peb->TlsBitmap = &tls_bitmap;
|
||||||
|
@ -4137,7 +4138,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
|
||||||
wm = build_main_module();
|
wm = build_main_module();
|
||||||
wm->ldr.LoadCount = -1;
|
wm->ldr.LoadCount = -1;
|
||||||
|
|
||||||
build_ntdll_module();
|
build_ntdll_module( meminfo.AllocationBase );
|
||||||
|
|
||||||
if (NtCurrentTeb()->WowTebOffset) init_wow64( context );
|
if (NtCurrentTeb()->WowTebOffset) init_wow64( context );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue