[ATL] Improve the order of operations in CComPtr and CComQIIDPtr
[reactos.git] / sdk / lib / atl / atlexcept.h
1
2 #ifndef __ATLEXCEPT_H__
3 #define __ATLEXCEPT_H__
4
5
6 #ifdef _ATL_NO_EXCEPTIONS
7 #if !defined(STATUS_NO_MEMORY) && defined(WIN32_NO_STATUS)
8 #define STATUS_NO_MEMORY ((DWORD)0xC0000017)
9 #endif
10 #endif
11
12
13 //FIXME: Enable when RaiseException is marked as NORETURN
14 //DECLSPEC_NORETURN
15 inline void AtlThrowImp(HRESULT hr)
16 {
17 #ifdef ATLTRACE
18 ATLTRACE(hr);
19 #endif
20
21 #ifdef _ATL_NO_EXCEPTIONS
22
23 ATLASSERT(false);
24
25 RaiseException(
26 hr == E_OUTOFMEMORY ? STATUS_NO_MEMORY : EXCEPTION_ILLEGAL_INSTRUCTION,
27 EXCEPTION_NONCONTINUABLE, 0, NULL
28 );
29
30 #else
31
32 // FIXME: This is horribly wrong, we should implement CException!
33 throw;
34
35 #endif
36
37 }
38
39
40
41 #ifndef AtlThrow
42 #define AtlThrow(x) AtlThrowImp(x)
43 #endif
44
45 #endif