ntdll: Support loading ntdll without a constructor.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0a72ec1dac
commit
3872dc55ef
|
@ -4469,6 +4469,7 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
|
||||||
*/
|
*/
|
||||||
void __wine_process_init(void)
|
void __wine_process_init(void)
|
||||||
{
|
{
|
||||||
|
extern IMAGE_NT_HEADERS __wine_spec_nt_header;
|
||||||
static const WCHAR ntdllW[] = {'\\','?','?','\\','C',':','\\','w','i','n','d','o','w','s','\\',
|
static const WCHAR ntdllW[] = {'\\','?','?','\\','C',':','\\','w','i','n','d','o','w','s','\\',
|
||||||
's','y','s','t','e','m','3','2','\\',
|
's','y','s','t','e','m','3','2','\\',
|
||||||
'n','t','d','l','l','.','d','l','l',0};
|
'n','t','d','l','l','.','d','l','l',0};
|
||||||
|
@ -4480,6 +4481,7 @@ void __wine_process_init(void)
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
ANSI_STRING func_name;
|
ANSI_STRING func_name;
|
||||||
UNICODE_STRING nt_name;
|
UNICODE_STRING nt_name;
|
||||||
|
HMODULE ntdll_module;
|
||||||
INITIAL_TEB stack;
|
INITIAL_TEB stack;
|
||||||
BOOL suspend;
|
BOOL suspend;
|
||||||
SIZE_T info_size;
|
SIZE_T info_size;
|
||||||
|
@ -4496,6 +4498,7 @@ void __wine_process_init(void)
|
||||||
init_unix_codepage();
|
init_unix_codepage();
|
||||||
init_directories();
|
init_directories();
|
||||||
init_user_process_params( info_size );
|
init_user_process_params( info_size );
|
||||||
|
params = peb->ProcessParameters;
|
||||||
|
|
||||||
NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 );
|
NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 );
|
||||||
|
|
||||||
|
@ -4510,9 +4513,16 @@ void __wine_process_init(void)
|
||||||
RtlInitUnicodeString( &nt_name, ntdllW );
|
RtlInitUnicodeString( &nt_name, ntdllW );
|
||||||
default_load_info.filename = &nt_name;
|
default_load_info.filename = &nt_name;
|
||||||
wine_dll_set_callback( load_builtin_callback );
|
wine_dll_set_callback( load_builtin_callback );
|
||||||
|
ntdll_module = (HMODULE)((__wine_spec_nt_header.OptionalHeader.ImageBase + 0xffff) & ~0xffff);
|
||||||
|
if (!get_modref( ntdll_module ))
|
||||||
|
{
|
||||||
|
map_so_dll( &__wine_spec_nt_header, ntdll_module );
|
||||||
|
status = build_so_dll_module( params->DllPath.Buffer, &nt_name, ntdll_module, 0, &wm );
|
||||||
|
assert( !status );
|
||||||
|
}
|
||||||
|
|
||||||
RtlInitUnicodeString( &nt_name, kernel32W );
|
RtlInitUnicodeString( &nt_name, kernel32W );
|
||||||
if ((status = load_builtin_dll( NULL, &nt_name, NULL, 0, &wm )) != STATUS_SUCCESS)
|
if ((status = load_builtin_dll( params->DllPath.Buffer, &nt_name, NULL, 0, &wm )) != STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
MESSAGE( "wine: could not load kernel32.dll, status %x\n", status );
|
MESSAGE( "wine: could not load kernel32.dll, status %x\n", status );
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -4527,7 +4537,6 @@ void __wine_process_init(void)
|
||||||
|
|
||||||
init_locale( wm->ldr.BaseAddress );
|
init_locale( wm->ldr.BaseAddress );
|
||||||
|
|
||||||
params = peb->ProcessParameters;
|
|
||||||
if (!(status = load_dll( params->DllPath.Buffer, params->ImagePathName.Buffer, NULL,
|
if (!(status = load_dll( params->DllPath.Buffer, params->ImagePathName.Buffer, NULL,
|
||||||
DONT_RESOLVE_DLL_REFERENCES, &wm )))
|
DONT_RESOLVE_DLL_REFERENCES, &wm )))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue