Debugging Tools for Windows

ReadUnicodeStringVirtual

The ReadUnicodeStringVirtual method reads a null-terminated, Unicode string from the target and converts it to a multibyte string.

HRESULT
  IDebugDataSpaces4::ReadUnicodeStringVirtual(
    IN ULONG64  Offset,
    IN ULONG  MaxBytes,
    IN ULONG  CodePage,
    OUT OPTIONAL PSTR  Buffer,
    IN ULONG  BufferSize,
    OUT OPTIONAL PULONG  StringBytes
    );

Parameters

Offset
Specifies the location in the process's virtual address space of the string.
MaxBytes
Specifies the maximum number of bytes to read from the target.
CodePage
Specifies the code page to use to convert the multibyte string read from the target into a Unicode string. For example, CP_ACP is the ANSI code page.
Buffer
Receives the string from the target. If Buffer is NULL, this information is not returned.
BufferSize
Specifies the size, in characters, of the Buffer buffer.
StringBytes
Receives the size, in bytes, of the string in the target. If StringBytes is NULL, this information is not returned.

Return Value

S_OK
The method was successful.
S_FALSE
The method was successful. However Buffer was not large enough to hold the string and the string was truncated to fit in Buffer. The truncated string is null-terminated if Buffer has space for at least one character.
E_INVALIDARG
A null-terminator was not found after reading MaxBytes from the target.

This method can also return error values. See Return Values for more details.

Interface Version

ReadUnicodeStringVirtual is available in IDebugDataSpaces4 and later versions.

Comments

The engine will read up to MaxBytes from the target, looking for a null-terminator. If the string has more than BufferSize characters, the string will be truncated to fit in Buffer.

Requirements

Headers: Defined in Dbgeng.h. Include Dbgeng.h. Code pages are defined in Winnls.h.

See Also

ReadMultiByteStringVirtual, ReadUnicodeStringVirtualWide

Build machine: CAPEBUILD