ReactOS 0.4.16-dev-2207-geb15453
precomp.h File Reference
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <tchar.h>
#include <strsafe.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlcoll.h>
#include <atlstr.h>
#include <wine/debug.h>
#include <shellutils.h>
#include "resource.h"
#include "fontpidl.hpp"
#include "CFontCache.hpp"
#include "CFontExt.hpp"
#include "CFontFolderViewCB.h"
#include "CFontBackgroundMenu.h"
Include dependency graph for precomp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tagINSTALL_FONT_DATA
 
struct  CRegKeyHandleArray
 

Macros

#define WIN32_NO_STATUS
 
#define COM_NO_WINDOWS_H
 
#define FONT_HIVE   HKEY_LOCAL_MACHINE
 
#define FONT_KEY   L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts"
 

Typedefs

typedef struct tagINSTALL_FONT_DATA INSTALL_FONT_DATA
 
typedef struct tagINSTALL_FONT_DATAPINSTALL_FONT_DATA
 

Functions

HRESULT _CEnumFonts_CreateInstance (CFontExt *zip, DWORD flags, REFIID riid, LPVOID *ppvOut)
 
HRESULT _CDataObject_CreateInstance (PCIDLIST_ABSOLUTE folder, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, LPVOID *ppvOut)
 
BOOL IsFontDotExt (LPCWSTR pchDotExt)
 
HRESULT InstallFontFiles (_Inout_ PINSTALL_FONT_DATA pData)
 
HRESULT DoInstallFontFile (_In_ PCWSTR pszFontPath, _In_ PCWSTR pszFontsDir, _In_ HKEY hkeyFonts)
 
HRESULT DoGetFontTitle (_In_ PCWSTR pszFontPath, _Out_ CStringW &strFontName)
 
BOOL CheckDropFontFiles (HDROP hDrop)
 
BOOL CheckDataObject (IDataObject *pDataObj)
 
HRESULT InstallFontsFromDataObject (HWND hwndView, IDataObject *pDataObj)
 
HRESULT APIENTRY CFontBackgroundMenu_Create (CFontExt *pFontExt, HWND hwnd, IShellFolder *psf, IContextMenu **ppcm)
 
LSTATUS AddClassKeyToArray (const WCHAR *szClass, HKEY *array, UINT *cKeys)
 
void CloseRegKeyArray (HKEY *array, UINT cKeys)
 

Variables

const GUID CLSID_CFontExt
 
LONG g_ModuleRefCnt
 

Macro Definition Documentation

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 11 of file precomp.h.

◆ FONT_HIVE

#define FONT_HIVE   HKEY_LOCAL_MACHINE

Definition at line 49 of file precomp.h.

◆ FONT_KEY

#define FONT_KEY   L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts"

Definition at line 50 of file precomp.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 10 of file precomp.h.

Typedef Documentation

◆ INSTALL_FONT_DATA

◆ PINSTALL_FONT_DATA

Function Documentation

◆ _CDataObject_CreateInstance()

HRESULT _CDataObject_CreateInstance ( PCIDLIST_ABSOLUTE  folder,
UINT  cidl,
PCUITEMID_CHILD_ARRAY  apidl,
REFIID  riid,
LPVOID ppvOut 
)

Definition at line 36 of file CDataObject.cpp.

38{
39 HRESULT hr = CIDLData_CreateFromIDArray(folder, cidl, apidl, (IDataObject**)ppvOut);
41 return hr;
42
43 // Now that we have an IDataObject with the shell itemid list (CFSTR_SHELLIDLIST, aka HIDA) format
44 // we will augment this IDataObject with the CF_HDROP format. (Full filepaths)
45 // This enabled the objects for the 'copy' and drag to copy actions
46
48
49 // First we allocate room for the DROPFILES structure
50 data.AllocateBytes(sizeof(DROPFILES));
51 UINT offset = sizeof(DROPFILES);
52
53 // Then we walk all files
54 for (UINT n = 0; n < cidl; ++n)
55 {
56 const FontPidlEntry* fontEntry = _FontFromIL(apidl[n]);
57 if (fontEntry)
58 {
59 CStringW File = g_FontCache->Filename(g_FontCache->Find(fontEntry), true);
60 if (!File.IsEmpty())
61 {
62 // Now append the path (+ nullterminator) to the buffer
63 UINT len = offset + (File.GetLength() + 1) * sizeof(WCHAR);
64 data.ReallocateBytes(len);
65 if (!data)
66 {
67 ERR("Unable to allocate memory for the CF_HDROP\n");
68 return hr;
69 }
70 BYTE* dataPtr = data;
72 offset = len;
73 }
74 else
75 {
76 ERR("No file found for %S\n", fontEntry->Name);
77 }
78 }
79 }
80
81 // Append the final nullterminator (double null terminated list)
82 data.ReallocateBytes(offset + sizeof(UNICODE_NULL));
85 offset += sizeof(UNICODE_NULL);
86
87 // Fill in the required fields
88 DROPFILES* pDrop = (DROPFILES*)(BYTE*)data;
89 pDrop->fWide = 1;
90 pDrop->pFiles = sizeof(DROPFILES);
91 // Zero out the rest
92 pDrop->pt.x = pDrop->pt.y = 0;
93 pDrop-> fNC = NULL;
94
97
98 return hr;
99}
CFontCache * g_FontCache
Definition: CFontCache.cpp:12
#define CF_HDROP
Definition: constants.h:410
#define ERR(fmt,...)
Definition: precomp.h:57
CStringW Filename(CFontInfo *info, bool alwaysFullPath=false)
Definition: CFontCache.cpp:158
CFontInfo * Find(const FontPidlEntry *fontEntry)
Definition: CFontCache.cpp:145
Definition: File.h:16
#define NULL
Definition: types.h:112
static HRESULT WINAPI DataObject_SetData(LPDATAOBJECT iface, LPFORMATETC pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
Definition: view.c:203
#define FAILED_UNEXPECTEDLY
Definition: utils.cpp:30
const FontPidlEntry * _FontFromIL(LPCITEMIDLIST pidl)
Definition: fontpidl.cpp:29
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble n
Definition: glext.h:7729
GLintptr offset
Definition: glext.h:5920
GLenum GLsizei len
Definition: glext.h:6722
unsigned int UINT
Definition: ndis.h:50
#define UNICODE_NULL
wchar_t * STRSAFE_LPWSTR
Definition: ntstrsafe.h:53
const WCHAR * str
HRESULT WINAPI CIDLData_CreateFromIDArray(PCIDLIST_ABSOLUTE pidlFolder, UINT cpidlFiles, PCUIDLIST_RELATIVE_ARRAY lppidlFiles, LPDATAOBJECT *ppdataObject)
Definition: shellord.c:2419
HRESULT hr
Definition: shlfolder.c:183
struct _DROPFILES DROPFILES
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
WCHAR Name[1]
Definition: fontpidl.hpp:15
DWORD pFiles
Definition: shlobj.h:2313
BOOL fWide
Definition: shlobj.h:2316
POINT pt
Definition: shlobj.h:2314
Definition: fci.c:116
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
unsigned char BYTE
Definition: xxhash.c:193

Referenced by CFontExt::GetUIObjectOf().

◆ _CEnumFonts_CreateInstance()

HRESULT _CEnumFonts_CreateInstance ( CFontExt zip,
DWORD  flags,
REFIID  riid,
LPVOID ppvOut 
)

Definition at line 97 of file CEnumFonts.cpp.

98{
99 return ShellObjectCreatorInit<CEnumFonts>(zip, flags, riid, ppvOut);
100}
GLbitfield flags
Definition: glext.h:7161
REFIID riid
Definition: atlbase.h:39

Referenced by CFontExt::EnumObjects().

◆ AddClassKeyToArray()

LSTATUS AddClassKeyToArray ( const WCHAR szClass,
HKEY array,
UINT cKeys 
)

Definition at line 109 of file fontext.cpp.

110{
111 if (*cKeys >= 16)
112 return ERROR_MORE_DATA;
113
114 HKEY hkey;
116 if (result == ERROR_SUCCESS)
117 {
118 array[*cKeys] = hkey;
119 *cKeys += 1;
120 }
121 return result;
122}
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define ERROR_SUCCESS
Definition: deptool.c:10
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
GLuint64EXT * result
Definition: glext.h:11304
#define KEY_READ
Definition: nt_native.h:1026
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019
Definition: undname.c:54
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

◆ CFontBackgroundMenu_Create()

HRESULT APIENTRY CFontBackgroundMenu_Create ( CFontExt pFontExt,
HWND  hwnd,
IShellFolder psf,
IContextMenu **  ppcm 
)

Definition at line 114 of file CFontBackgroundMenu.cpp.

119{
120 DEFCONTEXTMENU dcm;
121 ZeroMemory(&dcm, sizeof(dcm));
122 dcm.hwnd = hwnd;
123 dcm.psf = psf;
124 return ShellObjectCreatorInit<CFontBackgroundMenu>(pFontExt, &dcm, IID_PPV_ARG(IContextMenu, ppcm));
125}
#define ZeroMemory
Definition: minwinbase.h:31
IShellFolder * psf
Definition: shlobj.h:2558
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define IID_PPV_ARG(Itype, ppType)

Referenced by CFontExt::CreateViewObject().

◆ CheckDataObject()

BOOL CheckDataObject ( IDataObject pDataObj)

Definition at line 308 of file fontext.cpp.

309{
310 STGMEDIUM stg;
311 FORMATETC etc = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
312 HRESULT hr = pDataObj->GetData(&etc, &stg);
314 return FALSE;
315 HDROP hDrop = reinterpret_cast<HDROP>(stg.hGlobal);
316 BOOL bOK = CheckDropFontFiles(hDrop);
317 ReleaseStgMedium(&stg);
318 return bOK;
319}
#define FALSE
Definition: types.h:117
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL CheckDropFontFiles(HDROP hDrop)
Definition: fontext.cpp:289
HRESULT GetData([in, unique] FORMATETC *pformatetcIn, [out] STGMEDIUM *pmedium)

Referenced by CFontExt::DragEnter(), InstallFontsFromDataObject(), and CFontBackgroundMenu::InvokeCommand().

◆ CheckDropFontFiles()

BOOL CheckDropFontFiles ( HDROP  hDrop)

Definition at line 289 of file fontext.cpp.

290{
291 UINT cFiles = DragQueryFileW(hDrop, 0xFFFFFFFF, NULL, 0);
292 if (cFiles == 0)
293 return FALSE;
294
295 for (UINT iFile = 0; iFile < cFiles; ++iFile)
296 {
297 WCHAR szFile[MAX_PATH];
298 if (!DragQueryFileW(hDrop, iFile, szFile, _countof(szFile)))
299 return FALSE;
300 LPCWSTR pchDotExt = PathFindExtensionW(szFile);
301 if (!IsFontDotExt(pchDotExt))
302 return FALSE;
303 }
304
305 return TRUE;
306}
#define TRUE
Definition: types.h:120
BOOL IsFontDotExt(LPCWSTR pchDotExt)
Definition: precomp.h:56
#define MAX_PATH
Definition: compat.h:34
LPWSTR WINAPI PathFindExtensionW(const WCHAR *path)
Definition: path.c:1274
UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
Definition: shellole.c:666
#define _countof(array)
Definition: sndvol32.h:70
_In_ ULONG_PTR iFile
Definition: winddi.h:3835
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by CheckDataObject().

◆ CloseRegKeyArray()

void CloseRegKeyArray ( HKEY array,
UINT  cKeys 
)

Definition at line 103 of file fontext.cpp.

104{
105 for (UINT i = 0; i < cKeys; ++i)
107}
#define RegCloseKey(hKey)
Definition: registry.h:49
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 i
Definition: glfuncs.h:248

Referenced by CRegKeyHandleArray::~CRegKeyHandleArray().

◆ DoGetFontTitle()

HRESULT DoGetFontTitle ( _In_ PCWSTR  pszFontPath,
_Out_ CStringW strFontName 
)

◆ DoInstallFontFile()

HRESULT DoInstallFontFile ( _In_ PCWSTR  pszFontPath,
_In_ PCWSTR  pszFontsDir,
_In_ HKEY  hkeyFonts 
)

Definition at line 181 of file fontext.cpp.

185{
186 ATLASSERT(pszFontPath);
187 ATLASSERT(pszFontsDir);
188 ATLASSERT(hkeyFonts);
189
190 // Add this font to the font list, so we can query the name
191 if (!AddFontResourceW(pszFontPath))
192 {
193 ERR("AddFontResourceW('%S') failed\n", pszFontPath);
194 return E_FAIL;
195 }
196
197 // Get the font name
198 CStringW strFontName;
199 HRESULT hr = DoGetFontTitle(pszFontPath, strFontName);
201 return hr;
202
203 // Remove it now
204 // WINDOWS BUG: Removing once is not enough
205 for (INT iTry = 0; iTry < 3; ++iTry)
206 {
207 if (!RemoveFontResourceW(pszFontPath) &&
208 !RemoveFontResourceExW(pszFontPath, FR_PRIVATE, NULL))
209 {
210 break;
211 }
212 }
213
214 // Delete font entry in registry
215 RegDeleteValueW(hkeyFonts, strFontName);
216
217 LPCWSTR pszFileTitle = PathFindFileName(pszFontPath);
218 ATLASSERT(pszFileTitle);
219
220 // Build destination path
221 CStringW szDestFile(pszFontsDir); // pszFontsDir has backslash at back
222 szDestFile += pszFileTitle;
223 TRACE("szDestFile: '%S'\n", (PCWSTR)szDestFile);
224
225 if (!StrCmpIW(szDestFile, pszFontPath)) // Same file?
226 {
227 ERR("Wrongly same: %S\n", pszFontPath);
228 return E_FAIL;
229 }
230
231 // Copy file
232 if (!CopyFileW(pszFontPath, szDestFile, FALSE))
233 {
234 ERR("CopyFileW('%S', '%S') failed\n", pszFontPath, (PCWSTR)szDestFile);
235 return E_FAIL;
236 }
237
238 // Write registry for font entry
239 DWORD cbData = (wcslen(pszFileTitle) + 1) * sizeof(WCHAR);
240 LONG nError = RegSetValueExW(hkeyFonts, strFontName, 0, REG_SZ,
241 (const BYTE *)pszFileTitle, cbData);
242 if (nError)
243 {
244 ERR("RegSetValueExW failed with %ld\n", nError);
245 DeleteFileW(szDestFile);
246 return E_FAIL;
247 }
248
249 // Notify file creation
251
252 return AddFontResourceW(szDestFile) ? S_OK : E_FAIL;
253}
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
EXTERN_C void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
#define E_FAIL
Definition: ddrawi.h:102
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:4882
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2330
BOOL WINAPI CopyFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN BOOL bFailIfExists)
Definition: copy.c:439
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
int WINAPI StrCmpIW(const WCHAR *str, const WCHAR *comp)
Definition: string.c:456
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT DoGetFontTitle(_In_ LPCWSTR pszFontPath, _Out_ CStringW &strFontName)
Definition: fontext.cpp:256
#define S_OK
Definition: intsafe.h:52
#define REG_SZ
Definition: layer.c:22
long LONG
Definition: pedump.c:60
_In_opt_ _In_opt_ _In_ _In_ DWORD cbData
Definition: shlwapi.h:761
#define PathFindFileName
Definition: shlwapi.h:469
#define SHCNE_CREATE
Definition: shlobj.h:1896
#define SHCNF_PATHW
Definition: shlobj.h:1931
#define TRACE(s)
Definition: solgame.cpp:4
const uint16_t * PCWSTR
Definition: typedefs.h:57
int32_t INT
Definition: typedefs.h:58
BOOL WINAPI RemoveFontResourceExW(_In_ LPCWSTR lpFileName, _In_ DWORD fl, _In_opt_ PVOID pdv)
Definition: font.c:2232
int WINAPI AddFontResourceW(_In_ LPCWSTR pszFilename)
Definition: font.c:2167
BOOL WINAPI RemoveFontResourceW(_In_ LPCWSTR)
Definition: font.c:2175

Referenced by InstallFontFiles().

◆ InstallFontFiles()

HRESULT InstallFontFiles ( _Inout_ PINSTALL_FONT_DATA  pData)

Definition at line 125 of file fontext.cpp.

127{
128 PCUIDLIST_ABSOLUTE pidlParent = pData->pidlParent;
129 UINT cidl = pData->cSteps;
130 PCUITEMID_CHILD_ARRAY apidl = pData->apidl;
131
132 CAtlArray<CStringW> FontPaths;
133 for (UINT n = 0; n < cidl; ++n)
134 {
136 pidl.Attach(ILCombine(pidlParent, apidl[n]));
137 if (!pidl)
138 {
139 ERR("Out of memory\n");
140 return E_OUTOFMEMORY;
141 }
142
146 {
147 ERR("Not font file: %s\n", wine_dbgstr_w(szPath));
148 return E_FAIL;
149 }
150
151 FontPaths.Add(szPath);
152 }
153
154 CRegKey keyFonts;
155 if (keyFonts.Open(FONT_HIVE, FONT_KEY, KEY_WRITE) != ERROR_SUCCESS)
156 {
157 ERR("CRegKey::Open failed\n");
158 return E_FAIL;
159 }
160
161 for (SIZE_T iItem = 0; iItem < FontPaths.GetCount(); ++iItem)
162 {
163 if (pData->bCanceled)
164 {
165 WARN("Canceled\n");
166 return E_ABORT;
167 }
168
169 HRESULT hr = DoInstallFontFile(FontPaths[iItem], g_FontCache->FontPath(), keyFonts);
171 return hr;
172
173 if (pData->hwnd)
175 }
176
177 return S_OK;
178}
#define WARN(fmt,...)
Definition: precomp.h:61
size_t Add(INARGTYPE element)
Definition: atlcoll.h:295
size_t GetCount() const
Definition: atlcoll.h:373
LONG Open(HKEY hKeyParent, LPCTSTR lpszKeyName, REGSAM samDesired=KEY_READ|KEY_WRITE) noexcept
Definition: atlbase.h:1173
const CStringW & FontPath() const
Definition: CFontCache.hpp:51
void Attach(T *lp)
Definition: atlalloc.h:162
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FONT_HIVE
Definition: precomp.h:49
#define FONT_KEY
Definition: precomp.h:50
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1729
HRESULT DoInstallFontFile(_In_ PCWSTR pszFontPath, _In_ PCWSTR pszFontsDir, _In_ HKEY hkeyFonts)
Definition: fontext.cpp:181
#define wine_dbgstr_w
Definition: kernel32.h:34
LPCWSTR szPath
Definition: env.c:37
#define KEY_WRITE
Definition: nt_native.h:1034
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:817
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1496
const ITEMIDLIST_ABSOLUTE UNALIGNED * PCUIDLIST_ABSOLUTE
Definition: shtypes.idl:63
const PCUITEMID_CHILD * PCUITEMID_CHILD_ARRAY
Definition: shtypes.idl:71
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define IDCONTINUE
Definition: vfdguiut.c:42
#define E_ABORT
Definition: winerror.h:3481
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_COMMAND
Definition: winuser.h:1768

Referenced by InstallThreadProc().

◆ InstallFontsFromDataObject()

HRESULT InstallFontsFromDataObject ( HWND  hwndView,
IDataObject pDataObj 
)

Definition at line 390 of file fontext.cpp.

391{
392 if (!CheckDataObject(pDataObj))
393 {
394 ERR("!CheckDataObject\n");
395 return E_FAIL;
396 }
397
398 CDataObjectHIDA cida(pDataObj);
399 if (!cida || cida->cidl <= 0)
400 {
401 ERR("E_UNEXPECTED\n");
402 return E_FAIL;
403 }
404
405 PCUIDLIST_ABSOLUTE pidlParent = HIDA_GetPIDLFolder(cida);
406 if (!pidlParent)
407 {
408 ERR("pidlParent is NULL\n");
409 return E_FAIL;
410 }
411
413 for (UINT n = 0; n < cida->cidl; ++n)
414 {
415 PCUIDLIST_RELATIVE pidlRelative = HIDA_GetPIDLItem(cida, n);
416 if (!pidlRelative)
417 {
418 ERR("!pidlRelative\n");
419 return E_FAIL;
420 }
421 apidl.Add(pidlRelative);
422 }
423
424 // Show progress dialog
426 data.pDataObj = pDataObj;
427 data.pidlParent = pidlParent;
428 data.apidl = &apidl[0];
429 data.cSteps = cida->cidl;
430 pDataObj->AddRef();
431 DialogBoxParamW(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCEW(IDD_INSTALL),
432 hwndView, InstallDialogProc, (LPARAM)&data);
433 if (data.bCanceled)
434 return S_FALSE;
435
436 return FAILED_UNEXPECTEDLY(data.hrResult) ? E_FAIL : S_OK;
437}
#define IDD_INSTALL
Definition: resource.h:3
BOOL CheckDataObject(IDataObject *pDataObj)
Definition: fontext.cpp:308
static INT_PTR CALLBACK InstallDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: fontext.cpp:377
ULONG AddRef()
LONG_PTR LPARAM
Definition: minwindef.h:175
static PCUIDLIST_RELATIVE HIDA_GetPIDLItem(CIDA const *pida, SIZE_T i)
Definition: shellutils.h:713
static PCUIDLIST_ABSOLUTE HIDA_GetPIDLFolder(CIDA const *pida)
Definition: shellutils.h:708
const ITEMIDLIST_RELATIVE UNALIGNED * PCUIDLIST_RELATIVE
Definition: shtypes.idl:57
#define S_FALSE
Definition: winerror.h:3451
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by CFontExt::Drop().

◆ IsFontDotExt()

BOOL IsFontDotExt ( LPCWSTR  pchDotExt)
inline

Definition at line 56 of file precomp.h.

57{
58 static const LPCWSTR array[] =
59 {
60 L".ttf", L".ttc", L".otf", L".otc", L".fon", L".fnt", NULL
61 };
62 for (const LPCWSTR *pp = array; *pp; ++pp)
63 {
64 if (!StrCmpIW(*pp, pchDotExt))
65 return TRUE;
66 }
67 return FALSE;
68}
#define L(x)
Definition: resources.c:13

Referenced by CheckDropFontFiles(), and InstallFontFiles().

Variable Documentation

◆ CLSID_CFontExt

const GUID CLSID_CFontExt
extern

Definition at line 13 of file fontext.cpp.

Referenced by CFontExt::GetClassID().

◆ g_ModuleRefCnt

LONG g_ModuleRefCnt
extern

Definition at line 13 of file ACPPage.cpp.