ReactOS 0.4.16-dev-1946-g52006dd
CCategoryMgr Class Reference
Inheritance diagram for CCategoryMgr:
Collaboration diagram for CCategoryMgr:

Public Member Functions

 CCategoryMgr ()
 
virtual ~CCategoryMgr ()
 
STDMETHODIMP QueryInterface (REFIID riid, void **ppvObj) override
 
 STDMETHODIMP_ (ULONG) AddRef() override
 
 STDMETHODIMP_ (ULONG) Release() override
 
STDMETHODIMP RegisterCategory (_In_ REFCLSID rclsid, _In_ REFGUID rcatid, _In_ REFGUID rguid) override
 
STDMETHODIMP UnregisterCategory (_In_ REFCLSID rclsid, _In_ REFGUID rcatid, _In_ REFGUID rguid) override
 
STDMETHODIMP EnumCategoriesInItem (_In_ REFGUID rguid, _Out_ IEnumGUID **ppEnum) override
 
STDMETHODIMP EnumItemsInCategory (_In_ REFGUID rcatid, _Out_ IEnumGUID **ppEnum) override
 
STDMETHODIMP FindClosestCategory (_In_ REFGUID rguid, _Out_ GUID *pcatid, _In_ const GUID **ppcatidList, _In_ ULONG ulCount) override
 
STDMETHODIMP RegisterGUIDDescription (_In_ REFCLSID rclsid, _In_ REFGUID rguid, _In_ const WCHAR *pchDesc, _In_ ULONG cch) override
 
STDMETHODIMP UnregisterGUIDDescription (_In_ REFCLSID rclsid, _In_ REFGUID rguid) override
 
STDMETHODIMP GetGUIDDescription (_In_ REFGUID rguid, _Out_ BSTR *pbstrDesc) override
 
STDMETHODIMP RegisterGUIDDWORD (_In_ REFCLSID rclsid, _In_ REFGUID rguid, _In_ DWORD dw) override
 
STDMETHODIMP UnregisterGUIDDWORD (_In_ REFCLSID rclsid, _In_ REFGUID rguid) override
 
STDMETHODIMP GetGUIDDWORD (_In_ REFGUID rguid, _Out_ DWORD *pdw) override
 
STDMETHODIMP RegisterGUID (_In_ REFGUID rguid, _Out_ TfGuidAtom *pguidatom) override
 
STDMETHODIMP GetGUID (_In_ TfGuidAtom guidatom, _Out_ GUID *pguid) override
 
STDMETHODIMP IsEqualTfGuidAtom (_In_ TfGuidAtom guidatom, _In_ REFGUID rguid, _Out_ BOOL *pfEqual) override
 
- Public Member Functions inherited from ITfCategoryMgr
HRESULT RegisterCategory ([in] REFCLSID rclsid, [in] REFGUID rcatid, [in] REFGUID rguid)
 
HRESULT UnregisterCategory ([in] REFCLSID rclsid, [in] REFGUID rcatid, [in] REFGUID rguid)
 
HRESULT EnumCategoriesInItem ([in] REFGUID rguid, [out] IEnumGUID **ppEnum)
 
HRESULT EnumItemsInCategory ([in] REFGUID rcatid, [out] IEnumGUID **ppEnum)
 
HRESULT FindClosestCategory ([in] REFGUID rguid, [out] GUID *pcatid, [in, size_is(ulCount)] const GUID **ppcatidList, [in] ULONG ulCount)
 
HRESULT RegisterGUIDDescription ([in] REFCLSID rclsid, [in] REFGUID rguid, [in, size_is(cch)] const WCHAR *pchDesc, [in] ULONG cch)
 
HRESULT UnregisterGUIDDescription ([in] REFCLSID rclsid, [in] REFGUID rguid)
 
HRESULT GetGUIDDescription ([in] REFGUID rguid, [out] BSTR *pbstrDesc)
 
HRESULT RegisterGUIDDWORD ([in] REFCLSID rclsid, [in] REFGUID rguid, [in] DWORD dw)
 
HRESULT UnregisterGUIDDWORD ([in] REFCLSID rclsid, [in] REFGUID rguid)
 
HRESULT GetGUIDDWORD ([in] REFGUID rguid, [out] DWORD *pdw)
 
HRESULT RegisterGUID ([in] REFGUID rguid, [out] TfGuidAtom *pguidatom)
 
HRESULT GetGUID ([in] TfGuidAtom guidatom, [out] GUID *pguid)
 
HRESULT IsEqualTfGuidAtom ([in] TfGuidAtom guidatom, [in] REFGUID rguid, [out] BOOL *pfEqual)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Protected Attributes

LONG m_cRefs
 

Additional Inherited Members

- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 

Detailed Description

Definition at line 16 of file categorymgr.cpp.

Constructor & Destructor Documentation

◆ CCategoryMgr()

CCategoryMgr::CCategoryMgr ( )

Definition at line 86 of file categorymgr.cpp.

87 : m_cRefs(1)
88{
89}

◆ ~CCategoryMgr()

CCategoryMgr::~CCategoryMgr ( )
virtual

Definition at line 91 of file categorymgr.cpp.

92{
93 TRACE("destroying %p\n", this);
94}
#define TRACE(s)
Definition: solgame.cpp:4

Member Function Documentation

◆ EnumCategoriesInItem()

STDMETHODIMP CCategoryMgr::EnumCategoriesInItem ( _In_ REFGUID  rguid,
_Out_ IEnumGUID **  ppEnum 
)
override

Definition at line 203 of file categorymgr.cpp.

206{
207 FIXME("STUB:(%p)\n", this);
208 return E_NOTIMPL;
209}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ EnumItemsInCategory()

STDMETHODIMP CCategoryMgr::EnumItemsInCategory ( _In_ REFGUID  rcatid,
_Out_ IEnumGUID **  ppEnum 
)
override

Definition at line 211 of file categorymgr.cpp.

214{
215 FIXME("STUB:(%p)\n", this);
216 return E_NOTIMPL;
217}

◆ FindClosestCategory()

STDMETHODIMP CCategoryMgr::FindClosestCategory ( _In_ REFGUID  rguid,
_Out_ GUID pcatid,
_In_ const GUID **  ppcatidList,
_In_ ULONG  ulCount 
)
override

Definition at line 219 of file categorymgr.cpp.

224{
225 WCHAR szFullKey[120], szGuid[39];
226 HKEY hKey = NULL;
228 DWORD dwIndex = 0;
230
231 TRACE("(%p)\n", this);
232
233 if (!pcatid || (ulCount && !ppcatidList))
234 return E_INVALIDARG;
235
237 StringCchPrintfW(szFullKey, _countof(szFullKey), L"%s\\%s\\Category\\Item\\%s", szwSystemTIPKey, szGuid, szGuid);
238 *pcatid = GUID_NULL;
239
241 if (error != ERROR_SUCCESS)
242 return S_FALSE;
243
244 // Enumerate subkeys to find the closest category
245 while (TRUE)
246 {
247 WCHAR szCatidName[39];
248 DWORD cchCatidName = _countof(szCatidName);
249 GUID currentCatid;
250
251 error = RegEnumKeyExW(hKey, dwIndex, szCatidName, &cchCatidName, NULL, NULL, NULL, NULL);
253 break;
254
255 dwIndex++;
256
257 HRESULT hr2 = CLSIDFromString(szCatidName, &currentCatid);
258 if (FAILED(hr2))
259 continue; // Skip invalid GUID strings
260
261 if (ulCount <= 0)
262 {
263 *pcatid = currentCatid;
264 hr = S_OK; // Found a category
265 break;
266 }
267
268 // If a list of categories is provided, check if the current one is in the list
269 BOOL bFound = FALSE;
270 for (ULONG j = 0; j < ulCount; j++)
271 {
272 if (currentCatid == *ppcatidList[j])
273 {
274 bFound = TRUE;
275 *pcatid = currentCatid;
276 hr = S_OK; // Found a matching category
277 break;
278 }
279 }
280 if (bFound)
281 break; // Found and matched, so stop searching
282 }
283
285 return hr;
286}
#define szwSystemTIPKey
Definition: precomp.h:105
#define RegCloseKey(hKey)
Definition: registry.h:49
#define E_INVALIDARG
Definition: ddrawi.h:101
#define ERROR_SUCCESS
Definition: deptool.c:10
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2504
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2338
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#define GUID_NULL
Definition: ks.h:106
#define error(str)
Definition: mkdosfs.c:1605
static const WCHAR szGuid[]
Definition: rtlstr.c:1892
#define KEY_READ
Definition: nt_native.h:1026
HRESULT hr
Definition: shlfolder.c:183
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
uint32_t ULONG
Definition: typedefs.h:59
#define S_FALSE
Definition: winerror.h:3451
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ GetGUID()

STDMETHODIMP CCategoryMgr::GetGUID ( _In_ TfGuidAtom  guidatom,
_Out_ GUID pguid 
)
override

Definition at line 376 of file categorymgr.cpp.

379{
380 TRACE("%p -> (%d, %p)\n", this, guidatom, pguid);
381
382 if (!pguid)
383 return E_INVALIDARG;
384
385 *pguid = GUID_NULL;
386
388 *pguid = *(const GUID *)get_Cookie_data(guidatom);
389
390 return S_OK;
391}
#define COOKIE_MAGIC_GUIDATOM
Definition: precomp.h:35
EXTERN_C DWORD get_Cookie_magic(DWORD id)
Definition: msctf.cpp:203
EXTERN_C LPVOID get_Cookie_data(DWORD id)
Definition: msctf.cpp:217

◆ GetGUIDDescription()

STDMETHODIMP CCategoryMgr::GetGUIDDescription ( _In_ REFGUID  rguid,
_Out_ BSTR pbstrDesc 
)
override

Definition at line 306 of file categorymgr.cpp.

309{
310 FIXME("STUB:(%p)\n", this);
311 return E_NOTIMPL;
312}

◆ GetGUIDDWORD()

STDMETHODIMP CCategoryMgr::GetGUIDDWORD ( _In_ REFGUID  rguid,
_Out_ DWORD pdw 
)
override

Definition at line 331 of file categorymgr.cpp.

334{
335 FIXME("STUB:(%p)\n", this);
336 return E_NOTIMPL;
337}

◆ IsEqualTfGuidAtom()

STDMETHODIMP CCategoryMgr::IsEqualTfGuidAtom ( _In_ TfGuidAtom  guidatom,
_In_ REFGUID  rguid,
_Out_ BOOL pfEqual 
)
override

Definition at line 393 of file categorymgr.cpp.

397{
398 TRACE("%p -> (%d %s %p)\n", this, guidatom, debugstr_guid(&rguid), pfEqual);
399
400 if (!pfEqual)
401 return E_INVALIDARG;
402
403 *pfEqual = FALSE;
405 {
406 if (rguid == *(const GUID *)get_Cookie_data(guidatom))
407 *pfEqual = TRUE;
408 }
409
410 return S_OK;
411}
#define debugstr_guid
Definition: kernel32.h:35

◆ QueryInterface()

STDMETHODIMP CCategoryMgr::QueryInterface ( REFIID  riid,
void **  ppvObj 
)
override

Implements IUnknown.

Definition at line 96 of file categorymgr.cpp.

97{
98 if (!ppvObj)
99 return E_INVALIDARG;
100
101 *ppvObj = NULL;
102
103 if (riid == IID_IUnknown || riid == IID_ITfCategoryMgr)
104 *ppvObj = this;
105
106 if (*ppvObj)
107 {
108 AddRef();
109 return S_OK;
110 }
111
112 WARN("unsupported interface: %s\n", debugstr_guid(&riid));
113 return E_NOINTERFACE;
114}
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
ULONG AddRef()
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ RegisterCategory()

STDMETHODIMP CCategoryMgr::RegisterCategory ( _In_ REFCLSID  rclsid,
_In_ REFGUID  rcatid,
_In_ REFGUID  rguid 
)
override

Definition at line 129 of file categorymgr.cpp.

133{
134 WCHAR szFullKey[110], szClsid[39], szCatid[39], szGuid[39];
135 HKEY hTipKey = NULL, hCatKey = NULL, hItemKey = NULL;
137 HRESULT hr = E_FAIL;
138
139 TRACE("%p -> (%s, %s, %s)\n", this, debugstr_guid(&rclsid), debugstr_guid(&rcatid),
140 debugstr_guid(&rguid));
141
142 StringFromGUID2(rclsid, szClsid, _countof(szClsid));
143 StringFromGUID2(rcatid, szCatid, _countof(szCatid));
145
146 StringCchPrintfW(szFullKey, _countof(szFullKey), L"%s\\%s", szwSystemTIPKey, szClsid);
147 error = RegOpenKeyExW(HKEY_LOCAL_MACHINE, szFullKey, 0, KEY_READ | KEY_WRITE, &hTipKey);
148 if (error != ERROR_SUCCESS)
149 return E_FAIL;
150
151 StringCchPrintfW(szFullKey, _countof(szFullKey), L"Category\\Category\\%s\\%s", szCatid, szGuid);
152 error = RegCreateKeyExW(hTipKey, szFullKey, 0, NULL, 0, KEY_READ | KEY_WRITE, NULL,
153 &hCatKey, NULL);
154 if (error == ERROR_SUCCESS)
155 {
156 RegCloseKey(hCatKey);
157
158 StringCchPrintfW(szFullKey, _countof(szFullKey), L"Category\\Item\\%s\\%s", szGuid, szCatid);
159 error = RegCreateKeyExW(hTipKey, szFullKey, 0, NULL, 0, KEY_READ | KEY_WRITE, NULL,
160 &hItemKey, NULL);
161 if (error == ERROR_SUCCESS)
162 {
163 RegCloseKey(hItemKey);
164 hr = S_OK;
165 }
166 }
167
168 RegCloseKey(hTipKey);
169 return hr;
170}
#define E_FAIL
Definition: ddrawi.h:102
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
#define KEY_WRITE
Definition: nt_native.h:1034

◆ RegisterGUID()

STDMETHODIMP CCategoryMgr::RegisterGUID ( _In_ REFGUID  rguid,
_Out_ TfGuidAtom pguidatom 
)
override

Definition at line 339 of file categorymgr.cpp.

342{
343 TRACE("%p -> (%s, %p)\n", this, debugstr_guid(&rguid), pguidatom);
344
345 if (!pguidatom)
346 return E_INVALIDARG;
347
348 DWORD dwCookieId = 0, dwEnumIndex = 0;
349 do
350 {
351 dwCookieId = enumerate_Cookie(COOKIE_MAGIC_GUIDATOM, &dwEnumIndex);
352 if (dwCookieId && rguid == *(const GUID *)get_Cookie_data(dwCookieId))
353 {
354 *pguidatom = dwCookieId;
355 return S_OK;
356 }
357 } while (dwCookieId != 0);
358
359 GUID *pNewGuid = (GUID *)cicMemAlloc(sizeof(GUID));
360 if (!pNewGuid)
361 return E_OUTOFMEMORY;
362
363 *pNewGuid = rguid;
364
365 dwCookieId = generate_Cookie(COOKIE_MAGIC_GUIDATOM, pNewGuid);
366 if (dwCookieId == 0)
367 {
368 cicMemFree(pNewGuid);
369 return E_FAIL;
370 }
371
372 *pguidatom = dwCookieId;
373 return S_OK;
374}
static LPVOID cicMemAlloc(SIZE_T size)
Definition: cicbase.h:10
static void cicMemFree(LPVOID ptr)
Definition: cicbase.h:20
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
EXTERN_C DWORD enumerate_Cookie(DWORD magic, DWORD *index)
Definition: msctf.cpp:246
EXTERN_C DWORD generate_Cookie(DWORD magic, LPVOID data)
Definition: msctf.cpp:157

◆ RegisterGUIDDescription()

STDMETHODIMP CCategoryMgr::RegisterGUIDDescription ( _In_ REFCLSID  rclsid,
_In_ REFGUID  rguid,
_In_ const WCHAR pchDesc,
_In_ ULONG  cch 
)
override

Definition at line 288 of file categorymgr.cpp.

293{
294 FIXME("STUB:(%p)\n", this);
295 return E_NOTIMPL;
296}

◆ RegisterGUIDDWORD()

STDMETHODIMP CCategoryMgr::RegisterGUIDDWORD ( _In_ REFCLSID  rclsid,
_In_ REFGUID  rguid,
_In_ DWORD  dw 
)
override

Definition at line 314 of file categorymgr.cpp.

318{
319 FIXME("STUB:(%p)\n", this);
320 return E_NOTIMPL;
321}

◆ STDMETHODIMP_() [1/2]

CCategoryMgr::STDMETHODIMP_ ( ULONG  )
override

◆ STDMETHODIMP_() [2/2]

CCategoryMgr::STDMETHODIMP_ ( ULONG  )
override

◆ UnregisterCategory()

STDMETHODIMP CCategoryMgr::UnregisterCategory ( _In_ REFCLSID  rclsid,
_In_ REFGUID  rcatid,
_In_ REFGUID  rguid 
)
override

Definition at line 172 of file categorymgr.cpp.

176{
177 WCHAR szFullKey[110], szClsid[39], szCatid[39], szGuid[39];
178 HKEY hTipKey = NULL;
180
181 TRACE("%p -> (%s %s %s)\n", this, debugstr_guid(&rclsid), debugstr_guid(&rcatid),
182 debugstr_guid(&rguid));
183
184 StringFromGUID2(rclsid, szClsid, _countof(szClsid));
185 StringFromGUID2(rcatid, szCatid, _countof(szCatid));
187
188 StringCchPrintfW(szFullKey, _countof(szFullKey), L"%s\\%s", szwSystemTIPKey, szClsid);
189 error = RegOpenKeyExW(HKEY_LOCAL_MACHINE, szFullKey, 0, KEY_READ | KEY_WRITE, &hTipKey);
190 if (error != ERROR_SUCCESS)
191 return E_FAIL;
192
193 StringCchPrintfW(szFullKey, _countof(szFullKey), L"Category\\Category\\%s\\%s", szCatid, szGuid);
194 RegDeleteTreeW(hTipKey, szFullKey);
195
196 StringCchPrintfW(szFullKey, _countof(szFullKey), L"Category\\Item\\%s\\%s", szGuid, szCatid);
197 RegDeleteTreeW(hTipKey, szFullKey);
198
199 RegCloseKey(hTipKey);
200 return S_OK;
201}
LSTATUS WINAPI RegDeleteTreeW(_In_ HKEY, _In_opt_ LPCWSTR)

◆ UnregisterGUIDDescription()

STDMETHODIMP CCategoryMgr::UnregisterGUIDDescription ( _In_ REFCLSID  rclsid,
_In_ REFGUID  rguid 
)
override

Definition at line 298 of file categorymgr.cpp.

301{
302 FIXME("STUB:(%p)\n", this);
303 return E_NOTIMPL;
304}

◆ UnregisterGUIDDWORD()

STDMETHODIMP CCategoryMgr::UnregisterGUIDDWORD ( _In_ REFCLSID  rclsid,
_In_ REFGUID  rguid 
)
override

Definition at line 323 of file categorymgr.cpp.

326{
327 FIXME("STUB:(%p)\n", this);
328 return E_NOTIMPL;
329}

Member Data Documentation

◆ m_cRefs

LONG CCategoryMgr::m_cRefs
protected

Definition at line 81 of file categorymgr.cpp.

Referenced by STDMETHODIMP_().


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