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