OSDN Git Service

UNICODEビルド、X64ビルドでコンパイルエラーが発生しないように修正した。
[seraphyscrtools/SeraphyScriptTools.git] / PrivateProfile.cpp
1 // PrivateProfile.cpp : CPrivateProfile \82Ì\83C\83\93\83v\83\8a\83\81\83\93\83e\81[\83V\83\87\83\93
2 #include "stdafx.h"
3 #include "SeraphyScriptTools.h"
4 #include "PrivateProfile.h"
5 #include "profilesection.h"
6 #include "generic.h"
7
8 /////////////////////////////////////////////////////////////////////////////
9 // CPrivateProfile
10
11 STDMETHODIMP CPrivateProfile::InterfaceSupportsErrorInfo(REFIID riid)
12 {
13         static const IID* arr[] = 
14         {
15                 &IID_IPrivateProfile
16         };
17         for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
18         {
19                 if (IsEqualGUID(*arr[i],riid))
20                         return S_OK;
21         }
22         return S_FALSE;
23 }
24
25 STDMETHODIMP CPrivateProfile::get_ProfilePath(BSTR *pVal)
26 {
27         return m_bstr_profilepath.CopyTo(pVal);
28 }
29
30 STDMETHODIMP CPrivateProfile::put_ProfilePath(BSTR newVal)
31 {
32         m_bstr_profilepath = newVal;
33         return S_OK;
34 }
35
36 STDMETHODIMP CPrivateProfile::OpenSection(VARIANT text,VARIANT* pVal)
37 {
38         ::VariantInit(pVal);
39         CComVariant varText;
40         if(varText.ChangeType(VT_BSTR,&text) != S_OK){
41                 return DISP_E_TYPEMISMATCH;
42         }
43         if (m_bstr_profilepath.Length() <= 0) {
44                 ErrorInfo(IDS_ERR_PROFILEPATH);
45                 return DISP_E_EXCEPTION;
46         }
47         CComObject<CProfileSection>* pSection = NULL;
48         pSection->CreateInstance(&pSection);
49         ATLASSERT(pSection);
50
51         pSection->m_szProfilePath = m_bstr_profilepath;
52         pSection->m_szSectionName = varText.bstrVal;
53
54         IUnknown* pUnk = NULL;
55         pSection->QueryInterface(IID_IUnknown,(void**)&pUnk);
56         ATLASSERT(pUnk);
57         pVal->vt      = VT_UNKNOWN;
58         pVal->punkVal = pUnk;
59         return S_OK;
60 }