wusa: Fix double free on error path in read_update_package (scan-build).
[wine.git] / dlls / toolhelp.dll16 / toolhelp.h
blobda41a888c7913f9afda581c1f47258dd3fe13f0c
1 /*
2 * Copyright (C) the Wine project
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef __WINE_TOOLHELP_H
20 #define __WINE_TOOLHELP_H
22 #include <windef.h>
23 #include <wine/windef16.h>
25 #define MAX_DATA 11
26 #define MAX_MODULE_NAME 9
27 #define MAX_PATH16 255
28 #define MAX_CLASSNAME 255
30 #include <pshpack1.h>
32 /* Global heap */
34 typedef struct
36 DWORD dwSize;
37 WORD wcItems;
38 WORD wcItemsFree;
39 WORD wcItemsLRU;
40 } GLOBALINFO;
42 typedef struct
44 DWORD dwSize;
45 DWORD dwAddress;
46 DWORD dwBlockSize;
47 HGLOBAL16 hBlock;
48 WORD wcLock;
49 WORD wcPageLock;
50 WORD wFlags;
51 BOOL16 wHeapPresent;
52 HGLOBAL16 hOwner;
53 WORD wType;
54 WORD wData;
55 DWORD dwNext;
56 DWORD dwNextAlt;
57 } GLOBALENTRY;
59 /* GlobalFirst()/GlobalNext() flags */
60 #define GLOBAL_ALL 0
61 #define GLOBAL_LRU 1
62 #define GLOBAL_FREE 2
64 /* wType values */
65 #define GT_UNKNOWN 0
66 #define GT_DGROUP 1
67 #define GT_DATA 2
68 #define GT_CODE 3
69 #define GT_TASK 4
70 #define GT_RESOURCE 5
71 #define GT_MODULE 6
72 #define GT_FREE 7
73 #define GT_INTERNAL 8
74 #define GT_SENTINEL 9
75 #define GT_BURGERMASTER 10
77 /* wData values */
78 #define GD_USERDEFINED 0
79 #define GD_CURSORCOMPONENT 1
80 #define GD_BITMAP 2
81 #define GD_ICONCOMPONENT 3
82 #define GD_MENU 4
83 #define GD_DIALOG 5
84 #define GD_STRING 6
85 #define GD_FONTDIR 7
86 #define GD_FONT 8
87 #define GD_ACCELERATORS 9
88 #define GD_RCDATA 10
89 #define GD_ERRTABLE 11
90 #define GD_CURSOR 12
91 #define GD_ICON 14
92 #define GD_NAMETABLE 15
93 #define GD_MAX_RESOURCE 15
95 /* wFlags values */
96 #define GF_PDB_OWNER 0x0100 /* Low byte is KERNEL flags */
98 BOOL16 WINAPI GlobalInfo16( GLOBALINFO *pInfo );
99 BOOL16 WINAPI GlobalFirst16( GLOBALENTRY *pGlobal, WORD wFlags );
100 BOOL16 WINAPI GlobalNext16( GLOBALENTRY *pGlobal, WORD wFlags) ;
101 BOOL16 WINAPI GlobalEntryHandle16( GLOBALENTRY *pGlobal, HGLOBAL16 hItem );
102 BOOL16 WINAPI GlobalEntryModule16( GLOBALENTRY *pGlobal, HMODULE16 hModule,
103 WORD wSeg );
105 /* Local heap */
107 typedef struct
109 DWORD dwSize;
110 WORD wcItems;
111 } LOCALINFO;
113 typedef struct
115 DWORD dwSize;
116 HLOCAL16 hHandle;
117 WORD wAddress;
118 WORD wSize;
119 WORD wFlags;
120 WORD wcLock;
121 WORD wType;
122 WORD hHeap;
123 WORD wHeapType;
124 WORD wNext;
125 } LOCALENTRY;
127 /* wHeapType values */
128 #define NORMAL_HEAP 0
129 #define USER_HEAP 1
130 #define GDI_HEAP 2
132 /* wFlags values */
133 #define LF_FIXED 1
134 #define LF_FREE 2
135 #define LF_MOVEABLE 4
137 /* wType values */
138 #define LT_NORMAL 0
139 #define LT_FREE 0xff
140 #define LT_GDI_PEN 1 /* LT_GDI_* is for GDI's heap */
141 #define LT_GDI_BRUSH 2
142 #define LT_GDI_FONT 3
143 #define LT_GDI_PALETTE 4
144 #define LT_GDI_BITMAP 5
145 #define LT_GDI_RGN 6
146 #define LT_GDI_DC 7
147 #define LT_GDI_DISABLED_DC 8
148 #define LT_GDI_METADC 9
149 #define LT_GDI_METAFILE 10
150 #define LT_GDI_MAX LT_GDI_METAFILE
151 #define LT_USER_CLASS 1 /* LT_USER_* is for USER's heap */
152 #define LT_USER_WND 2
153 #define LT_USER_STRING 3
154 #define LT_USER_MENU 4
155 #define LT_USER_CLIP 5
156 #define LT_USER_CBOX 6
157 #define LT_USER_PALETTE 7
158 #define LT_USER_ED 8
159 #define LT_USER_BWL 9
160 #define LT_USER_OWNERDRAW 10
161 #define LT_USER_SPB 11
162 #define LT_USER_CHECKPOINT 12
163 #define LT_USER_DCE 13
164 #define LT_USER_MWP 14
165 #define LT_USER_PROP 15
166 #define LT_USER_LBIV 16
167 #define LT_USER_MISC 17
168 #define LT_USER_ATOMS 18
169 #define LT_USER_LOCKINPUTSTATE 19
170 #define LT_USER_HOOKLIST 20
171 #define LT_USER_USERSEEUSERDOALLOC 21
172 #define LT_USER_HOTKEYLIST 22
173 #define LT_USER_POPUPMENU 23
174 #define LT_USER_HANDLETABLE 32
175 #define LT_USER_MAX LT_USER_HANDLETABLE
177 BOOL16 WINAPI LocalInfo16( LOCALINFO *pLocalInfo, HGLOBAL16 handle );
178 BOOL16 WINAPI LocalFirst16( LOCALENTRY *pLocalEntry, HGLOBAL16 handle );
179 BOOL16 WINAPI LocalNext16( LOCALENTRY *pLocalEntry );
181 /* Local 32-bit heap */
183 typedef struct
185 DWORD dwSize; /* 00 */
186 DWORD dwMemReserved; /* 04 */
187 DWORD dwMemCommitted; /* 08 */
188 DWORD dwTotalFree; /* 0C */
189 DWORD dwLargestFreeBlock; /* 10 */
190 DWORD dwcFreeHandles; /* 14 */
191 } LOCAL32INFO;
193 typedef struct
195 DWORD dwSize; /* 00 */
196 WORD hHandle; /* 04 */
197 DWORD dwAddress; /* 06 */
198 DWORD dwSizeBlock; /* 0A */
199 WORD wFlags; /* 0E */
200 WORD wType; /* 10 */
201 WORD hHeap; /* 12 */
202 WORD wHeapType; /* 14 */
203 DWORD dwNext; /* 16 */
204 DWORD dwNextAlt; /* 1A */
205 } LOCAL32ENTRY;
207 /* LOCAL32ENTRY.wHeapType flags same as LOCALENTRY.wHeapType flags */
208 /* LOCAL32ENTRY.wFlags same as LOCALENTRY.wFlags */
209 /* LOCAL32ENTRY.wType same as LOCALENTRY.wType */
211 BOOL16 WINAPI Local32Info16( LOCAL32INFO *pLocal32Info, HGLOBAL16 handle );
212 BOOL16 WINAPI Local32First16( LOCAL32ENTRY *pLocal32Entry, HGLOBAL16 handle );
213 BOOL16 WINAPI Local32Next16( LOCAL32ENTRY *pLocal32Entry );
216 /* modules */
218 typedef struct
220 DWORD dwSize;
221 char szModule[MAX_MODULE_NAME + 1];
222 HMODULE16 hModule;
223 WORD wcUsage;
224 char szExePath[MAX_PATH16 + 1];
225 HANDLE16 wNext;
226 } MODULEENTRY, *LPMODULEENTRY;
228 BOOL16 WINAPI ModuleFirst16(MODULEENTRY *lpModule);
229 BOOL16 WINAPI ModuleNext16(MODULEENTRY *lpModule);
230 BOOL16 WINAPI ModuleFindName16(MODULEENTRY *lpModule, LPCSTR lpstrName);
231 BOOL16 WINAPI ModuleFindHandle16(MODULEENTRY *lpModule, HMODULE16 hModule);
233 /* tasks */
235 typedef struct
237 DWORD dwSize;
238 HTASK16 hTask;
239 HTASK16 hTaskParent;
240 HINSTANCE16 hInst;
241 HMODULE16 hModule;
242 WORD wSS;
243 WORD wSP;
244 WORD wStackTop;
245 WORD wStackMinimum;
246 WORD wStackBottom;
247 WORD wcEvents;
248 HGLOBAL16 hQueue;
249 char szModule[MAX_MODULE_NAME + 1];
250 WORD wPSPOffset;
251 HANDLE16 hNext;
252 } TASKENTRY, *LPTASKENTRY;
254 BOOL16 WINAPI TaskFirst16(LPTASKENTRY lpTask);
255 BOOL16 WINAPI TaskNext16(LPTASKENTRY lpTask);
256 BOOL16 WINAPI TaskFindHandle16(LPTASKENTRY lpTask, HTASK16 hTask);
257 DWORD WINAPI TaskSetCSIP(HTASK16 hTask, WORD wCS, WORD wIP);
258 DWORD WINAPI TaskGetCSIP(HTASK16 hTask);
259 BOOL16 WINAPI TaskSwitch(HTASK16 hTask, DWORD dwNewCSIP);
261 /* flag for TerminateApp16() */
262 #define NO_UAE_BOX 1
264 /* mem info */
266 typedef struct tagMEMMANINFO {
267 DWORD dwSize;
268 DWORD dwLargestFreeBlock;
269 DWORD dwMaxPagesAvailable;
270 DWORD dwMaxPagesLockable;
271 DWORD dwTotalLinearSpace;
272 DWORD dwTotalUnlockedPages;
273 DWORD dwFreePages;
274 DWORD dwTotalPages;
275 DWORD dwFreeLinearSpace;
276 DWORD dwSwapFilePages;
277 WORD wPageSize;
278 } MEMMANINFO;
279 typedef MEMMANINFO *LPMEMMANINFO;
281 typedef struct
283 DWORD dwSize;
284 WORD wUserFreePercent;
285 WORD wGDIFreePercent;
286 HGLOBAL16 hUserSegment;
287 HGLOBAL16 hGDISegment;
288 } SYSHEAPINFO;
290 BOOL16 WINAPI MemManInfo16(LPMEMMANINFO lpEnhMode);
291 BOOL16 WINAPI SystemHeapInfo16( SYSHEAPINFO *pHeapInfo );
293 /* timer info */
295 typedef struct tagTIMERINFO {
296 DWORD dwSize;
297 DWORD dwmsSinceStart;
298 DWORD dwmsThisVM;
299 } TIMERINFO;
301 BOOL16 WINAPI TimerCount16( TIMERINFO *pTimerInfo );
303 /* Window classes */
305 typedef struct
307 DWORD dwSize;
308 HMODULE16 hInst; /* This is really an hModule */
309 char szClassName[MAX_CLASSNAME + 1];
310 HANDLE16 wNext;
311 } CLASSENTRY;
313 BOOL16 WINAPI ClassFirst16( CLASSENTRY *pClassEntry );
314 BOOL16 WINAPI ClassNext16( CLASSENTRY *pClassEntry );
317 /* Memory read/write */
319 DWORD WINAPI MemoryRead16( WORD sel, DWORD offset, void *buffer, DWORD count );
320 DWORD WINAPI MemoryWrite16( WORD sel, DWORD offset, void *buffer, DWORD count );
322 /* flags to NotifyRegister() */
323 #define NF_NORMAL 0 /* everything except taskswitches, debugerrors,
324 * debugstrings
326 #define NF_TASKSWITCH 1 /* get taskswitch information */
327 #define NF_RIP 2 /* get debugerrors of system */
329 BOOL16 WINAPI NotifyRegister16(HTASK16 htask,FARPROC16 lpfnCallback,WORD wFlags);
331 #define NFY_UNKNOWN 0
332 #define NFY_LOADSEG 1
333 /* DATA is a pointer to following struct: */
334 typedef struct {
335 DWORD dwSize;
336 WORD wSelector;
337 WORD wSegNum;
338 WORD wType; /* bit 0 set if this is a code segment */
339 WORD wcInstance; /* only valid for data segment */
340 } NFYLOADSEG;
341 /* called when freeing a segment. LOWORD(dwData) is the freed selector */
342 #define NFY_FREESEG 2
344 /* called when loading/starting a DLL */
345 #define NFY_STARTDLL 3
346 typedef struct {
347 DWORD dwSize;
348 HMODULE16 hModule;
349 WORD wCS;
350 WORD wIP;
351 } NFYSTARTDLL;
353 /* called when starting a task. dwData is CS:IP */
354 #define NFY_STARTTASK 4
356 /* called when a task terminates. dwData is the return code */
357 #define NFY_EXITTASK 5
359 /* called when module is removed. LOWORD(dwData) is the handle */
360 #define NFY_DELMODULE 6
362 /* RIP? debugevent */
363 #define NFY_RIP 7
364 typedef struct {
365 DWORD dwSize;
366 WORD wIP;
367 WORD wCS;
368 WORD wSS;
369 WORD wBP;
370 WORD wExitCode;
371 } NFYRIP;
373 /* called before (after?) switching to a task
374 * no data, callback should call GetCurrentTask
376 #define NFY_TASKIN 8
378 /* called before(after?) switching from a task
379 * no data, callback should call GetCurrentTask
381 #define NFY_TASKOUT 9
383 /* returns ASCII input value, dwData not set */
384 #define NFY_INCHAR 10
386 /* output debugstring (pointed to by dwData) */
387 #define NFY_OUTSTRING 11
389 /* log errors */
390 #define NFY_LOGERROR 12
391 typedef struct {
392 DWORD dwSize;
393 UINT16 wErrCode;
394 VOID *lpInfo; /* depends on wErrCode */
395 } NFYLOGERROR;
397 /* called for parameter errors? */
398 #define NFY_LOGPARAMERROR 13
399 typedef struct {
400 DWORD dwSize;
401 UINT16 wErrCode;
402 FARPROC16 lpfnErrorAddr;
403 void **lpBadParam;
404 } NFYLOGPARAMERROR;
406 typedef struct {
407 DWORD dwSize;
408 HTASK16 hTask;
409 WORD wSS;
410 WORD wBP;
411 WORD wCS;
412 WORD wIP;
413 HMODULE16 hModule;
414 WORD wSegment;
415 WORD wFlags;
416 } STACKTRACEENTRY;
418 #include <poppack.h>
420 #endif /* __WINE_TOOLHELP_H */