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