ReactOS  0.4.15-dev-2961-gecb0c09
CFontExt.cpp
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 implementation
5  * COPYRIGHT: Copyright 2019-2021 Mark Jansen <mark.jansen@reactos.org>
6  * Copyright 2019 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
7  */
8 
9 #include "precomp.h"
10 #include "undocgdi.h" // for GetFontResourceInfoW
11 
13 
14 #ifndef SHCIDS_ALLFIELDS
15 #define SHCIDS_ALLFIELDS 0x80000000L
16 #endif
17 
19 {
20  int iResource;
22  int cxChar;
23  int fmt;
24 };
25 
27 {
33 };
34 
36 {
42 };
43 
44 
45 
46 // Should fix our headers..
48 
49 
50 // Helper functions to translate a guid to a readable name
51 bool GetInterfaceName(const WCHAR* InterfaceString, WCHAR* buf, size_t size)
52 {
53  WCHAR LocalBuf[100];
54  DWORD dwType = 0, dwDataSize = size * sizeof(WCHAR);
55 
56  if (!SUCCEEDED(StringCchPrintfW(LocalBuf, _countof(LocalBuf), L"Interface\\%s", InterfaceString)))
57  return false;
58 
59  return RegGetValueW(HKEY_CLASSES_ROOT, LocalBuf, NULL, RRF_RT_REG_SZ, &dwType, buf, &dwDataSize) == ERROR_SUCCESS;
60 }
61 
63 {
64  static WCHAR buf[2][300];
65  static int idx = 0;
66 
67  idx ^= 1;
68 
69  LPOLESTR tmp;
70  HRESULT hr = ProgIDFromCLSID(iid, &tmp);
71  if (SUCCEEDED(hr))
72  {
73  wcscpy(buf[idx], tmp);
74  CoTaskMemFree(tmp);
75  return buf[idx];
76  }
79  {
80  return buf[idx];
81  }
83 
84  return buf[idx];
85 }
86 
87 
89 {
91 }
92 
94 {
96 }
97 
98 // *** IShellFolder2 methods ***
100 {
101  ERR("%s() UNIMPLEMENTED\n", __FUNCTION__);
102  return E_NOTIMPL;
103 }
104 
106 {
107  ERR("%s() UNIMPLEMENTED\n", __FUNCTION__);
108  return E_NOTIMPL;
109 }
110 
112 {
113  ERR("%s() UNIMPLEMENTED\n", __FUNCTION__);
114  return E_NOTIMPL;
115 }
116 
118 {
119  if (!pcsFlags || iColumn >= _countof(g_ColumnDefs))
120  return E_INVALIDARG;
121 
122  *pcsFlags = g_ColumnDefs[iColumn].dwDefaultState;
123  return S_OK;
124 }
125 
127 {
128  ERR("%s() UNIMPLEMENTED\n", __FUNCTION__);
129  return E_NOTIMPL;
130 }
131 
133 {
134  if (iColumn >= _countof(g_ColumnDefs))
135  return E_FAIL;
136 
137  psd->cxChar = g_ColumnDefs[iColumn].cxChar;
138  psd->fmt = g_ColumnDefs[iColumn].fmt;
139 
140  // No item requested, so return the column name
141  if (pidl == NULL)
142  {
143  return SHSetStrRet(&psd->str, _AtlBaseModule.GetResourceInstance(), g_ColumnDefs[iColumn].iResource);
144  }
145 
146  // Validate that this pidl is the last one
147  PCUIDLIST_RELATIVE curpidl = ILGetNext(pidl);
148  if (curpidl->mkid.cb != 0)
149  {
150  ERR("ERROR, unhandled PIDL!\n");
151  return E_FAIL;
152  }
153 
154  // Name, ReactOS specific?
155  if (iColumn == FONTEXT_COL_NAME)
156  return GetDisplayNameOf(pidl, 0, &psd->str);
157 
158  const FontPidlEntry* fontEntry = _FontFromIL(pidl);
159  if (!fontEntry)
160  {
161  ERR("ERROR, not a font PIDL!\n");
162  return E_FAIL;
163  }
164 
165  // If we got here, we are in details view!
166  auto info = g_FontCache->Find(fontEntry);
167  if (info == nullptr)
168  {
169  ERR("Unable to query info about %S\n", fontEntry->Name);
171  }
172 
173  int ret;
174  CStringA AttrLetters;
177  switch (iColumn)
178  {
180  return SHSetStrRet(&psd->str, PathFindFileNameW(info->File()));
181  case FONTEXT_COL_SIZE:
182  psd->str.uType = STRRET_CSTR;
183  StrFormatKBSizeA(info->FileSize().QuadPart, psd->str.cStr, MAX_PATH);
184  return S_OK;
186  psd->str.uType = STRRET_CSTR;
187  FileTimeToSystemTime(&info->FileWriteTime(), &time);
189  if (ret < 1)
190  {
191  ERR("GetDateFormatA failed\n");
192  return E_FAIL;
193  }
194  psd->str.cStr[ret-1] = ' ';
196  return S_OK;
197  case FONTEXT_COL_ATTR:
198  AttrLetters.LoadString(IDS_COL_ATTR_LETTERS);
199  if (AttrLetters.GetLength() != 5)
200  {
201  ERR("IDS_COL_ATTR_LETTERS does not contain 5 letters!\n");
202  return E_FAIL;
203  }
204  psd->str.uType = STRRET_CSTR;
205  dwAttributes = info->FileAttributes();
206  ret = 0;
208  psd->str.cStr[ret++] = AttrLetters[0];
210  psd->str.cStr[ret++] = AttrLetters[1];
212  psd->str.cStr[ret++] = AttrLetters[2];
214  psd->str.cStr[ret++] = AttrLetters[3];
216  psd->str.cStr[ret++] = AttrLetters[4];
217  psd->str.cStr[ret] = '\0';
218  return S_OK;
219  default:
220  break;
221  }
222 
224  return E_NOTIMPL;
225 }
226 
228 {
229  //ERR("%s() UNIMPLEMENTED\n", __FUNCTION__);
230  return E_NOTIMPL;
231 }
232 
233 // *** IShellFolder2 methods ***
234 STDMETHODIMP CFontExt::ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes)
235 {
236  ERR("%s() UNIMPLEMENTED\n", __FUNCTION__);
237  return E_NOTIMPL;
238 }
239 
240 STDMETHODIMP CFontExt::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
241 {
242  return _CEnumFonts_CreateInstance(this, dwFlags, IID_PPV_ARG(IEnumIDList, ppEnumIDList));
243 }
244 
246 {
247  ERR("%s(riid=%S) UNIMPLEMENTED\n", __FUNCTION__, g2s(riid));
248  return E_NOTIMPL;
249 }
250 
252 {
253  ERR("%s() UNIMPLEMENTED\n", __FUNCTION__);
254  return E_NOTIMPL;
255 }
256 
258 {
259  const FontPidlEntry* fontEntry1 = _FontFromIL(pidl1);
260  const FontPidlEntry* fontEntry2 = _FontFromIL(pidl2);
261 
262  if (!fontEntry1 || !fontEntry2)
263  return E_INVALIDARG;
264 
265  int result;
266  DWORD sortMode = lParam & 0xFFFF0000;
267  DWORD column = lParam & 0x0000FFFF;
268  if (sortMode == SHCIDS_ALLFIELDS)
269  {
271  result = (int)fontEntry1->Index - (int)fontEntry2->Index;
272  }
273  else
274  {
275  auto info1 = g_FontCache->Find(fontEntry1);
276  auto info2 = g_FontCache->Find(fontEntry2);
277 
278  if (!info1 || !info2)
279  {
280  ERR("Unable to find font %S or %S in cache!\n", fontEntry1->Name, fontEntry2->Name);
281  return E_INVALIDARG;
282  }
283 
284  switch (column)
285  {
286  case 0xffff:
287  /* ROS bug? */
288  case FONTEXT_COL_NAME:
289  // These items are already ordered by name
290  result = (int)fontEntry1->Index - (int)fontEntry2->Index;
291  break;
293  result = wcsicmp(PathFindFileNameW(info1->File()), PathFindFileNameW(info2->File()));
294  break;
295  case FONTEXT_COL_SIZE:
296  result = (int)info1->FileSize().HighPart - info2->FileSize().HighPart;
297  if (result == 0)
298  result = (int)info1->FileSize().LowPart - info2->FileSize().LowPart;
299  break;
301  result = CompareFileTime(&info1->FileWriteTime(), &info2->FileWriteTime());
302  break;
303  case FONTEXT_COL_ATTR:
304  // FIXME: how to compare attributes?
305  result = (int)info1->FileAttributes() - info2->FileAttributes();
306  break;
307  default:
308  ERR("Unimplemented column %u\n", column);
309  return E_INVALIDARG;
310  }
311  }
312 
314 }
315 
317 {
319 
320  *ppvOut = NULL;
321 
322  if (IsEqualIID(riid, IID_IDropTarget))
323  {
324  ERR("IDropTarget not implemented\n");
325  *ppvOut = static_cast<IDropTarget *>(this);
326  AddRef();
327  hr = S_OK;
328  }
329  else if (IsEqualIID(riid, IID_IContextMenu))
330  {
331  ERR("IContextMenu not implemented\n");
332  hr = E_NOTIMPL;
333  }
334  else if (IsEqualIID(riid, IID_IShellView))
335  {
336  // Just create a default shell folder view, and register ourself as folder
337  SFV_CREATE sfv = { sizeof(SFV_CREATE) };
338  sfv.pshf = this;
339  hr = SHCreateShellFolderView(&sfv, (IShellView**)ppvOut);
340  }
341 
342  return hr;
343 }
344 
346 {
347  if (!rgfInOut || !cidl || !apidl)
348  return E_INVALIDARG;
349 
350  DWORD rgf = 0;
351  while (cidl > 0 && *apidl)
352  {
353  const FontPidlEntry* fontEntry = _FontFromIL(*apidl);
354  if (fontEntry)
355  {
356  // We don't support delete yet
357  rgf |= (/*SFGAO_CANDELETE |*/ SFGAO_HASPROPSHEET | SFGAO_CANCOPY | SFGAO_FILESYSTEM);
358  }
359  else
360  {
361  rgf = 0;
362  break;
363  }
364 
365  apidl++;
366  cidl--;
367  }
368 
369  *rgfInOut = rgf;
370  return S_OK;
371 }
372 
373 
375 {
376  if (riid == IID_IContextMenu ||
377  riid == IID_IContextMenu2 ||
378  riid == IID_IContextMenu3)
379  {
380  return _CFontMenu_CreateInstance(hwndOwner, cidl, apidl, this, riid, ppvOut);
381  }
382  else if (riid == IID_IExtractIconA || riid == IID_IExtractIconW)
383  {
384  if (cidl == 1)
385  {
386  const FontPidlEntry* fontEntry = _FontFromIL(*apidl);
387  if (fontEntry)
388  {
391  // Just create a default icon extractor based on the filename
392  // We might want to create a preview with the font to get really fancy one day.
394  }
395  }
396  else
397  {
398  ERR("IID_IExtractIcon with cidl != 1 UNIMPLEMENTED\n");
399  }
400  }
401  else if (riid == IID_IDataObject)
402  {
403  if (cidl >= 1)
404  {
405  return _CDataObject_CreateInstance(m_Folder, cidl, apidl, riid, ppvOut);
406  }
407  else
408  {
409  ERR("IID_IDataObject with cidl == 0 UNIMPLEMENTED\n");
410  }
411  }
412 
413  //ERR("%s(riid=%S) UNIMPLEMENTED\n", __FUNCTION__, g2s(riid));
414  return E_NOTIMPL;
415 }
416 
418 {
419  if (!pidl)
420  return E_NOTIMPL;
421 
422  // Validate that this pidl is the last one
423  PCUIDLIST_RELATIVE curpidl = ILGetNext(pidl);
424  if (curpidl->mkid.cb != 0)
425  {
426  ERR("ERROR, unhandled PIDL!\n");
427  return E_FAIL;
428  }
429 
430  const FontPidlEntry* fontEntry = _FontFromIL(pidl);
431  if (!fontEntry)
432  return E_FAIL;
433 
434  if (dwFlags == SHGDN_FORPARSING)
435  {
436  CStringW File = g_FontCache->Filename(g_FontCache->Find(fontEntry), true);
437  if (!File.IsEmpty())
438  {
439  return SHSetStrRet(strRet, File);
440  }
441  }
442 
443  return SHSetStrRet(strRet, fontEntry->Name);
444 }
445 
447 {
448  ERR("%s() UNIMPLEMENTED\n", __FUNCTION__);
449  return E_NOTIMPL;
450 }
451 
452 // *** IPersistFolder2 methods ***
454 {
455  if (ppidl && m_Folder)
456  {
457  *ppidl = ILClone(m_Folder);
458  return S_OK;
459  }
460 
461  return E_POINTER;
462 }
463 
464 
465 // *** IPersistFolder methods ***
467 {
468  WCHAR PidlPath[MAX_PATH + 1] = {0}, FontsDir[MAX_PATH + 1];
469  if (!SHGetPathFromIDListW(pidl, PidlPath))
470  {
471  ERR("Unable to extract path from pidl\n");
472  return E_FAIL;
473  }
474 
475  HRESULT hr = SHGetFolderPathW(NULL, CSIDL_FONTS, NULL, 0, FontsDir);
476  if (FAILED_UNEXPECTEDLY(hr))
477  {
478  ERR("Unable to get fonts path (0x%x)\n", hr);
479  return hr;
480  }
481 
482  if (_wcsicmp(PidlPath, FontsDir))
483  {
484  ERR("CFontExt View initializing on unexpected folder: '%S'\n", PidlPath);
485  return E_FAIL;
486  }
487 
488  m_Folder.Attach(ILClone(pidl));
489  StringCchCatW(FontsDir, _countof(FontsDir), L"\\");
490  g_FontCache->SetFontDir(FontsDir);
491 
492  return S_OK;
493 }
494 
495 
496 // *** IPersist methods ***
498 {
499  *lpClassId = CLSID_CFontExt;
500  return S_OK;
501 }
502 
503 // *** IDropTarget methods ***
504 STDMETHODIMP CFontExt::DragEnter(IDataObject* pDataObj, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect)
505 {
506  *pdwEffect = DROPEFFECT_NONE;
507 
508  CComHeapPtr<CIDA> cida;
509  HRESULT hr = _GetCidlFromDataObject(pDataObj, &cida);
510  if (FAILED_UNEXPECTEDLY(hr))
511  return hr;
512 
513  *pdwEffect = DROPEFFECT_COPY;
514  return S_OK;
515 }
516 
518 {
519  return S_OK;
520 }
521 
523 {
524  return S_OK;
525 }
526 
527 STDMETHODIMP CFontExt::Drop(IDataObject* pDataObj, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect)
528 {
529  *pdwEffect = DROPEFFECT_NONE;
530 
531  CComHeapPtr<CIDA> cida;
532  HRESULT hr = _GetCidlFromDataObject(pDataObj, &cida);
533  if (FAILED_UNEXPECTEDLY(hr))
534  return hr;
535 
536  PCUIDLIST_ABSOLUTE pidlParent = HIDA_GetPIDLFolder(cida);
537  if (!pidlParent)
538  {
539  ERR("pidlParent is NULL\n");
540  return E_FAIL;
541  }
542 
543  BOOL bOK = TRUE;
544  CAtlArray<CStringW> FontPaths;
545  for (UINT n = 0; n < cida->cidl; ++n)
546  {
547  PCUIDLIST_RELATIVE pidlRelative = HIDA_GetPIDLItem(cida, n);
548  if (!pidlRelative)
549  continue;
550 
551  PIDLIST_ABSOLUTE pidl = ILCombine(pidlParent, pidlRelative);
552  if (!pidl)
553  {
554  ERR("ILCombine failed\n");
555  bOK = FALSE;
556  break;
557  }
558 
561  ILFree(pidl);
562 
563  if (!ret)
564  {
565  ERR("SHGetPathFromIDListW failed\n");
566  bOK = FALSE;
567  break;
568  }
569 
571  {
572  ERR("PathIsDirectory\n");
573  bOK = FALSE;
574  break;
575  }
576 
577  LPCWSTR pchDotExt = PathFindExtensionW(szPath);
578  if (!IsFontDotExt(pchDotExt))
579  {
580  ERR("'%S' is not supported\n", pchDotExt);
581  bOK = FALSE;
582  break;
583  }
584 
585  FontPaths.Add(szPath);
586  }
587 
588  if (!bOK)
589  return E_FAIL;
590 
591  CRegKey keyFonts;
592  if (keyFonts.Open(FONT_HIVE, FONT_KEY, KEY_WRITE) != ERROR_SUCCESS)
593  {
594  ERR("keyFonts.Open failed\n");
595  return E_FAIL;
596  }
597 
598  for (size_t iItem = 0; iItem < FontPaths.GetCount(); ++iItem)
599  {
600  HRESULT hr = DoInstallFontFile(FontPaths[iItem], g_FontCache->FontPath(), keyFonts.m_hKey);
601  if (FAILED_UNEXPECTEDLY(hr))
602  {
603  bOK = FALSE;
604  break;
605  }
606  }
607 
608  // TODO: update g_FontCache
609 
611 
612  // TODO: Show message
613 
614  return bOK ? S_OK : E_FAIL;
615 }
616 
617 HRESULT CFontExt::DoInstallFontFile(LPCWSTR pszFontPath, LPCWSTR pszFontsDir, HKEY hkeyFonts)
618 {
619  WCHAR szDestFile[MAX_PATH];
620  LPCWSTR pszFileTitle = PathFindFileName(pszFontPath);
621 
622  CStringW strFontName;
623  if (!DoGetFontTitle(pszFontPath, strFontName))
624  return E_FAIL;
625 
626  RemoveFontResourceW(pszFileTitle);
627 
628  StringCchCopyW(szDestFile, sizeof(szDestFile), pszFontsDir);
629  PathAppendW(szDestFile, pszFileTitle);
630  if (!CopyFileW(pszFontPath, szDestFile, FALSE))
631  {
632  ERR("CopyFileW('%S', '%S') failed\n", pszFontPath, szDestFile);
633  return E_FAIL;
634  }
635 
636  if (!AddFontResourceW(szDestFile))
637  {
638  ERR("AddFontResourceW('%S') failed\n", pszFileTitle);
639  DeleteFileW(szDestFile);
640  return E_FAIL;
641  }
642 
643  DWORD cbData = (wcslen(pszFileTitle) + 1) * sizeof(WCHAR);
644  LONG nError = RegSetValueExW(hkeyFonts, strFontName, 0, REG_SZ,
645  (const BYTE *)pszFileTitle, cbData);
646  if (nError)
647  {
648  ERR("RegSetValueExW failed with %ld\n", nError);
649  RemoveFontResourceW(pszFileTitle);
650  DeleteFileW(szDestFile);
651  return E_FAIL;
652  }
653 
654  return S_OK;
655 }
656 
657 HRESULT
658 CFontExt::DoGetFontTitle(IN LPCWSTR pszFontPath, OUT CStringW& strFontName)
659 {
660  DWORD cbInfo = 0;
661  BOOL ret = GetFontResourceInfoW(pszFontPath, &cbInfo, NULL, 1);
662  if (!ret || !cbInfo)
663  {
664  ERR("GetFontResourceInfoW failed\n");
665  return E_FAIL;
666  }
667 
668  LPWSTR pszBuffer = strFontName.GetBuffer(cbInfo / sizeof(WCHAR));
669  ret = GetFontResourceInfoW(pszFontPath, &cbInfo, pszBuffer, 1);
670  strFontName.ReleaseBuffer();
671  if (ret)
672  {
673  TRACE("pszFontName: %S\n", (LPCWSTR)strFontName);
674  return S_OK;
675  }
676 
677  ERR("GetFontResourceInfoW failed\n");
678  return E_FAIL;
679 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1965
#define SHCIDS_ALLFIELDS
Definition: CFontExt.cpp:15
int GetLength() const
Definition: atlsimpstr.h:356
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1722
DWORD dwDefaultState
Definition: CFontExt.cpp:21
#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
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
#define E_NOINTERFACE
Definition: winerror.h:2364
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
GLuint64EXT * result
Definition: glext.h:11304
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
interface IBindCtx * LPBC
Definition: objfwd.h:18
#define TRUE
Definition: types.h:120
INT WINAPI GetDateFormatA(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCSTR lpFormat, LPSTR lpDateStr, INT cchOut)
Definition: lcformat.c:922
#define pt(x, y)
Definition: drawing.c:79
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
REFIID riid
Definition: precomp.h:44
virtual STDMETHODIMP GetClassID(CLSID *lpClassId)
Definition: CFontExt.cpp:497
LONG g_ModuleRefCnt
Definition: ACPPage.cpp:13
#define REFCLSID
Definition: guiddef.h:117
#define LOCALE_USER_DEFAULT
#define DATE_SHORTDATE
Definition: winnls.h:196
virtual STDMETHODIMP Initialize(LPCITEMIDLIST pidl)
Definition: CFontExt.cpp:466
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:699
#define LVCFMT_RIGHT
Definition: commctrl.h:2599
HRESULT _CEnumFonts_CreateInstance(CFontExt *zip, DWORD flags, REFIID riid, LPVOID *ppvOut)
Definition: CEnumFonts.cpp:87
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1294
static PCUIDLIST_RELATIVE HIDA_GetPIDLItem(CIDA const *pida, SIZE_T i)
Definition: shellutils.h:554
_In_ LPCSTR lpName
Definition: winbase.h:2768
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:851
REFIID LPVOID * ppv
Definition: atlbase.h:39
GLdouble n
Definition: glext.h:7729
#define IDS_COL_NAME
Definition: resource.h:6
WINE_DEFAULT_DEBUG_CHANNEL(fontext)
#define LVCFMT_LEFT
Definition: commctrl.h:2598
const FontPidlEntry * _FontFromIL(LPCITEMIDLIST pidl)
Definition: fontpidl.cpp:32
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
#define RRF_RT_REG_SZ
Definition: driver.c:575
HRESULT _GetCidlFromDataObject(IDataObject *pDataObject, CIDA **ppcida)
Definition: CFontMenu.cpp:14
~CFontExt()
Definition: CFontExt.cpp:93
LPSTR WINAPI StrFormatKBSizeA(LONGLONG llBytes, LPSTR lpszDest, UINT cchMax)
Definition: string.c:1727
const GUID IID_IDataObject
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:546
__u16 time
Definition: mkdosfs.c:366
bool GetInterfaceName(const WCHAR *InterfaceString, WCHAR *buf, size_t size)
Definition: CFontExt.cpp:51
static LPOLESTR
Definition: stg_prop.c:27
font_columns
Definition: CFontExt.cpp:26
#define CSIDL_FONTS
Definition: shlobj.h:2031
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:3782
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
STRRET str
Definition: shtypes.idl:108
virtual STDMETHODIMP CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2)
Definition: CFontExt.cpp:257
HKEY m_hKey
Definition: atlbase.h:1013
HRESULT DoInstallFontFile(LPCWSTR pszFontPath, LPCWSTR pszFontsDir, HKEY hkeyFonts)
Definition: CFontExt.cpp:617
DWORD dwAttributes
Definition: vdmdbg.h:34
virtual STDMETHODIMP EnumSearches(IEnumExtraSearch **ppenum)
Definition: CFontExt.cpp:105
const DWORD DROPEFFECT_COPY
Definition: oleidl.idl:930
BOOL WINAPI PathAppendW(LPWSTR lpszPath, LPCWSTR lpszAppend)
Definition: path.c:126
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
int WINAPI AddFontResourceW(_In_ LPCWSTR pszFilename)
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
INT WINAPI GetTimeFormatA(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCSTR lpFormat, LPSTR lpTimeStr, INT cchOut)
Definition: lcformat.c:1030
const DWORD DROPEFFECT_NONE
Definition: oleidl.idl:929
char cStr[MAX_PATH]
Definition: shtypes.idl:98
size_t GetCount() const
Definition: atlcoll.h:373
HRESULT WINAPI DECLSPEC_HOTPATCH ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *ppszProgID)
Definition: compobj.c:2530
#define FALSE
Definition: types.h:117
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
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
BOOL IsFontDotExt(LPCWSTR pchDotExt)
Definition: precomp.h:41
if SUCCEEDED(hr)
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
virtual STDMETHODIMP GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet)
Definition: CFontExt.cpp:417
#define STDMETHODIMP
Definition: basetyps.h:43
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
#define FONT_KEY
Definition: precomp.h:31
unsigned int idx
Definition: utils.c:41
#define IDS_COL_MODIFIED
Definition: resource.h:9
#define E_INVALIDARG
Definition: ddrawi.h:101
static FolderViewColumns g_ColumnDefs[]
Definition: CFontExt.cpp:35
virtual STDMETHODIMP GetDefaultColumnState(UINT iColumn, SHCOLSTATEF *pcsFlags)
Definition: CFontExt.cpp:117
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:394
LONG_PTR LPARAM
Definition: windef.h:208
HRESULT _CFontMenu_CreateInstance(HWND hwnd, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, IShellFolder *psf, REFIID riid, LPVOID *ppvOut)
Definition: CFontMenu.cpp:146
HRESULT DoGetFontTitle(IN LPCWSTR pszFontPath, OUT CStringW &strFontName)
Definition: CFontExt.cpp:658
#define IDS_COL_SIZE
Definition: resource.h:8
virtual STDMETHODIMP ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes)
Definition: CFontExt.cpp:234
struct _SFV_CREATE SFV_CREATE
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
void SetFontDir(const LPCWSTR Path)
Definition: CFontCache.cpp:120
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 KEY_WRITE
Definition: nt_native.h:1031
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
CFontExt()
Definition: CFontExt.cpp:88
size_t Add(INARGTYPE element)
Definition: atlcoll.h:295
virtual STDMETHODIMP GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut)
Definition: CFontExt.cpp:374
#define FONT_HIVE
Definition: precomp.h:30
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:188
GLsizeiptr size
Definition: glext.h:5919
LONG WINAPI CompareFileTime(IN CONST FILETIME *lpFileTime1, IN CONST FILETIME *lpFileTime2)
Definition: time.c:106
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
BOOL WINAPI CopyFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN BOOL bFailIfExists)
Definition: copy.c:439
#define _countof(array)
Definition: sndvol32.h:68
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
#define MAX_PATH
Definition: compat.h:34
#define IDS_COL_ATTR
Definition: resource.h:10
#define WINAPI
Definition: msvc.h:6
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
LONG Open(HKEY hKeyParent, LPCTSTR lpszKeyName, REGSAM samDesired=KEY_READ|KEY_WRITE)
Definition: atlbase.h:1071
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
UINT cidl
Definition: shlobj.h:499
#define PathFindFileName
Definition: shlwapi.h:911
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI RemoveFontResourceW(_In_ LPCWSTR)
virtual STDMETHODIMP Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: CFontExt.cpp:527
#define FILE_ATTRIBUTE_COMPRESSED
Definition: nt_native.h:711
ULONG AddRef()
#define FILE_ATTRIBUTE_ARCHIVE
Definition: nt_native.h:706
#define WM_FONTCHANGE
Definition: winuser.h:1615
EXTERN_C HRESULT WINAPI SHCreateFileExtractIconW(LPCWSTR pszPath, DWORD dwFileAttributes, REFIID riid, void **ppv)
#define wcsicmp
Definition: compat.h:15
int ret
virtual STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: CFontExt.cpp:517
DWORD SHCOLSTATEF
Definition: shtypes.idl:142
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
virtual STDMETHODIMP GetDefaultSearchGUID(GUID *lpguid)
Definition: CFontExt.cpp:99
static const WCHAR L[]
Definition: oid.c:1250
#define InterlockedDecrement
Definition: armddk.h:52
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
virtual STDMETHODIMP GetCurFolder(LPITEMIDLIST *ppidl)
Definition: CFontExt.cpp:453
CFontCache * g_FontCache
Definition: CFontCache.cpp:12
WCHAR Name[1]
Definition: fontpidl.hpp:17
static PCUIDLIST_ABSOLUTE HIDA_GetPIDLFolder(CIDA const *pida)
Definition: shellutils.h:549
#define IDS_COL_FILENAME
Definition: resource.h:7
const CStringW & FontPath() const
Definition: CFontCache.hpp:52
unsigned char BYTE
Definition: xxhash.c:193
CComHeapPtr< ITEMIDLIST > m_Folder
Definition: CFontExt.hpp:18
#define ERR(fmt,...)
Definition: debug.h:110
IShellFolder * pshf
Definition: shlobj.h:1283
virtual STDMETHODIMP EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
Definition: CFontExt.cpp:240
#define S_OK
Definition: intsafe.h:52
const ITEMIDLIST_ABSOLUTE UNALIGNED * PCUIDLIST_ABSOLUTE
Definition: shtypes.idl:63
#define InterlockedIncrement
Definition: armddk.h:53
LPCWSTR szPath
Definition: env.c:37
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define IDS_COL_ATTR_LETTERS
Definition: resource.h:11
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
#define E_NOTIMPL
Definition: ddrawi.h:99
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
virtual STDMETHODIMP CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
Definition: CFontExt.cpp:316
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
virtual STDMETHODIMP GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv)
Definition: CFontExt.cpp:126
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
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2447
DWORD dwFileAttributes
#define OUT
Definition: typedefs.h:40
CFontInfo * Find(const FontPidlEntry *fontEntry)
Definition: CFontCache.cpp:145
unsigned int ULONG
Definition: retypes.h:1
BOOL LoadString(_In_ UINT nID)
Definition: cstringt.h:591
const GUID CLSID_CFontExt
Definition: fontext.cpp:12
#define UNIMPLEMENTED
Definition: debug.h:115
virtual STDMETHODIMP MapColumnToSCID(UINT iColumn, SHCOLUMNID *pscid)
Definition: CFontExt.cpp:227
HRESULT _CDataObject_CreateInstance(PCIDLIST_ABSOLUTE folder, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, LPVOID *ppvOut)
Definition: CDataObject.cpp:38
CStringW Filename(CFontInfo *info, bool alwaysFullPath=false)
Definition: CFontCache.cpp:164
#define TIME_NOSECONDS
Definition: winnls.h:278
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
BOOL WINAPI GetFontResourceInfoW(LPCWSTR lpFileName, DWORD *pdwBufSize, void *lpBuffer, DWORD dwType)
Definition: File.h:15
virtual STDMETHODIMP SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut)
Definition: CFontExt.cpp:446
virtual STDMETHODIMP GetDefaultColumn(DWORD dwReserved, ULONG *pSort, ULONG *pDisplay)
Definition: CFontExt.cpp:111
WCHAR * LPWSTR
Definition: xmlstorage.h:184
UINT uType
Definition: shtypes.idl:93
#define E_POINTER
Definition: winerror.h:2365
#define EXTERN_C
Definition: basetyps.h:12
#define __FUNCTION__
Definition: types.h:112
#define HWND_BROADCAST
Definition: winuser.h:1190
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
LPARAM lParam
Definition: combotst.c:139
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define REG_SZ
Definition: layer.c:22