ReactOS 0.4.16-dev-197-g92996da
CLayerStringList.hpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Compatibility Layer Shell Extension
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: CLayerStringList implementation
5 * COPYRIGHT: Copyright 2015-2018 Mark Jansen (mark.jansen@reactos.org)
6 */
7
8#pragma once
9
10/* TODO: Use HSDB instead of PDB */
12 public CComObjectRootEx<CComMultiThreadModelNoCS>,
13 public IEnumString
14{
15public:
18 {
21 StringCchCatW(buf, _countof(buf), L"\\sysmain.sdb");
23 Reset();
24 }
25
27 {
29 }
30
31 STDMETHOD(Next)(ULONG celt, LPOLESTR *rgelt, ULONG *pceltFetched) override
32 {
33 if (pceltFetched)
34 *pceltFetched = 0;
35
36 while (celt && m_layer)
37 {
39 if (nameid)
40 {
42 if (name && !IsBuiltinLayer(name))
43 {
44 ULONG Size = wcslen(name) + 1;
45
46 *rgelt = (LPOLESTR)::CoTaskMemAlloc(Size * sizeof(WCHAR));
47 StringCchCopyW(*rgelt, Size, name);
48
49 if (pceltFetched)
50 (*pceltFetched)++;
51
52 celt--;
53 rgelt++;
54 }
55 }
57 }
58 return celt ? S_FALSE : S_OK;
59 }
60
61 STDMETHOD(Skip)(ULONG celt) override
62 {
63 while (m_layer && celt)
64 {
66 --celt;
67 }
68 return celt ? S_FALSE : S_OK;
69 }
70
71 STDMETHOD(Reset)() override
72 {
74 if (m_db)
75 {
77 if (m_root != TAGID_NULL)
78 {
80 return S_OK;
81 }
82 }
83 return E_FAIL;
84 }
85
86 STDMETHOD(Clone)(IEnumString **ppenum) override
87 {
88 return E_NOTIMPL;
89 }
90
91protected:
95
96public:
100};
101
BOOL IsBuiltinLayer(PCWSTR Name)
TAGID WINAPI SdbFindFirstTag(PDB pdb, TAGID parent, TAG tag)
Definition: sdbread.c:208
PDB WINAPI SdbOpenDatabase(LPCWSTR path, PATH_TYPE type)
Definition: sdbapi.c:329
HRESULT WINAPI SdbGetAppPatchDir(HSDB db, LPWSTR path, DWORD size)
Definition: hsdb.c:579
void WINAPI SdbCloseDatabase(PDB)
Definition: sdbapi.c:373
TAGID WINAPI SdbFindNextTag(PDB pdb, TAGID parent, TAGID prev_child)
Definition: sdbread.c:231
LPWSTR WINAPI SdbGetStringTagPtr(PDB pdb, TAGID tagid)
Definition: sdbread.c:375
DWORD TAGID
#define STDMETHOD(m)
Definition: basetyps.h:62
STDMETHOD() Reset() override
STDMETHOD() Skip(ULONG celt) override
STDMETHOD() Clone(IEnumString **ppenum) override
STDMETHOD() Next(ULONG celt, LPOLESTR *rgelt, ULONG *pceltFetched) override
#define TAG_LAYER
Definition: db.cpp:90
#define TAGID_NULL
Definition: db.cpp:38
#define DOS_PATH
Definition: db.cpp:32
#define TAGID_ROOT
Definition: db.cpp:39
#define TAG_DATABASE
Definition: db.cpp:85
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
#define MAX_PATH
Definition: compat.h:34
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define S_OK
Definition: intsafe.h:52
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:581
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:601
#define END_COM_MAP()
Definition: atlcom.h:592
static LPOLESTR
Definition: stg_prop.c:27
#define L(x)
Definition: ntvdm.h:50
const GUID IID_IEnumString
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
Definition: name.c:39
uint32_t ULONG
Definition: typedefs.h:59
#define TAG_NAME
Definition: vfat.h:553
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
#define S_FALSE
Definition: winerror.h:2357
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184