source: trunk/include/win/task.h@ 4

Last change on this file since 4 was 4, checked in by ktk, 26 years ago

Import

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