title: COM method call returns Catastrophic Failure when BSTR is passed
body: <p>Revised from <a href="https://stackoverflow.com/questions/669347/com-method-call-returns-catastrophic-failure">previous question</a></p>
  
  <p><strong>Note:</strong></p>
  
  <ul>
  <li>Pass <strong>BSTR</strong> variable to <strong>COM</strong> method, <strong>HRESULT</strong> return is <code>8000FFFF</code></li>
  <li>Previous calls with <strong>interface pointer</strong>, was <strong>successful</strong>: HRESULT is <code>0</code></li>
  <li>Execution, inside Visual Studio <strong>succeeds</strong>, outside <strong>fails</strong> - release and debug</li>
  </ul>
  
  <p><strong>Illustration:</strong></p>
  
  <pre><code>BSTR raw_sim_Open = SysAllocString (L"c:\\example.S8");
  
  hresult = pis8-&gt;raw_Open (raw_sim_Open); //0x8000FFFF returned
  </code></pre>
  
  <h2>Edit - WinDbg:</h2>
  
  <pre><code>First chance exceptions are reported before any exception handling.
  This exception may be expected and handled.
  eax=003a5be8 ebx=00009000 ecx=003a0208 edx=77606e00 esi=0012ec90 edi=00191b14
  eip=003a0283 esp=0012ec34 ebp=0012ecb4 iopl=0         nv up ei ng nz ac pe nc
  cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010296
  Missing image name, possible paged-out or corrupt data.
  Missing image name, possible paged-out or corrupt data.
  &lt;Unloaded_PI32.dll&gt;+0x3a0282:
  003a0283 0080023a0088    add     byte ptr [eax-77FFC5FEh],al ds:0023:883a95ea=??
  </code></pre>