ReactOS  0.4.15-dev-3181-g4acf100
CFontExt.hpp
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Font Shell Extension
3  * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE: CFontExt definition
5  * COPYRIGHT: Copyright 2019,2020 Mark Jansen <mark.jansen@reactos.org>
6  * Copyright 2019 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
7  */
8 
9 #pragma once
10 
11 class CFontExt :
12  public CComCoClass<CFontExt, &CLSID_CFontExt>,
13  public CComObjectRootEx<CComMultiThreadModelNoCS>,
14  public IShellFolder2,
15  public IPersistFolder2,
16  public IDropTarget
17 {
18  CComHeapPtr<ITEMIDLIST> m_Folder;
19 
20 public:
21 
22  CFontExt();
23  ~CFontExt();
24 
25  // *** IShellFolder2 methods ***
26  virtual STDMETHODIMP GetDefaultSearchGUID(GUID *lpguid);
27  virtual STDMETHODIMP EnumSearches(IEnumExtraSearch **ppenum);
28  virtual STDMETHODIMP GetDefaultColumn(DWORD dwReserved, ULONG *pSort, ULONG *pDisplay);
29  virtual STDMETHODIMP GetDefaultColumnState(UINT iColumn, SHCOLSTATEF *pcsFlags);
30  virtual STDMETHODIMP GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv);
31  virtual STDMETHODIMP GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd);
32  virtual STDMETHODIMP MapColumnToSCID(UINT iColumn, SHCOLUMNID *pscid);
33 
34  // *** IShellFolder methods ***
35  virtual STDMETHODIMP ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes);
36  virtual STDMETHODIMP EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList);
37  virtual STDMETHODIMP BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
38  virtual STDMETHODIMP BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut);
40  virtual STDMETHODIMP CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut);
41  virtual STDMETHODIMP GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut);
42  virtual STDMETHODIMP GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut);
44  virtual STDMETHODIMP SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut);
45 
46 
47  // *** IPersistFolder2 methods ***
48  virtual STDMETHODIMP GetCurFolder(LPITEMIDLIST *ppidl);
49 
50  // *** IPersistFolder methods ***
52 
53  // *** IPersist methods ***
54  virtual STDMETHODIMP GetClassID(CLSID *lpClassId);
55 
56  // *** IDropTarget methods ***
57  virtual STDMETHODIMP DragEnter(IDataObject* pDataObj, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
58  virtual STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
59  virtual STDMETHODIMP DragLeave();
60  virtual STDMETHODIMP Drop(IDataObject* pDataObj, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
61 
62 #if 0
63  static HRESULT WINAPI log_stuff(void* pv, REFIID riid, LPVOID* ppv, DWORD_PTR dw)
64  {
65  WCHAR* g2s(REFCLSID iid);
66 
68  StringCchPrintfW(buffer, _countof(buffer), L"CFontExt::QueryInterface(%s)\n", g2s(riid));
70 
71  return E_NOINTERFACE;
72  }
73 #endif
74 
75 protected:
76 
77 public:
78 
81 
83 
85  COM_INTERFACE_ENTRY_IID(IID_IShellFolder2, IShellFolder2)
86  COM_INTERFACE_ENTRY_IID(IID_IShellFolder, IShellFolder)
87  COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2)
88  COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder)
89  COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
90  //COM_INTERFACE_ENTRY_FUNC_BLIND(0, log_stuff)
91  END_COM_MAP()
92 
93  HRESULT DoInstallFontFile(LPCWSTR pszFontPath, LPCWSTR pszFontsDir, HKEY hkeyFonts);
94  HRESULT DoGetFontTitle(IN LPCWSTR pszFontPath, OUT CStringW& strFontName);
95 };
#define IN
Definition: typedefs.h:39
virtual STDMETHODIMP DragLeave()
Definition: CFontExt.cpp:522
virtual STDMETHODIMP GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd)
Definition: CFontExt.cpp:132
#define REFIID
Definition: guiddef.h:118
#define E_NOINTERFACE
Definition: winerror.h:2364
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
interface IBindCtx * LPBC
Definition: objfwd.h:18
#define pt(x, y)
Definition: drawing.c:79
REFIID riid
Definition: precomp.h:44
virtual STDMETHODIMP GetClassID(CLSID *lpClassId)
Definition: CFontExt.cpp:497
#define REFCLSID
Definition: guiddef.h:117
virtual STDMETHODIMP Initialize(LPCITEMIDLIST pidl)
Definition: CFontExt.cpp:466
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
_In_ LPCSTR lpName
Definition: winbase.h:2768
REFIID LPVOID * ppv
Definition: atlbase.h:39
virtual STDMETHODIMP DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: CFontExt.cpp:504
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70
~CFontExt()
Definition: CFontExt.cpp:93
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:612
GLuint buffer
Definition: glext.h:5915
static LPOLESTR
Definition: stg_prop.c:27
virtual STDMETHODIMP CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2)
Definition: CFontExt.cpp:257
HRESULT DoInstallFontFile(LPCWSTR pszFontPath, LPCWSTR pszFontsDir, HKEY hkeyFonts)
Definition: CFontExt.cpp:617
virtual STDMETHODIMP EnumSearches(IEnumExtraSearch **ppenum)
Definition: CFontExt.cpp:105
void WINAPI SHIM_OBJ_NAME() OutputDebugStringW(LPCWSTR lpOutputString)
Definition: ignoredbgout.c:23
const PCUITEMID_CHILD * PCUITEMID_CHILD_ARRAY
Definition: shtypes.idl:71
virtual STDMETHODIMP BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
Definition: CFontExt.cpp:245
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
virtual STDMETHODIMP GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet)
Definition: CFontExt.cpp:417
#define STDMETHODIMP
Definition: basetyps.h:43
REFIID LPVOID DWORD_PTR dw
Definition: atlbase.h:40
virtual STDMETHODIMP GetDefaultColumnState(UINT iColumn, SHCOLSTATEF *pcsFlags)
Definition: CFontExt.cpp:117
LONG_PTR LPARAM
Definition: windef.h:208
HRESULT DoGetFontTitle(IN LPCWSTR pszFontPath, OUT CStringW &strFontName)
Definition: CFontExt.cpp:658
virtual STDMETHODIMP ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes)
Definition: CFontExt.cpp:234
WCHAR * g2s(REFCLSID iid)
Definition: CFontExt.cpp:62
virtual STDMETHODIMP BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
Definition: CFontExt.cpp:251
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:542
CFontExt()
Definition: CFontExt.cpp:88
virtual STDMETHODIMP GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut)
Definition: CFontExt.cpp:374
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
#define WINAPI
Definition: msvc.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
virtual STDMETHODIMP Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: CFontExt.cpp:527
virtual STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: CFontExt.cpp:517
DWORD SHCOLSTATEF
Definition: shtypes.idl:142
virtual STDMETHODIMP GetDefaultSearchGUID(GUID *lpguid)
Definition: CFontExt.cpp:99
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
virtual STDMETHODIMP GetCurFolder(LPITEMIDLIST *ppidl)
Definition: CFontExt.cpp:453
#define DECLARE_REGISTRY_RESOURCEID(x)
Definition: atlcom.h:606
uint32_t DWORD_PTR
Definition: typedefs.h:65
CComHeapPtr< ITEMIDLIST > m_Folder
Definition: CFontExt.hpp:18
virtual STDMETHODIMP EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
Definition: CFontExt.cpp:240
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:562
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
unsigned int UINT
Definition: ndis.h:50
virtual STDMETHODIMP CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
Definition: CFontExt.cpp:316
virtual STDMETHODIMP GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv)
Definition: CFontExt.cpp:126
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:640
const ITEMIDLIST_RELATIVE UNALIGNED * PCUIDLIST_RELATIVE
Definition: shtypes.idl:57
virtual STDMETHODIMP GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut)
Definition: CFontExt.cpp:345
#define OUT
Definition: typedefs.h:40
unsigned int ULONG
Definition: retypes.h:1
CAtlStringW CStringW
Definition: atlstr.h:130
virtual STDMETHODIMP MapColumnToSCID(UINT iColumn, SHCOLUMNID *pscid)
Definition: CFontExt.cpp:227
virtual STDMETHODIMP SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut)
Definition: CFontExt.cpp:446
#define END_COM_MAP()
Definition: atlcom.h:553
virtual STDMETHODIMP GetDefaultColumn(DWORD dwReserved, ULONG *pSort, ULONG *pDisplay)
Definition: CFontExt.cpp:111
#define IDR_FONTEXT
Definition: resource.h:15
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
LPARAM lParam
Definition: combotst.c:139