Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
4.8 KiB

  1. //============================================================
  2. //
  3. // WBEMPSAPI.h - PSAPI.DLL access class definition
  4. //
  5. // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
  6. //
  7. // 01/21/97 a-jmoon created
  8. //
  9. //============================================================
  10. #ifndef __WBEMPSAPI__
  11. #define __WBEMPSAPI__
  12. #ifdef NTONLY
  13. #include <psapi.h>
  14. /**********************************************************************************************************
  15. * #includes to Register this class with the CResourceManager.
  16. **********************************************************************************************************/
  17. #include "ResourceManager.h"
  18. #include "TimedDllResource.h"
  19. extern const GUID guidPSAPI ;
  20. typedef BOOL (WINAPI *PSAPI_ENUM_PROCESSES) (DWORD *pdwPIDList, // Pointer to DWORD array
  21. DWORD dwListSize, // Size of array
  22. DWORD *pdwByteCount) ; // Bytes needed/returned
  23. typedef BOOL (WINAPI *PSAPI_ENUM_DRIVERS) (LPVOID pImageBaseList, // Pointer to void * array
  24. DWORD dwListSize, // Size of array
  25. DWORD *pdwByteCount) ; // Bytes needed/returned
  26. typedef BOOL (WINAPI *PSAPI_ENUM_MODULES) (HANDLE hProcess, // Process to query
  27. HMODULE *pModuleList, // Array of HMODULEs
  28. DWORD dwListSize, // Size of array
  29. DWORD *pdwByteCount) ; // Bytes needed/returned
  30. typedef DWORD (WINAPI *PSAPI_GET_DRIVER_NAME)(LPVOID pImageBase, // Address of driver to query
  31. LPTSTR pszName, // Pointer to name buffer
  32. DWORD dwNameSize) ; // Size of buffer
  33. typedef DWORD (WINAPI *PSAPI_GET_MODULE_NAME)(HANDLE hProcess, // Process to query
  34. HMODULE hModule, // Module to query
  35. LPTSTR pszName, // Pointer to name buffer
  36. DWORD dwNameSize) ; // Size of buffer
  37. typedef DWORD (WINAPI *PSAPI_GET_DRIVER_EXE) (LPVOID pImageBase, // Address of driver to query
  38. LPTSTR pszName, // Pointer to name buffer
  39. DWORD dwNameSize) ; // Size of buffer
  40. typedef DWORD (WINAPI *PSAPI_GET_MODULE_EXE) (HANDLE hProcess, // Process to query
  41. HMODULE hModule, // Module to query
  42. LPTSTR pszName, // Pointer to name buffer
  43. DWORD dwNameSize) ; // Size of buffer
  44. typedef BOOL (WINAPI *PSAPI_GET_MEMORY_INFO)(HANDLE hProcess, // Process to query
  45. PROCESS_MEMORY_COUNTERS *pMemCtrs, // Memory counter struct
  46. DWORD dwByteCount) ; // Size of buffer
  47. class CPSAPI : public CTimedDllResource
  48. {
  49. public :
  50. CPSAPI() ;
  51. ~CPSAPI() ;
  52. LONG Init() ;
  53. BOOL EnumProcesses(DWORD *pdwPIDList, DWORD dwListSize, DWORD *pdwByteCount) ;
  54. BOOL EnumDeviceDrivers(LPVOID pImageBaseList, DWORD dwListSize, DWORD *pdwByteCount) ;
  55. BOOL EnumProcessModules(HANDLE hProcess, HMODULE *ModuleList, DWORD dwListSize, DWORD *pdwByteCount) ;
  56. DWORD GetDeviceDriverBaseName(LPVOID pImageBase, LPTSTR pszName, DWORD dwNameSize) ;
  57. DWORD GetModuleBaseName(HANDLE hProcess, HMODULE hModule, LPTSTR pszName, DWORD dwNameSize) ;
  58. DWORD GetDeviceDriverFileName(LPVOID pImageBase, LPTSTR pszName, DWORD dwNameSize) ;
  59. DWORD GetModuleFileNameEx(HANDLE hProcess, HMODULE hModule, LPTSTR pszName, DWORD dwNameSize) ;
  60. BOOL GetProcessMemoryInfo(HANDLE hProcess, PROCESS_MEMORY_COUNTERS *pMemCtrs, DWORD dwByteCount) ;
  61. private :
  62. HINSTANCE hLibHandle ;
  63. PSAPI_ENUM_PROCESSES pEnumProcesses ;
  64. PSAPI_ENUM_DRIVERS pEnumDeviceDrivers ;
  65. PSAPI_ENUM_MODULES pEnumProcessModules ;
  66. PSAPI_GET_DRIVER_NAME pGetDeviceDriverBaseName ;
  67. PSAPI_GET_MODULE_NAME pGetModuleBaseName ;
  68. PSAPI_GET_DRIVER_EXE pGetDeviceDriverFileName ;
  69. PSAPI_GET_MODULE_EXE pGetModuleFileNameEx ;
  70. PSAPI_GET_MEMORY_INFO pGetProcessMemoryInfo ;
  71. } ;
  72. #endif
  73. #endif // File inclusion