ReactOS 0.4.15-dev-7842-g558ab78
fontpidl.hpp File Reference
#include <pshpack1.h>
#include <poppack.h>
Include dependency graph for fontpidl.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  FontPidlEntry
 

Functions

LPITEMIDLIST _ILCreate (LPCWSTR lpString, ULONG Index)
 
const FontPidlEntry_FontFromIL (LPCITEMIDLIST pidl)
 

Function Documentation

◆ _FontFromIL()

const FontPidlEntry * _FontFromIL ( LPCITEMIDLIST  pidl)

Definition at line 32 of file fontpidl.cpp.

33{
34 const FontPidlEntry* fontEntry = (const FontPidlEntry*)pidl;
35 if (fontEntry->Magic == 'fp')
36 return fontEntry;
37 return NULL;
38}
#define NULL
Definition: types.h:112

Referenced by _CDataObject_CreateInstance(), CFontExt::CompareIDs(), FontFolderMenuCallback(), CFontExt::GetAttributesOf(), CFontExt::GetDetailsOf(), CFontExt::GetDisplayNameOf(), and CFontExt::GetUIObjectOf().

◆ _ILCreate()

LPITEMIDLIST _ILCreate ( LPCWSTR  lpString,
ULONG  Index 
)

Definition at line 10 of file fontpidl.cpp.

11{
12 // Because the FontPidlEntry contains one WCHAR, we do not need to take the null terminator into account
13 size_t cbData = sizeof(FontPidlEntry) + wcslen(lpString) * sizeof(WCHAR);
14 FontPidlEntry* pidl = (FontPidlEntry*)CoTaskMemAlloc(cbData + sizeof(WORD));
15 if (!pidl)
16 return NULL;
17
18 ZeroMemory(pidl, cbData + sizeof(WORD));
19
20 pidl->cb = (WORD)cbData;
21 pidl->Magic = 'fp';
22 pidl->Index = Index;
23
24 wcscpy(pidl->Name, lpString);
25 // Should be zero already, but make sure it is
26 *(WORD*)((char*)pidl + cbData) = 0;
27
28 return (LPITEMIDLIST)pidl;
29}
unsigned short WORD
Definition: ntddk_ex.h:93
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
WCHAR Name[1]
Definition: fontpidl.hpp:17
_In_ WDFCOLLECTION _In_ ULONG Index
#define ZeroMemory
Definition: winbase.h:1712
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by CFindFolder::AddResult(), CEnumFonts::Next(), and CEnumZipContents::Next().