Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. COM
  4. _bstr_t and MS Security update

_bstr_t and MS Security update

Scheduled Pinned Locked Moved COM
securitytutorialquestionannouncement
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    ChrisLang
    wrote on last edited by
    #1

    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

    M 1 Reply Last reply
    0
    • C ChrisLang

      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

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      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

      C 1 Reply Last reply
      0
      • M Michael Dunn

        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

        C Offline
        C Offline
        ChrisLang
        wrote on last edited by
        #3

        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

        C 1 Reply Last reply
        0
        • C ChrisLang

          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

          C Offline
          C Offline
          ChrisLang
          wrote on last edited by
          #4

          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

          S 1 Reply Last reply
          0
          • C ChrisLang

            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

            S Offline
            S Offline
            Steve S
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups