Added missing #include "config.h"
[wine/multimedia.git] / include / process.h
blob46eb24a713023271015301de6ec03d88e083b382
1 /*
2 * Process definitions
4 * Copyright 1996 Alexandre Julliard
5 */
7 #ifndef __WINE_PROCESS_H
8 #define __WINE_PROCESS_H
10 #include "windows.h"
11 #include "winbase.h"
12 #include "winnt.h"
13 #include "module.h"
14 #include "k32obj.h"
16 struct _NE_MODULE;
17 struct _THREAD_ENTRY;
19 /* Process handle entry */
20 typedef struct
22 DWORD access; /* Access flags */
23 K32OBJ *ptr; /* Object ptr */
24 int server; /* Server handle (FIXME: tmp hack) */
25 } HANDLE_ENTRY;
27 /* Process handle table */
28 typedef struct
30 DWORD count;
31 HANDLE_ENTRY entries[1];
32 } HANDLE_TABLE;
34 /* Current Process pseudo-handle - Returned by GetCurrentProcess*/
35 #define CURRENT_PROCESS_PSEUDOHANDLE ((HANDLE32)0x7fffffff)
37 /* Win32 process environment database */
38 typedef struct
40 LPSTR environ; /* 00 Process environment strings */
41 DWORD unknown1; /* 04 Unknown */
42 LPSTR cmd_line; /* 08 Command line */
43 LPSTR cur_dir; /* 0c Current directory */
44 STARTUPINFO32A *startup_info; /* 10 Startup information */
45 HANDLE32 hStdin; /* 14 Handle for standard input */
46 HANDLE32 hStdout; /* 18 Handle for standard output */
47 HANDLE32 hStderr; /* 1c Handle for standard error */
48 DWORD unknown2; /* 20 Unknown */
49 DWORD inherit_console; /* 24 Inherit console flag */
50 DWORD break_type; /* 28 Console events flag */
51 K32OBJ *break_sem; /* 2c SetConsoleCtrlHandler semaphore */
52 K32OBJ *break_event; /* 30 SetConsoleCtrlHandler event */
53 K32OBJ *break_thread; /* 34 SetConsoleCtrlHandler thread */
54 void *break_handlers; /* 38 List of console handlers */
55 /* The following are Wine-specific fields */
56 CRITICAL_SECTION section; /* 3c Env DB critical section */
57 LPWSTR cmd_lineW; /* 40 Unicode command line */
58 WORD env_sel; /* 44 Environment strings selector */
59 } ENVDB;
61 /* Win32 process database */
62 typedef struct _PDB32
64 K32OBJ header; /* 00 Kernel object header */
65 DWORD unknown1; /* 08 Unknown */
66 K32OBJ *event; /* 0c Pointer to an event object */
67 DWORD exit_code; /* 10 Process exit code */
68 DWORD unknown2; /* 14 Unknown */
69 HANDLE32 heap; /* 18 Default process heap */
70 HANDLE32 mem_context; /* 1c Process memory context */
71 DWORD flags; /* 20 Flags */
72 void *pdb16; /* 24 DOS PSP */
73 WORD PSP_sel; /* 28 Selector to DOS PSP */
74 WORD module; /* 2a IMTE for the process module */
75 WORD threads; /* 2c Number of threads */
76 WORD running_threads; /* 2e Number of running threads */
77 WORD unknown3; /* 30 Unknown */
78 WORD ring0_threads; /* 32 Number of ring 0 threads */
79 HANDLE32 system_heap; /* 34 System heap to allocate handles */
80 HTASK32 task; /* 38 Win16 task */
81 void *mem_map_files; /* 3c Pointer to mem-mapped files */
82 ENVDB *env_db; /* 40 Environment database */
83 HANDLE_TABLE *handle_table; /* 44 Handle table */
84 struct _PDB32 *parent; /* 48 Parent process */
85 WINE_MODREF *modref_list; /* 4c MODREF list */
86 struct _THREAD_ENTRY *thread_list; /* 50 List of threads */
87 void *debuggee_CB; /* 54 Debuggee context block */
88 void *local_heap_free; /* 58 Head of local heap free list */
89 DWORD unknown4; /* 5c Unknown */
90 CRITICAL_SECTION crit_section; /* 60 Critical section */
91 DWORD unknown5[3]; /* 78 Unknown */
92 K32OBJ *console; /* 84 Console */
93 DWORD tls_bits[2]; /* 88 TLS in-use bits */
94 DWORD process_dword; /* 90 Unknown */
95 struct _PDB32 *group; /* 94 Process group */
96 WINE_MODREF *exe_modref; /* 98 MODREF for the process EXE */
97 LPTOP_LEVEL_EXCEPTION_FILTER top_filter; /* 9c Top exception filter */
98 DWORD priority; /* a0 Priority level */
99 HANDLE32 heap_list; /* a4 Head of process heap list */
100 void *heap_handles; /* a8 Head of heap handles list */
101 DWORD unknown6; /* ac Unknown */
102 K32OBJ *console_provider; /* b0 Console provider (??) */
103 WORD env_selector; /* b4 Selector to process environment */
104 WORD error_mode; /* b6 Error mode */
105 K32OBJ *load_done_evt; /* b8 Event for process loading done */
106 DWORD unknown7; /* bc Unknown */
107 DWORD unknown8; /* c0 Unknown (NT) */
108 LCID locale; /* c4 Locale to be queried by GetThreadLocale (NT) */
109 /* The following are Wine-specific fields */
110 void *server_pid; /* Server id for this process */
111 } PDB32;
113 /* Process flags */
114 #define PDB32_WIN16_PROC 0x0008 /* Win16 process */
115 #define PDB32_DOS_PROC 0x0010 /* Dos process */
116 #define PDB32_CONSOLE_PROC 0x0020 /* Console process */
117 #define PDB32_FILE_APIS_OEM 0x0040 /* File APIs are OEM */
118 #define PDB32_WIN32S_PROC 0x8000 /* Win32s process */
120 /* PDB <-> Process id conversion macros */
121 #define PROCESS_OBFUSCATOR ((DWORD)0xdeadbeef)
122 #define PROCESS_ID_TO_PDB(id) ((PDB32 *)((id) ^ PROCESS_OBFUSCATOR))
123 #define PDB_TO_PROCESS_ID(pdb) ((DWORD)(pdb) ^ PROCESS_OBFUSCATOR)
125 /* scheduler/environ.c */
126 extern BOOL32 ENV_BuildEnvironment( PDB32 *pdb );
127 extern BOOL32 ENV_InheritEnvironment( PDB32 *pdb, LPCSTR env );
128 extern void ENV_FreeEnvironment( PDB32 *pdb );
130 /* scheduler/handle.c */
131 extern BOOL32 HANDLE_CreateTable( PDB32 *pdb, BOOL32 inherit );
132 extern HANDLE32 HANDLE_Alloc( PDB32 *pdb, K32OBJ *ptr, DWORD access,
133 BOOL32 inherit, int server_handle );
134 extern K32OBJ *HANDLE_GetObjPtr( PDB32 *pdb, HANDLE32 handle,
135 K32OBJ_TYPE type, DWORD access,
136 int *server_handle );
137 extern BOOL32 HANDLE_SetObjPtr( PDB32 *pdb, HANDLE32 handle,
138 K32OBJ *ptr, DWORD access );
139 extern void HANDLE_CloseAll( PDB32 *pdb, K32OBJ *ptr );
141 /* Global handle macros */
142 #define HANDLE_OBFUSCATOR ((DWORD)0x544a4def)
143 #define HANDLE_IS_GLOBAL(h) (((DWORD)(h) ^ HANDLE_OBFUSCATOR) < 0x10000)
144 #define HANDLE_LOCAL_TO_GLOBAL(h) ((HANDLE32)((DWORD)(h) ^ HANDLE_OBFUSCATOR))
145 #define HANDLE_GLOBAL_TO_LOCAL(h) ((HANDLE32)((DWORD)(h) ^ HANDLE_OBFUSCATOR))
148 /* scheduler/process.c */
149 extern BOOL32 PROCESS_Init( void );
150 extern PDB32 *PROCESS_Current(void);
151 extern PDB32 *PROCESS_Initial(void);
152 extern PDB32 *PROCESS_GetPtr( HANDLE32 handle, DWORD access, int *server_handle );
153 extern PDB32 *PROCESS_IdToPDB( DWORD id );
154 extern PDB32 *PROCESS_Create( struct _NE_MODULE *pModule, LPCSTR cmd_line,
155 LPCSTR env, HINSTANCE16 hInstance,
156 HINSTANCE16 hPrevInstance, STARTUPINFO32A *startup,
157 PROCESS_INFORMATION *info );
158 extern void PROCESS_SuspendOtherThreads(void);
159 extern void PROCESS_ResumeOtherThreads(void);
161 #endif /* __WINE_PROCESS_H */