Re: BSTR, _bstr_t issues occuring on our Windows 2003 Server




"FinTeam" <FinTeam@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B71A8A5B-10F8-45BB-A1FA-D91DCBD9661F@xxxxxxxxxxxxxxxx
We have server components which were created by a third party and
compiled in VC++5 (sp3). They run fine on NT4 and 2000, however during
testing of our migration to Server 2003, these components have been
failing when performing Data Access functions. In particular we have
been having problems with BSTR and _bstr_t.

_bstr_t(BSTR*, 1) is the original code that the problem started with.
Other findings are -

1) Converting a BSTR* to a _bstr_t when the length of the message in
BSTR* is 16,382 characters or more, gives errors.
a) Using _bstr_t(BSTR*, 1) causes the application to crash. fcopy=1
b) Using _bstr_t(BSTR*) ). In this case, fcopy=0 by default.
i) When message length is 16,382 or more characters - converts the
message but the first two characters are corrupted and unreadable
ii) When message length is much higher, ex:32,758 characters, the
application crashes.
2) The length of message content is not an issue when converting
_bstr_t to a BSTR.

_bstr_t(BSTR*, 1) worked fine even for message lengths as high as
50,292 characters, on the Windows NT 4.0 and Windows 2000 servers.

Anyone have any advice, input?


Hummmm... MSDN defines _bstr_t() function as:

-------%<---------%<--------
_bstr_t(BSTR, BOOL);
-------%<---------%<--------

Notice that the first parameter isn't a pointer to BSTR... maybe the error
is there!

[]s
Fred


.



Relevant Pages

  • Re: Code Page problem in SetWindowText
    ... My application will call an extranl dll, which will return a string as ... The result only consists of characters from A~Z plus 2 special characters ... BSTR bstr = NULL; ... This is because the first 256 code points of Unicode are the same as ISO-8859-1. ...
    (microsoft.public.vc.mfc)
  • Encrpytion routine - embedded nulls in BSTR
    ... I’m currently working on a VC++ 2005 dll used for encrypting and decrypting ... This dll needs to be called by a VB6 application, ... When I convert to a BSTR I’m losing all characters after the null. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Code Page problem in SetWindowText
    ... If you're having code page problems it's because you're dealing with ANSI code pages other than ASCII. ... The result only consists of characters from A~Z plus 2 special characters ... BSTR bstr = NULL; ... I think MBCS may be the only choice for it. ...
    (microsoft.public.vc.mfc)
  • Re: bstr
    ... I have created atl com dll. ... this bstr should support null characters also in the data. ...
    (microsoft.public.vc.atl)
  • BSTR, _bstr_t issues occuring on our Windows 2003 Server
    ... We have server components which were created by a third party and ... testing of our migration to Server 2003, ... been having problems with BSTR and _bstr_t. ... BSTR* is 16,382 characters or more, gives errors. ...
    (microsoft.public.dotnet.languages.vc)

Loading