Release 951003
[wine/hacks.git] / include / task.h
blobfd5604db0f3d95e4c069991f74441dfe2114e656
1 /*
2 * Task definitions
4 * Copyright 1995 Alexandre Julliard
5 */
7 #ifndef _WINE_TASK_H
8 #define _WINE_TASK_H
10 #include "wintypes.h"
12 #ifndef WINELIB
13 #pragma pack(1)
14 #endif
17 extern BOOL TASK_Init(void);
18 extern void TASK_KillCurrentTask( int exitCode );
20 /* Process database (i.e. a normal DOS PSP) */
22 typedef struct
24 WORD int20; /* int 20h instruction */
25 WORD nextParagraph; /* Segment of next paragraph */
26 BYTE reserved1;
27 BYTE dispatcher[5]; /* Long call to DOS */
28 SEGPTR savedint22; /* Saved int 22h handler */
29 SEGPTR savedint23; /* Saved int 23h handler */
30 SEGPTR savedint24; /* Saved int 24h handler */
31 WORD parentPSP; /* Selector of parent PSP */
32 BYTE fileHandles[20]; /* Open file handles */
33 HANDLE environment; /* Selector of environment */
34 WORD reserved2[23];
35 BYTE fcb1[16]; /* First FCB */
36 BYTE fcb2[20]; /* Second FCB */
37 BYTE cmdLine[128]; /* Command-line (first byte is length) */
38 } PDB;
41 /* Segment containing MakeProcInstance() thunks */
42 typedef struct
44 WORD next; /* Selector of next segment */
45 WORD magic; /* Thunks signature */
46 WORD unused;
47 WORD free; /* Head of the free list */
48 WORD thunks[4]; /* Each thunk is 4 words long */
49 } THUNKS;
51 #define THUNK_MAGIC ('P' | ('T' << 8))
54 /* Task database. See 'Windows Internals' p. 226 */
55 typedef struct
57 HTASK hNext; /* Selector of next TDB */
58 WORD sp; /* Stack pointer of task */
59 WORD ss; /* Stack segment of task */
60 WORD nEvents; /* Events for this task */
61 char priority; /* Task priority, between -32 and 15 */
62 BYTE unused1;
63 HGLOBAL hStack32; /* Handle to 32-bit stack */
64 HTASK hSelf; /* Selector of this TDB */
65 HANDLE hPrevInstance; /* Previous instance of the module */
66 DWORD esp; /* 32-bit stack pointer */
67 WORD ctrlword8087; /* 80x87 control word */
68 WORD flags; /* Task flags */
69 WORD error_flags; /* Error handling flags */
70 WORD version; /* Expected Windows version */
71 HANDLE hInstance; /* Instance handle for this task */
72 HMODULE hModule; /* Module handle */
73 HANDLE hQueue; /* Selector of task message queue */
74 HTASK hParent; /* Selector of TDB of parent task */
75 WORD signal_flags; /* Flags related to signal handler */
76 DWORD sighandler WINE_PACKED; /* Signal handler */
77 DWORD userhandler WINE_PACKED; /* USER signal handler */
78 DWORD discardhandler WINE_PACKED; /* Handler for GlobalDiscard() */
79 DWORD int0 WINE_PACKED; /* int 0 (divide by zero) handler */
80 DWORD int2 WINE_PACKED; /* int 2 (NMI) handler */
81 DWORD int4 WINE_PACKED; /* int 4 (INTO) handler */
82 DWORD int6 WINE_PACKED; /* int 6 (invalid opcode) handler */
83 DWORD int7 WINE_PACKED; /* int 7 (coprocessor) handler */
84 DWORD int3e WINE_PACKED; /* int 3e (80x87 emulator) handler */
85 DWORD int75 WINE_PACKED; /* int 75 (80x87 error) handler */
86 DWORD compat_flags WINE_PACKED; /* Compatibility flags */
87 BYTE unused4[14];
88 HANDLE hPDB; /* Selector of PDB (i.e. PSP) */
89 DWORD dta WINE_PACKED; /* Current DTA */
90 BYTE curdrive; /* Current drive */
91 BYTE curdir[65]; /* Current directory */
92 WORD nCmdShow; /* cmdShow parameter to WinMain */
93 HTASK hYieldTo; /* Next task to schedule */
94 DWORD dlls_to_init; /* Ptr to list of DLL to initialize */
95 HANDLE hCSAlias; /* Code segment alias for this TDB */
96 THUNKS thunks WINE_PACKED; /* Make proc instance thunks */
97 WORD more_thunks[6*4]; /* Space for 6 more thunks */
98 BYTE module_name[8]; /* Module name for task */
99 WORD magic; /* TDB signature */
100 DWORD unused7;
101 PDB pdb; /* PDB for this task */
102 } TDB;
104 #define TDB_MAGIC ('T' | ('D' << 8))
106 /* TDB flags */
107 #define TDBF_WINOLDAP 0x0001
108 #define TDBF_OS2APP 0x0008
109 #define TDBF_WIN32S 0x0010
111 #ifndef WINELIB
112 #pragma pack(4)
113 #endif
115 extern HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance,
116 HANDLE hPrevInstance, HANDLE hEnvironment,
117 char *cmdLine, WORD cmdShow );
119 /* TASK_Reschedule() 16-bit entry point */
120 extern FARPROC RELAY_RescheduleProcAddr;
122 #endif /* _WINE_TASK_H */