Source code of Windows XP (NT5)
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.

86 lines
2.5 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 2000
  6. //
  7. // File: processes.h
  8. //
  9. //--------------------------------------------------------------------------
  10. // Processes.h: interface for the CProcesses class.
  11. //
  12. //////////////////////////////////////////////////////////////////////
  13. #if !defined(AFX_PROCESSES_H__3CE003F7_9F5D_11D2_83A4_000000000000__INCLUDED_)
  14. #define AFX_PROCESSES_H__3CE003F7_9F5D_11D2_83A4_000000000000__INCLUDED_
  15. #if _MSC_VER > 1000
  16. #pragma once
  17. #endif // _MSC_VER > 1000
  18. #ifndef NO_STRICT
  19. #ifndef STRICT
  20. #define STRICT 1
  21. #endif
  22. #endif /* NO_STRICT */
  23. #include <WINDOWS.H>
  24. #include <TCHAR.H>
  25. #include "globals.h"
  26. //#include "ProgramOptions.h"
  27. // Forward Declarations
  28. //class CProgramOptions;
  29. class CProcessInfo;
  30. class CProcessInfoNode;
  31. class CFileData;
  32. class CModuleInfoCache;
  33. class CProcesses
  34. {
  35. public:
  36. CProcesses();
  37. virtual ~CProcesses();
  38. bool Initialize(CModuleInfoCache * lpModuleInfoCache, CFileData * lpInputFile, CFileData * lpOutputFile);
  39. // bool OutputProcessesData(LPCTSTR tszOutputContext, bool fDumpHeader = true);
  40. bool OutputProcessesData(CollectionTypes enumCollectionType, bool fCSVFileContext, bool fDumpHeader = true);
  41. bool GetProcessesData();
  42. // Public functions for exporting functions in dynamically loaded DLLs...
  43. enum ProcessCollectionMethod { NO_METHOD, TOOLHELP32_METHOD, PSAPI_METHOD };
  44. ProcessCollectionMethod GetProcessCollectionMethod();
  45. inline long GetNumberOfProcesses() {
  46. return m_iNumberOfProcesses;
  47. };
  48. protected:
  49. bool GetProcessesDataFromFile();
  50. bool GetProcessesDataForRunningProcessesUsingTOOLHELP32();
  51. bool GetProcessesDataForRunningProcessesUsingPSAPI();
  52. bool OutputProcessesDataToStdout(CollectionTypes enumCollectionType, bool fCSVFileContext, bool fDumpHeader = true);
  53. bool OutputProcessesDataToFile(CollectionTypes enumCollectionType, bool fDumpHeader = true);
  54. CFileData * m_lpOutputFile;
  55. CFileData * m_lpInputFile;
  56. CModuleInfoCache * m_lpModuleInfoCache;
  57. // CProgramOptions * m_lpProgramOptions;
  58. CProcessInfoNode * m_lpProcessInfoHead;
  59. HANDLE m_ProcessInfoHeadMutex;
  60. long m_iNumberOfProcesses;
  61. bool m_fInitialized; // We need to ensure initialization since a mutex is involved...
  62. // Protected Methods
  63. bool AddNewProcessInfoObject(CProcessInfo * lpProcessInfo);
  64. bool SetPrivilege(HANDLE hToken, LPCTSTR Privilege, bool bEnablePrivilege);
  65. ProcessCollectionMethod m_enumProcessCollectionMethod;
  66. };
  67. #endif // !defined(AFX_PROCESSES_H__3CE003F7_9F5D_11D2_83A4_000000000000__INCLUDED_)