1 /**
2  * \file
3  * System.Diagnostics.Process support
4  *
5  * Author:
6  *	Dick Porter (dick@ximian.com)
7  *
8  * (C) 2002 Ximian, Inc.
9  */
10 
11 #ifndef _MONO_METADATA_W32PROCESS_H_
12 #define _MONO_METADATA_W32PROCESS_H_
13 
14 #include <config.h>
15 #include <glib.h>
16 
17 #if HAVE_SYS_TYPES_H
18 #include <sys/types.h>
19 #endif
20 
21 #include <mono/metadata/object.h>
22 
23 G_BEGIN_DECLS
24 
25 typedef enum {
26 	MONO_W32PROCESS_PRIORITY_CLASS_NORMAL       = 0x0020,
27 	MONO_W32PROCESS_PRIORITY_CLASS_IDLE         = 0x0040,
28 	MONO_W32PROCESS_PRIORITY_CLASS_HIGH         = 0x0080,
29 	MONO_W32PROCESS_PRIORITY_CLASS_REALTIME     = 0x0100,
30 	MONO_W32PROCESS_PRIORITY_CLASS_BELOW_NORMAL = 0x4000,
31 	MONO_W32PROCESS_PRIORITY_CLASS_ABOVE_NORMAL = 0x8000,
32 } MonoW32ProcessPriorityClass;
33 
34 typedef struct
35 {
36 	gpointer process_handle;
37 	guint32 pid; /* Contains mono_w32error_get_last () on failure */
38 	MonoArray *env_variables;
39 	MonoString *username;
40 	MonoString *domain;
41 	gpointer password; /* BSTR from SecureString in 2.0 profile */
42 	MonoBoolean load_user_profile;
43 } MonoW32ProcessInfo;
44 
45 typedef struct
46 {
47 	MonoObject object;
48 	MonoString *filename;
49 	MonoString *arguments;
50 	MonoString *working_directory;
51 	MonoString *verb;
52 	guint32 window_style;
53 	MonoBoolean error_dialog;
54 	gpointer error_dialog_parent_handle;
55 	MonoBoolean use_shell_execute;
56 	MonoString *username;
57 	MonoString *domain;
58 	MonoObject *password; /* SecureString in 2.0 profile, dummy in 1.x */
59 	MonoString *password_in_clear_text;
60 	MonoBoolean load_user_profile;
61 	MonoBoolean redirect_standard_input;
62 	MonoBoolean redirect_standard_output;
63 	MonoBoolean redirect_standard_error;
64 	MonoObject *encoding_stdout;
65 	MonoObject *encoding_stderr;
66 	MonoBoolean create_no_window;
67 	MonoObject *weak_parent_process;
68 	MonoObject *envVars;
69 } MonoW32ProcessStartInfo;
70 
71 void
72 mono_w32process_init (void);
73 
74 void
75 mono_w32process_cleanup (void);
76 
77 void
78 mono_w32process_signal_finished (void);
79 
80 #ifndef HOST_WIN32
81 
82 void
83 mono_w32process_set_cli_launcher (gchar *path);
84 
85 gchar*
86 mono_w32process_get_path (pid_t pid);
87 
88 #endif
89 
90 gpointer
91 ves_icall_System_Diagnostics_Process_GetProcess_internal (guint32 pid);
92 
93 MonoArray*
94 ves_icall_System_Diagnostics_Process_GetProcesses_internal (void);
95 
96 MonoArray*
97 ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject *this_obj, gpointer process);
98 
99 void
100 ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal (MonoObject *this_obj, MonoString *filename);
101 
102 MonoBoolean
103 ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoW32ProcessStartInfo *proc_start_info, MonoW32ProcessInfo *process_handle);
104 
105 MonoBoolean
106 ves_icall_System_Diagnostics_Process_CreateProcess_internal (MonoW32ProcessStartInfo *proc_start_info, gpointer stdin_handle,
107 	gpointer stdout_handle, gpointer stderr_handle, MonoW32ProcessInfo *process_handle);
108 
109 MonoString*
110 ves_icall_System_Diagnostics_Process_ProcessName_internal (gpointer process);
111 
112 gint64
113 ves_icall_System_Diagnostics_Process_GetProcessData (int pid, gint32 data_type, gint32 *error);
114 
115 gpointer
116 ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess (void);
117 
118 MonoBoolean
119 ves_icall_Microsoft_Win32_NativeMethods_GetExitCodeProcess (gpointer handle, gint32 *exitcode);
120 
121 MonoBoolean
122 ves_icall_Microsoft_Win32_NativeMethods_CloseProcess (gpointer handle);
123 
124 MonoBoolean
125 ves_icall_Microsoft_Win32_NativeMethods_TerminateProcess (gpointer handle, gint32 exitcode);
126 
127 MonoBoolean
128 ves_icall_Microsoft_Win32_NativeMethods_GetProcessWorkingSetSize (gpointer handle, gsize *min, gsize *max);
129 MonoBoolean
130 ves_icall_Microsoft_Win32_NativeMethods_SetProcessWorkingSetSize (gpointer handle, gsize min, gsize max);
131 
132 gint32
133 ves_icall_Microsoft_Win32_NativeMethods_GetPriorityClass (gpointer handle);
134 MonoBoolean
135 ves_icall_Microsoft_Win32_NativeMethods_SetPriorityClass (gpointer handle, gint32 priorityClass);
136 
137 MonoBoolean
138 ves_icall_Microsoft_Win32_NativeMethods_GetProcessTimes (gpointer handle, gint64 *creationtime, gint64 *exittime, gint64 *kerneltime, gint64 *usertime);
139 
140 G_END_DECLS
141 
142 #endif /* _MONO_METADATA_W32PROCESS_H_ */
143 
144