2 * PROJECT: ReactOS Font Shell Extension
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: pidl handling
5 * COPYRIGHT: Copyright 2019,2020 Mark Jansen (mark.jansen@reactos.org)
10 LPITEMIDLIST
_ILCreate(LPCWSTR lpString
, ULONG Index
)
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
));
18 ZeroMemory(pidl
, cbData
+ sizeof(WORD
));
20 pidl
->cb
= (WORD
)cbData
;
24 wcscpy(pidl
->Name
, lpString
);
25 // Should be zero already, but make sure it is
26 *(WORD
*)((char*)pidl
+ cbData
) = 0;
28 return (LPITEMIDLIST
)pidl
;
32 const FontPidlEntry
* _FontFromIL(LPCITEMIDLIST pidl
)
34 const FontPidlEntry
* fontEntry
= (const FontPidlEntry
*)pidl
;
35 if (fontEntry
->Magic
== 'fp')