Commit aa234f3a authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

ntdll: Don't add dependencies for system dlls.

parent 250c1131
...@@ -1409,7 +1409,7 @@ static void test_ddag_node(void) ...@@ -1409,7 +1409,7 @@ static void test_ddag_node(void)
} }
mod2 = CONTAINING_RECORD(dep_node->Modules.Flink, LDR_DATA_TABLE_ENTRY, NodeModuleLink); mod2 = CONTAINING_RECORD(dep_node->Modules.Flink, LDR_DATA_TABLE_ENTRY, NodeModuleLink);
todo_wine ok( !lstrcmpW( mod2->BaseDllName.Buffer, expected_exe_dependencies[i].dllname ), ok( !lstrcmpW( mod2->BaseDllName.Buffer, expected_exe_dependencies[i].dllname ),
"Got unexpected module %s.\n", debugstr_w(mod2->BaseDllName.Buffer)); "Got unexpected module %s.\n", debugstr_w(mod2->BaseDllName.Buffer));
se2 = dep_node->IncomingDependencies.Tail; se2 = dep_node->IncomingDependencies.Tail;
...@@ -1428,7 +1428,7 @@ static void test_ddag_node(void) ...@@ -1428,7 +1428,7 @@ static void test_ddag_node(void)
winetest_pop_context(); winetest_pop_context();
prev_node = dep_node; prev_node = dep_node;
} }
todo_wine ok( se == node->Dependencies.Tail, "Expected end of the list.\n" ); ok( se == node->Dependencies.Tail, "Expected end of the list.\n" );
} }
START_TEST(module) START_TEST(module)
......
...@@ -182,6 +182,8 @@ static WINE_MODREF *cached_modref; ...@@ -182,6 +182,8 @@ static WINE_MODREF *cached_modref;
static WINE_MODREF *current_modref; static WINE_MODREF *current_modref;
static WINE_MODREF *last_failed_modref; static WINE_MODREF *last_failed_modref;
static LDR_DDAG_NODE *node_ntdll, *node_kernel32;
static NTSTATUS load_dll( const WCHAR *load_path, const WCHAR *libname, const WCHAR *default_ext, static NTSTATUS load_dll( const WCHAR *load_path, const WCHAR *libname, const WCHAR *default_ext,
DWORD flags, WINE_MODREF** pwm ); DWORD flags, WINE_MODREF** pwm );
static NTSTATUS process_attach( LDR_DDAG_NODE *node, LPVOID lpReserved ); static NTSTATUS process_attach( LDR_DDAG_NODE *node, LPVOID lpReserved );
...@@ -1280,7 +1282,10 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path ) ...@@ -1280,7 +1282,10 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path )
imp = NULL; imp = NULL;
status = STATUS_DLL_NOT_FOUND; status = STATUS_DLL_NOT_FOUND;
} }
else add_module_dependency_after( wm->ldr.DdagNode, imp->ldr.DdagNode, dep_after ); else if (!is_import_dll_system( &wm->ldr, &imports[i] ))
{
add_module_dependency_after( wm->ldr.DdagNode, imp->ldr.DdagNode, dep_after );
}
} }
current_modref = prev; current_modref = prev;
if (wm->ldr.ActivationContext) RtlDeactivateActivationContext( 0, cookie ); if (wm->ldr.ActivationContext) RtlDeactivateActivationContext( 0, cookie );
...@@ -2076,6 +2081,7 @@ static void build_ntdll_module(void) ...@@ -2076,6 +2081,7 @@ static void build_ntdll_module(void)
wm = alloc_module( meminfo.AllocationBase, &nt_name, TRUE ); 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;
if (TRACE_ON(relay)) RELAY_SetupDLL( meminfo.AllocationBase ); if (TRACE_ON(relay)) RELAY_SetupDLL( meminfo.AllocationBase );
} }
...@@ -4004,6 +4010,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR ...@@ -4004,6 +4010,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
NtTerminateProcess( GetCurrentProcess(), status ); NtTerminateProcess( GetCurrentProcess(), status );
} }
kernel32_handle = kernel32->ldr.DllBase; kernel32_handle = kernel32->ldr.DllBase;
node_kernel32 = kernel32->ldr.DdagNode;
RtlInitAnsiString( &func_name, "BaseThreadInitThunk" ); RtlInitAnsiString( &func_name, "BaseThreadInitThunk" );
if ((status = LdrGetProcedureAddress( kernel32_handle, &func_name, if ((status = LdrGetProcedureAddress( kernel32_handle, &func_name,
0, (void **)&pBaseThreadInitThunk )) != STATUS_SUCCESS) 0, (void **)&pBaseThreadInitThunk )) != STATUS_SUCCESS)
...@@ -4053,6 +4060,14 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR ...@@ -4053,6 +4060,14 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
if (wm->ldr.ActivationContext) if (wm->ldr.ActivationContext)
RtlActivateActivationContext( 0, wm->ldr.ActivationContext, &cookie ); RtlActivateActivationContext( 0, wm->ldr.ActivationContext, &cookie );
if ((status = process_attach( node_ntdll, context ))
|| (status = process_attach( node_kernel32, context )))
{
ERR( "Initializing system dll for %s failed, status %x\n",
debugstr_w(NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer), status );
NtTerminateProcess( GetCurrentProcess(), status );
}
if ((status = walk_node_dependencies( wm->ldr.DdagNode, context, process_attach ))) if ((status = walk_node_dependencies( wm->ldr.DdagNode, context, process_attach )))
{ {
if (last_failed_modref) if (last_failed_modref)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment