Re: BSTR not returned correctly
"Rohit Kumar" <RohitKumar@discussions.microsoft.com> wrote in message
news:73156817-2552-437A-8968-BBACD47271FA@microsoft.com
When i debug at the client end, my BSTR shows "r" as the first
character followed by some garbage values.
Remember that BSTR contains Unicode
characters. In your case, this means every other byte (not
character) is zero. If you somehow treat it as a regular narrow
string, it would appear that it contains only one character.
I didnt understand what you meant to say here? What is the possible
solution to this problem?
My point was, I'm not convinced there _is_ a problem. A BSTR may be
perfectly fine, but your method of inspecting it, whatever it is, may
incorrectly suggest otherwise. I don't see anything wrong in the code
you've shown (except for one thing: I've never seen [retval][out]
before, it's usually written [out, retval] within a single set of square
brackets. Does MIDL complain about it at all?)
Does SysStringLen return the correct length?
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925