-/*
- * process-windows-uwp.c: UWP process support for Mono.
+/**
+ * \file
+ * UWP process support for Mono.
*
* Copyright 2016 Microsoft
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include <config.h>
#include <glib.h>
+#include "mono/utils/mono-compiler.h"
#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
-#include <Windows.h>
+#include <windows.h>
+#include <mono/metadata/object-internals.h>
+#include "mono/metadata/w32process.h"
+#include "mono/metadata/w32process-internals.h"
#include "mono/metadata/w32process-win32-internals.h"
gboolean
HANDLE
ves_icall_System_Diagnostics_Process_GetProcess_internal (guint32 pid)
{
- HANDLE handle;
-
- /* GetCurrentProcess returns a pseudo-handle, so use
- * OpenProcess instead
- */
- handle = OpenProcess (PROCESS_ALL_ACCESS, TRUE, pid);
- if (handle == NULL)
- /* FIXME: Throw an exception */
- return NULL;
- return handle;
+ MonoError mono_error;
+ error_init (&mono_error);
+
+ g_unsupported_api ("OpenProcess");
+
+ mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "OpenProcess");
+ mono_error_set_pending_exception (&mono_error);
+
+ SetLastError (ERROR_NOT_SUPPORTED);
+
+ return NULL;
}
void
{
g_unsupported_api ("GetFileVersionInfoSize, GetFileVersionInfo, VerQueryValue, VerLanguageName");
- mono_error_init (error);
+ error_init (error);
mono_error_set_not_supported (error, G_UNSUPPORTED_API, "GetFileVersionInfoSize, GetFileVersionInfo, VerQueryValue, VerLanguageName");
SetLastError (ERROR_NOT_SUPPORTED);
{
g_unsupported_api ("GetModuleInformation");
- mono_error_init (error);
+ error_init (error);
mono_error_set_not_supported (error, G_UNSUPPORTED_API, "GetModuleInformation");
SetLastError (ERROR_NOT_SUPPORTED);
ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject *this_obj, HANDLE process)
{
MonoError mono_error;
- mono_error_init (&mono_error);
+ error_init (&mono_error);
g_unsupported_api ("EnumProcessModules, GetModuleBaseName, GetModuleFileNameEx");
}
MonoBoolean
-ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoProcessStartInfo *proc_start_info, MonoProcInfo *process_info)
+ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoW32ProcessStartInfo *proc_start_info, MonoW32ProcessInfo *process_info)
{
MonoError mono_error;
- mono_error_init (&mono_error);
+ error_init (&mono_error);
g_unsupported_api ("ShellExecuteEx");
}
gboolean
-mono_process_create_process (MonoProcInfo *mono_process_info, gunichar2 *shell_path, MonoString *cmd, guint32 creation_flags,
- gchar *env_vars, gunichar2 *dir, STARTUPINFO *start_info, PROCESS_INFORMATION *process_info)
+mono_process_create_process (MonoW32ProcessInfo *mono_process_info, MonoString *cmd, guint32 creation_flags,
+ gunichar2 *env_vars, gunichar2 *dir, STARTUPINFO *start_info, PROCESS_INFORMATION *process_info)
{
MonoError mono_error;
gchar *api_name = "";
memset (&process_info, 0, sizeof (PROCESS_INFORMATION));
g_unsupported_api (api_name);
- mono_error_init (&mono_error);
+ error_init (&mono_error);
mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, api_name);
mono_error_set_pending_exception (&mono_error);
mono_icall_get_process_working_set_size (gpointer handle, gsize *min, gsize *max)
{
MonoError mono_error;
- mono_error_init (&mono_error);
+ error_init (&mono_error);
g_unsupported_api ("GetProcessWorkingSetSize");
mono_icall_set_process_working_set_size (gpointer handle, gsize min, gsize max)
{
MonoError mono_error;
- mono_error_init (&mono_error);
+ error_init (&mono_error);
g_unsupported_api ("SetProcessWorkingSetSize");
mono_icall_get_priority_class (gpointer handle)
{
MonoError mono_error;
- mono_error_init (&mono_error);
+ error_init (&mono_error);
g_unsupported_api ("GetPriorityClass");
mono_icall_set_priority_class (gpointer handle, gint32 priorityClass)
{
MonoError mono_error;
- mono_error_init (&mono_error);
+ error_init (&mono_error);
g_unsupported_api ("SetPriorityClass");
#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
-#ifdef _MSC_VER
-// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
-void __mono_win32_process_windows_uwp_quiet_lnk4221(void) {}
-#endif
+MONO_EMPTY_SOURCE_FILE (process_windows_uwp);
#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */