172 lines
3.2 KiB
C++
172 lines
3.2 KiB
C++
#ifndef _PSAPINT_PROCESSENTRY_HPP_
|
|
#define _PSAPINT_PROCESSENTRY_HPP_
|
|
#ifndef _COMMON_WINDOWS_HPP_
|
|
#include <common/windows.hpp>
|
|
#endif
|
|
#ifndef _COMMON_TOOLHELP32_HPP_
|
|
#include <common/tlhelp32.hpp>
|
|
#endif
|
|
|
|
class ProcessEntry : private PROCESSENTRY32
|
|
{
|
|
public:
|
|
ProcessEntry(void);
|
|
virtual ~ProcessEntry();
|
|
DWORD cntUsage(void)const;
|
|
void cntUsage(DWORD cntUsage);
|
|
DWORD processID(void)const;
|
|
void processID(DWORD processID);
|
|
DWORD heapID(void)const;
|
|
void heapID(DWORD heapID);
|
|
DWORD moduleID(void)const;
|
|
void moduleID(DWORD moduleID);
|
|
DWORD cntThreads(void)const;
|
|
void cntThreads(DWORD cntThreads);
|
|
DWORD parentProcessID(void)const;
|
|
void parentProcessID(DWORD parentProcessID);
|
|
LONG priClassBase(void)const;
|
|
void priClassBase(LONG priClassBase);
|
|
DWORD flags(void)const;
|
|
void flags(DWORD flags);
|
|
String strExeFile(void)const;
|
|
void strExeFile(const String &strExeFile);
|
|
PROCESSENTRY32 &getPROCESSENTRY(void);
|
|
private:
|
|
void zeroInit(void);
|
|
};
|
|
|
|
inline
|
|
ProcessEntry::ProcessEntry(void)
|
|
{
|
|
zeroInit();
|
|
}
|
|
|
|
inline
|
|
ProcessEntry::~ProcessEntry()
|
|
{
|
|
}
|
|
|
|
inline
|
|
DWORD ProcessEntry::cntUsage(void)const
|
|
{
|
|
return PROCESSENTRY32::cntUsage;
|
|
}
|
|
|
|
inline
|
|
void ProcessEntry::cntUsage(DWORD cntUsage)
|
|
{
|
|
PROCESSENTRY32::cntUsage=cntUsage;
|
|
}
|
|
|
|
inline
|
|
DWORD ProcessEntry::processID(void)const
|
|
{
|
|
return PROCESSENTRY32::th32ProcessID;
|
|
}
|
|
|
|
inline
|
|
void ProcessEntry::processID(DWORD processID)
|
|
{
|
|
PROCESSENTRY32::th32ProcessID=processID;
|
|
}
|
|
|
|
inline
|
|
DWORD ProcessEntry::heapID(void)const
|
|
{
|
|
return PROCESSENTRY32::th32DefaultHeapID;
|
|
}
|
|
|
|
inline
|
|
void ProcessEntry::heapID(DWORD heapID)
|
|
{
|
|
PROCESSENTRY32::th32DefaultHeapID=heapID;
|
|
}
|
|
|
|
inline
|
|
DWORD ProcessEntry::moduleID(void)const
|
|
{
|
|
return PROCESSENTRY32::th32ModuleID;
|
|
}
|
|
|
|
inline
|
|
void ProcessEntry::moduleID(DWORD moduleID)
|
|
{
|
|
PROCESSENTRY32::th32ModuleID=moduleID;
|
|
}
|
|
|
|
inline
|
|
DWORD ProcessEntry::cntThreads(void)const
|
|
{
|
|
return PROCESSENTRY32::cntThreads;
|
|
}
|
|
|
|
inline
|
|
void ProcessEntry::cntThreads(DWORD cntThreads)
|
|
{
|
|
PROCESSENTRY32::cntThreads=cntThreads;
|
|
}
|
|
|
|
inline
|
|
DWORD ProcessEntry::parentProcessID(void)const
|
|
{
|
|
return PROCESSENTRY32::th32ParentProcessID;
|
|
}
|
|
|
|
inline
|
|
void ProcessEntry::parentProcessID(DWORD parentProcessID)
|
|
{
|
|
PROCESSENTRY32::th32ParentProcessID=parentProcessID;
|
|
}
|
|
|
|
inline
|
|
LONG ProcessEntry::priClassBase(void)const
|
|
{
|
|
return PROCESSENTRY32::pcPriClassBase;
|
|
}
|
|
|
|
inline
|
|
void ProcessEntry::priClassBase(LONG priClassBase)
|
|
{
|
|
PROCESSENTRY32::pcPriClassBase=priClassBase;
|
|
}
|
|
|
|
inline
|
|
DWORD ProcessEntry::flags(void)const
|
|
{
|
|
return PROCESSENTRY32::dwFlags;
|
|
}
|
|
|
|
inline
|
|
void ProcessEntry::flags(DWORD flags)
|
|
{
|
|
PROCESSENTRY32::dwFlags=flags;
|
|
}
|
|
|
|
inline
|
|
String ProcessEntry::strExeFile(void)const
|
|
{
|
|
return PROCESSENTRY32::szExeFile;
|
|
}
|
|
|
|
inline
|
|
void ProcessEntry::strExeFile(const String &strExeFile)
|
|
{
|
|
int strLen(strExeFile.length());
|
|
if(strLen<MAX_PATH)::strcpy(PROCESSENTRY32::szExeFile,(LPSTR)(String&)strExeFile);
|
|
else {::strncpy(PROCESSENTRY32::szExeFile,(LPSTR)(String&)strExeFile,MAX_PATH-1);PROCESSENTRY32::szExeFile[MAX_PATH-1]=0;}
|
|
}
|
|
|
|
inline
|
|
PROCESSENTRY32 &ProcessEntry::getPROCESSENTRY(void)
|
|
{
|
|
return *this;
|
|
}
|
|
|
|
inline
|
|
void ProcessEntry::zeroInit(void)
|
|
{
|
|
::memset(&getPROCESSENTRY(),0,sizeof(PROCESSENTRY32));
|
|
PROCESSENTRY32::dwSize=sizeof(PROCESSENTRY32);
|
|
}
|
|
#endif
|