Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. int main()
  2. {
  3. SYSTEM_INFO si;
  4. GetSystemInfo(&si);
  5.  
  6. char *pMin = (char*)si.lpMinimumApplicationAddress;
  7. char *pMax = (char*)si.lpMaximumApplicationAddress;
  8. for (char* pAddress = pMin; pAddress<pMax; /*Empty*/)
  9. {
  10. MEMORY_BASIC_INFORMATION mbi;
  11. DWORD res = VirtualQuery(pAddress, &mbi, sizeof(mbi));
  12. if (res != sizeof(mbi))
  13. {
  14. cerr << "VirtualQuery failed!" << endl;
  15. return -1;
  16. }
  17.  
  18. if (mbi.State == MEM_COMMIT)
  19. {
  20. DWORD base = (DWORD)mbi.BaseAddress;
  21. cout << hex << showbase << base << " - " << base + mbi.RegionSize-1 << endl;
  22. }
  23.  
  24. pAddress += mbi.RegionSize;
  25. }
  26.  
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement