flat assembler
Message board for the users of flat assembler.

Index > Windows > BSTR to Unicode

Author
Thread Post new topic Reply to topic
Everhest



Joined: 26 Jun 2008
Posts: 84
Location: Russia
Everhest
Hi. why BSTR translate to Unicode?

_________________
Forgive for my bad english, I from russia...
Post 10 Dec 2009, 12:21
View user's profile Send private message ICQ Number Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
BSTR? Anyway, the reason why you would use Unicode would be because it can be used with any localization then.
Post 10 Dec 2009, 14:42
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
Everhest



Joined: 26 Jun 2008
Posts: 84
Location: Russia
Everhest
BSTR - not anyway. im use com IWebBrowser2 and functions on this interface. get_LocationURL return BSTR and i want translate to Unicode. Why?
Post 10 Dec 2009, 14:55
View user's profile Send private message ICQ Number Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Transforming it to plain UNICODE string is what you want?

Code:
mov ecx, [eax]
lea esi, [eax+4]
mov edi, buffer_address
cmp ecx, buffer_size + 2
jb .buffer_too_small
rep movsw
...    

Note that you don't actually need to copy, if you need the string for, say, SetWindowTextW, then just pass a pointer to the BSTR but adding four to the address first (the NULL terminator is already included).

http://msdn.microsoft.com/en-us/library/ms221069.aspx
Post 10 Dec 2009, 15:04
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.