Exemplo n.º 1
0
float SystemLinux::GetPercentageOfUsedPhysicalMemory() const
{
	MemoryInformation sMemoryInformation;
	if (GetMemoryInformation(sMemoryInformation))
		return (static_cast<float>(sMemoryInformation.nTotalPhysicalMemory-sMemoryInformation.nFreePhysicalMemory)/sMemoryInformation.nTotalPhysicalMemory)*100.0f;
	else
		return 0.0f;
}
Exemplo n.º 2
0
Arquivo: main.cpp Projeto: w4kfu/whook
void test(void)
{
    std::list<PROCESSENTRY32>  lProcess;
    std::list<MODULEENTRY32> lModules;
    DWORD   dwPid = 0;
    std::list<MEMORY_BASIC_INFORMATION> lMemBI;
    std::list<THREADENTRY32> lThreads;
    std::list<LPCVOID> lAddress;
    DWORD dwBaseAddress = 0;
    IMAGE_DOS_HEADER DosHeader;
    IMAGE_NT_HEADERS NTHeader;

    lProcess = GetProcessList();

    PrintProcessList(lProcess);

    dwPid = GetPidProcess("notepad++.exe");
    PrintPidProcess("notepad++.exe", dwPid);

    lModules = GetModuleList(dwPid);
    PrintModulesList(lModules);

    lMemBI = GetMemoryInformation(dwPid);
    PrintMemoryInfo(lMemBI);

    lThreads = GetThreadsList(dwPid);
    PrintThreadsInfo(lThreads);

    SuspendAllThread(dwPid);
    Sleep(1000);
    ResumeAllThread(dwPid);

    lAddress = ScanPattern("\x42\x42\x42", 3, dwPid);
    PrintPatternMatch(lAddress);

    dwBaseAddress = GetRemoteBaseAddress(dwPid);
    printf("BaseAddress = %08X\n", dwBaseAddress);

    DosHeader = GetDosHeader(dwPid);
    PrintDosHeader(&DosHeader);

    NTHeader = GetNTHeader(dwPid);
    PrintNTHeader(&NTHeader);
}
Exemplo n.º 3
0
uint64 SystemLinux::GetFreeVirtualMemory() const
{
	MemoryInformation sMemoryInformation;
	return GetMemoryInformation(sMemoryInformation) ? sMemoryInformation.nFreeSwapMemory : 0;
}
Exemplo n.º 4
0
uint64 SystemLinux::GetTotalVirtualMemory() const
{
	MemoryInformation sMemoryInformation;
	return GetMemoryInformation(sMemoryInformation) ? sMemoryInformation.nTotalSwapMemory : 0;
}
Exemplo n.º 5
0
uint64 SystemLinux::GetFreePhysicalMemory() const
{
	MemoryInformation sMemoryInformation;
	return GetMemoryInformation(sMemoryInformation) ? sMemoryInformation.nFreePhysicalMemory : 0;
}