/* * Misc Toolhelp functions * * Copyright 1996 Marcus Meissner */ #include #include #include #include #include #include "winbase.h" #include "wine/winbase16.h" #include "winerror.h" #include "process.h" #include "tlhelp32.h" #include "toolhelp.h" #include "heap.h" #include "server.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(toolhelp) /* FIXME: to make this working, we have to callback 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; /*********************************************************************** * NotifyRegister16 */ BOOL16 WINAPI NotifyRegister16( HTASK16 htask, FARPROC16 lpfnCallback, WORD wFlags ) { int i; TRACE("(%x,%lx,%x) called.\n", htask, (DWORD)lpfnCallback, wFlags ); if (!htask) htask = GetCurrentTask(); for (i=0;iflags = flags & ~TH32CS_INHERIT; req->inherit = (flags & TH32CS_INHERIT) != 0; server_call( REQ_CREATE_SNAPSHOT ); return req->handle; } /*********************************************************************** * Thread32First (KERNEL32.686) * * Return info about the first thread in a toolhelp32 snapshot */ BOOL WINAPI Thread32First(HANDLE hSnapshot, LPTHREADENTRY lpte) { if (!lpte) return FALSE; FIXME("(%d,%p),stub!\n",hSnapshot,lpte); return FALSE; } /*********************************************************************** * Thread32Next (KERNEL32.687) * * Return info about the "next" thread in a toolhelp32 snapshot */ BOOL WINAPI Thread32Next(HANDLE hSnapshot, LPTHREADENTRY lpte) { if (!lpte) return FALSE; FIXME("(%d,%p),stub!\n",hSnapshot,lpte); return FALSE; } /*********************************************************************** * TOOLHELP_Process32Next * * Implementation of Process32First/Next */ static BOOL TOOLHELP_Process32Next( HANDLE handle, LPPROCESSENTRY lppe, BOOL first ) { struct next_process_request *req = get_req_buffer(); if (lppe->dwSize < sizeof (PROCESSENTRY)) { SetLastError( ERROR_INSUFFICIENT_BUFFER ); ERR("Result buffer too small\n"); return FALSE; } req->handle = handle; req->reset = first; if (server_call( REQ_NEXT_PROCESS )) return FALSE; lppe->cntUsage = 1; lppe->th32ProcessID = (DWORD)req->pid; lppe->th32DefaultHeapID = 0; /* FIXME */ lppe->th32ModuleID = 0; /* FIXME */ lppe->cntThreads = req->threads; lppe->th32ParentProcessID = 0; /* FIXME */ lppe->pcPriClassBase = req->priority; lppe->dwFlags = -1; /* FIXME */ lppe->szExeFile[0] = 0; /* FIXME */ return TRUE; } /*********************************************************************** * Process32First (KERNEL32.555) * * Return info about the first process in a toolhelp32 snapshot */ BOOL WINAPI Process32First(HANDLE hSnapshot, LPPROCESSENTRY lppe) { return TOOLHELP_Process32Next( hSnapshot, lppe, TRUE ); } /*********************************************************************** * Process32Next (KERNEL32.556) * * Return info about the "next" process in a toolhelp32 snapshot */ BOOL WINAPI Process32Next(HANDLE hSnapshot, LPPROCESSENTRY lppe) { return TOOLHELP_Process32Next( hSnapshot, lppe, FALSE ); } /*********************************************************************** * Module32First (KERNEL32.527) * * Return info about the "first" module in a toolhelp32 snapshot */ BOOL WINAPI Module32First(HANDLE hSnapshot, LPMODULEENTRY lpme) { FIXME("(%d,%p),stub!\n",hSnapshot,lpme); return FALSE; } /*********************************************************************** * Module32Next (KERNEL32.528) * * Return info about the "next" module in a toolhelp32 snapshot */ BOOL WINAPI Module32Next(HANDLE hSnapshot, LPMODULEENTRY lpme) { FIXME("(%d,%p),stub!\n",hSnapshot,lpme); return FALSE; } /************************************************************************ * GlobalMasterHandle16 (KERNEL.28) * * * Should return selector and handle of the information structure for * the global heap. selector and handle are stored in the THHOOK as * pGlobalHeap and hGlobalHeap. * As Wine doesn't have this structure, we return both values as zero * Applications should interpret this as "No Global Heap" */ DWORD WINAPI GlobalMasterHandle16(void) { FIXME(": stub\n"); return 0; }