ReactOS 0.4.16-dev-2224-g3637fd8
fontpidl.cpp File Reference
#include "precomp.h"
Include dependency graph for fontpidl.cpp:

Go to the source code of this file.

Functions

LPITEMIDLIST _ILCreate (LPCWSTR lpString)
 
const FontPidlEntry_FontFromIL (LPCITEMIDLIST pidl)
 

Function Documentation

◆ _FontFromIL()

const FontPidlEntry * _FontFromIL ( LPCITEMIDLIST  pidl)

Definition at line 29 of file fontpidl.cpp.

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

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

◆ _ILCreate()

LPITEMIDLIST _ILCreate ( LPCWSTR  lpString)

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);
15 if (!pidl)
16 return NULL;
17
18 ZeroMemory(pidl, cbData + sizeof(WORD));
19
20 pidl->cb = (WORD)cbData;
21 pidl->Magic = 'fp';
22 wcscpy(pidl->Name, lpString);
23 // Should be zero already, but make sure it is
24 *(WORD*)((char*)pidl + cbData) = 0;
25
26 return (LPITEMIDLIST)pidl;
27}
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
unsigned short WORD
Definition: ntddk_ex.h:93
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define ZeroMemory
Definition: minwinbase.h:31
_In_opt_ _In_opt_ _In_ _In_ DWORD cbData
Definition: shlwapi.h:761
wcscpy
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
WCHAR Name[1]
Definition: fontpidl.hpp:15
__wchar_t WCHAR
Definition: xmlstorage.h:180

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