ReactOS 0.4.16-dev-122-g325d74c
CMemPropertyBag Class Reference
Inheritance diagram for CMemPropertyBag:
Collaboration diagram for CMemPropertyBag:

Public Member Functions

 CMemPropertyBag (DWORD dwMode)
 
STDMETHODIMP Read (_In_z_ LPCWSTR pszPropName, _Inout_ VARIANT *pvari, _Inout_opt_ IErrorLog *pErrorLog) override
 
STDMETHODIMP Write (_In_z_ LPCWSTR pszPropName, _In_ VARIANT *pvari) override
 
- Public Member Functions inherited from CBasePropertyBag
 CBasePropertyBag (DWORD dwMode)
 
virtual ~CBasePropertyBag ()
 
STDMETHODIMP QueryInterface (REFIID riid, void **ppvObject) override
 
 STDMETHODIMP_ (ULONG) AddRef() override
 
 STDMETHODIMP_ (ULONG) Release() override
 
- Public Member Functions inherited from IPropertyBag
HRESULT Read ([in] LPCOLESTR pszPropName, [in, out] VARIANT *pVar, [in] IErrorLog *pErrorLog)
 
HRESULT RemoteRead ([in] LPCOLESTR pszPropName, [out] VARIANT *pVar, [in] IErrorLog *pErrorLog, [in] DWORD varType, [in] IUnknown *pUnkObj)
 
HRESULT Write ([in] LPCOLESTR pszPropName, [in] VARIANT *pVar)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Protected Attributes

ATL::CSimpleMap< ATL::CStringW, ATL::CComVariant, CPropMapEqualm_PropMap
 
- Protected Attributes inherited from CBasePropertyBag
LONG m_cRefs
 
DWORD m_dwMode
 

Additional Inherited Members

- Public Types inherited from IPropertyBag
typedef IPropertyBagLPPROPERTYBAG
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 

Detailed Description

Definition at line 138 of file propbag.cpp.

Constructor & Destructor Documentation

◆ CMemPropertyBag()

CMemPropertyBag::CMemPropertyBag ( DWORD  dwMode)
inline

Definition at line 144 of file propbag.cpp.

144: CBasePropertyBag(dwMode) { }

Member Function Documentation

◆ Read()

STDMETHODIMP CMemPropertyBag::Read ( _In_z_ LPCWSTR  pszPropName,
_Inout_ VARIANT pvari,
_Inout_opt_ IErrorLog pErrorLog 
)
override

Definition at line 152 of file propbag.cpp.

156{
157 UNREFERENCED_PARAMETER(pErrorLog);
158
159 TRACE("%p: %s %p %p\n", this, debugstr_w(pszPropName), pvari, pErrorLog);
160
161 VARTYPE vt = V_VT(pvari);
162
163 ::VariantInit(pvari);
164
165#if (_WIN32_WINNT < _WIN32_WINNT_VISTA)
167 {
168 ERR("%p: 0x%X\n", this, m_dwMode);
169 return E_ACCESSDENIED;
170 }
171#endif
172
173 if (!pszPropName || !pvari)
174 {
175 ERR("%p: %s %p %p\n", this, debugstr_w(pszPropName), pvari, pErrorLog);
176 return E_INVALIDARG;
177 }
178
179 INT iItem = m_PropMap.FindKey(pszPropName);
180 if (iItem == -1)
181 {
182 ERR("%p: %s %p %p\n", this, debugstr_w(pszPropName), pvari, pErrorLog);
183 return E_FAIL;
184 }
185
186 HRESULT hr = ::VariantCopy(pvari, &m_PropMap.GetValueAt(iItem));
187 if (FAILED(hr))
188 {
189 ERR("%p: 0x%08X %p\n", this, hr, pvari);
190 return hr;
191 }
192
193 hr = ::VariantChangeTypeForRead(pvari, vt);
194 if (FAILED(hr))
195 {
196 ERR("%p: 0x%08X %p\n", this, hr, pvari);
197 return hr;
198 }
199
200 return hr;
201}
#define ERR(fmt,...)
Definition: precomp.h:57
ATL::CSimpleMap< ATL::CStringW, ATL::CComVariant, CPropMapEqual > m_PropMap
Definition: propbag.cpp:141
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
unsigned short VARTYPE
Definition: compat.h:2254
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:91
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_w
Definition: kernel32.h:32
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define V_VT(A)
Definition: oleauto.h:211
#define MODE_CAN_READ(dwMode)
Definition: propbag.cpp:22
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
int32_t INT
Definition: typedefs.h:58
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:568
HRESULT WINAPI VariantCopy(VARIANTARG *pvargDest, VARIANTARG *pvargSrc)
Definition: variant.c:748
#define E_ACCESSDENIED
Definition: winerror.h:2849

◆ Write()

STDMETHODIMP CMemPropertyBag::Write ( _In_z_ LPCWSTR  pszPropName,
_In_ VARIANT pvari 
)
override

Definition at line 204 of file propbag.cpp.

207{
208 TRACE("%p: %s %p\n", this, debugstr_w(pszPropName), pvari);
209
210#if (_WIN32_WINNT < _WIN32_WINNT_VISTA)
212 {
213 ERR("%p: 0x%X\n", this, m_dwMode);
214 return E_ACCESSDENIED;
215 }
216#endif
217
218 if (!pszPropName || !pvari)
219 {
220 ERR("%p: %s %p\n", this, debugstr_w(pszPropName), pvari);
221 return E_INVALIDARG;
222 }
223
224 ATL::CComVariant vari;
225 HRESULT hr = vari.Copy(pvari);
226 if (FAILED(hr))
227 {
228 ERR("%p: %s %p: 0x%08X\n", this, debugstr_w(pszPropName), pvari, hr);
229 return hr;
230 }
231
232 if (!m_PropMap.SetAt(pszPropName, vari))
233 {
234 ERR("%p: %s %p\n", this, debugstr_w(pszPropName), pvari);
235 return E_FAIL;
236 }
237
238 return hr;
239}
HRESULT Copy(_In_ const VARIANT *src)
Definition: atlcomcli.h:584
#define MODE_CAN_WRITE(dwMode)
Definition: propbag.cpp:24

Member Data Documentation

◆ m_PropMap

ATL::CSimpleMap<ATL::CStringW, ATL::CComVariant, CPropMapEqual> CMemPropertyBag::m_PropMap
protected

Definition at line 141 of file propbag.cpp.

Referenced by Read(), and Write().


The documentation for this class was generated from the following file: