[Coop] Remove handles from Mono.Interop.ComInteropProxy. (#16993)
[mono-project.git] / mono / metadata / icall-decl.h
blobde4b2131be10207ec6bc290360af36e8506d2b94
1 /**
2 * \file
3 * Copyright 2018 Microsoft
4 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
5 */
6 #ifndef __MONO_METADATA_ICALL_DECL_H__
7 #define __MONO_METADATA_ICALL_DECL_H__
9 #include "appdomain-icalls.h"
10 #include "class.h"
11 #include "console-io.h"
12 #include "environment.h"
13 #include "file-mmap.h"
14 #include "filewatcher.h"
15 #include "gc-internals.h"
16 #include "handle-decl.h"
17 #include "handle.h"
18 #include "locales.h"
19 #include "marshal.h"
20 #include "monitor.h"
21 #include "mono-perfcounters.h"
22 #include "object-forward.h"
23 #include "object-internals.h"
24 #include "rand.h"
25 #include "reflection.h"
26 #include "security-core-clr.h"
27 #include "security-manager.h"
28 #include "security.h"
29 #include "string-icalls.h"
30 #include "threadpool-io.h"
31 #include "threadpool.h"
32 #include "mono/utils/mono-digest.h"
33 #include "mono/utils/mono-forward-internal.h"
34 #include "w32event.h"
35 #include "w32file.h"
36 #include "w32mutex.h"
37 #include "w32process.h"
38 #include "w32semaphore.h"
39 #include "w32socket.h"
40 #include "mono/utils/mono-proclib.h"
42 /* From MonoProperty.cs */
43 typedef enum {
44 PInfo_Attributes = 1,
45 PInfo_GetMethod = 1 << 1,
46 PInfo_SetMethod = 1 << 2,
47 PInfo_ReflectedType = 1 << 3,
48 PInfo_DeclaringType = 1 << 4,
49 PInfo_Name = 1 << 5
50 } PInfo;
52 #include "icall-table.h"
54 #define NOHANDLES(inner) inner
55 #define HANDLES_REUSE_WRAPPER(...) /* nothing */
57 // Generate prototypes for coop icall wrappers and coop icalls.
58 #define MONO_HANDLE_REGISTER_ICALL(func, ret, nargs, argtypes) \
59 MONO_HANDLE_DECLARE (,,func ## _impl, ret, nargs, argtypes); \
60 MONO_HANDLE_REGISTER_ICALL_DECLARE_RAW (func, ret, nargs, argtypes);
61 #define ICALL_TYPE(id, name, first) /* nothing */
62 #define ICALL(id, name, func) /* nothing */
63 #define HANDLES(id, name, func, ret, nargs, argtypes) \
64 MONO_HANDLE_DECLARE_RAW (id, name, func, ret, nargs, argtypes); \
65 MONO_HANDLE_DECLARE (id, name, func, ret, nargs, argtypes);
66 #include "icall-def.h"
67 #undef ICALL_TYPE
68 #undef ICALL
69 #undef HANDLES
70 #undef HANDLES_REUSE_WRAPPER
71 #undef NOHANDLES
72 #undef MONO_HANDLE_REGISTER_ICALL
74 // This is sorted.
75 // grep ICALL_EXPORT | sort | uniq
76 ICALL_EXPORT MonoAssemblyName* ves_icall_System_Reflection_AssemblyName_GetNativeName (MonoAssembly*);
77 ICALL_EXPORT MonoBoolean ves_icall_RuntimeTypeHandle_is_subclass_of (MonoType*, MonoType*);
78 ICALL_EXPORT MonoBoolean ves_icall_System_Environment_GetIs64BitOperatingSystem (void);
79 ICALL_EXPORT MonoBoolean ves_icall_System_Environment_get_HasShutdownStarted (void);
80 ICALL_EXPORT MonoBoolean ves_icall_System_GCHandle_CheckCurrentDomain (guint32 gchandle);
81 ICALL_EXPORT MonoBoolean ves_icall_System_IO_DriveInfo_GetDiskFreeSpace (const gunichar2*, gint32, guint64*, guint64*, guint64*, gint32*);
82 ICALL_EXPORT MonoBoolean ves_icall_System_Reflection_AssemblyName_ParseAssemblyName (const char*, MonoAssemblyName*, MonoBoolean*, MonoBoolean* is_token_defined_arg);
83 ICALL_EXPORT MonoBoolean ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_SufficientExecutionStack (void);
84 ICALL_EXPORT MonoBoolean ves_icall_System_Threading_Thread_YieldInternal (void);
85 ICALL_EXPORT void ves_icall_System_ArgIterator_Setup (MonoArgIterator*, char*, char*);
86 ICALL_EXPORT MonoType* ves_icall_System_ArgIterator_IntGetNextArgType (MonoArgIterator*);
87 ICALL_EXPORT void ves_icall_System_ArgIterator_IntGetNextArg (MonoArgIterator*, MonoTypedRef*);
88 ICALL_EXPORT void ves_icall_System_ArgIterator_IntGetNextArgWithType (MonoArgIterator*, MonoTypedRef*, MonoType*);
89 ICALL_EXPORT double ves_icall_System_Math_Abs_double (double);
90 ICALL_EXPORT double ves_icall_System_Math_Acos (double);
91 ICALL_EXPORT double ves_icall_System_Math_Acosh (double);
92 ICALL_EXPORT double ves_icall_System_Math_Asin (double);
93 ICALL_EXPORT double ves_icall_System_Math_Asinh (double);
94 ICALL_EXPORT double ves_icall_System_Math_Atan (double);
95 ICALL_EXPORT double ves_icall_System_Math_Atan2 (double, double);
96 ICALL_EXPORT double ves_icall_System_Math_Atanh (double);
97 ICALL_EXPORT double ves_icall_System_Math_Cbrt (double);
98 ICALL_EXPORT double ves_icall_System_Math_Ceiling (double);
99 ICALL_EXPORT double ves_icall_System_Math_Cos (double);
100 ICALL_EXPORT double ves_icall_System_Math_Cosh (double);
101 ICALL_EXPORT double ves_icall_System_Math_Exp (double);
102 ICALL_EXPORT double ves_icall_System_Math_FMod (double, double);
103 ICALL_EXPORT double ves_icall_System_Math_Floor (double);
104 ICALL_EXPORT double ves_icall_System_Math_Log (double);
105 ICALL_EXPORT double ves_icall_System_Math_Log10 (double);
106 ICALL_EXPORT double ves_icall_System_Math_ModF (double, double*);
107 ICALL_EXPORT double ves_icall_System_Math_Pow (double, double);
108 ICALL_EXPORT double ves_icall_System_Math_Round (double);
109 ICALL_EXPORT double ves_icall_System_Math_Sin (double);
110 ICALL_EXPORT double ves_icall_System_Math_Sinh (double);
111 ICALL_EXPORT double ves_icall_System_Math_Sqrt (double);
112 ICALL_EXPORT double ves_icall_System_Math_Tan (double);
113 ICALL_EXPORT double ves_icall_System_Math_Tanh (double);
114 ICALL_EXPORT float ves_icall_System_MathF_Acos (float);
115 ICALL_EXPORT float ves_icall_System_MathF_Acosh (float);
116 ICALL_EXPORT float ves_icall_System_MathF_Asin (float);
117 ICALL_EXPORT float ves_icall_System_MathF_Asinh (float);
118 ICALL_EXPORT float ves_icall_System_MathF_Atan (float);
119 ICALL_EXPORT float ves_icall_System_MathF_Atan2 (float, float);
120 ICALL_EXPORT float ves_icall_System_MathF_Atanh (float);
121 ICALL_EXPORT float ves_icall_System_MathF_Cbrt (float);
122 ICALL_EXPORT float ves_icall_System_MathF_Ceiling (float);
123 ICALL_EXPORT float ves_icall_System_MathF_Cos (float);
124 ICALL_EXPORT float ves_icall_System_MathF_Cosh (float);
125 ICALL_EXPORT float ves_icall_System_MathF_Exp (float);
126 ICALL_EXPORT float ves_icall_System_MathF_FMod (float, float);
127 ICALL_EXPORT float ves_icall_System_MathF_Floor (float);
128 ICALL_EXPORT float ves_icall_System_MathF_Log (float);
129 ICALL_EXPORT float ves_icall_System_MathF_Log10 (float);
130 ICALL_EXPORT float ves_icall_System_MathF_ModF (float, float*);
131 ICALL_EXPORT float ves_icall_System_MathF_Pow (float, float);
132 ICALL_EXPORT float ves_icall_System_MathF_Sin (float);
133 ICALL_EXPORT float ves_icall_System_MathF_Sinh (float);
134 ICALL_EXPORT float ves_icall_System_MathF_Sqrt (float);
135 ICALL_EXPORT float ves_icall_System_MathF_Tan (float);
136 ICALL_EXPORT float ves_icall_System_MathF_Tanh (float);
137 ICALL_EXPORT float ves_icall_System_Math_Abs_single (float);
138 #if ENABLE_NETCORE
139 ICALL_EXPORT gint32 ves_icall_System_Math_ILogB (double);
140 ICALL_EXPORT double ves_icall_System_Math_Log2 (double);
141 ICALL_EXPORT double ves_icall_System_Math_ScaleB (double, gint32);
142 ICALL_EXPORT double ves_icall_System_Math_FusedMultiplyAdd (double, double, double);
143 ICALL_EXPORT gint32 ves_icall_System_MathF_ILogB (float);
144 ICALL_EXPORT float ves_icall_System_MathF_Log2 (float);
145 ICALL_EXPORT float ves_icall_System_MathF_ScaleB (float, gint32);
146 ICALL_EXPORT float ves_icall_System_MathF_FusedMultiplyAdd (float, float, float);
147 #endif
148 ICALL_EXPORT gint ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetOffsetToStringData (void);
149 ICALL_EXPORT gint32 ves_icall_System_Environment_get_ProcessorCount (void);
150 ICALL_EXPORT gint32 ves_icall_System_Environment_get_TickCount (void);
151 #if ENABLE_NETCORE
152 ICALL_EXPORT gint64 ves_icall_System_Environment_get_TickCount64 (void);
153 #endif
154 ICALL_EXPORT gint64 ves_icall_System_DateTime_GetSystemTimeAsFileTime (void);
155 ICALL_EXPORT gint64 ves_icall_System_Diagnostics_Process_GetProcessData (int, gint32, MonoProcessError*);
156 ICALL_EXPORT gint64 ves_icall_System_Diagnostics_Stopwatch_GetTimestamp (void);
157 ICALL_EXPORT gint64 ves_icall_System_GC_GetTotalMemory (MonoBoolean forceCollection);
158 ICALL_EXPORT gint64 ves_icall_System_Threading_Timer_GetTimeMonotonic (void);
159 ICALL_EXPORT gpointer ves_icall_System_GCHandle_GetAddrOfPinnedObject (guint32 handle);
160 ICALL_EXPORT int ves_icall_Interop_Sys_DoubleToString (double, char*, char*, int);
161 ICALL_EXPORT int ves_icall_System_Environment_get_Platform (void);
162 ICALL_EXPORT int ves_icall_System_GC_GetCollectionCount (int);
163 ICALL_EXPORT int ves_icall_System_GC_GetMaxGeneration (void);
164 ICALL_EXPORT gint64 ves_icall_System_GC_GetAllocatedBytesForCurrentThread (void);
165 ICALL_EXPORT int ves_icall_System_Threading_Thread_SystemMaxStackSize (void);
166 ICALL_EXPORT int ves_icall_get_method_attributes (MonoMethod* method);
167 ICALL_EXPORT void ves_icall_Mono_Runtime_RegisterReportingForNativeLib (const char*, const char*);
168 ICALL_EXPORT void ves_icall_Mono_Runtime_RegisterReportingForAllNativeLibs (void);
169 ICALL_EXPORT void ves_icall_System_Array_GetGenericValue_icall (MonoArray**, guint32, gpointer);
170 ICALL_EXPORT void ves_icall_System_Array_SetGenericValue_icall (MonoArray**, guint32, gpointer);
171 ICALL_EXPORT void ves_icall_System_Buffer_MemcpyInternal (gpointer dest, gconstpointer src, gint32 count);
172 ICALL_EXPORT void ves_icall_System_Environment_Exit (int);
173 ICALL_EXPORT void ves_icall_System_GCHandle_FreeHandle (guint32 handle);
174 ICALL_EXPORT void ves_icall_System_GC_InternalCollect (int generation);
175 ICALL_EXPORT void ves_icall_System_GC_RecordPressure (gint64);
176 ICALL_EXPORT void ves_icall_System_GC_WaitForPendingFinalizers (void);
177 ICALL_EXPORT void ves_icall_System_GC_GetGCMemoryInfo (gint64*, gint64*, gint64*, gint64*, gint64*);
179 #if !ENABLE_NETCORE
180 ICALL_EXPORT void ves_icall_System_IO_LogcatTextWriter_Log (const char*, gint32, const char*);
181 #endif
182 ICALL_EXPORT void ves_icall_System_NumberFormatter_GetFormatterTables (guint64 const**, gint32 const**, gunichar2 const**, gunichar2 const**, gint64 const**, gint32 const**);
183 #if ENABLE_NETCORE
184 ICALL_EXPORT void ves_icall_System_Runtime_RuntimeImports_Memmove (guint8*, guint8*, size_t);
185 ICALL_EXPORT void ves_icall_System_Runtime_RuntimeImports_RhBulkMoveWithWriteBarrier (guint8*, guint8*, size_t);
186 #else
187 ICALL_EXPORT void ves_icall_System_Runtime_RuntimeImports_Memmove (guint8*, guint8*, guint);
188 ICALL_EXPORT void ves_icall_System_Runtime_RuntimeImports_Memmove_wbarrier (guint8*, guint8*, guint, MonoType*);
189 #endif
190 #if ENABLE_NETCORE
191 ICALL_EXPORT void ves_icall_System_Runtime_RuntimeImports_ZeroMemory (guint8*, size_t);
192 #else
193 ICALL_EXPORT void ves_icall_System_Runtime_RuntimeImports_ZeroMemory (guint8*, guint);
194 #endif
195 ICALL_EXPORT void ves_icall_System_Runtime_RuntimeImports_ecvt_s(char*, size_t, double, int, int*, int*);
197 #if defined(ENABLE_MONODROID) || defined(ENABLE_MONOTOUCH) || defined(TARGET_WASM)
198 ICALL_EXPORT gpointer ves_icall_System_IO_Compression_DeflateStreamNative_CreateZStream (gint32 compress, MonoBoolean gzip, gpointer feeder, gpointer data);
199 ICALL_EXPORT gint32 ves_icall_System_IO_Compression_DeflateStreamNative_CloseZStream (gpointer stream);
200 ICALL_EXPORT gint32 ves_icall_System_IO_Compression_DeflateStreamNative_Flush (gpointer stream);
201 ICALL_EXPORT gint32 ves_icall_System_IO_Compression_DeflateStreamNative_ReadZStream (gpointer stream, gpointer buffer, gint32 length);
202 ICALL_EXPORT gint32 ves_icall_System_IO_Compression_DeflateStreamNative_WriteZStream (gpointer stream, gpointer buffer, gint32 length);
203 #endif
205 #if defined(ENABLE_MONODROID)
206 ICALL_EXPORT gpointer ves_icall_System_Net_NetworkInformation_LinuxNetworkChange_CreateNLSocket (void);
207 ICALL_EXPORT gint32 ves_icall_System_Net_NetworkInformation_LinuxNetworkChange_ReadEvents (gpointer sock, gpointer buffer, gint32 count, gint32 size);
208 ICALL_EXPORT gpointer ves_icall_System_Net_NetworkInformation_LinuxNetworkChange_CloseNLSocket (gpointer sock);
209 #endif
211 ICALL_EXPORT MonoBoolean ves_icall_Microsoft_Win32_NativeMethods_CloseProcess (gpointer handle);
212 ICALL_EXPORT gpointer ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess (void);
213 ICALL_EXPORT gint32 ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcessId (void);
214 ICALL_EXPORT MonoBoolean ves_icall_Microsoft_Win32_NativeMethods_GetExitCodeProcess (gpointer handle, gint32 *exitcode);
215 ICALL_EXPORT gint32 ves_icall_Microsoft_Win32_NativeMethods_GetPriorityClass (gpointer handle);
216 ICALL_EXPORT MonoBoolean ves_icall_Microsoft_Win32_NativeMethods_GetProcessTimes (gpointer handle, gint64 *creation_time, gint64 *exit_time, gint64 *kernel_time, gint64 *user_time);
217 ICALL_EXPORT MonoBoolean ves_icall_Microsoft_Win32_NativeMethods_GetProcessWorkingSetSize (gpointer handle, gsize *min, gsize *max);
218 ICALL_EXPORT MonoBoolean ves_icall_Microsoft_Win32_NativeMethods_SetPriorityClass (gpointer handle, gint32 priorityClass);
219 ICALL_EXPORT MonoBoolean ves_icall_Microsoft_Win32_NativeMethods_SetProcessWorkingSetSize (gpointer handle, gsize min, gsize max);
220 ICALL_EXPORT MonoBoolean ves_icall_Microsoft_Win32_NativeMethods_TerminateProcess (gpointer handle, gint32 exitcode);
221 ICALL_EXPORT gint32 ves_icall_Microsoft_Win32_NativeMethods_WaitForInputIdle (gpointer handle, gint32 milliseconds);
223 ICALL_EXPORT MonoBoolean ves_icall_Mono_TlsProviderFactory_IsBtlsSupported (void);
225 ICALL_EXPORT void ves_icall_Mono_Runtime_AnnotateMicrosoftTelemetry (const char *key, const char *value);
226 ICALL_EXPORT void ves_icall_Mono_Runtime_DisableMicrosoftTelemetry (void);
227 ICALL_EXPORT int ves_icall_Mono_Runtime_CheckCrashReportingLog (const char *directory, MonoBoolean clear);
228 ICALL_EXPORT void ves_icall_Mono_Runtime_EnableCrashReportingLog (const char *directory);
230 ICALL_EXPORT void ves_icall_System_Array_InternalCreate (MonoArray *volatile* result, MonoType* type, gint32 rank, gint32* pLengths, gint32* pLowerBounds);
231 ICALL_EXPORT MonoBoolean ves_icall_System_Array_CanChangePrimitive (MonoReflectionType *volatile* ref_src_type_handle, MonoReflectionType *volatile* ref_dst_type_handle, MonoBoolean reliable);
233 ICALL_EXPORT MonoBoolean ves_icall_System_Diagnostics_Debugger_IsAttached_internal (void);
234 ICALL_EXPORT MonoBoolean ves_icall_System_Diagnostics_Debugger_IsLogging (void);
235 ICALL_EXPORT void ves_icall_System_Diagnostics_Debugger_Log (int level, MonoString *volatile* category, MonoString *volatile* message);
237 ICALL_EXPORT void ves_icall_Mono_RuntimeGPtrArrayHandle_GPtrArrayFree (GPtrArray *ptr_array);
238 ICALL_EXPORT void ves_icall_Mono_RuntimeMarshal_FreeAssemblyName (MonoAssemblyName *aname, MonoBoolean free_struct);
239 ICALL_EXPORT void ves_icall_Mono_SafeStringMarshal_GFree (void *c_str);
240 ICALL_EXPORT char* ves_icall_Mono_SafeStringMarshal_StringToUtf8 (MonoString *volatile* s);
241 ICALL_EXPORT MonoType* ves_icall_Mono_RuntimeClassHandle_GetTypeFromClass (MonoClass *klass);
243 ICALL_EXPORT MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_CanSecure (const gunichar2*);
244 ICALL_EXPORT MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsMachineProtected (const gunichar2*);
245 ICALL_EXPORT MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsUserProtected (const gunichar2*);
246 ICALL_EXPORT MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectMachine (const gunichar2*);
247 ICALL_EXPORT MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectUser (const gunichar2*);
248 ICALL_EXPORT void ves_icall_Mono_Interop_ComInteropProxy_AddProxy (gpointer pUnk, MonoComInteropProxy *volatile* proxy_handle);
249 ICALL_EXPORT void ves_icall_Mono_Interop_ComInteropProxy_FindProxy (gpointer pUnk, MonoComInteropProxy *volatile* proxy_handle);
251 ICALL_EXPORT gpointer ves_icall_System_Net_Sockets_Socket_Accept_icall (gsize, gint32*, MonoBoolean);
252 ICALL_EXPORT gint32 ves_icall_System_Net_Sockets_Socket_Available_icall (gsize, gint32*);
253 ICALL_EXPORT void ves_icall_System_Net_Sockets_Socket_Blocking_icall (gsize sock, MonoBoolean block, gint32 *werror);
254 ICALL_EXPORT void ves_icall_System_Net_Sockets_Socket_Close_icall (gsize sock, gint32 *werror);
255 ICALL_EXPORT void ves_icall_System_Net_Sockets_Socket_Disconnect_icall (gsize sock, MonoBoolean reuse, gint32 *werror);
256 ICALL_EXPORT MonoBoolean ves_icall_System_Net_Sockets_Socket_Duplicate_icall (gpointer handle, gint32 targetProcessId, gpointer *duplicate_handle, gint32 *werror);
257 ICALL_EXPORT void ves_icall_System_Net_Sockets_Socket_Listen_icall (gsize sock, guint32 backlog, gint32 *werror);
258 ICALL_EXPORT MonoBoolean ves_icall_System_Net_Sockets_Socket_Poll_icall (gsize sock, gint mode, gint timeout, gint32 *werror);
259 ICALL_EXPORT gint32 ves_icall_System_Net_Sockets_Socket_Receive_icall (gsize sock, gchar *buffer, gint32 count, gint32 flags, gint32 *werror, MonoBoolean blocking);
260 ICALL_EXPORT gint32 ves_icall_System_Net_Sockets_Socket_Receive_array_icall (gsize sock, WSABUF *buffers, gint32 count, gint32 flags, gint32 *werror, MonoBoolean blocking);
261 ICALL_EXPORT gint32 ves_icall_System_Net_Sockets_Socket_Send_icall (gsize sock, gchar *buffer, gint32 count, gint32 flags, gint32 *werror, MonoBoolean blocking);
262 ICALL_EXPORT gint32 ves_icall_System_Net_Sockets_Socket_Send_array_icall (gsize sock, WSABUF *buffers, gint32 count, gint32 flags, gint32 *werror, MonoBoolean blocking);
263 ICALL_EXPORT void ves_icall_System_Net_Sockets_Socket_Shutdown_icall (gsize sock, gint32 how, gint32 *werror);
264 ICALL_EXPORT MonoBoolean ves_icall_System_Net_Sockets_Socket_SupportPortReuse_icall (MonoProtocolType proto);
266 ICALL_EXPORT gpointer ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMem (int);
267 ICALL_EXPORT gpointer ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMemSize (gsize);
268 ICALL_EXPORT gpointer ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal (gsize);
269 ICALL_EXPORT gpointer ves_icall_System_Runtime_InteropServices_Marshal_ReAllocCoTaskMem (gpointer ptr, int size);
270 ICALL_EXPORT gpointer ves_icall_System_Runtime_InteropServices_Marshal_ReAllocHGlobal (gpointer, gsize);
271 ICALL_EXPORT char* ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi (const gunichar2*, int);
272 ICALL_EXPORT gunichar2* ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni (const gunichar2*, int);
275 #endif // __MONO_METADATA_ICALL_DECL_H__