Commit c1dbeade authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Make toolhelp.dll into a stand-alone 16-bit module.

parent 72b0389b
......@@ -119,7 +119,6 @@ dlls/setupx.dll16
dlls/shdocvw/shdocvw_v1.tlb
dlls/stdole2.tlb/std_ole_v2.tlb
dlls/stdole32.tlb/std_ole_v1.tlb
dlls/toolhelp.dll16
dlls/user.exe16
dlls/ver.dll16
dlls/wineps16.drv16
......
......@@ -16682,6 +16682,14 @@ dlls/tapi32/Makefile: dlls/tapi32/Makefile.in dlls/Makedll.rules"
ac_config_files="$ac_config_files dlls/tapi32/Makefile"
ALL_MAKEFILES="$ALL_MAKEFILES \\
dlls/toolhelp.dll16/Makefile"
test "x$enable_win16" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\
toolhelp.dll16"
ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
dlls/toolhelp.dll16/Makefile: dlls/toolhelp.dll16/Makefile.in dlls/Makedll.rules"
ac_config_files="$ac_config_files dlls/toolhelp.dll16/Makefile"
ALL_MAKEFILES="$ALL_MAKEFILES \\
dlls/traffic/Makefile"
test "x$enable_traffic" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\
traffic"
......@@ -19056,6 +19064,7 @@ do
"dlls/system.drv16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/system.drv16/Makefile" ;;
"dlls/t2embed/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/t2embed/Makefile" ;;
"dlls/tapi32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/tapi32/Makefile" ;;
"dlls/toolhelp.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/toolhelp.dll16/Makefile" ;;
"dlls/traffic/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/traffic/Makefile" ;;
"dlls/twain.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/twain.dll16/Makefile" ;;
"dlls/twain_32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/twain_32/Makefile" ;;
......
......@@ -2446,6 +2446,7 @@ WINE_CONFIG_MAKEFILE([dlls/sxs/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DI
WINE_CONFIG_MAKEFILE([dlls/system.drv16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16])
WINE_CONFIG_MAKEFILE([dlls/t2embed/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/tapi32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/toolhelp.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16])
WINE_CONFIG_MAKEFILE([dlls/traffic/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/twain.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16])
WINE_CONFIG_MAKEFILE([dlls/twain_32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
......
......@@ -23,7 +23,6 @@ WIN16_FILES = \
krnl386.exe16 \
mmsystem.dll16 \
setupx.dll16 \
toolhelp.dll16 \
user.exe16 \
ver.dll16 \
wineps16.drv16 \
......@@ -44,7 +43,7 @@ commdlg.dll16:
gdi.exe16:
echo "gdi32.dll" >$@
krnl386.exe16 toolhelp.dll16:
krnl386.exe16:
echo "kernel32.dll" >$@
setupx.dll16:
......
......@@ -9,9 +9,7 @@ IMPORTS = ntdll
EXTRALIBS = @COREFOUNDATIONLIB@ @LIBPOLL@
EXTRADLLFLAGS = -Wb,-F,KERNEL32.dll -Wl,--image-base,0x7b800000
SPEC_SRCS16 = \
krnl386.exe.spec \
toolhelp.spec
SPEC_SRCS16 = krnl386.exe.spec
C_SRCS = \
actctx.c \
......@@ -71,8 +69,7 @@ C_SRCS16 = \
atom16.c \
error16.c \
kernel16.c \
registry16.c \
toolhelp16.c
registry16.c
RC_SRCS = \
locale_rc.rc \
......
......@@ -38,7 +38,6 @@
#endif
#include "wine/winbase16.h"
#include "toolhelp.h"
#include "winternl.h"
#include "kernel_private.h"
#include "kernel16_private.h"
......@@ -951,6 +950,8 @@ DWORD WINAPI GlobalMasterHandle16(void)
/***********************************************************************
* GlobalHandleToSel (TOOLHELP.50)
*
* FIXME: This is in TOOLHELP but we keep a copy here for now.
*/
WORD WINAPI GlobalHandleToSel16( HGLOBAL16 handle )
{
......@@ -969,100 +970,6 @@ WORD WINAPI GlobalHandleToSel16( HGLOBAL16 handle )
/***********************************************************************
* GlobalFirst (TOOLHELP.51)
*/
BOOL16 WINAPI GlobalFirst16( GLOBALENTRY *pGlobal, WORD wFlags )
{
if (wFlags == GLOBAL_LRU) return FALSE;
pGlobal->dwNext = 0;
return GlobalNext16( pGlobal, wFlags );
}
/***********************************************************************
* GlobalNext (TOOLHELP.52)
*/
BOOL16 WINAPI GlobalNext16( GLOBALENTRY *pGlobal, WORD wFlags)
{
GLOBALARENA *pArena;
if (pGlobal->dwNext >= globalArenaSize) return FALSE;
pArena = pGlobalArena + pGlobal->dwNext;
if (wFlags == GLOBAL_FREE) /* only free blocks */
{
int i;
for (i = pGlobal->dwNext; i < globalArenaSize; i++, pArena++)
if (pArena->size == 0) break; /* block is free */
if (i >= globalArenaSize) return FALSE;
pGlobal->dwNext = i;
}
pGlobal->dwAddress = (DWORD_PTR)pArena->base;
pGlobal->dwBlockSize = pArena->size;
pGlobal->hBlock = pArena->handle;
pGlobal->wcLock = pArena->lockCount;
pGlobal->wcPageLock = pArena->pageLockCount;
pGlobal->wFlags = (GetCurrentPDB16() == pArena->hOwner);
pGlobal->wHeapPresent = FALSE;
pGlobal->hOwner = pArena->hOwner;
pGlobal->wType = GT_UNKNOWN;
pGlobal->wData = 0;
pGlobal->dwNext++;
return TRUE;
}
/***********************************************************************
* GlobalInfo (TOOLHELP.53)
*/
BOOL16 WINAPI GlobalInfo16( GLOBALINFO *pInfo )
{
int i;
GLOBALARENA *pArena;
pInfo->wcItems = globalArenaSize;
pInfo->wcItemsFree = 0;
pInfo->wcItemsLRU = 0;
for (i = 0, pArena = pGlobalArena; i < globalArenaSize; i++, pArena++)
if (pArena->size == 0) pInfo->wcItemsFree++;
return TRUE;
}
/***********************************************************************
* GlobalEntryHandle (TOOLHELP.54)
*/
BOOL16 WINAPI GlobalEntryHandle16( GLOBALENTRY *pGlobal, HGLOBAL16 hItem )
{
GLOBALARENA *pArena = GET_ARENA_PTR(hItem);
pGlobal->dwAddress = (DWORD_PTR)pArena->base;
pGlobal->dwBlockSize = pArena->size;
pGlobal->hBlock = pArena->handle;
pGlobal->wcLock = pArena->lockCount;
pGlobal->wcPageLock = pArena->pageLockCount;
pGlobal->wFlags = (GetCurrentPDB16() == pArena->hOwner);
pGlobal->wHeapPresent = FALSE;
pGlobal->hOwner = pArena->hOwner;
pGlobal->wType = GT_UNKNOWN;
pGlobal->wData = 0;
pGlobal->dwNext++;
return TRUE;
}
/***********************************************************************
* GlobalEntryModule (TOOLHELP.55)
*/
BOOL16 WINAPI GlobalEntryModule16( GLOBALENTRY *pGlobal, HMODULE16 hModule,
WORD wSeg )
{
FIXME("(%p, 0x%04x, 0x%04x), stub.\n", pGlobal, hModule, wSeg);
return FALSE;
}
/***********************************************************************
* GetFreeMemInfo (KERNEL.316)
*/
DWORD WINAPI GetFreeMemInfo16(void)
......
......@@ -35,7 +35,6 @@
#include <string.h>
#include "wine/winbase16.h"
#include "wownt32.h"
#include "toolhelp.h"
#include "winternl.h"
#include "kernel_private.h"
#include "kernel16_private.h"
......@@ -126,6 +125,30 @@ typedef struct
WORD magic; /* 28 Magic number */
} LOCALHEAPINFO;
typedef struct
{
DWORD dwSize; /* 00 */
DWORD dwMemReserved; /* 04 */
DWORD dwMemCommitted; /* 08 */
DWORD dwTotalFree; /* 0C */
DWORD dwLargestFreeBlock; /* 10 */
DWORD dwcFreeHandles; /* 14 */
} LOCAL32INFO;
typedef struct
{
DWORD dwSize; /* 00 */
WORD hHandle; /* 04 */
DWORD dwAddress; /* 06 */
DWORD dwSizeBlock; /* 0A */
WORD wFlags; /* 0E */
WORD wType; /* 10 */
WORD hHeap; /* 12 */
WORD wHeapType; /* 14 */
DWORD dwNext; /* 16 */
DWORD dwNextAlt; /* 1A */
} LOCAL32ENTRY;
#include "poppack.h"
#define LOCAL_HEAP_MAGIC 0x484c /* 'LH' */
......@@ -1686,68 +1709,6 @@ WORD WINAPI LocalHandleDelta16( WORD delta )
/***********************************************************************
* LocalInfo (TOOLHELP.56)
*/
BOOL16 WINAPI LocalInfo16( LOCALINFO *pLocalInfo, HGLOBAL16 handle )
{
LOCALHEAPINFO *pInfo = LOCAL_GetHeap(SELECTOROF(WOWGlobalLock16(handle)));
if (!pInfo) return FALSE;
pLocalInfo->wcItems = pInfo->items;
return TRUE;
}
/***********************************************************************
* LocalFirst (TOOLHELP.57)
*/
BOOL16 WINAPI LocalFirst16( LOCALENTRY *pLocalEntry, HGLOBAL16 handle )
{
WORD ds = GlobalHandleToSel16( handle );
char *ptr = MapSL( MAKESEGPTR( ds, 0 ) );
LOCALHEAPINFO *pInfo = LOCAL_GetHeap( ds );
if (!pInfo) return FALSE;
pLocalEntry->hHandle = pInfo->first + ARENA_HEADER_SIZE;
pLocalEntry->wAddress = pLocalEntry->hHandle;
pLocalEntry->wFlags = LF_FIXED;
pLocalEntry->wcLock = 0;
pLocalEntry->wType = LT_NORMAL;
pLocalEntry->hHeap = handle;
pLocalEntry->wHeapType = NORMAL_HEAP;
pLocalEntry->wNext = ARENA_PTR(ptr,pInfo->first)->next;
pLocalEntry->wSize = pLocalEntry->wNext - pLocalEntry->hHandle;
return TRUE;
}
/***********************************************************************
* LocalNext (TOOLHELP.58)
*/
BOOL16 WINAPI LocalNext16( LOCALENTRY *pLocalEntry )
{
WORD ds = GlobalHandleToSel16( pLocalEntry->hHeap );
char *ptr = MapSL( MAKESEGPTR( ds, 0 ) );
LOCALARENA *pArena;
if (!LOCAL_GetHeap( ds )) return FALSE;
if (!pLocalEntry->wNext) return FALSE;
pArena = ARENA_PTR( ptr, pLocalEntry->wNext );
pLocalEntry->hHandle = pLocalEntry->wNext + ARENA_HEADER_SIZE;
pLocalEntry->wAddress = pLocalEntry->hHandle;
pLocalEntry->wFlags = (pArena->prev & 3) + 1;
pLocalEntry->wcLock = 0;
pLocalEntry->wType = LT_NORMAL;
if (pArena->next != pLocalEntry->wNext) /* last one? */
pLocalEntry->wNext = pArena->next;
else
pLocalEntry->wNext = 0;
pLocalEntry->wSize = pLocalEntry->wNext - pLocalEntry->hHandle;
return TRUE;
}
/***********************************************************************
* 32-bit local heap functions (Win95; undocumented)
*/
......@@ -2189,7 +2150,6 @@ static LOCAL32HEADER *Local32_GetHeap( HGLOBAL16 handle )
/***********************************************************************
* Local32Info (KERNEL.444)
* Local32Info (TOOLHELP.84)
*/
BOOL16 WINAPI Local32Info16( LOCAL32INFO *pLocal32Info, HGLOBAL16 handle )
{
......@@ -2236,7 +2196,6 @@ BOOL16 WINAPI Local32Info16( LOCAL32INFO *pLocal32Info, HGLOBAL16 handle )
/***********************************************************************
* Local32First (KERNEL.445)
* Local32First (TOOLHELP.85)
*/
BOOL16 WINAPI Local32First16( LOCAL32ENTRY *pLocal32Entry, HGLOBAL16 handle )
{
......@@ -2246,7 +2205,6 @@ BOOL16 WINAPI Local32First16( LOCAL32ENTRY *pLocal32Entry, HGLOBAL16 handle )
/***********************************************************************
* Local32Next (KERNEL.446)
* Local32Next (TOOLHELP.86)
*/
BOOL16 WINAPI Local32Next16( LOCAL32ENTRY *pLocal32Entry )
{
......
......@@ -36,7 +36,6 @@
#include "wine/winbase16.h"
#include "wownt32.h"
#include "winternl.h"
#include "toolhelp.h"
#include "kernel_private.h"
#include "kernel16_private.h"
#include "wine/exception.h"
......@@ -1955,58 +1954,6 @@ FARPROC16 WINAPI WIN32_GetProcAddress16( HMODULE hModule, LPCSTR name )
return GetProcAddress16( LOWORD(hModule), name );
}
/**********************************************************************
* ModuleFirst (TOOLHELP.59)
*/
BOOL16 WINAPI ModuleFirst16( MODULEENTRY *lpme )
{
lpme->wNext = hFirstModule;
return ModuleNext16( lpme );
}
/**********************************************************************
* ModuleNext (TOOLHELP.60)
*/
BOOL16 WINAPI ModuleNext16( MODULEENTRY *lpme )
{
NE_MODULE *pModule;
char *name;
if (!lpme->wNext) return FALSE;
if (!(pModule = NE_GetPtr( lpme->wNext ))) return FALSE;
name = (char *)pModule + pModule->ne_restab;
memcpy( lpme->szModule, name + 1, min(*name, MAX_MODULE_NAME) );
lpme->szModule[min(*name, MAX_MODULE_NAME)] = '\0';
lpme->hModule = lpme->wNext;
lpme->wcUsage = pModule->count;
lstrcpynA( lpme->szExePath, NE_MODULE_NAME(pModule), sizeof(lpme->szExePath) );
lpme->wNext = pModule->next;
return TRUE;
}
/**********************************************************************
* ModuleFindName (TOOLHELP.61)
*/
BOOL16 WINAPI ModuleFindName16( MODULEENTRY *lpme, LPCSTR name )
{
lpme->wNext = GetModuleHandle16( name );
return ModuleNext16( lpme );
}
/**********************************************************************
* ModuleFindHandle (TOOLHELP.62)
*/
BOOL16 WINAPI ModuleFindHandle16( MODULEENTRY *lpme, HMODULE16 hModule )
{
hModule = GetExePtr( hModule );
lpme->wNext = hModule;
return ModuleNext16( lpme );
}
/***************************************************************************
* IsRomModule (KERNEL.323)
*/
......
......@@ -27,7 +27,6 @@
#include "wine/server.h"
#include "wine/debug.h"
#include "kernel_private.h"
#include "toolhelp.h"
WINE_DEFAULT_DEBUG_CHANNEL(selector);
......@@ -418,41 +417,6 @@ BOOL16 WINAPI IsBadFlatReadWritePtr16( SEGPTR ptr, DWORD size, BOOL16 bWrite )
}
/***********************************************************************
* MemoryRead (TOOLHELP.78)
*/
DWORD WINAPI MemoryRead16( WORD sel, DWORD offset, void *buffer, DWORD count )
{
LDT_ENTRY entry;
DWORD limit;
wine_ldt_get_entry( sel, &entry );
if (wine_ldt_is_empty( &entry )) return 0;
limit = wine_ldt_get_limit( &entry );
if (offset > limit) return 0;
if (offset + count > limit + 1) count = limit + 1 - offset;
memcpy( buffer, (char *)wine_ldt_get_base(&entry) + offset, count );
return count;
}
/***********************************************************************
* MemoryWrite (TOOLHELP.79)
*/
DWORD WINAPI MemoryWrite16( WORD sel, DWORD offset, void *buffer, DWORD count )
{
LDT_ENTRY entry;
DWORD limit;
wine_ldt_get_entry( sel, &entry );
if (wine_ldt_is_empty( &entry )) return 0;
limit = wine_ldt_get_limit( &entry );
if (offset > limit) return 0;
if (offset + count > limit) count = limit + 1 - offset;
memcpy( (char *)wine_ldt_get_base(&entry) + offset, buffer, count );
return count;
}
/************************************* Win95 pointer mapping functions *
*
*/
......
......@@ -38,14 +38,12 @@
#include "wine/winbase16.h"
#include "winternl.h"
#include "toolhelp.h"
#include "kernel_private.h"
#include "kernel16_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(task);
WINE_DECLARE_DEBUG_CHANNEL(toolhelp);
#include "pshpack1.h"
......@@ -1462,54 +1460,6 @@ HMODULE16 WINAPI GetExePtr( HANDLE16 handle )
}
/***********************************************************************
* TaskFirst (TOOLHELP.63)
*/
BOOL16 WINAPI TaskFirst16( TASKENTRY *lpte )
{
lpte->hNext = hFirstTask;
return TaskNext16( lpte );
}
/***********************************************************************
* TaskNext (TOOLHELP.64)
*/
BOOL16 WINAPI TaskNext16( TASKENTRY *lpte )
{
TDB *pTask;
INSTANCEDATA *pInstData;
TRACE_(toolhelp)("(%p): task=%04x\n", lpte, lpte->hNext );
if (!lpte->hNext) return FALSE;
/* make sure that task and hInstance are valid (skip initial Wine task !) */
while (1) {
pTask = TASK_GetPtr( lpte->hNext );
if (!pTask || pTask->magic != TDB_MAGIC) return FALSE;
if (pTask->hInstance)
break;
lpte->hNext = pTask->hNext;
}
pInstData = MapSL( MAKESEGPTR( GlobalHandleToSel16(pTask->hInstance), 0 ) );
lpte->hTask = lpte->hNext;
lpte->hTaskParent = pTask->hParent;
lpte->hInst = pTask->hInstance;
lpte->hModule = pTask->hModule;
lpte->wSS = SELECTOROF( pTask->teb->WOW32Reserved );
lpte->wSP = OFFSETOF( pTask->teb->WOW32Reserved );
lpte->wStackTop = pInstData->stacktop;
lpte->wStackMinimum = pInstData->stackmin;
lpte->wStackBottom = pInstData->stackbottom;
lpte->wcEvents = pTask->nEvents;
lpte->hQueue = pTask->hQueue;
lstrcpynA( lpte->szModule, pTask->module_name, sizeof(lpte->szModule) );
lpte->wPSPOffset = 0x100; /*??*/
lpte->hNext = pTask->hNext;
return TRUE;
}
typedef INT (WINAPI *MessageBoxA_funcptr)(HWND hWnd, LPCSTR text, LPCSTR title, UINT type);
/**************************************************************************
......@@ -1539,39 +1489,6 @@ void WINAPI FatalAppExit16( UINT16 action, LPCSTR str )
/***********************************************************************
* TerminateApp (TOOLHELP.77)
*
* See "Undocumented Windows".
*/
void WINAPI TerminateApp16(HTASK16 hTask, WORD wFlags)
{
if (hTask && hTask != GetCurrentTask())
{
FIXME("cannot terminate task %x\n", hTask);
return;
}
if (wFlags & NO_UAE_BOX)
{
UINT16 old_mode;
old_mode = SetErrorMode16(0);
SetErrorMode16(old_mode|SEM_NOGPFAULTERRORBOX);
}
FatalAppExit16( 0, NULL );
/* hmm, we're still alive ?? */
/* check undocumented flag */
if (!(wFlags & 0x8000))
TASK_CallTaskSignalProc( USIG16_TERMINATION, hTask );
/* UndocWin says to call int 0x21/0x4c exit=0xff here,
but let's just call ExitThread */
ExitThread(0xff);
}
/***********************************************************************
* GetAppCompatFlags (KERNEL.354)
*/
DWORD WINAPI GetAppCompatFlags16( HTASK16 hTask )
......
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <ctype.h>
#include <assert.h>
#include "windef.h"
#include "winbase.h"
#include "winternl.h"
#include "wine/winbase16.h"
#include "toolhelp.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;
/***********************************************************************
* TaskFindHandle (TOOLHELP.65)
*/
BOOL16 WINAPI TaskFindHandle16( TASKENTRY *lpte, HTASK16 hTask )
{
lpte->hNext = hTask;
return TaskNext16( lpte );
}
/***********************************************************************
* MemManInfo (TOOLHELP.72)
*/
BOOL16 WINAPI MemManInfo16( MEMMANINFO *info )
{
MEMORYSTATUS status;
/*
* Not unsurprisingly although the documentation says you
* _must_ provide the size in the dwSize field, this function
* (under Windows) always fills the structure and returns true.
*/
GlobalMemoryStatus( &status );
info->wPageSize = getpagesize();
info->dwLargestFreeBlock = status.dwAvailVirtual;
info->dwMaxPagesAvailable = info->dwLargestFreeBlock / info->wPageSize;
info->dwMaxPagesLockable = info->dwMaxPagesAvailable;
info->dwTotalLinearSpace = status.dwTotalVirtual / info->wPageSize;
info->dwTotalUnlockedPages = info->dwTotalLinearSpace;
info->dwFreePages = info->dwMaxPagesAvailable;
info->dwTotalPages = info->dwTotalLinearSpace;
info->dwFreeLinearSpace = info->dwMaxPagesAvailable;
info->dwSwapFilePages = status.dwTotalPageFile / info->wPageSize;
return TRUE;
}
/***********************************************************************
* NotifyRegister (TOOLHELP.73)
*/
BOOL16 WINAPI NotifyRegister16( HTASK16 htask, FARPROC16 lpfnCallback,
WORD wFlags )
{
int i;
FIXME("(%x,%x,%x), semi-stub.\n",
htask, (DWORD)lpfnCallback, wFlags );
if (!htask) htask = GetCurrentTask();
for (i=0;i<nrofnotifys;i++)
if (notifys[i].htask==htask)
break;
if (i==nrofnotifys) {
if (notifys==NULL)
notifys=HeapAlloc( GetProcessHeap(), 0,
sizeof(struct notify) );
else
notifys=HeapReAlloc( GetProcessHeap(), 0, notifys,
sizeof(struct notify)*(nrofnotifys+1));
if (!notifys) return FALSE;
nrofnotifys++;
}
notifys[i].htask=htask;
notifys[i].lpfnCallback=lpfnCallback;
notifys[i].wFlags=wFlags;
return TRUE;
}
/***********************************************************************
* NotifyUnregister (TOOLHELP.74)
*/
BOOL16 WINAPI NotifyUnregister16( HTASK16 htask )
{
int i;
FIXME("(%x), semi-stub.\n", htask );
if (!htask) htask = GetCurrentTask();
for (i=nrofnotifys;i--;)
if (notifys[i].htask==htask)
break;
if (i==-1)
return FALSE;
memcpy(notifys+i,notifys+(i+1),sizeof(struct notify)*(nrofnotifys-i-1));
notifys=HeapReAlloc( GetProcessHeap(), 0, notifys,
(nrofnotifys-1)*sizeof(struct notify));
nrofnotifys--;
return TRUE;
}
/***********************************************************************
* StackTraceCSIPFirst (TOOLHELP.67)
*/
BOOL16 WINAPI StackTraceCSIPFirst16(STACKTRACEENTRY *ste, WORD wSS, WORD wCS, WORD wIP, WORD wBP)
{
FIXME("(%p, ss %04x, cs %04x, ip %04x, bp %04x): stub.\n", ste, wSS, wCS, wIP, wBP);
return TRUE;
}
/***********************************************************************
* StackTraceFirst (TOOLHELP.66)
*/
BOOL16 WINAPI StackTraceFirst16(STACKTRACEENTRY *ste, HTASK16 Task)
{
FIXME("(%p, %04x), stub.\n", ste, Task);
return TRUE;
}
/***********************************************************************
* StackTraceNext (TOOLHELP.68)
*/
BOOL16 WINAPI StackTraceNext16(STACKTRACEENTRY *ste)
{
FIXME("(%p), stub.\n", ste);
return TRUE;
}
/***********************************************************************
* InterruptRegister (TOOLHELP.75)
*/
BOOL16 WINAPI InterruptRegister16( HTASK16 task, FARPROC callback )
{
FIXME("(%04x, %p), stub.\n", task, callback);
return TRUE;
}
/***********************************************************************
* InterruptUnRegister (TOOLHELP.76)
*/
BOOL16 WINAPI InterruptUnRegister16( HTASK16 task )
{
FIXME("(%04x), stub.\n", task);
return TRUE;
}
/***********************************************************************
* TimerCount (TOOLHELP.80)
*/
BOOL16 WINAPI TimerCount16( TIMERINFO *pTimerInfo )
{
/* FIXME
* In standard mode, dwmsSinceStart = dwmsThisVM
*
* I tested this, under Windows in enhanced mode, and
* if you never switch VM (ie start/stop DOS) these
* values should be the same as well.
*
* Also, Wine should adjust for the hardware timer
* to reduce the amount of error to ~1ms.
* I can't be bothered, can you?
*/
pTimerInfo->dwmsSinceStart = 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;
}
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = toolhelp.dll16
IMPORTS = kernel32
EXTRADLLFLAGS = -Wb,--subsystem,win16
C_SRCS = toolhelp.c
@MAKE_DLL_RULES@
@DEPENDENCIES@ # everything below this line is overwritten by make depend
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment