BinaryPeekStrW

Extracts a Unicode string from a binary buffer.

Syntax:

BinaryPeekStrW( handle, offset, maxsize [,reverse-bytes])

Parameters:

(i) handle: handle of buffer.

(i) offset: zero-based offset in the buffer where the string starts.

(i) maxsize: maximum number of bytes in string. Must be an even number.

(i) reverse bytes: [optional] @FALSE default. @TRUE the bytes in each Unicode character are reversed from the normal byte order.

Returns:

(s)  Unicode string.

 

This function is used to extract Unicode string data from a binary buffer. The desired starting offset and a maxsize are passed to the function. The function returns a Unicode string of bytes, starting at the specified offset and continuing until the end of the string is reached, when a Unicode NULL character is found (which terminates the string) or the maxsize number of bytes have been copied into the return string.

 

Example:


unicodestr = ChrHexToUnicode("480065006C006C006F00");Hello
bytecnt = StrByteCount ( unicodestr, 1)
buf = BinaryAlloc(bytecnt)
BinaryPokeStrW( buf, 0, unicodestr)
unicodestr = BinaryPeekStrW( buf, 0, bytecnt )
BinaryFree(buf)
Message("Unicode String", unicodestr)
See Also:

Binary Operations, BinaryCopy, BinaryPeek, BinaryPeekStr, BinaryPoke, BinaryPokeStr