SplitScript reference / MemoryReader / readUtf16Le

MemoryReader.readUtf16Le

Method

Self.readUtf16Le(address: Address, maxUtf16Units: u32) -> String! where Self: MemoryReader

Reads a bounded NUL-terminated little-endian UTF-16 string.

At most maxUtf16Units code units are read in one operation. Decoding stops at the first NUL code unit. Failed memory access, a zero or excessive bound returns an error. Unpaired surrogate code units become the Unicode replacement character.

Parameters

  • address: Address of the first little-endian UTF-16 code unit.
  • maxUtf16Units: Maximum number of code units to read, from 1 through 2048.

Effects: allocates, reads process memory, requires an attached process

Runtime behavior: available while a process is attached, except in onDetach; synchronous

Examples

Read a native Windows string

let chapter = process.readUtf16Le(0x1000, 64) else "Unknown"