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 TRACE(toolhelp, "(%x,%lx,%x) called.\n",
39 htask, (DWORD)lpfnCallback, wFlags );
40 if (!htask) htask = GetCurrentTask();
41 for (i=0;i<nrofnotifys;i++)
42 if (notifys[i].htask==htask)
46 notifys=(struct notify*)HeapAlloc( SystemHeap, 0,
47 sizeof(struct notify) );
49 notifys=(struct notify*)HeapReAlloc( SystemHeap, 0, notifys,
50 sizeof(struct notify)*(nrofnotifys+1));
51 if (!notifys) return FALSE;
54 notifys[i].htask=htask;
55 notifys[i].lpfnCallback=lpfnCallback;
56 notifys[i].wFlags=wFlags;
60 BOOL16 WINAPI NotifyUnregister( HTASK16 htask )
64 TRACE(toolhelp, "(%x) called.\n", htask );
65 if (!htask) htask = GetCurrentTask();
66 for (i=nrofnotifys;i--;)
67 if (notifys[i].htask==htask)
71 memcpy(notifys+i,notifys+(i+1),sizeof(struct notify)*(nrofnotifys-i-1));
72 notifys=(struct notify*)HeapReAlloc( SystemHeap, 0, notifys,
73 (nrofnotifys-1)*sizeof(struct notify));
78 BOOL16 WINAPI StackTraceCSIPFirst(STACKTRACEENTRY *ste, WORD wSS, WORD wCS, WORD wIP, WORD wBP)
83 BOOL16 WINAPI StackTraceFirst(STACKTRACEENTRY *ste, HTASK16 Task)
88 BOOL16 WINAPI StackTraceNext(STACKTRACEENTRY *ste)
93 /***********************************************************************
94 * ToolHelpHook (KERNEL.341)
95 * see "Undocumented Windows"
97 FARPROC16 WINAPI ToolHelpHook(FARPROC16 lpfnNotifyHandler)
101 HookNotify = lpfnNotifyHandler;
102 /* just return previously installed notification function */