1 // Copyright 2020 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef BASE_WIN_ATL_THROW_H_ 6 #define BASE_WIN_ATL_THROW_H_ 7 8 #ifdef __ATLDEF_H__ 9 #error atl_throw.h must be included before atldef.h. 10 #endif 11 12 #include "base/base_export.h" 13 #include "base/win/windows_types.h" 14 15 // Defining _ATL_NO_EXCEPTIONS causes ATL to raise a structured exception 16 // instead of throwing a CAtlException. While crashpad will eventually handle 17 // this, the HRESULT that caused the problem is lost. So, in addition, define 18 // our own custom AtlThrow function (_ATL_CUSTOM_THROW). 19 #ifndef _ATL_NO_EXCEPTIONS 20 #define _ATL_NO_EXCEPTIONS 21 #endif 22 23 #define _ATL_CUSTOM_THROW 24 #define AtlThrow ::base::win::AtlThrowImpl 25 26 namespace base { 27 namespace win { 28 29 // Crash the process forthwith in case of ATL errors. 30 [[noreturn]] BASE_EXPORT void __stdcall AtlThrowImpl(HRESULT hr); 31 32 } // namespace win 33 } // namespace base 34 35 #include <atldef.h> 36 37 // atldef.h mistakenly leaves out the declaration of this function when 38 // _ATL_CUSTOM_THROW is defined. 39 namespace ATL { 40 ATL_NOINLINE __declspec(noreturn) inline void WINAPI AtlThrowLastWin32(); 41 } 42 43 #endif // BASE_WIN_ATL_THROW_H_ 44