diff options
| author | jaybeebabageyus <jaybeebabageyus@users.noreply.github.com> | 2026-11-22 17:14:23 +0100 |
|---|---|---|
| committer | jaybeebabageyus <jaybeebabageyus@users.noreply.github.com> | 2026-11-22 17:14:23 +0100 |
| commit | f4a3fe8d4a6dff718fa6ca9d2f5d5c5dcd8d6c41 (patch) | |
| tree | 67f24736e8471674d58fe0fb4851e35a5bf3cb1d /runtime/test/fixtures/tiny_bundled_load.cpp | |
| parent | 47f4cdc643f3fca3f87a34d9a4718f250d7cd905 (diff) | |
runtime: propagate LoadLibraryEx flags and reject DONT_RESOLVE_DLL_REFERENCES for bundled DLLs
Diffstat (limited to 'runtime/test/fixtures/tiny_bundled_load.cpp')
| -rw-r--r-- | runtime/test/fixtures/tiny_bundled_load.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
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() { | |||
| 27 | if (GetModuleHandleW(L"tiny_bundled_dll.dll") != nullptr) | 27 | if (GetModuleHandleW(L"tiny_bundled_dll.dll") != nullptr) |
| 28 | return fail("GetModuleHandleW before LoadLibrary should be NULL", 0); | 28 | return fail("GetModuleHandleW before LoadLibrary should be NULL", 0); |
| 29 | 29 | ||
| 30 | // DONT_RESOLVE_DLL_REFERENCES must fail explicitly rather than silently resolving imports and running DllMain. | ||
| 31 | SetLastError(0); | ||
| 32 | if (LoadLibraryExW(L"tiny_bundled_dll.dll", nullptr, DONT_RESOLVE_DLL_REFERENCES) != nullptr || | ||
| 33 | GetLastError() != ERROR_NOT_SUPPORTED) { | ||
| 34 | return fail("LoadLibraryExW(DONT_RESOLVE_DLL_REFERENCES) fails with ERROR_NOT_SUPPORTED", GetLastError()); | ||
| 35 | } | ||
| 36 | if (GetModuleHandleW(L"tiny_bundled_dll.dll") != nullptr) | ||
| 37 | return fail("DONT_RESOLVE_DLL_REFERENCES must not map or register the bundled DLL", 0); | ||
| 38 | |||
| 30 | HMODULE mod = LoadLibraryW(L"tiny_bundled_dll.dll"); | 39 | HMODULE mod = LoadLibraryW(L"tiny_bundled_dll.dll"); |
| 31 | if (!mod) return fail("LoadLibraryW(tiny_bundled_dll.dll)", GetLastError()); | 40 | if (!mod) return fail("LoadLibraryW(tiny_bundled_dll.dll)", GetLastError()); |
| 32 | 41 | ||