Jacek Caban (@jacek) commented about dlls/ntdll/loader.c:
{ if (wm->ldr.DdagNode != node_ntdll && wm->ldr.DdagNode != node_kernel32) {
if (importer)
{
/* Prepare for the callee stealing the reference */
if (wm_owned_ref) wm_owned_ref = FALSE;
else if (wm->ldr.LoadCount != -1) wm->ldr.LoadCount++;
add_module_dependency( importer->ldr.DdagNode, wm->ldr.DdagNode );
}
else if (wm_owned_ref && process_attach( wm->ldr.DdagNode, NULL ) != STATUS_SUCCESS)
{
proc = NULL;
}
Actually, looking at this again, I think it breaks the case where `LdrGetProcedureAddress` triggers the DLL to load. With this change (or rather, the previous commit), we would no longer attach such a DLL, which seems incorrect. Maybe we do need is_dynamic for that after all.