|
#ifndef _PROCESSQUERY_H
#define _PROCESSQUERY_H
#pragma once
// definitions
#define PROCESS_OPEN_FLAGS PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE|PROCESS_QUERY_INFORMATION|PROCESS_TERMINATE
//////////////////////////////////////////////////////////////////////////////////
// Class CProcessQuery
// is a class that enumerates processes, gets IDs and reads\writes
// process memory. It can be argued that the functions here should have
// been all static, since the object is never changed.
//
// Author: Asa Meltzer
// Date: 07/2007
class CProcessQuery
{
public:
// Construction
CProcessQuery();
virtual ~CProcessQuery();
// Operations
int GetProcessId(const char* const szName) const;
HANDLE CreateNewProcess(const CString& szFullPath, BOOL bShowWindow = TRUE);
HANDLE GetProcessHandle(const char* const szName) const;
HANDLE GetProcessHandle(int pid) const;
// return the address where the value is
long FindValueInProcessMem(HANDLE hProcess, long lAddrStart, long lAddrEnd, long lVal) const;
long ReadProcessAddress(HANDLE hProcess, long lAddr) const;
void WriteProcessAddress(HANDLE hProcess, long lAddr, long lVal) const;
void CloseProcess(HANDLE hProcess) const;
void KillProcess(HANDLE hProcess) const;
CString GetExecutablePath() const;
// variables
const static int NAME_LEN = 512;
private:
int FindProcessId(const char* szName) const;
BOOL IsProcessId(DWORD pid, const char* szName) const;
};
#endif
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Software designer and programmer.
Programming languages:
MFC, C++, Java , C#, VB and sometimes C and assembly.