Re: SysFreeString - Is the memory mine to use as I please ?
- From: "Egbert Nierop \(MVP for IIS\)" <egbert_nierop@xxxxxxxxxxxxxx>
- Date: Fri, 22 Dec 2006 09:26:59 +0100
"Tim Roberts" <timr@xxxxxxxxx> wrote in message news:ndv7l29u0jinn10rtbrg7kim243asod5k3@xxxxxxxxxx
"Egbert Nierop \(MVP for IIS\)" <egbert_nierop@xxxxxxxxxxxxxx> wrote:
the Sys* functions depend on CoTaskMemAlloc and CoTaskMemFree
As you know, BSTR's are compatible with LPWSTR's for use with zero
terminated strings but they are zero prepended.
What???
Typo,
they are length prepended and the total allocation is 16 bytes memory aligned.
A BSTR is an LPWSTR with the length of the string buffer stored in the word
just before the start of the string.
All about this...
http://technolog.nl/blogs/eprogrammer/archive/2006/07/25/Boost-BSTR-performance-for-free_2C00_-by-3000_2500_.aspx
And here is the source to 'replace' BSTR allocation with a faster alternative.
http://technolog.nl/blogs/eprogrammer/archive/2006/03/22/_5B00_Win64_5D00_-My-story_3A00_-Porting-a-product-to-x64.aspx
.
- Follow-Ups:
- Re: SysFreeString - Is the memory mine to use as I please ?
- From: Christian Kaiser
- Re: SysFreeString - Is the memory mine to use as I please ?
- Prev by Date: Re: How to get imagebase after a DLL gets loaded
- Next by Date: Re: Newbie Question: '_KTHREAD' undeclared identifier
- Previous by thread: Re: How to do threads synchronization on two machine?
- Next by thread: Re: SysFreeString - Is the memory mine to use as I please ?
- Index(es):