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 | // File: mtypes.h |
6 | // |
7 | |
8 | // |
9 | // Defines the mapping between MARSHAL_TYPE constants and their Marshaler |
10 | // classes. Used to generate all the enums and tables. |
11 | // |
12 | |
13 | |
14 | // ------------------------------------------------------------------------------------------------------------------ |
15 | // Marshaler ID Marshaler class name Supported in WinRT scenarios |
16 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_GENERIC_1, CopyMarshaler1, true) |
17 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_GENERIC_U1, CopyMarshalerU1, true) |
18 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_GENERIC_2, CopyMarshaler2, true) |
19 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_GENERIC_U2, CopyMarshalerU2, true) |
20 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_GENERIC_4, CopyMarshaler4, true) |
21 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_GENERIC_U4, CopyMarshalerU4, true) |
22 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_GENERIC_8, CopyMarshaler8, true) |
23 | |
24 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_WINBOOL, WinBoolMarshaler, false) |
25 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_CBOOL, CBoolMarshaler, true) |
26 | #ifdef FEATURE_COMINTEROP |
27 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_VTBOOL, VtBoolMarshaler, false) |
28 | #endif // FEATURE_COMINTEROP |
29 | |
30 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_ANSICHAR, AnsiCharMarshaler, false) |
31 | |
32 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_FLOAT, FloatMarshaler, true) |
33 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_DOUBLE, DoubleMarshaler, true) |
34 | |
35 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_CURRENCY, CurrencyMarshaler, false) |
36 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_DECIMAL, DecimalMarshaler, false) |
37 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_DECIMAL_PTR, DecimalPtrMarshaler, false) |
38 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_GUID, GuidMarshaler, true) |
39 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_GUID_PTR, GuidPtrMarshaler, false) |
40 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_DATE, DateMarshaler, false) |
41 | |
42 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_LPWSTR, WSTRMarshaler, false) |
43 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_LPSTR, CSTRMarshaler, false) |
44 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_LPUTF8STR, CUTF8Marshaler, false) |
45 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_BSTR, BSTRMarshaler, false) |
46 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_ANSIBSTR, AnsiBSTRMarshaler, false) |
47 | #ifdef FEATURE_COMINTEROP |
48 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_HSTRING, HSTRINGMarshaler, true) |
49 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_DATETIME, DateTimeMarshaler, true) |
50 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_URI, UriMarshaler, true) |
51 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_NCCEVENTARGS, NCCEventArgsMarshaler, true) // NotifyCollectionChangedEventArgs |
52 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_PCEVENTARGS, PCEventArgsMarshaler, true) // PropertyChangedEventArgs |
53 | #endif // FEATURE_COMINTEROP |
54 | |
55 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_LPWSTR_BUFFER, WSTRBufferMarshaler, false) |
56 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_LPSTR_BUFFER, CSTRBufferMarshaler, false) |
57 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_UTF8_BUFFER, UTF8BufferMarshaler, false) |
58 | |
59 | #if defined(FEATURE_COMINTEROP) |
60 | // CoreCLR doesn't have any support for marshalling interface pointers. |
61 | // Not even support for fake CCWs. |
62 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_INTERFACE, InterfaceMarshaler, true) |
63 | #endif // defined(FEATURE_COMINTEROP) |
64 | |
65 | #ifdef FEATURE_COMINTEROP |
66 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_SAFEARRAY, SafeArrayMarshaler, false) |
67 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_HIDDENLENGTHARRAY, HiddenLengthArrayMarshaler, true) |
68 | #endif // FEATURE_COMINTEROP |
69 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_NATIVEARRAY, NativeArrayMarshaler, false) |
70 | |
71 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_ASANYA, AsAnyAMarshaler, false) |
72 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_ASANYW, AsAnyWMarshaler, false) |
73 | |
74 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_DELEGATE, DelegateMarshaler, false) |
75 | |
76 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_BLITTABLEPTR, BlittablePtrMarshaler, false) |
77 | |
78 | #ifdef FEATURE_COMINTEROP |
79 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_VBBYVALSTR, VBByValStrMarshaler, false) |
80 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_VBBYVALSTRW, VBByValStrWMarshaler, false) |
81 | #endif // FEATURE_COMINTEROP |
82 | |
83 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_LAYOUTCLASSPTR, LayoutClassPtrMarshaler, false) |
84 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_ARRAYWITHOFFSET, ArrayWithOffsetMarshaler, false) |
85 | |
86 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_BLITTABLEVALUECLASS, BlittableValueClassMarshaler, true) |
87 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_VALUECLASS, ValueClassMarshaler, true) |
88 | |
89 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_REFERENCECUSTOMMARSHALER, ReferenceCustomMarshaler, false) |
90 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_ARGITERATOR, ArgIteratorMarshaler, false) |
91 | |
92 | |
93 | #ifdef FEATURE_COMINTEROP |
94 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_OBJECT, ObjectMarshaler, false) |
95 | #endif // FEATURE_COMINTEROP |
96 | |
97 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_HANDLEREF, HandleRefMarshaler, false) |
98 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_SAFEHANDLE, SafeHandleMarshaler, false) |
99 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_CRITICALHANDLE, CriticalHandleMarshaler, false) |
100 | |
101 | #ifdef FEATURE_COMINTEROP |
102 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_OLECOLOR, OleColorMarshaler, false) |
103 | #endif // FEATURE_COMINTEROP |
104 | |
105 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_RUNTIMETYPEHANDLE, RuntimeTypeHandleMarshaler, false) |
106 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_RUNTIMEMETHODHANDLE, RuntimeMethodHandleMarshaler, false) |
107 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_RUNTIMEFIELDHANDLE, RuntimeFieldHandleMarshaler, false) |
108 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_RUNTIMEMETHODINFO, IRuntimeMethodInfoMarshaler, false) |
109 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_RUNTIMEMODULE, RuntimeModuleMarshaler, false) |
110 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_RUNTIMEASSEMBLY, RuntimeAssemblyMarshaler, false) |
111 | |
112 | #ifdef FEATURE_COMINTEROP |
113 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_NULLABLE, NullableMarshaler, true) |
114 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_SYSTEMTYPE, SystemTypeMarshaler, true) |
115 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_KEYVALUEPAIR, KeyValuePairMarshaler, true) |
116 | DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_EXCEPTION, HResultExceptionMarshaler, true) // For WinRT, marshal exceptions as Windows.Foundation.HResult |
117 | #endif // FEATURE_COMINTEROP |
118 | |
119 | #undef DEFINE_MARSHALER_TYPE |
120 | |