Authors: Francis Beaudet <francis@macadamian.com>, Sylvain St-Germain <sylvain@macada...
[wine/multimedia.git] / misc / toolhelp.c
blobc3cb60aaaad8eb166ee37d175920916146507b16
1 /*
2 * Misc Toolhelp functions
4 * Copyright 1996 Marcus Meissner
5 */
7 #include <stdlib.h>
8 #include <string.h>
9 #include <unistd.h>
10 #include <ctype.h>
11 #include "windows.h"
12 #include "win.h"
13 #include "toolhelp.h"
14 #include "debug.h"
15 #include "heap.h"
17 /* FIXME: to make this working, we have to callback all these registered
18 * functions from all over the WINE code. Someone with more knowledge than
19 * me please do that. -Marcus
21 static struct notify
23 HTASK16 htask;
24 FARPROC16 lpfnCallback;
25 WORD wFlags;
26 } *notifys = NULL;
28 static int nrofnotifys = 0;
30 static FARPROC16 HookNotify = NULL;
32 BOOL16 WINAPI NotifyRegister( HTASK16 htask, FARPROC16 lpfnCallback,
33 WORD wFlags )
35 int i;
37 TRACE(toolhelp, "(%x,%lx,%x) called.\n",
38 htask, (DWORD)lpfnCallback, wFlags );
39 if (!htask) htask = GetCurrentTask();
40 for (i=0;i<nrofnotifys;i++)
41 if (notifys[i].htask==htask)
42 break;
43 if (i==nrofnotifys) {
44 if (notifys==NULL)
45 notifys=(struct notify*)HeapAlloc( SystemHeap, 0,
46 sizeof(struct notify) );
47 else
48 notifys=(struct notify*)HeapReAlloc( SystemHeap, 0, notifys,
49 sizeof(struct notify)*(nrofnotifys+1));
50 if (!notifys) return FALSE;
51 nrofnotifys++;
53 notifys[i].htask=htask;
54 notifys[i].lpfnCallback=lpfnCallback;
55 notifys[i].wFlags=wFlags;
56 return TRUE;
59 BOOL16 WINAPI NotifyUnregister( HTASK16 htask )
61 int i;
63 TRACE(toolhelp, "(%x) called.\n", htask );
64 if (!htask) htask = GetCurrentTask();
65 for (i=nrofnotifys;i--;)
66 if (notifys[i].htask==htask)
67 break;
68 if (i==-1)
69 return FALSE;
70 memcpy(notifys+i,notifys+(i+1),sizeof(struct notify)*(nrofnotifys-i-1));
71 notifys=(struct notify*)HeapReAlloc( SystemHeap, 0, notifys,
72 (nrofnotifys-1)*sizeof(struct notify));
73 nrofnotifys--;
74 return TRUE;
77 BOOL16 WINAPI StackTraceCSIPFirst(STACKTRACEENTRY *ste, WORD wSS, WORD wCS, WORD wIP, WORD wBP)
79 return TRUE;
82 BOOL16 WINAPI StackTraceFirst(STACKTRACEENTRY *ste, HTASK16 Task)
84 return TRUE;
87 BOOL16 WINAPI StackTraceNext(STACKTRACEENTRY *ste)
89 return TRUE;
92 /***********************************************************************
93 * ToolHelpHook (KERNEL.341)
94 * see "Undocumented Windows"
96 FARPROC16 WINAPI ToolHelpHook(FARPROC16 lpfnNotifyHandler)
98 FARPROC16 tmp;
99 tmp = HookNotify;
100 HookNotify = lpfnNotifyHandler;
101 /* just return previously installed notification function */
102 return tmp;
105 /***********************************************************************
106 * CreateToolHelp32Snapshot (KERNEL32.179)
107 * see "Undocumented Windows"
109 HANDLE32 WINAPI CreateToolhelp32Snapshot(DWORD dwFlags, DWORD th32ProcessID) {
110 FIXME(toolhelp,"(0x%08lx,0x%08lx), stub!\n",dwFlags,th32ProcessID);
111 return INVALID_HANDLE_VALUE32;