On 12/24/21 01:48, Bernhard Kölbl wrote:
+#define HSTRING_REFERENCE_FLAG 1
- struct hstring_private {
- LPWSTR buffer;
- UINT32 flags; UINT32 length;
- BOOL reference;
- LONG refcount;
- LONG refcount;
- LPWSTR ptr; };
From what I can tell this still doesn't match native layout. It also might be slightly different for references.
static BOOL alloc_string(UINT32 len, HSTRING *out) { struct hstring_private *priv;
- priv = HeapAlloc(GetProcessHeap(), 0, sizeof(*priv) + (len + 1) * sizeof(*priv->buffer));
- priv = HeapAlloc(GetProcessHeap(), 0, sizeof(*priv)); if (!priv) return FALSE;
- priv->buffer = (LPWSTR)(priv + 1);
- priv->ptr = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(*priv->ptr));
I don't see this behaviour on Windows.
But anyway, do you have any idea why application would care? Is it some statically linked code depending on it, or some native module bundled or installed separately?
If the layout is stable across Windows releases, we'll need tests for it.