Use GetStartupInfoA() instead of accessing process structure
[wine.git] / include / task.h
blobeeb69394c1446834f93116d1b2b45b35bc675475
1 /*
2 * Task definitions
4 * Copyright 1995 Alexandre Julliard
5 */
7 #ifndef __WINE_TASK_H
8 #define __WINE_TASK_H
10 #include "windef.h"
12 #include "pshpack1.h"
14 /* Process database (i.e. a normal DOS PSP) */
16 typedef struct
18 WORD int20; /* 00 int 20h instruction */
19 WORD nextParagraph; /* 02 Segment of next paragraph */
20 BYTE reserved1;
21 BYTE dispatcher[5]; /* 05 Long call to DOS */
22 FARPROC16 savedint22 WINE_PACKED; /* 0a Saved int 22h handler */
23 FARPROC16 savedint23 WINE_PACKED; /* 0e Saved int 23h handler */
24 FARPROC16 savedint24 WINE_PACKED; /* 12 Saved int 24h handler */
25 WORD parentPSP; /* 16 Selector of parent PSP */
26 BYTE fileHandles[20]; /* 18 Open file handles */
27 HANDLE16 environment; /* 2c Selector of environment */
28 WORD reserved2[2];
29 WORD nbFiles; /* 32 Number of file handles */
30 SEGPTR fileHandlesPtr; /* 34 Pointer to file handle table */
31 HANDLE16 hFileHandles; /* 38 Handle to fileHandlesPtr */
32 WORD reserved3[17];
33 BYTE fcb1[16]; /* 5c First FCB */
34 BYTE fcb2[20]; /* 6c Second FCB */
35 BYTE cmdLine[128]; /* 80 Command-line (first byte is len)*/
36 BYTE padding[16]; /* Some apps access beyond the end of the cmd line */
37 } PDB16;
40 /* Segment containing MakeProcInstance() thunks */
41 typedef struct
43 WORD next; /* Selector of next segment */
44 WORD magic; /* Thunks signature */
45 WORD unused;
46 WORD free; /* Head of the free list */
47 WORD thunks[4]; /* Each thunk is 4 words long */
48 } THUNKS;
50 #define THUNK_MAGIC ('P' | ('T' << 8))
52 struct _TEB;
53 struct _WSINFO;
54 struct _NE_MODULE;
56 /* signal proc typedef */
57 typedef void (CALLBACK *USERSIGNALPROC)(HANDLE16, UINT16, UINT16,
58 HINSTANCE16, HQUEUE16);
60 /* Task database. See 'Windows Internals' p. 226.
61 * Note that 16-bit OLE 2 libs like to read it directly
62 * so we have to keep entry offsets as they are.
64 typedef struct _TDB
66 HTASK16 hNext; /* 00 Selector of next TDB */
67 DWORD ss_sp WINE_PACKED; /* 02 Stack pointer of task */
68 WORD nEvents; /* 06 Events for this task */
69 INT16 priority; /* 08 Task priority, -32..15 */
70 WORD unused1; /* 0a */
71 HTASK16 hSelf; /* 0c Selector of this TDB */
72 HANDLE16 hPrevInstance; /* 0e Previous instance of module */
73 DWORD unused2; /* 10 */
74 WORD ctrlword8087; /* 14 80x87 control word */
75 WORD flags; /* 16 Task flags */
76 UINT16 error_mode; /* 18 Error mode (see SetErrorMode)*/
77 WORD version; /* 1a Expected Windows version */
78 HANDLE16 hInstance; /* 1c Instance handle for task */
79 HMODULE16 hModule; /* 1e Module handle */
80 HQUEUE16 hQueue; /* 20 Selector of task queue */
81 HTASK16 hParent; /* 22 Selector of TDB of parent */
82 WORD signal_flags; /* 24 Flags for signal handler */
83 FARPROC16 sighandler WINE_PACKED; /* 26 Signal handler */
84 FARPROC16 userhandler WINE_PACKED; /* 2a USER signal handler */
85 FARPROC16 discardhandler WINE_PACKED; /* 2e Handler for GlobalNotify() */
86 DWORD int0 WINE_PACKED; /* 32 int 0 (divide by 0) handler */
87 DWORD int2 WINE_PACKED; /* 36 int 2 (NMI) handler */
88 DWORD int4 WINE_PACKED; /* 3a int 4 (INTO) handler */
89 DWORD int6 WINE_PACKED; /* 3e int 6 (invalid opc) handler */
90 DWORD int7 WINE_PACKED; /* 42 int 7 (coprocessor) handler */
91 DWORD int3e WINE_PACKED; /* 46 int 3e (80x87 emu) handler */
92 DWORD int75 WINE_PACKED; /* 4a int 75 (80x87 error) handler */
93 DWORD compat_flags WINE_PACKED; /* 4e Compatibility flags */
94 BYTE unused4[2]; /* 52 */
95 struct _TEB *teb; /* 54 Pointer to thread database */
96 BYTE unused5[8]; /* 58 */
97 HANDLE16 hPDB; /* 60 Selector of PDB (i.e. PSP) */
98 SEGPTR dta WINE_PACKED; /* 62 Current DTA */
99 BYTE curdrive; /* 66 Current drive */
100 BYTE curdir[65]; /* 67 Current directory */
101 WORD nCmdShow; /* a8 cmdShow parameter to WinMain */
102 HTASK16 hYieldTo; /* aa Next task to schedule */
103 DWORD dlls_to_init; /* ac Ptr to DLLs to initialize */
104 HANDLE16 hCSAlias; /* b0 Code segment for this TDB */
105 THUNKS thunks WINE_PACKED; /* b2 Make proc instance thunks */
106 WORD more_thunks[6*4]; /* c2 Space for 6 more thunks */
107 BYTE module_name[8]; /* f2 Module name for task */
108 WORD magic; /* fa TDB signature */
109 HANDLE hEvent; /* fc scheduler event handle */
110 PDB16 pdb; /* 100 PDB for this task */
111 } TDB;
113 #define TDB_MAGIC ('T' | ('D' << 8))
115 /* TDB flags */
116 #define TDBF_WINOLDAP 0x0001
117 #define TDBF_OS2APP 0x0008
118 #define TDBF_WIN32 0x0010
120 /* Windows 3.1 USER signals */
121 #define USIG16_TERMINATION 0x0020
122 #define USIG16_DLL_LOAD 0x0040
123 #define USIG16_DLL_UNLOAD 0x0080
124 #define USIG16_GPF 0x0666
127 /* THHOOK Kernel Data Structure */
128 typedef struct _THHOOK
130 HANDLE16 hGlobalHeap; /* 00 (handle BURGERMASTER) */
131 WORD pGlobalHeap; /* 02 (selector BURGERMASTER) */
132 HMODULE16 hExeHead; /* 04 hFirstModule */
133 HMODULE16 hExeSweep; /* 06 (unused) */
134 HANDLE16 TopPDB; /* 08 (handle of KERNEL PDB) */
135 HANDLE16 HeadPDB; /* 0A (first PDB in list) */
136 HANDLE16 TopSizePDB; /* 0C (unused) */
137 HTASK16 HeadTDB; /* 0E hFirstTask */
138 HTASK16 CurTDB; /* 10 hCurrentTask */
139 HTASK16 LoadTDB; /* 12 (unused) */
140 HTASK16 LockTDB; /* 14 hLockedTask */
141 } THHOOK;
143 #include "poppack.h"
145 extern THHOOK *pThhook;
147 extern BOOL TASK_Create( struct _NE_MODULE *pModule, UINT16 cmdShow,
148 struct _TEB *teb, LPCSTR cmdline, BYTE len );
149 extern void TASK_KillTask( HTASK16 hTask );
150 extern HTASK16 TASK_GetNextTask( HTASK16 hTask );
151 extern void TASK_Reschedule(void);
152 extern void TASK_CallToStart(void);
153 extern void TASK_InstallTHHook( THHOOK *pNewThook );
154 extern void TASK_CallTaskSignalProc( UINT16 uCode, HANDLE16 hTaskOrModule );
156 extern HQUEUE16 WINAPI SetThreadQueue16( DWORD thread, HQUEUE16 hQueue );
157 extern HQUEUE16 WINAPI GetThreadQueue16( DWORD thread );
158 extern VOID WINAPI SetFastQueue16( DWORD thread, HANDLE hQueue );
159 extern HANDLE WINAPI GetFastQueue16( void );
162 #endif /* __WINE_TASK_H */