_bstr_t and MS Security update
-
I just finished another Security update and now this code throws an exception. CString myStr(L"test"); _bstr_t t = _bstr_t(myStr); This worked until the sercurity update. I've tried to AllocateSysString to get a BSTR as well as CComBSTR instead of CString and nothing seems to work. Does anyone know what happened to the wrapper class and how to successfully create a _bstr_t object? Thanks Chris
-
I just finished another Security update and now this code throws an exception. CString myStr(L"test"); _bstr_t t = _bstr_t(myStr); This worked until the sercurity update. I've tried to AllocateSysString to get a BSTR as well as CComBSTR instead of CString and nothing seems to work. Does anyone know what happened to the wrapper class and how to successfully create a _bstr_t object? Thanks Chris
How about:
_bstr_t t = (LPCTSTR) myStr;
to explicitly pass a C-style string pointer to the_bstr_t
ctor.--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
-
How about:
_bstr_t t = (LPCTSTR) myStr;
to explicitly pass a C-style string pointer to the_bstr_t
ctor.--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
Mike, Thanks for the response but no that doesn't work either. All will work in MFC but in my ATL DLL everything that worked yesterday now won't! I've tried createding a BSTR and then using that to create the _bstr_t, using a variant (_variant_t) even creating a BSTR and then using the attach method on the _bstr_t and everything throws and exception!!!!!! It is I can't find any information in MSDN about why it isn't working either. Chris
-
Mike, Thanks for the response but no that doesn't work either. All will work in MFC but in my ATL DLL everything that worked yesterday now won't! I've tried createding a BSTR and then using that to create the _bstr_t, using a variant (_variant_t) even creating a BSTR and then using the attach method on the _bstr_t and everything throws and exception!!!!!! It is I can't find any information in MSDN about why it isn't working either. Chris
Sometime I can be so stupid!! There was no problem with _bstr_t There was a problem were I changed the length of an integer array from 500 to 200 and FORGOT to change the init loop. The overwriting of memeory just happend to show up in the _bstr_t object. Sorry for all the wasted time. Chris
-
Sometime I can be so stupid!! There was no problem with _bstr_t There was a problem were I changed the length of an integer array from 500 to 200 and FORGOT to change the init loop. The overwriting of memeory just happend to show up in the _bstr_t object. Sorry for all the wasted time. Chris
Whenever I hit something that looks like a system issue, I use the following rules; #1: Suspect my code #2: See rule #1 It's stood me in good stead for over 20 years now, and only once has it failed, when I discovered a locking bug in C-ISAM for DOS. :) That was real fun to find. Steve S Developer for hire