Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.1 KiB

  1. /*
  2. *
  3. * memory.cxx
  4. *
  5. * Routines for reading/writing process memory.
  6. *
  7. */
  8. #include "actdbg.hxx"
  9. BOOL
  10. ReadMemory(
  11. IN PNTSD_EXTENSION_APIS pExtApis,
  12. IN HANDLE hProcess,
  13. IN DWORD_PTR Address,
  14. IN OUT void * pBuffer,
  15. IN DWORD BufferSize
  16. )
  17. {
  18. SIZE_T BytesRead;
  19. BOOL bStatus;
  20. if ( ! Address )
  21. return FALSE;
  22. bStatus = ReadProcessMemory(
  23. hProcess,
  24. (const void *)Address,
  25. pBuffer,
  26. BufferSize,
  27. &BytesRead );
  28. return bStatus && (BytesRead == BufferSize);
  29. }
  30. BOOL
  31. ReadMemory(
  32. IN PNTSD_EXTENSION_APIS pExtApis,
  33. IN HANDLE hProcess,
  34. IN char * pszAddress,
  35. IN OUT void * pBuffer,
  36. IN DWORD BufferSize
  37. )
  38. {
  39. DWORD_PTR Address;
  40. Address = (*pExtApis->lpGetExpressionRoutine)( pszAddress );
  41. return ReadMemory( pExtApis, hProcess, Address, pBuffer, BufferSize );
  42. }