OSDN Git Service

セットアップの追加、ヘルプの修正
[seraphyscrtools/SeraphyScriptTools.git] / PrivateProfile.cpp
index 4e1ba03..05fd7eb 100644 (file)
@@ -39,16 +39,17 @@ STDMETHODIMP CPrivateProfile::OpenSection(VARIANT text, VARIANT* pVal)
        }
        ATLASSERT(pSection);
 
-       pSection->m_szProfilePath = m_bstr_profilepath;
-       pSection->m_szSectionName = varText.bstrVal;
-
-       IUnknown* pUnk = NULL;
-       if (FAILED(hr = pSection->QueryInterface(IID_IUnknown, (void**)&pUnk))) {
+       CComPtr<IUnknown> pUnk = NULL;
+       if (FAILED(hr = pSection->QueryInterface(&pUnk))) {
+               delete pSection;
                return hr;
        }
        ATLASSERT(pUnk);
 
+       pSection->m_szProfilePath = m_bstr_profilepath;
+       pSection->m_szSectionName = varText.bstrVal;
+
        pVal->vt = VT_UNKNOWN;
-       pVal->punkVal = pUnk;
+       pVal->punkVal = pUnk.Detach();
        return S_OK;
 }