1 // Copyright 2019 The Crashpad Authors. All rights reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #include <windows.h> 16 17 #include "util/win/loader_lock.h" 18 19 namespace { 20 21 bool g_loader_lock_detected = false; 22 23 } // namespace 24 25 extern "C" { 26 LoaderLockDetected()27__declspec(dllexport) bool LoaderLockDetected() { 28 return g_loader_lock_detected; 29 } 30 31 } // extern "C" 32 DllMain(HINSTANCE,DWORD reason,LPVOID)33BOOL WINAPI DllMain(HINSTANCE, DWORD reason, LPVOID) { 34 switch (reason) { 35 case DLL_PROCESS_ATTACH: 36 g_loader_lock_detected = crashpad::IsThreadInLoaderLock(); 37 break; 38 } 39 40 return TRUE; 41 } 42