IDebugMemoryBytes2::ReadAt

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Reads a sequence of bytes, starting at a given location.

Syntax

HRESULT ReadAt( 
   IDebugMemoryContext2* pStartContext,
   DWORD                 dwCount,
   BYTE*                 rgbMemory,
   DWORD*                pdwRead,
   DWORD*                pdwUnreadable
);
int ReadAt(
   IDebugMemoryContext2 pStartContext,
   uint                 dwCount,
   byte[]               rgbMemory,
   out uint             pdwRead,
   ref uint             pdwUnreadable
);

Parameters

pStartContext
[in] The IDebugMemoryContext2 object that specifies where to start reading bytes.

dwCount
[in] The number of bytes to read. Also specifies the length of the rgbMemory array.

rgbMemory
[in, out] Array filled in with the bytes actually read.

pdwRead
[out] Returns the number of contiguous bytes actually read.

pdwUnreadable
[in, out] Returns the number of unreadable bytes. May be a null value if the client is uninterested in the number of unreadable bytes.

Return Value

If successful, returns S_OK; otherwise, returns an error code.

Remarks

If 100 bytes are requested and the first 50 are readable, the next 20 are unreadable, and the remaining 30 are readable, this method returns:

*pdwRead = 50

*pdwUnreadable = 20

In this case, because *pdwRead + *pdwUnreadable < dwCount, the caller must make an additional call to read the remaining 30 bytes of the original 100 requested and the IDebugMemoryContext2 object passed in the pStartContext parameter must be advanced by 70.

See also