2 * Misc Toolhelp functions
4 * Copyright 1996 Marcus Meissner
18 /* FIXME: to make this working, we have to callback all these registered
19 * functions from all over the WINE code. Someone with more knowledge than
20 * me please do that. -Marcus
25 FARPROC16 lpfnCallback;
29 static int nrofnotifys = 0;
31 static FARPROC16 HookNotify = NULL;
33 BOOL16 WINAPI NotifyRegister( HTASK16 htask, FARPROC16 lpfnCallback,
38 dprintf_toolhelp( stddeb, "NotifyRegister(%x,%lx,%x) called.\n",
39 htask, (DWORD)lpfnCallback, wFlags );
40 for (i=0;i<nrofnotifys;i++)
41 if (notifys[i].htask==htask)
45 notifys=(struct notify*)HeapAlloc( GetProcessHeap(), 0,
46 sizeof(struct notify) );
48 notifys=(struct notify*)HeapReAlloc( GetProcessHeap(), 0, notifys,
49 sizeof(struct notify)*(nrofnotifys+1));
50 if (!notifys) return FALSE;
53 notifys[i].htask=htask;
54 notifys[i].lpfnCallback=lpfnCallback;
55 notifys[i].wFlags=wFlags;
59 BOOL16 WINAPI NotifyUnregister( HTASK16 htask )
63 dprintf_toolhelp( stddeb, "NotifyUnregister(%x) called.\n", htask );
64 for (i=nrofnotifys;i--;)
65 if (notifys[i].htask==htask)
69 memcpy(notifys+i,notifys+(i+1),sizeof(struct notify)*(nrofnotifys-i-1));
70 notifys=(struct notify*)HeapReAlloc( GetProcessHeap(), 0, notifys,
71 (nrofnotifys-1)*sizeof(struct notify));
76 BOOL16 WINAPI StackTraceCSIPFirst(STACKTRACEENTRY *ste, WORD wSS, WORD wCS, WORD wIP, WORD wBP)
81 BOOL16 WINAPI StackTraceFirst(STACKTRACEENTRY *ste, HTASK16 Task)
86 BOOL16 WINAPI StackTraceNext(STACKTRACEENTRY *ste)
91 /***********************************************************************
92 * ToolHelpHook (KERNEL.341)
93 * see "Undocumented Windows"
95 FARPROC16 WINAPI ToolHelpHook(FARPROC16 lpfnNotifyHandler)
99 HookNotify = lpfnNotifyHandler;
100 /* just return previously installed notification function */