ReactOS 0.4.16-dev-257-g6aa11ac
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 dependency graph for precomp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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"
 

Functions

HRESULT _CEnumFonts_CreateInstance (CFontExt *zip, DWORD flags, REFIID riid, LPVOID *ppvOut)
 
HRESULT _CFontMenu_CreateInstance (HWND hwnd, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, IShellFolder *psf, REFIID riid, LPVOID *ppvOut)
 
HRESULT _CDataObject_CreateInstance (PCIDLIST_ABSOLUTE folder, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, LPVOID *ppvOut)
 
BOOL IsFontDotExt (LPCWSTR pchDotExt)
 

Variables

const GUID CLSID_CFontExt
 
LONG g_ModuleRefCnt
 

Macro Definition Documentation

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 6 of file precomp.h.

◆ FONT_HIVE

#define FONT_HIVE   HKEY_LOCAL_MACHINE

Definition at line 30 of file precomp.h.

◆ FONT_KEY

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

Definition at line 31 of file precomp.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 5 of file precomp.h.

Function Documentation

◆ _CDataObject_CreateInstance()

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

Definition at line 38 of file CDataObject.cpp.

40{
41 HRESULT hr = CIDLData_CreateFromIDArray(folder, cidl, apidl, (IDataObject**)ppvOut);
43 return hr;
44
45 // Now that we have an IDataObject with the shell itemid list (CFSTR_SHELLIDLIST, aka HIDA) format
46 // we will augment this IDataObject with the CF_HDROP format. (Full filepaths)
47 // This enabled the objects for the 'copy' and drag to copy actions
48
50
51 // First we allocate room for the DROPFILES structure
52 data.AllocateBytes(sizeof(DROPFILES));
53 UINT offset = sizeof(DROPFILES);
54
55 // Then we walk all files
56 for (UINT n = 0; n < cidl; ++n)
57 {
58 const FontPidlEntry* fontEntry = _FontFromIL(apidl[n]);
59 if (fontEntry)
60 {
61 CStringW File = g_FontCache->Filename(g_FontCache->Find(fontEntry), true);
62 if (!File.IsEmpty())
63 {
64 // Now append the path (+ nullterminator) to the buffer
65 UINT len = offset + (File.GetLength() + 1) * sizeof(WCHAR);
66 data.ReallocateBytes(len);
67 if (!data)
68 {
69 ERR("Unable to allocate memory for the CF_HDROP\n");
70 return hr;
71 }
72 BYTE* dataPtr = data;
74 offset = len;
75 }
76 else
77 {
78 ERR("No file found for %S\n", fontEntry->Name);
79 }
80 }
81 }
82
83 // Append the final nullterminator (double null terminated list)
84 data.ReallocateBytes(offset + sizeof(UNICODE_NULL));
87 offset += sizeof(UNICODE_NULL);
88
89 // Fill in the required fields
90 DROPFILES* pDrop = (DROPFILES*)(BYTE*)data;
91 pDrop->fWide = 1;
92 pDrop->pFiles = sizeof(DROPFILES);
93 // Zero out the rest
94 pDrop->pt.x = pDrop->pt.y = 0;
95 pDrop-> fNC = NULL;
96
99
100 return hr;
101}
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:164
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(hr)
Definition: precomp.h:121
const FontPidlEntry * _FontFromIL(LPCITEMIDLIST pidl)
Definition: fontpidl.cpp:32
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble n
Definition: glext.h:7729
GLenum GLsizei len
Definition: glext.h:6722
GLintptr offset
Definition: glext.h:5920
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:2413
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:17
DWORD pFiles
Definition: shlobj.h:2307
BOOL fWide
Definition: shlobj.h:2310
POINT pt
Definition: shlobj.h:2308
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 98 of file CEnumFonts.cpp.

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

Referenced by CFontExt::EnumObjects().

◆ _CFontMenu_CreateInstance()

HRESULT _CFontMenu_CreateInstance ( HWND  hwnd,
UINT  cidl,
PCUITEMID_CHILD_ARRAY  apidl,
IShellFolder psf,
REFIID  riid,
LPVOID ppvOut 
)

Definition at line 114 of file CFontMenu.cpp.

116{
117 if (cidl > 0)
118 {
119 HKEY keys[1] = {0};
120 int nkeys = 0;
122
123 // Use the default context menu handler, but augment it from the callbacks
124 HRESULT hr = CDefFolderMenu_Create2(NULL, hwnd, cidl, apidl, psf, FontFolderMenuCallback, nkeys, keys, &spMenu);
125
127 return hr;
128
129 // See if the requested interface (e.g. IContextMenu3) is also available
130 return spMenu->QueryInterface(riid, ppvOut);
131 }
132
133 // We can't create a background menu
134 return E_FAIL;
135}
HRESULT WINAPI CDefFolderMenu_Create2(PCIDLIST_ABSOLUTE pidlFolder, HWND hwnd, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, IShellFolder *psf, LPFNDFMCALLBACK lpfn, UINT nKeys, const HKEY *ahkeyClsKeys, IContextMenu **ppcm)
static HRESULT CALLBACK FontFolderMenuCallback(IShellFolder *psf, HWND hwnd, IDataObject *pdtobj, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CFontMenu.cpp:57
#define E_FAIL
Definition: ddrawi.h:102
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by CFontExt::GetUIObjectOf().

◆ IsFontDotExt()

BOOL IsFontDotExt ( LPCWSTR  pchDotExt)
inline

Definition at line 39 of file precomp.h.

40{
41 static const LPCWSTR array[] =
42 {
43 L".ttf", L".ttc", L".otf", L".otc", L".fon", L".fnt", NULL
44 };
45 for (const LPCWSTR *pp = array; *pp; ++pp)
46 {
47 if (!_wcsicmp(*pp, pchDotExt))
48 return TRUE;
49 }
50 return FALSE;
51}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define L(x)
Definition: ntvdm.h:50
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by CFontExt::Drop().

Variable Documentation

◆ CLSID_CFontExt

const GUID CLSID_CFontExt
extern

Definition at line 12 of file fontext.cpp.

Referenced by CFontExt::GetClassID().

◆ g_ModuleRefCnt

LONG g_ModuleRefCnt
extern

Definition at line 13 of file ACPPage.cpp.