~ruther/NosSmooth.Local

efd90a90d15f15353c65c69eeb2336bd8b72c604 — Rutherther 2 years ago bbad528
fix(inject): add possibility to inject multiple .NET runtime dlls without crashing
1 files changed, 6 insertions(+), 3 deletions(-)

M src/Inject/NosSmooth.Inject/nossmooth.cpp
M src/Inject/NosSmooth.Inject/nossmooth.cpp => src/Inject/NosSmooth.Inject/nossmooth.cpp +6 -3
@@ 42,8 42,11 @@ void* get_export(void*, const char*);

void* load_library(const char_t* path)
{
    HMODULE h = ::LoadLibraryW(path);
    assert(h != nullptr);
    HMODULE h = ::GetModuleHandleW(path);
    if (h == nullptr) {
        h = ::LoadLibraryW(path);
        assert(h != nullptr);
    }
    return (void*)h;
}
void* get_export(void* h, const char* name)


@@ 79,7 82,7 @@ load_assembly_and_get_function_pointer_fn get_dotnet_load_assembly(const char_t*
    void* load_assembly_and_get_function_pointer = nullptr;
    hostfxr_handle cxt = nullptr;
    int rc = init_fptr(config_path, nullptr, &cxt);
    if (rc != 0 || cxt == nullptr)
    if (rc > 1 || cxt == nullptr)
    {
        std::cerr << "Init failed: " << std::hex << std::showbase << rc << std::endl;
        close_fptr(cxt);

Do not follow this link