Skip to content

ntdll: Properly track refcount with forwarded exports.

This fixes https://bugs.winehq.org/show_bug.cgi?id=52094.

For reference, here's how current_modref is being passed around (before this patch):

graph TB
    fii["fixup_imports_ilonly<br><em style='color:#ff0'>(directly sets current_modref)</em>"]
    fi["fixup_imports<br><em style='color:#ff0'>(directly sets current_modref)</em>"]
    pa["process_attach<br><em style='color:#ff0'>(directly sets current_modref)</em>"]
    ld[load_dll]
    id["import_dll<br><em style='color:#0f0'>(directly uses current_modref)</em>"]
    bin["build_import_name<br><em style='color:#0f0'>(directly uses current_modref)</em>"]
    foe["find_ordinal_export<br><em style='color:#0f0'>(uses current_modref for relay)</em>"]
    ffe["find_forwarded_export<br><em style='color:#0f0'>(directly uses current_modref)</em>"]
    fne[find_named_export]
    MI[MODULE_InitDLL]
    fii --> ld
    fi --> id
    pa --> MI -.-> DllMain
    id --> bin
    id --> ld
    id --> foe
    id --> fne --> foe --> ffe --> foe
    ffe --> fne
    ffe --> bin
    style DllMain color:red;
Edited by Jinoh Kang

Merge request reports

Loading