pnig0s1992:
Lists current system information, current system memory status.
Enumerate processes that list the page types, page properties, and protection properties of all memory blocks in each process
Code by pnig0s1992//date:2012,3,15 #include <stdio.h> #include <Windows.h> #include <TlHelp32.h>
VOID getmemoryinfo (system_info si,handle hprocess);
int main (void) {System_info si;
Memorystatus MS;
Ms.dwlength = sizeof (MS);
GetSystemInfo (&SI);
printf ("\ n current memory page size%UKB", si.dwpagesize/1024);
printf ("\ n is less than 0x%x for system retention.", si.lpminimumapplicationaddress);
printf ("\ n is greater than 0x%x is the system kernel area.", si.lpmaximumapplicationaddress);
printf ("\ncpu Quantity:%u", si.dwnumberofprocessors);
GlobalMemoryStatus (&MS);
printf ("\ n current system memory usage:%u%%:", ms.dwmemoryload);
printf ("\ n current system Total Physical memory:%uM", ms.dwtotalphys/1024/1024);
printf ("\ n current system available physical memory:%uM", ms.dwavailphys/1024/1024);
printf ("\ n current system total virtual memory:%uM", ms.dwtotalvirtual/1024/1024);
printf ("\ n current system available virtual memory:%uM", ms.dwavailvirtual/1024/1024);
printf ("\ n current system total page file:%uM", ms.dwtotalpagefile/1024/1024);
printf ("\ n current system available page files:%uM", ms.dwavailpagefile/1024/1024); PROCESSENTRY32 Pe32;
pe32.dwsize = sizeof (PE32);
HANDLE Hprocesssnap;
Hprocesssnap = CreateToolhelp32Snapshot (th32cs_snapprocess,0);
if (Hprocesssnap = = Invalid_handle_value) {printf ("Get process snapshot Failed");
return-1;
}else {Process32First (HPROCESSSNAP,&PE32);
do {printf (\ n Current process name:%s pid:%u, PE32.SZEXEFILE,PE32.TH32PROCESSID); if (Pe32.th32processid!= getcurrentprocessid ()) {HANDLE hprocess = openprocess (process_quer y_information|
PROCESS_VM_READ,FALSE,PE32.TH32PROCESSID);
Getmemoryinfo (si,hprocess);
} while (Process32Next (HPROCESSSNAP,&PE32));
System ("pause");
return 0;
} VOID getmemoryinfo (system_info si,handle hprocess) {printf ("\ n memory Address Protection property page type"); DWORD Dwcurpos = (DWORD) si.lpminimumapplicationaddress;//First query location is an accessible minimum memory address while (Dwcurpos < (DWORD) si.lpmaximumapplicationaddress)//End condition isMax memory address {memory_basic_information MBI;
DWORD DWRC = VirtualQueryEx (hprocess, (LPVOID) dwcurpos,&mbi,sizeof (MBI)); printf ("\n0x%x%u%u", MBI.) Baseaddress,mbi. Allocationprotect,mbi.
Type); Dwcurpos = (DWORD) mbi. Baseaddress+mbi. regionsize;//current block base address plus block size}}
This article is from the "About:blank h4cking" blog, please be sure to keep this source http://pnig0s1992.blog.51cto.com/393390/807029