ReactOS 0.4.16-dev-91-g764881a
zippidl.cpp File Reference
#include "precomp.h"
Include dependency graph for zippidl.cpp:

Go to the source code of this file.

Functions

LPITEMIDLIST _ILCreate (ZipPidlType Type, PCWSTR lpString, unz_file_info64 &info)
 
const ZipPidlEntry_ZipFromIL (LPCITEMIDLIST pidl)
 

Function Documentation

◆ _ILCreate()

LPITEMIDLIST _ILCreate ( ZipPidlType  Type,
PCWSTR  lpString,
unz_file_info64 info 
)

Definition at line 11 of file zippidl.cpp.

12{
13 size_t cbData = sizeof(ZipPidlEntry) + wcslen(lpString) * sizeof(WCHAR);
14 if (cbData > MAXWORD)
15 return NULL;
16
17 ZipPidlEntry* pidl = (ZipPidlEntry*)SHAlloc(cbData + sizeof(WORD));
18 if (!pidl)
19 return NULL;
20
21 ZeroMemory(pidl, cbData + sizeof(WORD));
22
23 pidl->cb = (WORD)cbData;
24 pidl->MagicType = 'z';
25 pidl->ZipType = Type;
26
28 {
29 pidl->CompressedSize = info.compressed_size;
30 pidl->UncompressedSize = info.uncompressed_size;
31 pidl->DosDate = info.dosDate;
32 pidl->Password = info.flag & MINIZIP_PASSWORD_FLAG;
33 }
34
35 wcscpy(pidl->Name, lpString);
36 *(WORD*)((char*)pidl + cbData) = 0; // The end of an ITEMIDLIST
37
38 return (LPITEMIDLIST)pidl;
39}
Type
Definition: Type.h:7
#define NULL
Definition: types.h:112
#define MINIZIP_PASSWORD_FLAG
Definition: precomp.h:42
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:304
unsigned short WORD
Definition: ntddk_ex.h:93
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define MAXWORD
_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: zippidl.hpp:28
ULONG64 UncompressedSize
Definition: zippidl.hpp:25
BOOLEAN Password
Definition: zippidl.hpp:21
ZipPidlType ZipType
Definition: zippidl.hpp:22
ULONG DosDate
Definition: zippidl.hpp:26
ULONG64 CompressedSize
Definition: zippidl.hpp:24
BYTE MagicType
Definition: zippidl.hpp:20
#define ZeroMemory
Definition: winbase.h:1712
__wchar_t WCHAR
Definition: xmlstorage.h:180
@ ZIP_PIDL_DIRECTORY
Definition: zippidl.hpp:12

◆ _ZipFromIL()

const ZipPidlEntry * _ZipFromIL ( LPCITEMIDLIST  pidl)

Definition at line 41 of file zippidl.cpp.

42{
43 const ZipPidlEntry* zipPidl = (const ZipPidlEntry*)pidl;
44 if (zipPidl->MagicType == 'z')
45 return zipPidl;
46 return NULL;
47}

Referenced by CZipFolder::BindToObject(), CZipFolder::CompareIDs(), CZipFolder::GetAttributesOf(), CZipFolder::GetDetailsOf(), CZipFolder::GetDisplayNameOf(), and CZipFolder::GetUIObjectOf().