1 /*
   2  * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef _TOOLHELP_H_
  26 #define _TOOLHELP_H_
  27 
  28 #include <windows.h>
  29 #include <tlhelp32.h>
  30 
  31 namespace ToolHelp {
  32 extern "C" {
  33 
  34   ///////////////
  35   // Snapshots //
  36   ///////////////
  37   typedef HANDLE WINAPI
  38   CreateToolhelp32SnapshotFunc(DWORD dwFlags, DWORD th32ProcessID);
  39 
  40   //////////////////
  41   // Process List //
  42   //////////////////
  43   typedef BOOL WINAPI Process32FirstFunc(HANDLE hSnapshot,
  44                                          LPPROCESSENTRY32 lppe);
  45 
  46   typedef BOOL WINAPI Process32NextFunc(HANDLE hSnapshot,
  47                                         LPPROCESSENTRY32 lppe);
  48 
  49   // NOTE: although these routines are defined in TLHELP32.H, they
  50   // seem to always return false (maybe only under US locales)
  51   typedef BOOL WINAPI Process32FirstWFunc(HANDLE hSnapshot,
  52                                           LPPROCESSENTRY32W lppe);
  53 
  54   typedef BOOL WINAPI Process32NextWFunc(HANDLE hSnapshot,
  55                                          LPPROCESSENTRY32W lppe);
  56 
  57   /////////////////
  58   // Module List //
  59   /////////////////
  60   typedef BOOL WINAPI
  61   Module32FirstFunc(HANDLE hSnapshot, LPMODULEENTRY32 lpme);
  62 
  63   typedef BOOL WINAPI
  64   Module32NextFunc (HANDLE hSnapshot, LPMODULEENTRY32 lpme);
  65 
  66 
  67   // Routines to load and unload KERNEL32.DLL.
  68   HMODULE loadDLL();
  69   // Safe to call even if has not been loaded
  70   void    unloadDLL();
  71 
  72 } // extern "C"
  73 } // namespace "ToolHelp"
  74 
  75 #endif // #defined _TOOLHELP_H_