Re: x64 and BSTR allocation, what has changed?
"Jochen Kalmbach [MVP]" <nospam-Jochen.Kalmbach @holzma.de> wrote in message
news:%23f8t05XT GHA.4340@tk2msf tngp13.phx.gbl. ..[color=blue]
> Hi Egbert!
>[color=green][color=darkred]
>>>> So, you're saying that on 64-bit platforms, a BSTR has an 8 byte
>>>> length portion rather than a 4 byte length? I'd be surprised if it
>>>> was.
>>>
>>> A BSTR does not have a "length portion"... it is just a pointer...
>>>
>>> Or did I miss something?
>>>
>>> BSTR is just "wchar_t*". ..[/color]
>>
>> You missed a lot by thinking this :)[/color]
>
> No problem for me... I never rely on undecomented features...[/color]
Sure, it's your party, but BSTR is _not_ just a wchar_t* is documented!
[color=blue]
> (As "Alexander said: "And also let's not forget that the
> allocation strategy for BSTR is officially undocumented... ")[/color]
This is not rocket science :)
If you need an 11 wchar length string, what else must you store but the
length _and_ the compatibility with wchar_t* ie a zero terminator?
The other thing you need to know, is that all oleautomation memory allocs,
should go through CoTaskMemAlloc. Now I'm a rocket scientist :)
I started to hesitate on the x64 because of GPs but now I fixed it.
"Jochen Kalmbach [MVP]" <nospam-Jochen.Kalmbach @holzma.de> wrote in message
news:%23f8t05XT GHA.4340@tk2msf tngp13.phx.gbl. ..[color=blue]
> Hi Egbert!
>[color=green][color=darkred]
>>>> So, you're saying that on 64-bit platforms, a BSTR has an 8 byte
>>>> length portion rather than a 4 byte length? I'd be surprised if it
>>>> was.
>>>
>>> A BSTR does not have a "length portion"... it is just a pointer...
>>>
>>> Or did I miss something?
>>>
>>> BSTR is just "wchar_t*". ..[/color]
>>
>> You missed a lot by thinking this :)[/color]
>
> No problem for me... I never rely on undecomented features...[/color]
Sure, it's your party, but BSTR is _not_ just a wchar_t* is documented!
[color=blue]
> (As "Alexander said: "And also let's not forget that the
> allocation strategy for BSTR is officially undocumented... ")[/color]
This is not rocket science :)
If you need an 11 wchar length string, what else must you store but the
length _and_ the compatibility with wchar_t* ie a zero terminator?
The other thing you need to know, is that all oleautomation memory allocs,
should go through CoTaskMemAlloc. Now I'm a rocket scientist :)
I started to hesitate on the x64 because of GPs but now I fixed it.
Comment