BSTRを使用するCOMコードがあります。
:: SysFreeString()を使用するとアプリケーションがクラッシュするという点で
ただし、WINDOWS2003、WIN7、WINXPなどでも同じことが機能します。
何が問題を引き起こしているのか、何が間違っているのかについての考え。サンプルコードは以下の通りです
class CFoo::IUser
{
BSTR UserName;
}
HRESULT CBar::FooMethod(VARIANT *vOut)
{
//create interface, variant and fill the object.
BSTR bstrname = ::SysAllocString(_T("Username"));
//use bstrname to fill interface structure.
//finished using now deallocate memory
::SysFreeString(bstrname); // crashing here only in windows 2008 R2
}