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
16DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_GENERIC_1, CopyMarshaler1, true)
17DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_GENERIC_U1, CopyMarshalerU1, true)
18DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_GENERIC_2, CopyMarshaler2, true)
19DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_GENERIC_U2, CopyMarshalerU2, true)
20DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_GENERIC_4, CopyMarshaler4, true)
21DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_GENERIC_U4, CopyMarshalerU4, true)
22DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_GENERIC_8, CopyMarshaler8, true)
23
24DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_WINBOOL, WinBoolMarshaler, false)
25DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_CBOOL, CBoolMarshaler, true)
26#ifdef FEATURE_COMINTEROP
27DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_VTBOOL, VtBoolMarshaler, false)
28#endif // FEATURE_COMINTEROP
29
30DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_ANSICHAR, AnsiCharMarshaler, false)
31
32DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_FLOAT, FloatMarshaler, true)
33DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_DOUBLE, DoubleMarshaler, true)
34
35DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_CURRENCY, CurrencyMarshaler, false)
36DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_DECIMAL, DecimalMarshaler, false)
37DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_DECIMAL_PTR, DecimalPtrMarshaler, false)
38DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_GUID, GuidMarshaler, true)
39DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_GUID_PTR, GuidPtrMarshaler, false)
40DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_DATE, DateMarshaler, false)
41
42DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_LPWSTR, WSTRMarshaler, false)
43DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_LPSTR, CSTRMarshaler, false)
44DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_LPUTF8STR, CUTF8Marshaler, false)
45DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_BSTR, BSTRMarshaler, false)
46DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_ANSIBSTR, AnsiBSTRMarshaler, false)
47#ifdef FEATURE_COMINTEROP
48DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_HSTRING, HSTRINGMarshaler, true)
49DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_DATETIME, DateTimeMarshaler, true)
50DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_URI, UriMarshaler, true)
51DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_NCCEVENTARGS, NCCEventArgsMarshaler, true) // NotifyCollectionChangedEventArgs
52DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_PCEVENTARGS, PCEventArgsMarshaler, true) // PropertyChangedEventArgs
53#endif // FEATURE_COMINTEROP
54
55DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_LPWSTR_BUFFER, WSTRBufferMarshaler, false)
56DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_LPSTR_BUFFER, CSTRBufferMarshaler, false)
57DEFINE_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.
62DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_INTERFACE, InterfaceMarshaler, true)
63#endif // defined(FEATURE_COMINTEROP)
64
65#ifdef FEATURE_COMINTEROP
66DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_SAFEARRAY, SafeArrayMarshaler, false)
67DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_HIDDENLENGTHARRAY, HiddenLengthArrayMarshaler, true)
68#endif // FEATURE_COMINTEROP
69DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_NATIVEARRAY, NativeArrayMarshaler, false)
70
71DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_ASANYA, AsAnyAMarshaler, false)
72DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_ASANYW, AsAnyWMarshaler, false)
73
74DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_DELEGATE, DelegateMarshaler, false)
75
76DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_BLITTABLEPTR, BlittablePtrMarshaler, false)
77
78#ifdef FEATURE_COMINTEROP
79DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_VBBYVALSTR, VBByValStrMarshaler, false)
80DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_VBBYVALSTRW, VBByValStrWMarshaler, false)
81#endif // FEATURE_COMINTEROP
82
83DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_LAYOUTCLASSPTR, LayoutClassPtrMarshaler, false)
84DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_ARRAYWITHOFFSET, ArrayWithOffsetMarshaler, false)
85
86DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_BLITTABLEVALUECLASS, BlittableValueClassMarshaler, true)
87DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_VALUECLASS, ValueClassMarshaler, true)
88
89DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_REFERENCECUSTOMMARSHALER, ReferenceCustomMarshaler, false)
90DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_ARGITERATOR, ArgIteratorMarshaler, false)
91
92
93#ifdef FEATURE_COMINTEROP
94DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_OBJECT, ObjectMarshaler, false)
95#endif // FEATURE_COMINTEROP
96
97DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_HANDLEREF, HandleRefMarshaler, false)
98DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_SAFEHANDLE, SafeHandleMarshaler, false)
99DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_CRITICALHANDLE, CriticalHandleMarshaler, false)
100
101#ifdef FEATURE_COMINTEROP
102DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_OLECOLOR, OleColorMarshaler, false)
103#endif // FEATURE_COMINTEROP
104
105DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_RUNTIMETYPEHANDLE, RuntimeTypeHandleMarshaler, false)
106DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_RUNTIMEMETHODHANDLE, RuntimeMethodHandleMarshaler, false)
107DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_RUNTIMEFIELDHANDLE, RuntimeFieldHandleMarshaler, false)
108DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_RUNTIMEMETHODINFO, IRuntimeMethodInfoMarshaler, false)
109DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_RUNTIMEMODULE, RuntimeModuleMarshaler, false)
110DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_RUNTIMEASSEMBLY, RuntimeAssemblyMarshaler, false)
111
112#ifdef FEATURE_COMINTEROP
113DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_NULLABLE, NullableMarshaler, true)
114DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_SYSTEMTYPE, SystemTypeMarshaler, true)
115DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_KEYVALUEPAIR, KeyValuePairMarshaler, true)
116DEFINE_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