1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4// ============================================================
5//
6// BinderTypes.hpp
7//
8
9
10//
11// Declares a bunch of binder classes, types and macros
12//
13// ============================================================
14
15#ifndef __BINDER_TYPES_HPP__
16#define __BINDER_TYPES_HPP__
17
18#include "clrtypes.h"
19#include "sstring.h"
20
21#include "fusionhelpers.hpp"
22
23extern void DECLSPEC_NORETURN ThrowOutOfMemory();
24
25#ifndef S_TRUE
26#define S_TRUE S_OK
27#endif
28
29class PEImage;
30class PEAssembly;
31
32namespace BINDER_SPACE
33{
34 class AssemblyVersion;
35 class AssemblyName;
36 class Assembly;
37
38 class GACEntry;
39 class GACVersionIterator;
40 class GAC;
41
42 class ContextEntry;
43 class ExecutionContext;
44 class InspectionContext;
45
46 class PropertyMap;
47 class ApplicationContext;
48
49 class BindResult;
50 class FailureCache;
51 class AssemblyBinder;
52
53#if defined(BINDER_DEBUG_LOG)
54 class DebugLog;
55#endif
56
57#if defined(FEATURE_VERSIONING_LOG)
58 class BindingLog;
59 class CDebugLog;
60#endif // FEATURE_VERSIONING_LOG
61
62 namespace Tests
63 {
64 HRESULT Run();
65 };
66};
67
68#define IF_FAIL_GO(expr) \
69 hr = (expr); \
70 if (FAILED(hr)) \
71 { \
72 goto Exit; \
73 }
74
75#define IF_FALSE_GO(expr) \
76 if (!(expr)) { \
77 hr = E_FAIL; \
78 goto Exit; \
79 }
80
81#define GO_WITH_HRESULT(hrValue) \
82 hr = hrValue; \
83 goto Exit;
84
85#define IF_WIN32_ERROR_GO(expr) \
86 if (!(expr)) \
87 { \
88 hr = HRESULT_FROM_GetLastError(); \
89 goto Exit; \
90 }
91
92#define NEW_CONSTR(Object, Constr) \
93 (Object) = new (nothrow) Constr;
94
95#define SAFE_NEW_CONSTR(Object, Constr) \
96 (Object) = new (nothrow) Constr; \
97 if ((Object) == NULL) \
98 { \
99 hr = E_OUTOFMEMORY; \
100 goto Exit; \
101 }
102
103#define SAFE_NEW(Object, Class) \
104 SAFE_NEW_CONSTR(Object, Class());
105
106#define SAFE_RELEASE(objectPtr) \
107 if ((objectPtr) != NULL) \
108 { \
109 (objectPtr)->Release(); \
110 (objectPtr) = NULL; \
111 }
112
113#define SAFE_DELETE(objectPtr) \
114 if ((objectPtr) != NULL) \
115 { \
116 delete (objectPtr); \
117 (objectPtr) = NULL; \
118 }
119
120#define SAFE_DELETE_ARRAY(objectPtr) \
121 if ((objectPtr) != NULL) \
122 { \
123 delete[] (objectPtr); \
124 (objectPtr) = NULL; \
125 }
126
127#define LENGTH_OF(x) \
128 (sizeof(x) / sizeof(x[0]))
129
130#include "debuglog.hpp"
131
132#endif
133