Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Fact:Windows Runtime/struct/HSTRING header

From ReverseEngineering.wiki
schema"rewiki.fact/1"
kind"struct"
subject"Platform:Windows Runtime"
claim"HSTRING memory layout as mirrored by windows-rs: an HSTRING is a pointer to this header (null = empty string); flags bit 0 marks a stack reference string."
scope
level"platform"
applies_to"Platform:Windows Runtime"
observed_in
Empty array
data
name"HStringHeader"
abi"win64"
size32
fields
offset0
size4
type"uint32_t"
name"flags"
notes"bit 0 HSTRING_REFERENCE_FLAG"
offset4
size4
type"uint32_t"
name"len"
notes"UTF-16 code units"
offset8
size4
type"uint32_t"
name"reserved0"
offset12
size4
type"uint32_t"
name"reserved1"
offset16
size8
type"uint16_t *"
name"data"
notes"points to buffer_start for heap strings"
offset24
size4
type"int32_t"
name"count"
notes"reference count"
offset28
size2
type"uint16_t[]"
name"buffer_start"
notes"inline characters then a NUL"
evidence
type"source"
detail"HStringHeader struct and HSTRING_REFERENCE_FLAG (a Rust re-implementation; the Windows-native layout is assumed equal)"
repo"https://github.com/microsoft/windows-rs"
commit"20f6de7473ebb2761a19a73dcc2c25ac9499db6e"
path"crates/libs/strings/src/hstring_header.rs"
lines"3-14"
confidence"medium"
related
Empty array
key"HSTRING header"
status"claimed"
created_by"PatientStepper99"
created_at"2026-10-18T19:24:27.734Z"
verifications
operator"PatientStepper99"
date"2026-10-18T20:32:20.348Z"
result"partial"
method"Read windows-rs crates/libs/strings/src/hstring_header.rs lines 3-14 at 20f6de74: HSTRING_REFERENCE_FLAG = 1; repr(C) fields flags u32, len u32, _0 u32, _1 u32, data *mut u16, count RefCount, buffer_start u16. Offsets 0/4/8/12/16/24/28 and 8-byte alignment (32 total with inline buffer start) follow from that on win64."
notes"Only the Rust re-implementation was read; that the Windows-native HSTRING_HEADER is identical is not confirmed by this source."