From 5d83a6576eebf881459aa65ff8bbf585a28e5526 Mon Sep 17 00:00:00 2001 From: Huw D M Davies Date: Sat, 8 Jul 2000 11:47:38 +0000 Subject: [PATCH] Fix SysStringByteLen to really return the length in bytes. --- dlls/oleaut32/ole2disp.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dlls/oleaut32/ole2disp.c b/dlls/oleaut32/ole2disp.c index c0a9f8b3a64..ac608513365 100644 --- a/dlls/oleaut32/ole2disp.c +++ b/dlls/oleaut32/ole2disp.c @@ -303,7 +303,18 @@ int WINAPI SysStringLen(BSTR str) */ int WINAPI SysStringByteLen(BSTR str) { - return SysStringLen(str)*sizeof(WCHAR); + DWORD* bufferPointer; + + if (!str) return 0; + /* + * The length of the string (in bytes) is contained in a DWORD placed + * just before the BSTR pointer + */ + bufferPointer = (DWORD*)str; + + bufferPointer--; + + return (int)(*bufferPointer); } /******************************************************************************