ntdll: Add a separate helper for creating the initial ntdll module.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7709d9b870
commit
93eb4dbde8
|
@ -1937,20 +1937,23 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* build_builtin_module
|
* build_ntdll_module
|
||||||
*
|
*
|
||||||
* Build the module for a builtin library.
|
* Build the module data for the initially-loaded ntdll.
|
||||||
*/
|
*/
|
||||||
static NTSTATUS build_builtin_module( const WCHAR *load_path, const UNICODE_STRING *nt_name,
|
static void build_ntdll_module(void)
|
||||||
void *module, DWORD flags, WINE_MODREF **pwm )
|
|
||||||
{
|
{
|
||||||
NTSTATUS status;
|
MEMORY_BASIC_INFORMATION meminfo;
|
||||||
SECTION_IMAGE_INFORMATION image_info = { 0 };
|
UNICODE_STRING nt_name;
|
||||||
|
WINE_MODREF *wm;
|
||||||
|
|
||||||
image_info.u.s.WineBuiltin = 1;
|
RtlInitUnicodeString( &nt_name, L"\\??\\C:\\windows\\system32\\ntdll.dll" );
|
||||||
status = build_module( load_path, nt_name, &module, &image_info, NULL, flags, pwm );
|
NtQueryVirtualMemory( GetCurrentProcess(), build_ntdll_module, MemoryBasicInformation,
|
||||||
if (status && module) unix_funcs->unload_builtin_dll( module );
|
&meminfo, sizeof(meminfo), NULL );
|
||||||
return status;
|
wm = alloc_module( meminfo.AllocationBase, &nt_name, TRUE );
|
||||||
|
assert( wm );
|
||||||
|
wm->ldr.Flags &= ~LDR_DONT_RESOLVE_REFS;
|
||||||
|
if (TRACE_ON(relay)) RELAY_SetupDLL( meminfo.AllocationBase );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2348,7 +2351,14 @@ static NTSTATUS load_so_dll( LPCWSTR load_path, const UNICODE_STRING *nt_name,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((status = build_builtin_module( load_path, &win_name, module, flags, &wm ))) return status;
|
SECTION_IMAGE_INFORMATION image_info = { 0 };
|
||||||
|
|
||||||
|
image_info.u.s.WineBuiltin = 1;
|
||||||
|
if ((status = build_module( load_path, &win_name, &module, &image_info, NULL, flags, pwm )))
|
||||||
|
{
|
||||||
|
if (module) unix_funcs->unload_builtin_dll( module );
|
||||||
|
return status;
|
||||||
|
}
|
||||||
TRACE_(loaddll)( "Loaded %s at %p: builtin\n", debugstr_us(nt_name), module );
|
TRACE_(loaddll)( "Loaded %s at %p: builtin\n", debugstr_us(nt_name), module );
|
||||||
}
|
}
|
||||||
*pwm = wm;
|
*pwm = wm;
|
||||||
|
@ -3958,8 +3968,6 @@ static NTSTATUS process_init(void)
|
||||||
WINE_MODREF *wm;
|
WINE_MODREF *wm;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
ANSI_STRING func_name;
|
ANSI_STRING func_name;
|
||||||
UNICODE_STRING nt_name;
|
|
||||||
MEMORY_BASIC_INFORMATION meminfo;
|
|
||||||
INITIAL_TEB stack;
|
INITIAL_TEB stack;
|
||||||
TEB *teb = NtCurrentTeb();
|
TEB *teb = NtCurrentTeb();
|
||||||
PEB *peb = teb->Peb;
|
PEB *peb = teb->Peb;
|
||||||
|
@ -4059,11 +4067,7 @@ static NTSTATUS process_init(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RtlInitUnicodeString( &nt_name, L"\\??\\C:\\windows\\system32\\ntdll.dll" );
|
build_ntdll_module();
|
||||||
NtQueryVirtualMemory( GetCurrentProcess(), process_init, MemoryBasicInformation,
|
|
||||||
&meminfo, sizeof(meminfo), NULL );
|
|
||||||
status = build_builtin_module( params->DllPath.Buffer, &nt_name, meminfo.AllocationBase, 0, &wm );
|
|
||||||
assert( !status );
|
|
||||||
|
|
||||||
if ((status = load_dll( params->DllPath.Buffer, L"C:\\windows\\system32\\kernel32.dll",
|
if ((status = load_dll( params->DllPath.Buffer, L"C:\\windows\\system32\\kernel32.dll",
|
||||||
NULL, 0, &wm )) != STATUS_SUCCESS)
|
NULL, 0, &wm )) != STATUS_SUCCESS)
|
||||||
|
|
Loading…
Reference in New Issue