Bug 1860823 [wpt PR 42716] - Update wpt metadata, a=testonly
[gecko.git] / mozglue / misc / WindowsDllMain.cpp
blob1baec678dbc4e808ecfa53c6d4d963f8b2ddb5d2
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include <libloaderapi.h>
9 BOOL WINAPI DllMain(HINSTANCE aInstDll, DWORD aReason, LPVOID) {
10 if (aReason == DLL_PROCESS_ATTACH) {
11 ::DisableThreadLibraryCalls(aInstDll);
13 // mozglue.dll imports RtlGenRandom from advapi32.dll as SystemFunction036,
14 // but the actual function is implemented in cryptbase.dll. To avoid
15 // loading a fake cryptbase.dll from the installation directory, we preload
16 // cryptbase.dll from the system directory.
17 ::LoadLibraryExW(L"cryptbase.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
19 return TRUE;