From: Jay Krell Date: Mon, 21 Oct 2019 08:29:39 +0000 (-0700) Subject: [Coop] Unconvert Microsoft.Win32.NativeMethods. (mono/mono#16992) X-Git-Tag: submit/tizen/20210909.063632~10331^2~5^2~318 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9fb7e2acbd0b0ceb0c871c620293d553d0ccbfdb;p=platform%2Fupstream%2Fdotnet%2Fruntime.git [Coop] Unconvert Microsoft.Win32.NativeMethods. (mono/mono#16992) * [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_CloseProcess. * [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess. * [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcessId. * [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_GetExitCodeProcess. * [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_GetPriorityClass. * [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_GetProcessTimes. * [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_GetProcessWorkingSetSize. * [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_SetPriorityClass. * [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_SetProcessWorkingSetSize. * [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_TerminateProcess. * [Coop] Unconvert ves_icall_Microsoft_Win32_NativeMethods_WaitForInputIdle. Commit migrated from https://github.com/mono/mono/commit/9f50bdb2d944793d30ea2d052cdad96feb282003 --- diff --git a/src/mono/mono/metadata/icall-decl.h b/src/mono/mono/metadata/icall-decl.h index b7b1da9..0b887c4 100644 --- a/src/mono/mono/metadata/icall-decl.h +++ b/src/mono/mono/metadata/icall-decl.h @@ -204,6 +204,17 @@ ICALL_EXPORT gint32 ves_icall_System_Net_NetworkInformation_LinuxNetworkChange_R ICALL_EXPORT gpointer ves_icall_System_Net_NetworkInformation_LinuxNetworkChange_CloseNLSocket (gpointer sock); #endif +ICALL_EXPORT MonoBoolean ves_icall_Microsoft_Win32_NativeMethods_CloseProcess (gpointer handle); +ICALL_EXPORT gpointer ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess (void); +ICALL_EXPORT gint32 ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcessId (void); +ICALL_EXPORT MonoBoolean ves_icall_Microsoft_Win32_NativeMethods_GetExitCodeProcess (gpointer handle, gint32 *exitcode); +ICALL_EXPORT gint32 ves_icall_Microsoft_Win32_NativeMethods_GetPriorityClass (gpointer handle); +ICALL_EXPORT MonoBoolean ves_icall_Microsoft_Win32_NativeMethods_GetProcessTimes (gpointer handle, gint64 *creation_time, gint64 *exit_time, gint64 *kernel_time, gint64 *user_time); +ICALL_EXPORT MonoBoolean ves_icall_Microsoft_Win32_NativeMethods_GetProcessWorkingSetSize (gpointer handle, gsize *min, gsize *max); +ICALL_EXPORT MonoBoolean ves_icall_Microsoft_Win32_NativeMethods_SetPriorityClass (gpointer handle, gint32 priorityClass); +ICALL_EXPORT MonoBoolean ves_icall_Microsoft_Win32_NativeMethods_SetProcessWorkingSetSize (gpointer handle, gsize min, gsize max); +ICALL_EXPORT MonoBoolean ves_icall_Microsoft_Win32_NativeMethods_TerminateProcess (gpointer handle, gint32 exitcode); +ICALL_EXPORT gint32 ves_icall_Microsoft_Win32_NativeMethods_WaitForInputIdle (gpointer handle, gint32 milliseconds); ICALL_EXPORT MonoBoolean ves_icall_Mono_TlsProviderFactory_IsBtlsSupported (void); #endif // __MONO_METADATA_ICALL_H__ diff --git a/src/mono/mono/metadata/icall-def.h b/src/mono/mono/metadata/icall-def.h index c7d66c1..19ff387 100644 --- a/src/mono/mono/metadata/icall-def.h +++ b/src/mono/mono/metadata/icall-def.h @@ -115,18 +115,17 @@ ICALL_TYPE(CLR_INTEROP_SYS, "Interop/Sys", CLR_INTEROP_SYS_1) NOHANDLES(ICALL(CLR_INTEROP_SYS_1, "DoubleToString", ves_icall_Interop_Sys_DoubleToString)) ICALL_TYPE(NATIVEMETHODS, "Microsoft.Win32.NativeMethods", NATIVEMETHODS_1) -// FIXME Much of this could be NOHANDLES(). -HANDLES(NATIVEMETHODS_1, "CloseProcess", ves_icall_Microsoft_Win32_NativeMethods_CloseProcess, MonoBoolean, 1, (gpointer)) -HANDLES(NATIVEMETHODS_2, "GetCurrentProcess", ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess, gpointer, 0, ()) -HANDLES(NATIVEMETHODS_3, "GetCurrentProcessId", ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcessId, gint32, 0, ()) -HANDLES(NATIVEMETHODS_4, "GetExitCodeProcess", ves_icall_Microsoft_Win32_NativeMethods_GetExitCodeProcess, MonoBoolean, 2, (gpointer, gint32_ref)) -HANDLES(NATIVEMETHODS_5, "GetPriorityClass", ves_icall_Microsoft_Win32_NativeMethods_GetPriorityClass, gint32, 1, (gpointer)) -HANDLES(NATIVEMETHODS_6, "GetProcessTimes", ves_icall_Microsoft_Win32_NativeMethods_GetProcessTimes, MonoBoolean, 5, (gpointer, gint64_ref, gint64_ref, gint64_ref, gint64_ref)) -HANDLES(NATIVEMETHODS_7, "GetProcessWorkingSetSize", ves_icall_Microsoft_Win32_NativeMethods_GetProcessWorkingSetSize, MonoBoolean, 3, (gpointer, gsize_ref, gsize_ref)) -HANDLES(NATIVEMETHODS_8, "SetPriorityClass", ves_icall_Microsoft_Win32_NativeMethods_SetPriorityClass, MonoBoolean, 2, (gpointer, gint32)) -HANDLES(NATIVEMETHODS_9, "SetProcessWorkingSetSize", ves_icall_Microsoft_Win32_NativeMethods_SetProcessWorkingSetSize, MonoBoolean, 3, (gpointer, gsize, gsize)) -HANDLES(NATIVEMETHODS_10, "TerminateProcess", ves_icall_Microsoft_Win32_NativeMethods_TerminateProcess, MonoBoolean, 2, (gpointer, gint32)) -HANDLES(NATIVEMETHODS_11, "WaitForInputIdle", ves_icall_Microsoft_Win32_NativeMethods_WaitForInputIdle, gint32, 2, (gpointer, gint32)) +NOHANDLES(ICALL(NATIVEMETHODS_1, "CloseProcess", ves_icall_Microsoft_Win32_NativeMethods_CloseProcess)) +NOHANDLES(ICALL(NATIVEMETHODS_2, "GetCurrentProcess", ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess)) +NOHANDLES(ICALL(NATIVEMETHODS_3, "GetCurrentProcessId", ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcessId)) +NOHANDLES(ICALL(NATIVEMETHODS_4, "GetExitCodeProcess", ves_icall_Microsoft_Win32_NativeMethods_GetExitCodeProcess)) +NOHANDLES(ICALL(NATIVEMETHODS_5, "GetPriorityClass", ves_icall_Microsoft_Win32_NativeMethods_GetPriorityClass)) +NOHANDLES(ICALL(NATIVEMETHODS_6, "GetProcessTimes", ves_icall_Microsoft_Win32_NativeMethods_GetProcessTimes)) +NOHANDLES(ICALL(NATIVEMETHODS_7, "GetProcessWorkingSetSize", ves_icall_Microsoft_Win32_NativeMethods_GetProcessWorkingSetSize)) +NOHANDLES(ICALL(NATIVEMETHODS_8, "SetPriorityClass", ves_icall_Microsoft_Win32_NativeMethods_SetPriorityClass)) +NOHANDLES(ICALL(NATIVEMETHODS_9, "SetProcessWorkingSetSize", ves_icall_Microsoft_Win32_NativeMethods_SetProcessWorkingSetSize)) +NOHANDLES(ICALL(NATIVEMETHODS_10, "TerminateProcess", ves_icall_Microsoft_Win32_NativeMethods_TerminateProcess)) +NOHANDLES(ICALL(NATIVEMETHODS_11, "WaitForInputIdle", ves_icall_Microsoft_Win32_NativeMethods_WaitForInputIdle)) #ifndef DISABLE_COM ICALL_TYPE(COMPROX, "Mono.Interop.ComInteropProxy", COMPROX_1) diff --git a/src/mono/mono/metadata/icall.c b/src/mono/mono/metadata/icall.c index 200b1d3..b82b285 100644 --- a/src/mono/mono/metadata/icall.c +++ b/src/mono/mono/metadata/icall.c @@ -8900,7 +8900,7 @@ ves_icall_Mono_Runtime_GetDisplayName (MonoError *error) } #ifndef HOST_WIN32 -static inline gint32 +static gint32 mono_icall_wait_for_input_idle (gpointer handle, gint32 milliseconds) { return WAIT_TIMEOUT; @@ -8909,13 +8909,13 @@ mono_icall_wait_for_input_idle (gpointer handle, gint32 milliseconds) #ifndef ENABLE_NETCORE gint32 -ves_icall_Microsoft_Win32_NativeMethods_WaitForInputIdle (gpointer handle, gint32 milliseconds, MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_WaitForInputIdle (gpointer handle, gint32 milliseconds) { return mono_icall_wait_for_input_idle (handle, milliseconds); } gint32 -ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcessId (MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcessId (void) { return mono_process_current_pid (); } diff --git a/src/mono/mono/metadata/w32process-unix.c b/src/mono/mono/metadata/w32process-unix.c index dbb8e95..ddf251b 100644 --- a/src/mono/mono/metadata/w32process-unix.c +++ b/src/mono/mono/metadata/w32process-unix.c @@ -2260,13 +2260,13 @@ mono_w32process_set_cli_launcher (gchar *path) } gpointer -ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess (MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess (void) { return current_process; } MonoBoolean -ves_icall_Microsoft_Win32_NativeMethods_GetExitCodeProcess (gpointer handle, gint32 *exitcode, MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_GetExitCodeProcess (gpointer handle, gint32 *exitcode) { return mono_get_exit_code_process (handle, exitcode); } @@ -2315,13 +2315,13 @@ mono_get_exit_code_process (gpointer handle, gint32 *exitcode) } MonoBoolean -ves_icall_Microsoft_Win32_NativeMethods_CloseProcess (gpointer handle, MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_CloseProcess (gpointer handle) { return mono_w32handle_close (handle); } MonoBoolean -ves_icall_Microsoft_Win32_NativeMethods_TerminateProcess (gpointer handle, gint32 exitcode, MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_TerminateProcess (gpointer handle, gint32 exitcode) { #ifdef HAVE_KILL MonoW32Handle *handle_data; @@ -2364,7 +2364,7 @@ ves_icall_Microsoft_Win32_NativeMethods_TerminateProcess (gpointer handle, gint3 } MonoBoolean -ves_icall_Microsoft_Win32_NativeMethods_GetProcessWorkingSetSize (gpointer handle, gsize *min, gsize *max, MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_GetProcessWorkingSetSize (gpointer handle, gsize *min, gsize *max) { MonoW32Handle *handle_data; MonoW32HandleProcess *process_handle; @@ -2400,7 +2400,7 @@ ves_icall_Microsoft_Win32_NativeMethods_GetProcessWorkingSetSize (gpointer handl } MonoBoolean -ves_icall_Microsoft_Win32_NativeMethods_SetProcessWorkingSetSize (gpointer handle, gsize min, gsize max, MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_SetProcessWorkingSetSize (gpointer handle, gsize min, gsize max) { MonoW32Handle *handle_data; MonoW32HandleProcess *process_handle; @@ -2433,7 +2433,7 @@ ves_icall_Microsoft_Win32_NativeMethods_SetProcessWorkingSetSize (gpointer handl } gint32 -ves_icall_Microsoft_Win32_NativeMethods_GetPriorityClass (gpointer handle, MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_GetPriorityClass (gpointer handle) { #ifdef HAVE_GETPRIORITY MonoW32Handle *handle_data; @@ -2499,7 +2499,7 @@ ves_icall_Microsoft_Win32_NativeMethods_GetPriorityClass (gpointer handle, MonoE } MonoBoolean -ves_icall_Microsoft_Win32_NativeMethods_SetPriorityClass (gpointer handle, gint32 priorityClass, MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_SetPriorityClass (gpointer handle, gint32 priorityClass) { #ifdef HAVE_SETPRIORITY MonoW32Handle *handle_data; @@ -2578,7 +2578,7 @@ ticks_to_processtime (guint64 ticks, ProcessTime *processtime) } MonoBoolean -ves_icall_Microsoft_Win32_NativeMethods_GetProcessTimes (gpointer handle, gint64 *creation_time, gint64 *exit_time, gint64 *kernel_time, gint64 *user_time, MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_GetProcessTimes (gpointer handle, gint64 *creation_time, gint64 *exit_time, gint64 *kernel_time, gint64 *user_time) { MonoW32Handle *handle_data; MonoW32HandleProcess *process_handle; diff --git a/src/mono/mono/metadata/w32process-win32-uwp.c b/src/mono/mono/metadata/w32process-win32-uwp.c index c96d58c..bf4ed50 100644 --- a/src/mono/mono/metadata/w32process-win32-uwp.c +++ b/src/mono/mono/metadata/w32process-win32-uwp.c @@ -96,42 +96,50 @@ ves_icall_System_Diagnostics_Process_CreateProcess_internal (MonoW32ProcessStart } MonoBoolean -ves_icall_Microsoft_Win32_NativeMethods_GetProcessWorkingSetSize (gpointer handle, gsize *min, gsize *max, MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_GetProcessWorkingSetSize (gpointer handle, gsize *min, gsize *max) { + ERROR_DECL (error); g_unsupported_api ("GetProcessWorkingSetSize"); mono_error_set_not_supported(error, G_UNSUPPORTED_API, "GetProcessWorkingSetSize"); SetLastError (ERROR_NOT_SUPPORTED); + mono_error_set_pending_exception (error); return FALSE; } MonoBoolean -ves_icall_Microsoft_Win32_NativeMethods_SetProcessWorkingSetSize (gpointer handle, gsize min, gsize max, MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_SetProcessWorkingSetSize (gpointer handle, gsize min, gsize max) { + ERROR_DECL (error); g_unsupported_api ("SetProcessWorkingSetSize"); mono_error_set_not_supported (error, G_UNSUPPORTED_API, "SetProcessWorkingSetSize"); SetLastError (ERROR_NOT_SUPPORTED); + mono_error_set_pending_exception (error); return FALSE; } gint32 -ves_icall_Microsoft_Win32_NativeMethods_GetPriorityClass (gpointer handle, MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_GetPriorityClass (gpointer handle) { // FIXME GetPriorityClass is supported for UWP. Use finer grained #if. + ERROR_DECL (error); g_unsupported_api ("GetPriorityClass"); mono_error_set_not_supported (error, G_UNSUPPORTED_API, "GetPriorityClass"); SetLastError (ERROR_NOT_SUPPORTED); + mono_error_set_pending_exception (error); return FALSE; } MonoBoolean -ves_icall_Microsoft_Win32_NativeMethods_SetPriorityClass (gpointer handle, gint32 priorityClass, MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_SetPriorityClass (gpointer handle, gint32 priorityClass) { // FIXME SetPriorityClass is supported for UWP. Use finer grained #if. + ERROR_DECL (error); g_unsupported_api ("SetPriorityClass"); mono_error_set_not_supported(error, G_UNSUPPORTED_API, "SetPriorityClass"); SetLastError (ERROR_NOT_SUPPORTED); + mono_error_set_pending_exception (error); return FALSE; } diff --git a/src/mono/mono/metadata/w32process-win32.c b/src/mono/mono/metadata/w32process-win32.c index 95c1b10..6920ac8 100644 --- a/src/mono/mono/metadata/w32process-win32.c +++ b/src/mono/mono/metadata/w32process-win32.c @@ -380,55 +380,55 @@ exit: } MonoBoolean -ves_icall_Microsoft_Win32_NativeMethods_CloseProcess (gpointer handle, MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_CloseProcess (gpointer handle) { return CloseHandle (handle); } MonoBoolean -ves_icall_Microsoft_Win32_NativeMethods_TerminateProcess (gpointer handle, gint32 exitcode, MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_TerminateProcess (gpointer handle, gint32 exitcode) { return TerminateProcess (handle, exitcode); } MonoBoolean -ves_icall_Microsoft_Win32_NativeMethods_GetExitCodeProcess (gpointer handle, gint32 *exitcode, MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_GetExitCodeProcess (gpointer handle, gint32 *exitcode) { return GetExitCodeProcess (handle, (PDWORD)exitcode); } MonoBoolean -ves_icall_Microsoft_Win32_NativeMethods_GetProcessWorkingSetSize (gpointer handle, gsize *min, gsize *max, MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_GetProcessWorkingSetSize (gpointer handle, gsize *min, gsize *max) { return GetProcessWorkingSetSize (handle, (PSIZE_T)min, (PSIZE_T)max); } MonoBoolean -ves_icall_Microsoft_Win32_NativeMethods_SetProcessWorkingSetSize (gpointer handle, gsize min, gsize max, MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_SetProcessWorkingSetSize (gpointer handle, gsize min, gsize max) { return SetProcessWorkingSetSize (handle, min, max); } gint32 -ves_icall_Microsoft_Win32_NativeMethods_GetPriorityClass (gpointer handle, MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_GetPriorityClass (gpointer handle) { return GetPriorityClass (handle); } MonoBoolean -ves_icall_Microsoft_Win32_NativeMethods_SetPriorityClass (gpointer handle, gint32 priorityClass, MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_SetPriorityClass (gpointer handle, gint32 priorityClass) { return SetPriorityClass (handle, (guint32) priorityClass); } MonoBoolean -ves_icall_Microsoft_Win32_NativeMethods_GetProcessTimes (gpointer handle, gint64 *creationtime, gint64 *exittime, gint64 *kerneltime, gint64 *usertime, MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_GetProcessTimes (gpointer handle, gint64 *creationtime, gint64 *exittime, gint64 *kerneltime, gint64 *usertime) { return GetProcessTimes (handle, (LPFILETIME) creationtime, (LPFILETIME) exittime, (LPFILETIME) kerneltime, (LPFILETIME) usertime); } gpointer -ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess (MonoError *error) +ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess (void) { return GetCurrentProcess (); }