diff --git a/dlls/kernel/Makefile.in b/dlls/kernel/Makefile.in index 14a52030f9..f35c11dd5a 100644 --- a/dlls/kernel/Makefile.in +++ b/dlls/kernel/Makefile.in @@ -71,14 +71,15 @@ C_SRCS = \ virtual.c \ volume.c \ vxd.c \ - win87em.c \ windebug.c \ wowthunk.c C_SRCS16 = \ atom16.c \ error16.c \ - registry16.c + registry16.c \ + toolhelp16.c \ + win87em.c ASM_SRCS = relay16asm.s diff --git a/dlls/kernel/toolhelp.c b/dlls/kernel/toolhelp.c index 708aeaa414..a3b062b3aa 100644 --- a/dlls/kernel/toolhelp.c +++ b/dlls/kernel/toolhelp.c @@ -30,9 +30,7 @@ #include #include "windef.h" #include "winbase.h" -#include "wine/winbase16.h" #include "winerror.h" -#include "thread.h" #include "tlhelp32.h" #include "toolhelp.h" #include "wine/server.h" @@ -42,175 +40,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(toolhelp); -/* FIXME: to make this work, we have to call back all these registered - * functions from all over the WINE code. Someone with more knowledge than - * me please do that. -Marcus - */ -static struct notify -{ - HTASK16 htask; - FARPROC16 lpfnCallback; - WORD wFlags; -} *notifys = NULL; - -static int nrofnotifys = 0; - -static FARPROC16 HookNotify = NULL; - -/*********************************************************************** - * NotifyRegister (TOOLHELP.73) - */ -BOOL16 WINAPI NotifyRegister16( HTASK16 htask, FARPROC16 lpfnCallback, - WORD wFlags ) -{ - int i; - - FIXME("(%x,%lx,%x), semi-stub.\n", - htask, (DWORD)lpfnCallback, wFlags ); - if (!htask) htask = GetCurrentTask(); - for (i=0;idwmsSinceStart = pTimerInfo->dwmsThisVM = GetTickCount(); - return TRUE; -} - -/*********************************************************************** - * SystemHeapInfo (TOOLHELP.71) - */ -BOOL16 WINAPI SystemHeapInfo16( SYSHEAPINFO *pHeapInfo ) -{ - STACK16FRAME* stack16 = MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved); - HANDLE16 oldDS = stack16->ds; - WORD user = LoadLibrary16( "USER.EXE" ); - WORD gdi = LoadLibrary16( "GDI.EXE" ); - stack16->ds = user; - pHeapInfo->wUserFreePercent = (int)LocalCountFree16() * 100 / LocalHeapSize16(); - stack16->ds = gdi; - pHeapInfo->wGDIFreePercent = (int)LocalCountFree16() * 100 / LocalHeapSize16(); - stack16->ds = oldDS; - pHeapInfo->hUserSegment = user; - pHeapInfo->hGDISegment = gdi; - FreeLibrary16( user ); - FreeLibrary16( gdi ); - return TRUE; -} - - -/*********************************************************************** - * ToolHelpHook (KERNEL.341) - * see "Undocumented Windows" - */ -FARPROC16 WINAPI ToolHelpHook16(FARPROC16 lpfnNotifyHandler) -{ - FARPROC16 tmp; - - FIXME("(%p), stub.\n", lpfnNotifyHandler); - tmp = HookNotify; - HookNotify = lpfnNotifyHandler; - /* just return previously installed notification function */ - return tmp; -} - - /*********************************************************************** * CreateToolhelp32Snapshot (KERNEL32.@) */ diff --git a/dlls/kernel/toolhelp16.c b/dlls/kernel/toolhelp16.c new file mode 100644 index 0000000000..c29087decd --- /dev/null +++ b/dlls/kernel/toolhelp16.c @@ -0,0 +1,208 @@ +/* + * Misc Toolhelp functions + * + * Copyright 1996 Marcus Meissner + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#ifdef HAVE_UNISTD_H +# include +#endif +#include +#include +#include "windef.h" +#include "winbase.h" +#include "wine/winbase16.h" +#include "winerror.h" +#include "toolhelp.h" +#include "wine/server.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(toolhelp); + +/* FIXME: to make this work, we have to call back all these registered + * functions from all over the WINE code. Someone with more knowledge than + * me please do that. -Marcus + */ + +static struct notify +{ + HTASK16 htask; + FARPROC16 lpfnCallback; + WORD wFlags; +} *notifys = NULL; + +static int nrofnotifys = 0; + +static FARPROC16 HookNotify = NULL; + +/*********************************************************************** + * NotifyRegister (TOOLHELP.73) + */ +BOOL16 WINAPI NotifyRegister16( HTASK16 htask, FARPROC16 lpfnCallback, + WORD wFlags ) +{ + int i; + + FIXME("(%x,%lx,%x), semi-stub.\n", + htask, (DWORD)lpfnCallback, wFlags ); + if (!htask) htask = GetCurrentTask(); + for (i=0;idwmsSinceStart = pTimerInfo->dwmsThisVM = GetTickCount(); + return TRUE; +} + +/*********************************************************************** + * SystemHeapInfo (TOOLHELP.71) + */ +BOOL16 WINAPI SystemHeapInfo16( SYSHEAPINFO *pHeapInfo ) +{ + STACK16FRAME* stack16 = MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved); + HANDLE16 oldDS = stack16->ds; + WORD user = LoadLibrary16( "USER.EXE" ); + WORD gdi = LoadLibrary16( "GDI.EXE" ); + stack16->ds = user; + pHeapInfo->wUserFreePercent = (int)LocalCountFree16() * 100 / LocalHeapSize16(); + stack16->ds = gdi; + pHeapInfo->wGDIFreePercent = (int)LocalCountFree16() * 100 / LocalHeapSize16(); + stack16->ds = oldDS; + pHeapInfo->hUserSegment = user; + pHeapInfo->hGDISegment = gdi; + FreeLibrary16( user ); + FreeLibrary16( gdi ); + return TRUE; +} + + +/*********************************************************************** + * ToolHelpHook (KERNEL.341) + * see "Undocumented Windows" + */ +FARPROC16 WINAPI ToolHelpHook16(FARPROC16 lpfnNotifyHandler) +{ + FARPROC16 tmp; + + FIXME("(%p), stub.\n", lpfnNotifyHandler); + tmp = HookNotify; + HookNotify = lpfnNotifyHandler; + /* just return previously installed notification function */ + return tmp; +}