1 | /*
|
---|
2 | * Process definitions
|
---|
3 | *
|
---|
4 | * Copyright 1996 Alexandre Julliard
|
---|
5 | */
|
---|
6 |
|
---|
7 | #ifndef __WINE_PROCESS_H
|
---|
8 | #define __WINE_PROCESS_H
|
---|
9 |
|
---|
10 | #include "windef.h"
|
---|
11 | #include "module.h"
|
---|
12 | #include "thread.h"
|
---|
13 |
|
---|
14 | struct _NE_MODULE;
|
---|
15 | struct _THREAD_ENTRY;
|
---|
16 | struct _UTINFO;
|
---|
17 |
|
---|
18 | /* Current Process pseudo-handle - Returned by GetCurrentProcess*/
|
---|
19 | #define CURRENT_PROCESS_PSEUDOHANDLE ((HANDLE)0x7fffffff)
|
---|
20 |
|
---|
21 |
|
---|
22 | #ifdef __WIN32OS2__
|
---|
23 | /*
|
---|
24 | * This is GUESS WORK. I've not spend too much time
|
---|
25 | * figuring out how this really is. But this at least make some sense.
|
---|
26 | */
|
---|
27 | /* The doubly linked list node for one handler */
|
---|
28 | typedef struct _ConCtrl
|
---|
29 | {
|
---|
30 | void * pfnHandler; /* Pointer to the handler. (PHANDLER_ROUTINE) */
|
---|
31 | struct _ConCtrl * pNext; /* Pointer to the next in the chain. */
|
---|
32 | struct _ConCtrl * pPrev; /* Pointer to the prev in the chain. */
|
---|
33 | ULONG flFlags; /* Internal flags for prevent crash during
|
---|
34 | * GenerateConsoleCtrlEvent(). Initially 0.
|
---|
35 | */
|
---|
36 | } CONCTRL, *PCONCTRL;
|
---|
37 |
|
---|
38 | /* flFlags in CONCTRL */
|
---|
39 | #define ODIN32_CONCTRL_FLAGS_INIT 0x00000000
|
---|
40 | #define ODIN32_CONCTRL_FLAGS_USED 0x00000001
|
---|
41 | #define ODIN32_CONCTRL_FLAGS_REMOVED 0x00000002
|
---|
42 |
|
---|
43 | /*
|
---|
44 | * Console Handler Data struct.
|
---|
45 | * GUESS WORK!
|
---|
46 | * Insert at head. Remove from tail.
|
---|
47 | */
|
---|
48 | typedef struct _ConCtrlData
|
---|
49 | {
|
---|
50 | PCONCTRL pHead; /* Head of handler list. */
|
---|
51 | PCONCTRL pTail; /* Tail of handler list. */
|
---|
52 | BOOL fIgnoreCtrlC; /* If set we should ignore Ctrl-C. */
|
---|
53 | /* Initially false / inherited. */
|
---|
54 | } CONCTRLDATA, *PCONCTRLDATA;
|
---|
55 | #endif
|
---|
56 |
|
---|
57 | /* Win32 process environment database */
|
---|
58 | typedef struct
|
---|
59 | {
|
---|
60 | LPSTR environ; /* 00 Process environment strings */
|
---|
61 | DWORD unknown1; /* 04 Unknown */
|
---|
62 | LPSTR cmd_line; /* 08 Command line */
|
---|
63 | LPSTR cur_dir; /* 0c Current directory */
|
---|
64 | STARTUPINFOA *startup_info; /* 10 Startup information */
|
---|
65 | HANDLE hStdin; /* 14 Handle for standard input */
|
---|
66 | HANDLE hStdout; /* 18 Handle for standard output */
|
---|
67 | HANDLE hStderr; /* 1c Handle for standard error */
|
---|
68 | DWORD unknown2; /* 20 Unknown */
|
---|
69 | DWORD inherit_console; /* 24 Inherit console flag */
|
---|
70 | DWORD break_type; /* 28 Console events flag (kso: pointer in NT4?) */
|
---|
71 | void *break_sem; /* 2c SetConsoleCtrlHandler semaphore */
|
---|
72 | void *break_event; /* 30 SetConsoleCtrlHandler event */
|
---|
73 | void *break_thread; /* 34 SetConsoleCtrlHandler thread */
|
---|
74 | void *break_handlers; /* 38 List of console handlers */
|
---|
75 | /* The following are Wine-specific fields */
|
---|
76 | CRITICAL_SECTION section; /* 3c Env DB critical section */
|
---|
77 | LPWSTR cmd_lineW; /* 40 Unicode command line */
|
---|
78 | WORD env_sel; /* 44 Environment strings selector */
|
---|
79 | } ENVDB;
|
---|
80 |
|
---|
81 | /* Win32 process database */
|
---|
82 | typedef struct _PDB
|
---|
83 | {
|
---|
84 | LONG header[2]; /* 00 Kernel object header */
|
---|
85 | DWORD unknown1; /* 08 Unknown */
|
---|
86 | void *event; /* 0c Pointer to an event object (unused) */
|
---|
87 | // DWORD exit_code; /* 10 Process exit code */
|
---|
88 | void *unknown10; /* 10 Unknown pointer (SvL; NT4, SP6) */
|
---|
89 | DWORD unknown2; /* 14 Unknown */
|
---|
90 | HANDLE heap; /* 18 Default process heap */
|
---|
91 | HANDLE mem_context; /* 1c Process memory context */
|
---|
92 | DWORD flags; /* 20 Flags */
|
---|
93 | void *pdb16; /* 24 DOS PSP */
|
---|
94 | WORD PSP_sel; /* 28 Selector to DOS PSP */
|
---|
95 | WORD module; /* 2a IMTE for the process module */
|
---|
96 | WORD threads; /* 2c Number of threads */
|
---|
97 | WORD running_threads; /* 2e Number of running threads */
|
---|
98 | WORD free_lib_count; /* 30 Recursion depth of FreeLibrary calls */
|
---|
99 | WORD ring0_threads; /* 32 Number of ring 0 threads */
|
---|
100 | HANDLE system_heap; /* 34 System heap to allocate handles */
|
---|
101 | HTASK task; /* 38 Win16 task */
|
---|
102 | void *mem_map_files; /* 3c Pointer to mem-mapped files */
|
---|
103 | ENVDB *env_db; /* 40 Environment database */
|
---|
104 | void *handle_table; /* 44 Handle table */
|
---|
105 | struct _PDB *parent; /* 48 Parent process */
|
---|
106 | WINE_MODREF *modref_list; /* 4c MODREF list */
|
---|
107 | void *thread_list; /* 50 List of threads */
|
---|
108 | void *debuggee_CB; /* 54 Debuggee context block */
|
---|
109 | void *local_heap_free; /* 58 Head of local heap free list */
|
---|
110 | DWORD unknown4; /* 5c Unknown */
|
---|
111 | CRITICAL_SECTION crit_section; /* 60 Critical section */
|
---|
112 | DWORD unknown5[3]; /* 78 Unknown */
|
---|
113 | void *console; /* 84 Console */
|
---|
114 | DWORD tls_bits[2]; /* 88 TLS in-use bits */
|
---|
115 | DWORD process_dword; /* 90 Unknown */
|
---|
116 | struct _PDB *group; /* 94 Process group */
|
---|
117 | WINE_MODREF *exe_modref; /* 98 MODREF for the process EXE */
|
---|
118 | LPTOP_LEVEL_EXCEPTION_FILTER top_filter; /* 9c Top exception filter */
|
---|
119 | DWORD priority; /* a0 Priority level */
|
---|
120 | HANDLE heap_list; /* a4 Head of process heap list */
|
---|
121 | void *heap_handles; /* a8 Head of heap handles list */
|
---|
122 | DWORD unknown6; /* ac Unknown */
|
---|
123 | void *console_provider; /* b0 Console provider (??) */
|
---|
124 | WORD env_selector; /* b4 Selector to process environment */
|
---|
125 | WORD error_mode; /* b6 Error mode */
|
---|
126 | HANDLE load_done_evt; /* b8 Event for process loading done */
|
---|
127 | struct _UTINFO *UTState; /* bc Head of Univeral Thunk list */
|
---|
128 | DWORD unknown8; /* c0 Unknown (NT) */
|
---|
129 | LCID locale; /* c4 Locale to be queried by GetThreadLocale (NT) */
|
---|
130 | /* The following are Wine-specific fields */
|
---|
131 | void *server_pid; /* Server id for this process */
|
---|
132 | HANDLE *dos_handles; /* Handles mapping DOS -> Win32 */
|
---|
133 | struct _PDB *next; /* List reference - list of PDB's */
|
---|
134 | WORD winver; /* Windows version figured out by VERSION_GetVersion */
|
---|
135 | struct _SERVICETABLE *service_table; /* Service table for service thread */
|
---|
136 | #ifdef __WIN32OS2__
|
---|
137 | DWORD hInstance; //instance handle of executable
|
---|
138 | SYSTEMTIME creationTime; //time of process creation
|
---|
139 | #endif
|
---|
140 | } PDB;
|
---|
141 |
|
---|
142 | /* Process flags */
|
---|
143 | #define PDB32_DEBUGGED 0x0001 /* Process is being debugged */
|
---|
144 | #define PDB32_WIN16_PROC 0x0008 /* Win16 process */
|
---|
145 | #define PDB32_DOS_PROC 0x0010 /* Dos process */
|
---|
146 | #define PDB32_CONSOLE_PROC 0x0020 /* Console process */
|
---|
147 | #define PDB32_FILE_APIS_OEM 0x0040 /* File APIs are OEM */
|
---|
148 | #define PDB32_WIN32S_PROC 0x8000 /* Win32s process */
|
---|
149 |
|
---|
150 | /* USER signal proc flags and codes */
|
---|
151 | /* See PROCESS_CallUserSignalProc for comments */
|
---|
152 | #define USIG_FLAGS_WIN32 0x0001
|
---|
153 | #define USIG_FLAGS_GUI 0x0002
|
---|
154 | #define USIG_FLAGS_FEEDBACK 0x0004
|
---|
155 | #define USIG_FLAGS_FAULT 0x0008
|
---|
156 |
|
---|
157 | #define USIG_DLL_UNLOAD_WIN16 0x0001
|
---|
158 | #define USIG_DLL_UNLOAD_WIN32 0x0002
|
---|
159 | #define USIG_FAULT_DIALOG_PUSH 0x0003
|
---|
160 | #define USIG_FAULT_DIALOG_POP 0x0004
|
---|
161 | #define USIG_DLL_UNLOAD_ORPHANS 0x0005
|
---|
162 | #define USIG_THREAD_INIT 0x0010
|
---|
163 | #define USIG_THREAD_EXIT 0x0020
|
---|
164 | #define USIG_PROCESS_CREATE 0x0100
|
---|
165 | #define USIG_PROCESS_INIT 0x0200
|
---|
166 | #define USIG_PROCESS_EXIT 0x0300
|
---|
167 | #define USIG_PROCESS_DESTROY 0x0400
|
---|
168 | #define USIG_PROCESS_RUNNING 0x0500
|
---|
169 | #define USIG_PROCESS_LOADED 0x0600
|
---|
170 |
|
---|
171 | /* [GS]etProcessDword offsets */
|
---|
172 | #define GPD_APP_COMPAT_FLAGS (-56)
|
---|
173 | #define GPD_LOAD_DONE_EVENT (-52)
|
---|
174 | #define GPD_HINSTANCE16 (-48)
|
---|
175 | #define GPD_WINDOWS_VERSION (-44)
|
---|
176 | #define GPD_THDB (-40)
|
---|
177 | #define GPD_PDB (-36)
|
---|
178 | #define GPD_STARTF_SHELLDATA (-32)
|
---|
179 | #define GPD_STARTF_HOTKEY (-28)
|
---|
180 | #define GPD_STARTF_SHOWWINDOW (-24)
|
---|
181 | #define GPD_STARTF_SIZE (-20)
|
---|
182 | #define GPD_STARTF_POSITION (-16)
|
---|
183 | #define GPD_STARTF_FLAGS (-12)
|
---|
184 | #define GPD_PARENT (- 8)
|
---|
185 | #define GPD_FLAGS (- 4)
|
---|
186 | #define GPD_USERDATA ( 0)
|
---|
187 |
|
---|
188 | extern DWORD WINAPI GetProcessDword( DWORD dwProcessID, INT offset );
|
---|
189 | void WINAPI SetProcessDword( DWORD dwProcessID, INT offset, DWORD value );
|
---|
190 |
|
---|
191 | /* scheduler/environ.c */
|
---|
192 | extern BOOL ENV_InheritEnvironment( PDB *pdb, LPCSTR env );
|
---|
193 | extern void ENV_FreeEnvironment( PDB *pdb );
|
---|
194 |
|
---|
195 | /* scheduler/process.c */
|
---|
196 | extern BOOL PROCESS_Init( void );
|
---|
197 | extern BOOL PROCESS_IsCurrent( HANDLE handle );
|
---|
198 | extern PDB *PROCESS_Initial(void);
|
---|
199 | extern PDB *PROCESS_IdToPDB( DWORD id );
|
---|
200 | extern void PROCESS_CallUserSignalProc( UINT uCode, HMODULE hModule );
|
---|
201 | extern PDB *PROCESS_Create( struct _NE_MODULE *pModule,
|
---|
202 | LPCSTR cmd_line, LPCSTR env,
|
---|
203 | LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
|
---|
204 | BOOL inherit, DWORD flags,
|
---|
205 | STARTUPINFOA *startup, PROCESS_INFORMATION *info );
|
---|
206 | extern void PROCESS_FreePDB( PDB *pdb );
|
---|
207 | extern void PROCESS_WalkProcess( void );
|
---|
208 |
|
---|
209 | /* scheduler/debugger.c */
|
---|
210 | extern DWORD DEBUG_SendExceptionEvent( EXCEPTION_RECORD *rec, BOOL first_chance, CONTEXT *ctx );
|
---|
211 | extern DWORD DEBUG_SendCreateProcessEvent( HFILE file, HMODULE module, void *entry );
|
---|
212 | extern DWORD DEBUG_SendCreateThreadEvent( void *entry );
|
---|
213 | extern DWORD DEBUG_SendLoadDLLEvent( HFILE file, HMODULE module, LPSTR *name );
|
---|
214 | extern DWORD DEBUG_SendUnloadDLLEvent( HMODULE module );
|
---|
215 |
|
---|
216 | #include <wprocess.h>
|
---|
217 |
|
---|
218 | #endif /* __WINE_PROCESS_H */
|
---|