From f4a3fe8d4a6dff718fa6ca9d2f5d5c5dcd8d6c41 Mon Sep 17 00:00:00 2001 From: jaybeebabageyus Date: Sun, 22 Nov 2026 17:14:23 +0100 Subject: runtime: propagate LoadLibraryEx flags and reject DONT_RESOLVE_DLL_REFERENCES for bundled DLLs --- runtime/test/fixtures/tiny_bundled_load.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'runtime/test/fixtures/tiny_bundled_load.cpp') diff --git a/runtime/test/fixtures/tiny_bundled_load.cpp b/runtime/test/fixtures/tiny_bundled_load.cpp index 51fbaac72..f2a3b7f36 100644 --- a/runtime/test/fixtures/tiny_bundled_load.cpp +++ b/runtime/test/fixtures/tiny_bundled_load.cpp @@ -27,6 +27,15 @@ int main() { if (GetModuleHandleW(L"tiny_bundled_dll.dll") != nullptr) return fail("GetModuleHandleW before LoadLibrary should be NULL", 0); + // DONT_RESOLVE_DLL_REFERENCES must fail explicitly rather than silently resolving imports and running DllMain. + SetLastError(0); + if (LoadLibraryExW(L"tiny_bundled_dll.dll", nullptr, DONT_RESOLVE_DLL_REFERENCES) != nullptr || + GetLastError() != ERROR_NOT_SUPPORTED) { + return fail("LoadLibraryExW(DONT_RESOLVE_DLL_REFERENCES) fails with ERROR_NOT_SUPPORTED", GetLastError()); + } + if (GetModuleHandleW(L"tiny_bundled_dll.dll") != nullptr) + return fail("DONT_RESOLVE_DLL_REFERENCES must not map or register the bundled DLL", 0); + HMODULE mod = LoadLibraryW(L"tiny_bundled_dll.dll"); if (!mod) return fail("LoadLibraryW(tiny_bundled_dll.dll)", GetLastError()); -- cgit v1.2.3