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 | // |
7 | |
8 | // |
9 | // ==--== |
10 | #ifndef __strike_h__ |
11 | #define __strike_h__ |
12 | |
13 | #ifndef _countof |
14 | #define _countof(x) (sizeof(x)/sizeof(x[0])) |
15 | #endif |
16 | |
17 | #if defined(_MSC_VER) |
18 | #pragma warning(disable:4245) // signed/unsigned mismatch |
19 | #pragma warning(disable:4100) // unreferenced formal parameter |
20 | #pragma warning(disable:4201) // nonstandard extension used : nameless struct/union |
21 | #pragma warning(disable:4127) // conditional expression is constant |
22 | #pragma warning(disable:6255) // Prefast: alloca indicates failure by raising a stack overflow exception |
23 | #endif |
24 | |
25 | #ifdef PAL_STDCPP_COMPAT |
26 | #define _iswprint PAL_iswprint |
27 | #define _wcslen PAL_wcslen |
28 | #define _wcsncmp PAL_wcsncmp |
29 | #define _wcsrchr PAL_wcsrchr |
30 | #define _wcscmp PAL_wcscmp |
31 | #define _wcschr PAL_wcschr |
32 | #define _wcscspn PAL_wcscspn |
33 | #define _wcscat PAL_wcscat |
34 | #define _wcsstr PAL_wcsstr |
35 | #else // PAL_STDCPP_COMPAT |
36 | #define _iswprint iswprint |
37 | #define _wcslen wcslen |
38 | #define _wcsncmp wcsncmp |
39 | #define _wcsrchr wcsrchr |
40 | #define _wcscmp wcscmp |
41 | #define _wcschr wcschr |
42 | #define _wcscspn wcscspn |
43 | #define _wcscat wcscat |
44 | #define _wcsstr wcsstr |
45 | #endif // !PAL_STDCPP_COMPAT |
46 | |
47 | #define ___in _SAL1_Source_(__in, (), _In_) |
48 | #define ___out _SAL1_Source_(__out, (), _Out_) |
49 | |
50 | #define _max(a, b) (((a) > (b)) ? (a) : (b)) |
51 | #define _min(a, b) (((a) < (b)) ? (a) : (b)) |
52 | |
53 | #include <winternl.h> |
54 | #include <winver.h> |
55 | #include <windows.h> |
56 | |
57 | #include <wchar.h> |
58 | |
59 | //#define NOEXTAPI |
60 | #define KDEXT_64BIT |
61 | #include <wdbgexts.h> |
62 | #undef DECLARE_API |
63 | #undef GetContext |
64 | #undef SetContext |
65 | #undef ReadMemory |
66 | #undef WriteMemory |
67 | #undef GetFieldValue |
68 | #undef StackTrace |
69 | |
70 | #include <stdio.h> |
71 | #include <stdlib.h> |
72 | #include <stdint.h> |
73 | #include <string.h> |
74 | |
75 | |
76 | #ifndef PAL_STDCPP_COMPAT |
77 | #include <malloc.h> |
78 | #endif |
79 | |
80 | #ifdef FEATURE_PAL |
81 | #ifndef alloca |
82 | #define alloca __builtin_alloca |
83 | #endif |
84 | #ifndef _alloca |
85 | #define _alloca __builtin_alloca |
86 | #endif |
87 | #endif // FEATURE_PAL |
88 | |
89 | #include <stddef.h> |
90 | |
91 | #ifndef FEATURE_PAL |
92 | #include <basetsd.h> |
93 | #endif |
94 | |
95 | #define CORHANDLE_MASK 0x1 |
96 | |
97 | #include "static_assert.h" |
98 | |
99 | // exts.h includes dbgeng.h which has a bunch of IIDs we need instantiated. |
100 | #define INITGUID |
101 | #include "guiddef.h" |
102 | |
103 | #ifdef FEATURE_PAL |
104 | #define SOS_PTR(x) (size_t)(x) |
105 | #else // FEATURE_PAL |
106 | #define SOS_PTR(x) (unsigned __int64)(x) |
107 | #endif // FEATURE_PAL else |
108 | |
109 | #include "exts.h" |
110 | |
111 | //Alignment constant for allocation |
112 | #if defined(_TARGET_X86_) || defined(_TARGET_ARM_) |
113 | #define ALIGNCONST 3 |
114 | #else |
115 | #define ALIGNCONST 7 |
116 | #endif |
117 | |
118 | //The large object heap uses a different alignment |
119 | #define ALIGNCONSTLARGE 7 |
120 | |
121 | #ifdef _WIN64 |
122 | #define 8 |
123 | #else // !_WIN64 |
124 | #define SIZEOF_OBJHEADER 4 |
125 | #endif // !_WIN64 |
126 | |
127 | #define plug_skew SIZEOF_OBJHEADER |
128 | #define min_obj_size (sizeof(BYTE*)+plug_skew+sizeof(size_t)) |
129 | |
130 | extern BOOL CallStatus; |
131 | |
132 | |
133 | #ifndef NT_SUCCESS |
134 | #define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0) |
135 | #endif |
136 | |
137 | HRESULT SetNGENCompilerFlags(DWORD flags); |
138 | |
139 | |
140 | #endif // __strike_h__ |
141 | |