DkmProcess.ReadMemoryString(UInt64, DkmReadMemoryFlags, UInt16, Int32) Method

Definition

Reads a null-terminated string from the target process process's memory. This can be used to read an ANSI or Unicode (UTF-8, UTF-16 or UTF-32) strings.

public:
 cli::array <System::Byte> ^ ReadMemoryString(System::UInt64 Address, Microsoft::VisualStudio::Debugger::DkmReadMemoryFlags Flags, System::UInt16 CharacterSize, int MaxCharacters);
public:
 Platform::Array <byte> ^ ReadMemoryString(unsigned long long Address, Microsoft::VisualStudio::Debugger::DkmReadMemoryFlags Flags, unsigned short CharacterSize, int MaxCharacters);
std::Array <byte> ReadMemoryString(unsigned long Address, Microsoft::VisualStudio::Debugger::DkmReadMemoryFlags Flags, unsigned short CharacterSize, int MaxCharacters);
public byte[] ReadMemoryString (ulong Address, Microsoft.VisualStudio.Debugger.DkmReadMemoryFlags Flags, ushort CharacterSize, int MaxCharacters);
member this.ReadMemoryString : uint64 * Microsoft.VisualStudio.Debugger.DkmReadMemoryFlags * uint16 * int -> byte[]
Public Function ReadMemoryString (Address As ULong, Flags As DkmReadMemoryFlags, CharacterSize As UShort, MaxCharacters As Integer) As Byte()

Parameters

Address
UInt64

[In] The base address from which to read the target process's memory.

Flags
DkmReadMemoryFlags

[In] Flags controlling the behavior of DkmProcess.ReadMemory and DkmProcess.ReadMemoryString.

CharacterSize
UInt16

[In] Number of bytes in each character. This should be set to 1 (ANSI/UTF-8), 2 (UTF-16) or 4 (UTF-32).

MaxCharacters
Int32

[In] The maximum number of characters to read from the target process. When DkmReadMemoryFlags.AllowPartialRead is false, the request will fail if a null terminator isn't found within this range. This value should be reasonable. The Microsoft implementation will fail any request for more than 25 MBs of string memory.

Returns

Byte[]

[Out] The value of the string which was read from the target process. If DkmReadMemoryFlags.AllowPartialRead is clear, this memory will always include the null termination character. If DkmReadMemoryFlags.AllowPartialRead is specified, this buffer will not contain the null termination character if the read was truncated.

Exceptions

E_STRING_TOO_LONG indicates that the string could not be read within the specified maximum number of characters.

Applies to