blob: 7c1dc712935bad31f685733b8a1241b57c9ee4c4 [file] [log] [blame]
Alexandre Julliard7e56f681996-01-31 19:02:28 +00001/*
2 * Misc Toolhelp functions
3 *
4 * Copyright 1996 Marcus Meissner
5 */
6
7#include <stdlib.h>
Alexandre Julliard7e56f681996-01-31 19:02:28 +00008#include <string.h>
9#include <unistd.h>
10#include <ctype.h>
Patrick Spinler3f8e1e41998-12-11 15:04:11 +000011#include <assert.h>
Marcus Meissner04c3e1d1999-02-19 10:37:02 +000012#include "winbase.h"
13#include "wine/winbase16.h"
Patrick Spinler3f8e1e41998-12-11 15:04:11 +000014#include "winerror.h"
Alexandre Julliard6b141172000-07-31 21:01:05 +000015#include "local.h"
Patrick Spinler3f8e1e41998-12-11 15:04:11 +000016#include "tlhelp32.h"
Alexandre Julliard7e56f681996-01-31 19:02:28 +000017#include "toolhelp.h"
Alexandre Julliard37e95032001-07-19 00:39:09 +000018#include "wine/server.h"
Alexandre Julliard61fece01999-06-26 19:09:08 +000019#include "debugtools.h"
Patrick Spinler3f8e1e41998-12-11 15:04:11 +000020
Alexandre Julliard07d84462000-04-16 19:45:05 +000021DEFAULT_DEBUG_CHANNEL(toolhelp);
Patrik Stridvallb4b9fae1999-04-19 14:56:29 +000022
Patrick Spinler3f8e1e41998-12-11 15:04:11 +000023
Francois Gouget070e7492001-11-06 21:01:32 +000024/* FIXME: to make this work, we have to call back all these registered
Alexandre Julliard7e56f681996-01-31 19:02:28 +000025 * functions from all over the WINE code. Someone with more knowledge than
26 * me please do that. -Marcus
27 */
28static struct notify
29{
Alexandre Julliardbf9130a1996-10-13 17:45:47 +000030 HTASK16 htask;
Alexandre Julliard18f92e71996-07-17 20:02:21 +000031 FARPROC16 lpfnCallback;
Alexandre Julliard7e56f681996-01-31 19:02:28 +000032 WORD wFlags;
33} *notifys = NULL;
34
35static int nrofnotifys = 0;
36
Alexandre Julliard60ce85c1998-02-01 18:33:27 +000037static FARPROC16 HookNotify = NULL;
38
Patrik Stridvall2d6457c2000-03-28 20:22:59 +000039/***********************************************************************
Patrik Stridvall01d5e5b2001-07-02 19:59:40 +000040 * NotifyRegister (TOOLHELP.73)
Patrik Stridvall2d6457c2000-03-28 20:22:59 +000041 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000042BOOL16 WINAPI NotifyRegister16( HTASK16 htask, FARPROC16 lpfnCallback,
Alexandre Julliard670cdc41997-08-24 16:00:30 +000043 WORD wFlags )
Alexandre Julliard7e56f681996-01-31 19:02:28 +000044{
45 int i;
46
Andreas Mohr92dcad82000-09-22 20:51:09 +000047 FIXME("(%x,%lx,%x), semi-stub.\n",
Alexandre Julliard7e56f681996-01-31 19:02:28 +000048 htask, (DWORD)lpfnCallback, wFlags );
Alexandre Julliard03468f71998-02-15 19:40:49 +000049 if (!htask) htask = GetCurrentTask();
Alexandre Julliard7e56f681996-01-31 19:02:28 +000050 for (i=0;i<nrofnotifys;i++)
51 if (notifys[i].htask==htask)
52 break;
53 if (i==nrofnotifys) {
54 if (notifys==NULL)
Alexandre Julliard90476d62000-02-16 22:47:24 +000055 notifys=(struct notify*)HeapAlloc( GetProcessHeap(), 0,
Alexandre Julliard491502b1997-11-01 19:08:16 +000056 sizeof(struct notify) );
Alexandre Julliard7e56f681996-01-31 19:02:28 +000057 else
Alexandre Julliard90476d62000-02-16 22:47:24 +000058 notifys=(struct notify*)HeapReAlloc( GetProcessHeap(), 0, notifys,
Alexandre Julliard491502b1997-11-01 19:08:16 +000059 sizeof(struct notify)*(nrofnotifys+1));
60 if (!notifys) return FALSE;
Alexandre Julliard7e56f681996-01-31 19:02:28 +000061 nrofnotifys++;
62 }
63 notifys[i].htask=htask;
64 notifys[i].lpfnCallback=lpfnCallback;
65 notifys[i].wFlags=wFlags;
66 return TRUE;
67}
68
Patrik Stridvall2d6457c2000-03-28 20:22:59 +000069/***********************************************************************
Patrik Stridvall01d5e5b2001-07-02 19:59:40 +000070 * NotifyUnregister (TOOLHELP.74)
Patrik Stridvall2d6457c2000-03-28 20:22:59 +000071 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000072BOOL16 WINAPI NotifyUnregister16( HTASK16 htask )
Alexandre Julliard7e56f681996-01-31 19:02:28 +000073{
74 int i;
75
Andreas Mohr92dcad82000-09-22 20:51:09 +000076 FIXME("(%x), semi-stub.\n", htask );
Alexandre Julliard03468f71998-02-15 19:40:49 +000077 if (!htask) htask = GetCurrentTask();
Alexandre Julliard7e56f681996-01-31 19:02:28 +000078 for (i=nrofnotifys;i--;)
79 if (notifys[i].htask==htask)
80 break;
81 if (i==-1)
82 return FALSE;
83 memcpy(notifys+i,notifys+(i+1),sizeof(struct notify)*(nrofnotifys-i-1));
Alexandre Julliard90476d62000-02-16 22:47:24 +000084 notifys=(struct notify*)HeapReAlloc( GetProcessHeap(), 0, notifys,
Alexandre Julliard491502b1997-11-01 19:08:16 +000085 (nrofnotifys-1)*sizeof(struct notify));
Alexandre Julliard7e56f681996-01-31 19:02:28 +000086 nrofnotifys--;
87 return TRUE;
88}
Alexandre Julliard44ed71f1997-12-21 19:17:50 +000089
Patrik Stridvall2d6457c2000-03-28 20:22:59 +000090/***********************************************************************
Patrik Stridvall0c610282001-01-25 22:22:21 +000091 * StackTraceCSIPFirst (TOOLHELP.67)
Patrik Stridvall2d6457c2000-03-28 20:22:59 +000092 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000093BOOL16 WINAPI StackTraceCSIPFirst16(STACKTRACEENTRY *ste, WORD wSS, WORD wCS, WORD wIP, WORD wBP)
Alexandre Julliard44ed71f1997-12-21 19:17:50 +000094{
Andreas Mohr92dcad82000-09-22 20:51:09 +000095 FIXME("(%p, ss %04x, cs %04x, ip %04x, bp %04x): stub.\n", ste, wSS, wCS, wIP, wBP);
Alexandre Julliard44ed71f1997-12-21 19:17:50 +000096 return TRUE;
97}
98
Patrik Stridvall2d6457c2000-03-28 20:22:59 +000099/***********************************************************************
Patrik Stridvall0c610282001-01-25 22:22:21 +0000100 * StackTraceFirst (TOOLHELP.66)
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000101 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000102BOOL16 WINAPI StackTraceFirst16(STACKTRACEENTRY *ste, HTASK16 Task)
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000103{
Andreas Mohr92dcad82000-09-22 20:51:09 +0000104 FIXME("(%p, %04x), stub.\n", ste, Task);
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000105 return TRUE;
106}
107
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000108/***********************************************************************
Patrik Stridvall0c610282001-01-25 22:22:21 +0000109 * StackTraceNext (TOOLHELP.68)
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000110 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000111BOOL16 WINAPI StackTraceNext16(STACKTRACEENTRY *ste)
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000112{
Andreas Mohr92dcad82000-09-22 20:51:09 +0000113 FIXME("(%p), stub.\n", ste);
Alexandre Julliard44ed71f1997-12-21 19:17:50 +0000114 return TRUE;
115}
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000116
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000117/***********************************************************************
Patrik Stridvall0c610282001-01-25 22:22:21 +0000118 * InterruptRegister (TOOLHELP.75)
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000119 */
Alexandre Julliard4220b291999-07-11 17:20:01 +0000120BOOL16 WINAPI InterruptRegister16( HTASK16 task, FARPROC callback )
121{
Andreas Mohr92dcad82000-09-22 20:51:09 +0000122 FIXME("(%04x, %p), stub.\n", task, callback);
Alexandre Julliard4220b291999-07-11 17:20:01 +0000123 return TRUE;
124}
125
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000126/***********************************************************************
Patrik Stridvall0c610282001-01-25 22:22:21 +0000127 * InterruptUnRegister (TOOLHELP.76)
Patrik Stridvall2d6457c2000-03-28 20:22:59 +0000128 */
Alexandre Julliard4220b291999-07-11 17:20:01 +0000129BOOL16 WINAPI InterruptUnRegister16( HTASK16 task )
130{
Andreas Mohr92dcad82000-09-22 20:51:09 +0000131 FIXME("(%04x), stub.\n", task);
Alexandre Julliard4220b291999-07-11 17:20:01 +0000132 return TRUE;
133}
134
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000135/***********************************************************************
Alexandre Julliard6b141172000-07-31 21:01:05 +0000136 * TimerCount (TOOLHELP.80)
137 */
138BOOL16 WINAPI TimerCount16( TIMERINFO *pTimerInfo )
139{
140 /* FIXME
141 * In standard mode, dwmsSinceStart = dwmsThisVM
142 *
143 * I tested this, under Windows in enhanced mode, and
144 * if you never switch VM (ie start/stop DOS) these
145 * values should be the same as well.
146 *
147 * Also, Wine should adjust for the hardware timer
148 * to reduce the amount of error to ~1ms.
149 * I can't be bothered, can you?
150 */
151 pTimerInfo->dwmsSinceStart = pTimerInfo->dwmsThisVM = GetTickCount();
152 return TRUE;
153}
154
155/***********************************************************************
156 * SystemHeapInfo (TOOLHELP.71)
157 */
158BOOL16 WINAPI SystemHeapInfo16( SYSHEAPINFO *pHeapInfo )
159{
160 WORD user = LoadLibrary16( "USER.EXE" );
161 WORD gdi = LoadLibrary16( "GDI.EXE" );
162 pHeapInfo->wUserFreePercent = (int)LOCAL_CountFree(user) * 100 / LOCAL_HeapSize(user);
163 pHeapInfo->wGDIFreePercent = (int)LOCAL_CountFree(gdi) * 100 / LOCAL_HeapSize(gdi);
164 pHeapInfo->hUserSegment = user;
165 pHeapInfo->hGDISegment = gdi;
166 FreeLibrary16( user );
167 FreeLibrary16( gdi );
168 return TRUE;
169}
170
171
172/***********************************************************************
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000173 * ToolHelpHook (KERNEL.341)
174 * see "Undocumented Windows"
175 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000176FARPROC16 WINAPI ToolHelpHook16(FARPROC16 lpfnNotifyHandler)
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000177{
Andreas Mohr92dcad82000-09-22 20:51:09 +0000178 FARPROC16 tmp;
179
180 FIXME("(%p), stub.\n", lpfnNotifyHandler);
Alexandre Julliard60ce85c1998-02-01 18:33:27 +0000181 tmp = HookNotify;
182 HookNotify = lpfnNotifyHandler;
183 /* just return previously installed notification function */
184 return tmp;
185}
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000186
Patrick Spinler3f8e1e41998-12-11 15:04:11 +0000187
188/***********************************************************************
Patrik Stridvalldae8de62001-06-13 20:13:18 +0000189 * CreateToolhelp32Snapshot (KERNEL32.@)
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000190 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000191HANDLE WINAPI CreateToolhelp32Snapshot( DWORD flags, DWORD process )
Patrick Spinler3f8e1e41998-12-11 15:04:11 +0000192{
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000193 HANDLE ret;
Patrick Spinler3f8e1e41998-12-11 15:04:11 +0000194
Alexandre Julliard61fece01999-06-26 19:09:08 +0000195 TRACE("%lx,%lx\n", flags, process );
Alexandre Julliard07d84462000-04-16 19:45:05 +0000196 if (!(flags & (TH32CS_SNAPPROCESS|TH32CS_SNAPTHREAD|TH32CS_SNAPMODULE)))
Patrick Spinler3f8e1e41998-12-11 15:04:11 +0000197 {
Alexandre Julliard07d84462000-04-16 19:45:05 +0000198 FIXME("flags %lx not implemented\n", flags );
Alexandre Julliardfdc92ba1999-02-14 18:03:15 +0000199 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
Alexandre Julliarda3960291999-02-26 11:11:13 +0000200 return INVALID_HANDLE_VALUE;
Patrick Spinler3f8e1e41998-12-11 15:04:11 +0000201 }
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000202
Alexandre Julliard96c08d81999-02-28 13:27:56 +0000203 /* Now do the snapshot */
Alexandre Julliard67a74992001-02-27 02:09:16 +0000204 SERVER_START_REQ( create_snapshot )
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000205 {
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000206 req->flags = flags & ~TH32CS_INHERIT;
207 req->inherit = (flags & TH32CS_INHERIT) != 0;
208 req->pid = (void *)process;
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000209 wine_server_call_err( req );
210 ret = reply->handle;
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000211 }
212 SERVER_END_REQ;
Alexandre Julliard8081e5a2001-01-05 04:08:07 +0000213 if (!ret) ret = INVALID_HANDLE_VALUE;
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000214 return ret;
Patrick Spinler3f8e1e41998-12-11 15:04:11 +0000215}
216
Alexandre Julliardfdc92ba1999-02-14 18:03:15 +0000217
Patrick Spinler3f8e1e41998-12-11 15:04:11 +0000218/***********************************************************************
Alexandre Julliard07d84462000-04-16 19:45:05 +0000219 * TOOLHELP_Thread32Next
220 *
221 * Implementation of Thread32First/Next
222 */
223static BOOL TOOLHELP_Thread32Next( HANDLE handle, LPTHREADENTRY32 lpte, BOOL first )
224{
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000225 BOOL ret;
Alexandre Julliard07d84462000-04-16 19:45:05 +0000226
227 if (lpte->dwSize < sizeof(THREADENTRY32))
228 {
229 SetLastError( ERROR_INSUFFICIENT_BUFFER );
230 ERR("Result buffer too small (req: %d, was: %ld)\n", sizeof(THREADENTRY32), lpte->dwSize);
231 return FALSE;
232 }
Alexandre Julliard67a74992001-02-27 02:09:16 +0000233 SERVER_START_REQ( next_thread )
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000234 {
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000235 req->handle = handle;
236 req->reset = first;
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000237 if ((ret = !wine_server_call_err( req )))
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000238 {
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000239 lpte->cntUsage = reply->count;
240 lpte->th32ThreadID = (DWORD)reply->tid;
241 lpte->th32OwnerProcessID = (DWORD)reply->pid;
242 lpte->tpBasePri = reply->base_pri;
243 lpte->tpDeltaPri = reply->delta_pri;
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000244 lpte->dwFlags = 0; /* SDK: "reserved; do not use" */
245 }
246 }
247 SERVER_END_REQ;
248 return ret;
Alexandre Julliard07d84462000-04-16 19:45:05 +0000249}
250
251/***********************************************************************
Patrik Stridvalldae8de62001-06-13 20:13:18 +0000252 * Thread32First (KERNEL32.@)
Andreas Mohrf4077e61999-12-05 23:11:10 +0000253 *
254 * Return info about the first thread in a toolhelp32 snapshot
255 */
Alexandre Julliard07d84462000-04-16 19:45:05 +0000256BOOL WINAPI Thread32First(HANDLE hSnapshot, LPTHREADENTRY32 lpte)
Andreas Mohrf4077e61999-12-05 23:11:10 +0000257{
Alexandre Julliard07d84462000-04-16 19:45:05 +0000258 return TOOLHELP_Thread32Next(hSnapshot, lpte, TRUE);
Andreas Mohrf4077e61999-12-05 23:11:10 +0000259}
260
261/***********************************************************************
Patrik Stridvalldae8de62001-06-13 20:13:18 +0000262 * Thread32Next (KERNEL32.@)
Andreas Mohrf4077e61999-12-05 23:11:10 +0000263 *
264 * Return info about the "next" thread in a toolhelp32 snapshot
265 */
Alexandre Julliard07d84462000-04-16 19:45:05 +0000266BOOL WINAPI Thread32Next(HANDLE hSnapshot, LPTHREADENTRY32 lpte)
Andreas Mohrf4077e61999-12-05 23:11:10 +0000267{
Alexandre Julliard07d84462000-04-16 19:45:05 +0000268 return TOOLHELP_Thread32Next(hSnapshot, lpte, FALSE);
Andreas Mohrf4077e61999-12-05 23:11:10 +0000269}
270
271/***********************************************************************
Alexandre Julliardfdc92ba1999-02-14 18:03:15 +0000272 * TOOLHELP_Process32Next
273 *
274 * Implementation of Process32First/Next
275 */
Alexandre Julliard07d84462000-04-16 19:45:05 +0000276static BOOL TOOLHELP_Process32Next( HANDLE handle, LPPROCESSENTRY32 lppe, BOOL first )
Alexandre Julliardfdc92ba1999-02-14 18:03:15 +0000277{
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000278 BOOL ret;
Alexandre Julliardfdc92ba1999-02-14 18:03:15 +0000279
Alexandre Julliard07d84462000-04-16 19:45:05 +0000280 if (lppe->dwSize < sizeof(PROCESSENTRY32))
Alexandre Julliardfdc92ba1999-02-14 18:03:15 +0000281 {
282 SetLastError( ERROR_INSUFFICIENT_BUFFER );
Alexandre Julliard07d84462000-04-16 19:45:05 +0000283 ERR("Result buffer too small (req: %d, was: %ld)\n", sizeof(PROCESSENTRY32), lppe->dwSize);
Alexandre Julliardfdc92ba1999-02-14 18:03:15 +0000284 return FALSE;
285 }
Alexandre Julliard67a74992001-02-27 02:09:16 +0000286 SERVER_START_REQ( next_process )
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000287 {
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000288 req->handle = handle;
289 req->reset = first;
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000290 if ((ret = !wine_server_call_err( req )))
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000291 {
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000292 lppe->cntUsage = reply->count;
293 lppe->th32ProcessID = (DWORD)reply->pid;
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000294 lppe->th32DefaultHeapID = 0; /* FIXME */
295 lppe->th32ModuleID = 0; /* FIXME */
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000296 lppe->cntThreads = reply->threads;
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000297 lppe->th32ParentProcessID = 0; /* FIXME */
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000298 lppe->pcPriClassBase = reply->priority;
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000299 lppe->dwFlags = -1; /* FIXME */
300 lppe->szExeFile[0] = 0; /* FIXME */
301 }
302 }
303 SERVER_END_REQ;
304 return ret;
Alexandre Julliardfdc92ba1999-02-14 18:03:15 +0000305}
306
307
308/***********************************************************************
Patrik Stridvalldae8de62001-06-13 20:13:18 +0000309 * Process32First (KERNEL32.@)
Alexandre Julliardfdc92ba1999-02-14 18:03:15 +0000310 *
Patrick Spinler3f8e1e41998-12-11 15:04:11 +0000311 * Return info about the first process in a toolhelp32 snapshot
312 */
Alexandre Julliard07d84462000-04-16 19:45:05 +0000313BOOL WINAPI Process32First(HANDLE hSnapshot, LPPROCESSENTRY32 lppe)
Patrick Spinler3f8e1e41998-12-11 15:04:11 +0000314{
Alexandre Julliardfdc92ba1999-02-14 18:03:15 +0000315 return TOOLHELP_Process32Next( hSnapshot, lppe, TRUE );
Patrick Spinler3f8e1e41998-12-11 15:04:11 +0000316}
317
318/***********************************************************************
Patrik Stridvalldae8de62001-06-13 20:13:18 +0000319 * Process32Next (KERNEL32.@)
Alexandre Julliardfdc92ba1999-02-14 18:03:15 +0000320 *
Patrick Spinler3f8e1e41998-12-11 15:04:11 +0000321 * Return info about the "next" process in a toolhelp32 snapshot
322 */
Alexandre Julliard07d84462000-04-16 19:45:05 +0000323BOOL WINAPI Process32Next(HANDLE hSnapshot, LPPROCESSENTRY32 lppe)
Patrick Spinler3f8e1e41998-12-11 15:04:11 +0000324{
Alexandre Julliardfdc92ba1999-02-14 18:03:15 +0000325 return TOOLHELP_Process32Next( hSnapshot, lppe, FALSE );
Alexandre Julliardebfc0fe1998-06-28 18:40:26 +0000326}
Marcus Meissnere3e268e1999-03-18 17:29:40 +0000327
Alexandre Julliard07d84462000-04-16 19:45:05 +0000328
329/***********************************************************************
330 * TOOLHELP_Module32Next
331 *
332 * Implementation of Module32First/Next
333 */
334static BOOL TOOLHELP_Module32Next( HANDLE handle, LPMODULEENTRY32 lpme, BOOL first )
335{
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000336 BOOL ret;
337
Alexandre Julliard07d84462000-04-16 19:45:05 +0000338 if (lpme->dwSize < sizeof (MODULEENTRY32))
339 {
340 SetLastError( ERROR_INSUFFICIENT_BUFFER );
341 ERR("Result buffer too small (req: %d, was: %ld)\n", sizeof(MODULEENTRY32), lpme->dwSize);
342 return FALSE;
343 }
Alexandre Julliard67a74992001-02-27 02:09:16 +0000344 SERVER_START_REQ( next_module )
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000345 {
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000346 req->handle = handle;
347 req->reset = first;
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000348 if ((ret = !wine_server_call_err( req )))
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000349 {
350 lpme->th32ModuleID = 0; /* toolhelp internal id, never used */
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000351 lpme->th32ProcessID = (DWORD)reply->pid;
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000352 lpme->GlblcntUsage = 0; /* FIXME */
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000353 lpme->ProccntUsage = 0; /* FIXME */
354 lpme->modBaseAddr = reply->base;
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000355 lpme->modBaseSize = 0; /* FIXME */
Alexandre Julliard9caa71e2001-11-30 18:46:42 +0000356 lpme->hModule = (DWORD)reply->base;
Alexandre Julliard9c2370b2000-08-30 00:00:48 +0000357 lpme->szModule[0] = 0; /* FIXME */
358 lpme->szExePath[0] = 0; /* FIXME */
359 }
360 }
361 SERVER_END_REQ;
362 return ret;
Alexandre Julliard07d84462000-04-16 19:45:05 +0000363}
364
Marcus Meissnere3e268e1999-03-18 17:29:40 +0000365/***********************************************************************
Patrik Stridvalldae8de62001-06-13 20:13:18 +0000366 * Module32First (KERNEL32.@)
Marcus Meissnere3e268e1999-03-18 17:29:40 +0000367 *
368 * Return info about the "first" module in a toolhelp32 snapshot
369 */
Alexandre Julliard07d84462000-04-16 19:45:05 +0000370BOOL WINAPI Module32First(HANDLE hSnapshot, LPMODULEENTRY32 lpme)
Marcus Meissnere3e268e1999-03-18 17:29:40 +0000371{
Alexandre Julliard07d84462000-04-16 19:45:05 +0000372 return TOOLHELP_Module32Next( hSnapshot, lpme, TRUE );
Marcus Meissnere3e268e1999-03-18 17:29:40 +0000373}
374
375/***********************************************************************
Patrik Stridvalldae8de62001-06-13 20:13:18 +0000376 * Module32Next (KERNEL32.@)
Marcus Meissnere3e268e1999-03-18 17:29:40 +0000377 *
378 * Return info about the "next" module in a toolhelp32 snapshot
379 */
Alexandre Julliard07d84462000-04-16 19:45:05 +0000380BOOL WINAPI Module32Next(HANDLE hSnapshot, LPMODULEENTRY32 lpme)
Marcus Meissnere3e268e1999-03-18 17:29:40 +0000381{
Alexandre Julliard07d84462000-04-16 19:45:05 +0000382 return TOOLHELP_Module32Next( hSnapshot, lpme, FALSE );
Marcus Meissnere3e268e1999-03-18 17:29:40 +0000383}
Uwe Bonnes2df1afd1999-04-25 09:22:13 +0000384
385/************************************************************************
Patrik Stridvall01d5e5b2001-07-02 19:59:40 +0000386 * GlobalMasterHandle (KERNEL.28)
Uwe Bonnes2df1afd1999-04-25 09:22:13 +0000387 *
388 *
389 * Should return selector and handle of the information structure for
390 * the global heap. selector and handle are stored in the THHOOK as
391 * pGlobalHeap and hGlobalHeap.
392 * As Wine doesn't have this structure, we return both values as zero
393 * Applications should interpret this as "No Global Heap"
394 */
395DWORD WINAPI GlobalMasterHandle16(void)
396{
Alexandre Julliard61fece01999-06-26 19:09:08 +0000397 FIXME(": stub\n");
Uwe Bonnes2df1afd1999-04-25 09:22:13 +0000398 return 0;
399}