ReactOS  0.4.14-dev-50-g13bb5e2
CZipFolder.hpp
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Zip Shell Extension
3  * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE: Main class
5  * COPYRIGHT: Copyright 2017 Mark Jansen (mark.jansen@reactos.org)
6  */
7 
8 
10 
11 
13 {
14  int iResource;
16  int cxChar;
17  int fmt;
18 };
19 
21 {
29 };
30 
31 
32 class CZipFolder :
33  public CComCoClass<CZipFolder, &CLSID_ZipFolderStorageHandler>,
34  public CComObjectRootEx<CComMultiThreadModelNoCS>,
35  public IShellFolder2,
36  //public IStorage,
37  public IContextMenu,
38  public IShellExtInit,
39  //public IPersistFile,
40  public IPersistFolder2,
41  public IZip
42 {
45  CComHeapPtr<ITEMIDLIST> m_CurDir;
47 
48 public:
51  {
52  }
53 
55  {
56  Close();
57  }
58 
59  void Close()
60  {
61  if (m_UnzipFile)
63  m_UnzipFile = NULL;
64  }
65 
66  // *** IZip methods ***
68  {
69  if (!m_UnzipFile)
70  {
72  }
73 
74  return m_UnzipFile;
75  }
76 
77  // *** IShellFolder2 methods ***
79  {
81  return E_NOTIMPL;
82  }
84  {
86  return E_NOTIMPL;
87  }
88  STDMETHODIMP GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay)
89  {
91  return E_NOTIMPL;
92  }
94  {
95  if (!pcsFlags || iColumn >= _countof(g_ColumnDefs))
96  return E_INVALIDARG;
97  *pcsFlags = g_ColumnDefs[iColumn].dwDefaultState;
98  return S_OK;
99  }
101  {
103  return E_NOTIMPL;
104  }
105  // Adapted from CFileDefExt::GetFileTimeString
106  BOOL _GetFileTimeString(LPFILETIME lpFileTime, LPWSTR pwszResult, UINT cchResult)
107  {
108  SYSTEMTIME st;
109 
110  if (!FileTimeToSystemTime(lpFileTime, &st))
111  return FALSE;
112 
113  size_t cchRemaining = cchResult;
114  LPWSTR pwszEnd = pwszResult;
115  int cchWritten = GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, pwszEnd, cchRemaining);
116  if (cchWritten)
117  --cchWritten; // GetDateFormatW returns count with terminating zero
118  else
119  return FALSE;
120  cchRemaining -= cchWritten;
121  pwszEnd += cchWritten;
122 
123  StringCchCopyExW(pwszEnd, cchRemaining, L" ", &pwszEnd, &cchRemaining, 0);
124 
125  cchWritten = GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &st, NULL, pwszEnd, cchRemaining);
126  if (cchWritten)
127  --cchWritten; // GetTimeFormatW returns count with terminating zero
128  else
129  return FALSE;
130 
131  return TRUE;
132  }
134  {
135  if (iColumn >= _countof(g_ColumnDefs))
136  return E_FAIL;
137 
138  psd->cxChar = g_ColumnDefs[iColumn].cxChar;
139  psd->fmt = g_ColumnDefs[iColumn].fmt;
140 
141  if (pidl == NULL)
142  {
143  return SHSetStrRet(&psd->str, _AtlBaseModule.GetResourceInstance(), g_ColumnDefs[iColumn].iResource);
144  }
145 
146  PCUIDLIST_RELATIVE curpidl = ILGetNext(pidl);
147  if (curpidl->mkid.cb != 0)
148  {
149  DPRINT1("ERROR, unhandled PIDL!\n");
150  return E_FAIL;
151  }
152 
153  const ZipPidlEntry* zipEntry = _ZipFromIL(pidl);
154  if (!zipEntry)
155  return E_INVALIDARG;
156 
157  WCHAR Buffer[100];
158  bool isDir = zipEntry->ZipType == ZIP_PIDL_DIRECTORY;
159  switch (iColumn)
160  {
161  case 0: /* Name, ReactOS specific? */
162  return GetDisplayNameOf(pidl, 0, &psd->str);
163  case 1: /* Type */
164  {
165  SHFILEINFOA shfi;
167  ULONG_PTR firet = SHGetFileInfoA(zipEntry->Name, dwAttributes, &shfi, sizeof(shfi), SHGFI_USEFILEATTRIBUTES | SHGFI_TYPENAME);
168  if (!firet)
169  return E_FAIL;
170  return SHSetStrRet(&psd->str, shfi.szTypeName);
171  }
172  case 2: /* Compressed size */
173  case 4: /* Size */
174  {
175  if (isDir)
176  return SHSetStrRet(&psd->str, L"");
177 
178  ULONG64 Size = iColumn == 2 ? zipEntry->CompressedSize : zipEntry->UncompressedSize;
180  return E_FAIL;
181  return SHSetStrRet(&psd->str, Buffer);
182  }
183  case 3: /* Password */
184  if (isDir)
185  return SHSetStrRet(&psd->str, L"");
186  return SHSetStrRet(&psd->str, _AtlBaseModule.GetResourceInstance(), zipEntry->Password ? IDS_YES : IDS_NO);
187  case 5: /* Ratio */
188  {
189  if (isDir)
190  return SHSetStrRet(&psd->str, L"");
191 
192  int ratio = 0;
193  if (zipEntry->UncompressedSize)
194  ratio = 100 - (int)((zipEntry->CompressedSize*100)/zipEntry->UncompressedSize);
195  StringCchPrintfW(Buffer, _countof(Buffer), L"%d%%", ratio);
196  return SHSetStrRet(&psd->str, Buffer);
197  }
198  case 6: /* Date */
199  {
200  if (isDir)
201  return SHSetStrRet(&psd->str, L"");
202  FILETIME ftLocal;
203  DosDateTimeToFileTime((WORD)(zipEntry->DosDate>>16), (WORD)zipEntry->DosDate, &ftLocal);
204  if (!_GetFileTimeString(&ftLocal, Buffer, _countof(Buffer)))
205  return E_FAIL;
206  return SHSetStrRet(&psd->str, Buffer);
207  }
208  }
209 
211  return E_NOTIMPL;
212  }
214  {
216  return E_NOTIMPL;
217  }
218 
219  // *** IShellFolder methods ***
220  STDMETHODIMP ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes)
221  {
223  return E_NOTIMPL;
224  }
225  STDMETHODIMP EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
226  {
228  }
230  {
231  if (riid == IID_IShellFolder)
232  {
233  CStringA newZipDir = m_ZipDir;
234  PCUIDLIST_RELATIVE curpidl = pidl;
235  while (curpidl->mkid.cb)
236  {
237  const ZipPidlEntry* zipEntry = _ZipFromIL(curpidl);
238  if (!zipEntry)
239  {
240  return E_FAIL;
241  }
242  newZipDir += zipEntry->Name;
243  newZipDir += '/';
244 
245  curpidl = ILGetNext(curpidl);
246  }
247  return ShellObjectCreatorInit<CZipFolder>(m_ZipFile, newZipDir, m_CurDir, pidl, riid, ppvOut);
248  }
249  DbgPrint("%s(%S) UNHANDLED\n", __FUNCTION__, guid2string(riid));
250  return E_NOTIMPL;
251  }
253  {
255  return E_NOTIMPL;
256  }
258  {
259  const ZipPidlEntry* zipEntry1 = _ZipFromIL(pidl1);
260  const ZipPidlEntry* zipEntry2 = _ZipFromIL(pidl2);
261 
262  if (!zipEntry1 || !zipEntry2)
263  return E_INVALIDARG;
264 
265  int result = 0;
266  if (zipEntry1->ZipType != zipEntry2->ZipType)
267  result = zipEntry1->ZipType - zipEntry2->ZipType;
268  else
269  result = stricmp(zipEntry1->Name, zipEntry2->Name);
270 
271  if (!result && zipEntry1->ZipType == ZIP_PIDL_DIRECTORY)
272  {
273  PCUIDLIST_RELATIVE child1 = ILGetNext(pidl1);
274  PCUIDLIST_RELATIVE child2 = ILGetNext(pidl2);
275 
276  if (child1->mkid.cb && child2->mkid.cb)
277  return CompareIDs(lParam, child1, child2);
278  else if (child1->mkid.cb)
279  result = 1;
280  else if (child2->mkid.cb)
281  result = -1;
282  }
283 
285  }
287  {
288  static const GUID UnknownIID = // {93F81976-6A0D-42C3-94DD-AA258A155470}
289  {0x93F81976, 0x6A0D, 0x42C3, {0x94, 0xDD, 0xAA, 0x25, 0x8A, 0x15, 0x54, 0x70}};
290  if (riid == IID_IShellView)
291  {
292  SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this};
293  CComPtr<IShellFolderViewCB> pcb;
294 
295  HRESULT hr = _CFolderViewCB_CreateInstance(IID_PPV_ARG(IShellFolderViewCB, &pcb));
296  if (FAILED_UNEXPECTEDLY(hr))
297  return hr;
298 
299  sfvparams.psfvcb = pcb;
300  hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppvOut);
301 
302  return hr;
303  }
304  else if (riid == IID_IExplorerCommandProvider)
305  {
306  return _CExplorerCommandProvider_CreateInstance(this, riid, ppvOut);
307  }
308  else if (riid == IID_IContextMenu)
309  {
310  // Folder context menu
311  return QueryInterface(riid, ppvOut);
312  }
313  if (UnknownIID != riid)
314  DbgPrint("%s(%S) UNHANDLED\n", __FUNCTION__, guid2string(riid));
315  return E_NOTIMPL;
316  }
318  {
319  if (!rgfInOut || !cidl || !apidl)
320  return E_INVALIDARG;
321 
322  *rgfInOut = 0;
323 
324  //static DWORD dwFileAttrs = SFGAO_STREAM | SFGAO_HASPROPSHEET | SFGAO_CANDELETE | SFGAO_CANCOPY | SFGAO_CANMOVE;
325  //static DWORD dwFolderAttrs = SFGAO_FOLDER | SFGAO_DROPTARGET | SFGAO_HASPROPSHEET | SFGAO_CANDELETE | SFGAO_STORAGE | SFGAO_CANCOPY | SFGAO_CANMOVE;
326  static DWORD dwFileAttrs = SFGAO_STREAM;
327  static DWORD dwFolderAttrs = SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_BROWSABLE;
328 
329 
330  while (cidl > 0 && *apidl)
331  {
332  const ZipPidlEntry* zipEntry = _ZipFromIL(*apidl);
333 
334  if (zipEntry)
335  {
336  if (zipEntry->ZipType == ZIP_PIDL_FILE)
337  *rgfInOut |= dwFileAttrs;
338  else
339  *rgfInOut |= dwFolderAttrs;
340  }
341  else
342  {
343  *rgfInOut = 0;
344  }
345 
346  apidl++;
347  cidl--;
348  }
349 
350  *rgfInOut &= ~SFGAO_VALIDATE;
351  return S_OK;
352  }
354  UINT uMsg, WPARAM wParam, LPARAM lParam)
355  {
356  switch (uMsg)
357  {
359  {
360  CComQIIDPtr<I_ID(IContextMenu)> spContextMenu(psf);
361  if (!spContextMenu)
362  return E_NOINTERFACE;
363 
364  QCMINFO *pqcminfo = (QCMINFO *)lParam;
365  HRESULT hr = spContextMenu->QueryContextMenu(pqcminfo->hmenu,
366  pqcminfo->indexMenu,
367  pqcminfo->idCmdFirst,
368  pqcminfo->idCmdLast,
369  CMF_NORMAL);
370  if (FAILED_UNEXPECTEDLY(hr))
371  return hr;
372 
373  pqcminfo->indexMenu += HRESULT_CODE(hr);
374  return S_OK;
375  }
376  case DFM_INVOKECOMMAND:
377  {
378  CComQIIDPtr<I_ID(IContextMenu)> spContextMenu(psf);
379  if (!spContextMenu)
380  return E_NOINTERFACE;
381 
382  CMINVOKECOMMANDINFO ici = { sizeof(ici) };
384  return spContextMenu->InvokeCommand(&ici);
385  }
386  case DFM_INVOKECOMMANDEX:
387  case DFM_GETDEFSTATICID: // Required for Windows 7 to pick a default
388  return S_FALSE;
389  }
390  return E_NOTIMPL;
391  }
392  STDMETHODIMP GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT * prgfInOut, LPVOID * ppvOut)
393  {
394  if ((riid == IID_IExtractIconA || riid == IID_IExtractIconW) && cidl == 1)
395  {
396  const ZipPidlEntry* zipEntry = _ZipFromIL(*apidl);
397  if (zipEntry)
398  {
399  CComHeapPtr<WCHAR> pathW;
400 
401  int len = MultiByteToWideChar(CP_ACP, 0, zipEntry->Name, -1, NULL, 0);
402  pathW.Allocate(len);
403  MultiByteToWideChar(CP_ACP, 0, zipEntry->Name, -1, pathW, len);
404 
406  return SHCreateFileExtractIconW(pathW, dwAttributes, riid, ppvOut);
407  }
408  }
409  else if (riid == IID_IContextMenu && cidl >= 0)
410  {
411  // Context menu of an object inside the zip
412  const ZipPidlEntry* zipEntry = _ZipFromIL(*apidl);
413  if (zipEntry)
414  {
415  HKEY keys[1] = {0};
416  int nkeys = 0;
417  if (zipEntry->ZipType == ZIP_PIDL_DIRECTORY)
418  {
420  if (res != ERROR_SUCCESS)
421  return E_FAIL;
422  nkeys++;
423  }
424  return CDefFolderMenu_Create2(NULL, hwndOwner, cidl, apidl, this, ZipFolderMenuCallback, nkeys, keys, (IContextMenu**)ppvOut);
425  }
426  }
427  else if (riid == IID_IDataObject && cidl >= 1)
428  {
429  return CIDLData_CreateFromIDArray(m_CurDir, cidl, apidl, (IDataObject**)ppvOut);
430  }
431 
432  DbgPrint("%s(%S) UNHANDLED\n", __FUNCTION__ , guid2string(riid));
433  return E_NOINTERFACE;
434  }
436  {
437  if (!pidl)
438  return S_FALSE;
439 
440  PCUIDLIST_RELATIVE curpidl = ILGetNext(pidl);
441  if (curpidl->mkid.cb != 0)
442  {
443  DPRINT1("ERROR, unhandled PIDL!\n");
444  return E_FAIL;
445  }
446 
447  const ZipPidlEntry* zipEntry = _ZipFromIL(pidl);
448  if (!zipEntry)
449  return E_FAIL;
450 
451  return SHSetStrRet(strRet, (LPCSTR)zipEntry->Name);
452  }
453  STDMETHODIMP SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut)
454  {
456  return E_NOTIMPL;
457  }
459  //STDMETHODIMP CreateStream(LPCOLESTR pwcsName, DWORD grfMode, DWORD reserved1, DWORD reserved2, IStream **ppstm);
460  //STDMETHODIMP OpenStream(LPCOLESTR pwcsName, void *reserved1, DWORD grfMode, DWORD reserved2, IStream **ppstm);
461  //STDMETHODIMP CreateStorage(LPCOLESTR pwcsName, DWORD grfMode, DWORD dwStgFmt, DWORD reserved2, IStorage **ppstg);
462  //STDMETHODIMP OpenStorage(LPCOLESTR pwcsName, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstg);
463  //STDMETHODIMP CopyTo(DWORD ciidExclude, const IID *rgiidExclude, SNB snbExclude, IStorage *pstgDest);
464  //STDMETHODIMP MoveElementTo(LPCOLESTR pwcsName, IStorage *pstgDest, LPCOLESTR pwcsNewName, DWORD grfFlags);
465  //STDMETHODIMP Commit(DWORD grfCommitFlags);
466  //STDMETHODIMP Revert();
467  //STDMETHODIMP EnumElements(DWORD reserved1, void *reserved2, DWORD reserved3, IEnumSTATSTG **ppenum);
468  //STDMETHODIMP DestroyElement(LPCOLESTR pwcsName);
469  //STDMETHODIMP RenameElement(LPCOLESTR pwcsOldName, LPCOLESTR pwcsNewName);
470  //STDMETHODIMP SetElementTimes(LPCOLESTR pwcsName, const FILETIME *pctime, const FILETIME *patime, const FILETIME *pmtime);
471  //STDMETHODIMP SetClass(REFCLSID clsid);
472  //STDMETHODIMP SetStateBits(DWORD grfStateBits, DWORD grfMask);
473  //STDMETHODIMP Stat(STATSTG *pstatstg, DWORD grfStatFlag);
474 
475  // *** IContextMenu methods ***
477  {
478  if (idCmd != 0)
479  return E_INVALIDARG;
480 
481  switch (uFlags)
482  {
483  case GCS_VERBA:
484  return StringCchCopyA(pszName, cchMax, EXTRACT_VERBA);
485  case GCS_VERBW:
486  return StringCchCopyW((LPWSTR)pszName, cchMax, EXTRACT_VERBW);
487  case GCS_HELPTEXTA:
488  {
490  return StringCchCopyA(pszName, cchMax, helpText);
491  }
492  case GCS_HELPTEXTW:
493  {
495  return StringCchCopyW((LPWSTR)pszName, cchMax, helpText);
496  }
497  case GCS_VALIDATEA:
498  case GCS_VALIDATEW:
499  return S_OK;
500  }
501 
502  return E_INVALIDARG;
503  }
505  {
506  if (!pici || (pici->cbSize != sizeof(CMINVOKECOMMANDINFO) && pici->cbSize != sizeof(CMINVOKECOMMANDINFOEX)))
507  return E_INVALIDARG;
508 
509  if (pici->lpVerb == MAKEINTRESOURCEA(0) || (HIWORD(pici->lpVerb) && !strcmp(pici->lpVerb, EXTRACT_VERBA)))
510  {
511  BSTR ZipFile = m_ZipFile.AllocSysString();
513 
514  DWORD tid;
515  HANDLE hThread = CreateThread(NULL, 0, s_ExtractProc, ZipFile, NULL, &tid);
516  if (hThread)
517  {
519  return S_OK;
520  }
521  }
522  return E_INVALIDARG;
523  }
524  STDMETHODIMP QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
525  {
526  int Entries = 0;
527 
528  if (!(uFlags & CMF_DEFAULTONLY))
529  {
531 
532  if (indexMenu)
533  {
534  InsertMenuW(hmenu, indexMenu++, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
535  Entries++;
536  }
537  InsertMenuW(hmenu, indexMenu++, MF_BYPOSITION | MF_STRING, idCmdFirst++, menuText);
538  Entries++;
539  }
540 
542  }
543 
544  // *** IShellExtInit methods ***
545  STDMETHODIMP Initialize(PCIDLIST_ABSOLUTE pidlFolder, LPDATAOBJECT pDataObj, HKEY hkeyProgID)
546  {
547  FORMATETC etc = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
548  STGMEDIUM stg;
549 
550  HRESULT hr = pDataObj->GetData(&etc, &stg);
551  if (FAILED_UNEXPECTEDLY(hr))
552  {
553  return hr;
554  }
555  hr = E_FAIL;
556  HDROP hdrop = (HDROP)GlobalLock(stg.hGlobal);
557  if (hdrop)
558  {
559  UINT uNumFiles = DragQueryFileW(hdrop, 0xFFFFFFFF, NULL, 0);
560  if (uNumFiles == 1)
561  {
562  WCHAR szFile[MAX_PATH * 2];
563  if (DragQueryFileW(hdrop, 0, szFile, _countof(szFile)))
564  {
565  CComHeapPtr<ITEMIDLIST> pidl;
566  hr = SHParseDisplayName(szFile, NULL, &pidl, 0, NULL);
567  if (!FAILED_UNEXPECTEDLY(hr))
568  {
569  hr = Initialize(pidl);
570  }
571  }
572  else
573  {
574  DbgPrint("Failed to query the file.\r\n");
575  }
576  }
577  else
578  {
579  DbgPrint("Invalid number of files: %d\r\n", uNumFiles);
580  }
581  GlobalUnlock(stg.hGlobal);
582  }
583  else
584  {
585  DbgPrint("Could not lock stg.hGlobal\r\n");
586  }
587  ReleaseStgMedium(&stg);
588  return hr;
589 
590  }
591 
594  //STDMETHODIMP IsDirty();
595  //STDMETHODIMP Load(LPCOLESTR pszFileName, DWORD dwMode);
596  //STDMETHODIMP Save(LPCOLESTR pszFileName, BOOL fRemember);
597  //STDMETHODIMP SaveCompleted(LPCOLESTR pszFileName);
598  //STDMETHODIMP GetCurFile(LPOLESTR *ppszFileName);
599 
602  {
603  *pidl = ILClone(m_CurDir);
604  return S_OK;
605  }
606 
607  // *** IPersistFolder methods ***
609  {
610  WCHAR tmpPath[MAX_PATH];
611 
612  if (SHGetPathFromIDListW(pidl, tmpPath))
613  {
614  m_ZipFile = tmpPath;
615  m_CurDir.Attach(ILClone(pidl));
616  return S_OK;
617  }
618  DbgPrint("%s() => Unable to parse pidl\n", __FUNCTION__);
619  return E_INVALIDARG;
620  }
621 
622  // *** IPersist methods ***
624  {
625  DbgPrint("%s\n", __FUNCTION__);
626  return E_NOTIMPL;
627  }
628 
629 
631  {
632  m_ZipFile = zipFile;
633  m_ZipDir = zipDir;
634 
635  m_CurDir.Attach(ILCombine(curDir, pidl));
636  return S_OK;
637  }
639  {
640  CComBSTR ZipFile;
641  ZipFile.Attach((BSTR)arg);
642 
643  _CZipExtract_runWizard(ZipFile);
644 
646  return 0;
647  }
648 
649 public:
650  DECLARE_NO_REGISTRY() // Handled manually because this object is exposed via multiple clsid's
652 
654 
656  COM_INTERFACE_ENTRY_IID(IID_IShellFolder2, IShellFolder2)
657  COM_INTERFACE_ENTRY_IID(IID_IShellFolder, IShellFolder)
658 // COM_INTERFACE_ENTRY_IID(IID_IStorage, IStorage)
659  COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
660  COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit)
661  //COM_INTERFACE_ENTRY_IID(IID_IPersistFile, IPersistFile)
662  COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2)
663  COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder)
665  END_COM_MAP()
666 };
667 
STDMETHODIMP BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
Definition: CZipFolder.hpp:229
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:2376
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
UINT idCmdLast
Definition: shlobj.h:1309
const uint16_t * PCWSTR
Definition: typedefs.h:55
CComHeapPtr< ITEMIDLIST > m_CurDir
Definition: CZipFolder.hpp:45
#define REFIID
Definition: guiddef.h:118
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
#define E_NOINTERFACE
Definition: winerror.h:2364
ULONG64 CompressedSize
Definition: zippidl.hpp:22
#define SHGFI_TYPENAME
Definition: shellapi.h:165
HRESULT _CFolderViewCB_CreateInstance(REFIID riid, LPVOID *ppvOut)
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
static HMENU hmenu
Definition: win.c:66
IShellFolderViewCB * psfvcb
Definition: shlobj.h:1276
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define DbgPrint
Definition: loader.c:25
interface IBindCtx * LPBC
Definition: objfwd.h:18
BOOL WINAPI InsertMenuW(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2036
#define KEY_READ
Definition: nt_native.h:1023
REFIID riid
Definition: precomp.h:44
LONG g_ModuleRefCnt
Definition: ACPPage.cpp:13
#define CP_ACP
Definition: compat.h:99
#define _countof(array)
Definition: fontsub.cpp:30
#define LOCALE_USER_DEFAULT
voidp unzFile
Definition: unzip.h:70
#define DATE_SHORTDATE
Definition: winnls.h:193
const GUID IID_IPersist
Definition: proxy.cpp:14
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:699
STDMETHODIMP ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes)
Definition: CZipFolder.hpp:220
#define LVCFMT_RIGHT
Definition: commctrl.h:2571
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1280
#define CALLBACK
Definition: compat.h:27
#define MF_STRING
Definition: winuser.h:138
_In_ LPCSTR lpName
Definition: winbase.h:2729
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:851
REFIID LPVOID * ppv
Definition: atlbase.h:39
HMENU hmenu
Definition: shlobj.h:1306
#define LVCFMT_LEFT
Definition: commctrl.h:2570
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:611
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
const GUID IID_IDataObject
STDMETHODIMP EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
Definition: CZipFolder.hpp:225
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:513
UINT_PTR WPARAM
Definition: windef.h:207
OLECHAR * BSTR
Definition: compat.h:1934
UINT uFlags
Definition: api.c:60
char * LPSTR
Definition: xmlstorage.h:182
#define DECLARE_NO_REGISTRY()
Definition: atlcom.h:599
static LPOLESTR
Definition: stg_prop.c:27
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:3448
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
STRRET str
Definition: shtypes.idl:108
int ZEXPORT unzClose(unzFile file)
Definition: unzip.c:808
WPARAM wParam
Definition: combotst.c:138
#define SEVERITY_SUCCESS
Definition: winerror.h:64
DWORD dwAttributes
Definition: vdmdbg.h:34
STDMETHODIMP EnumSearches(IEnumExtraSearch **ppenum)
Definition: CZipFolder.hpp:83
ZipPidlType ZipType
Definition: zippidl.hpp:20
#define IDS_COL_DATE_MOD
Definition: resource.h:35
STDMETHODIMP MapColumnToSCID(UINT column, SHCOLUMNID *pscid)
Definition: CZipFolder.hpp:213
STDMETHODIMP GetCurFolder(PIDLIST_ABSOLUTE *pidl)
Definition: CZipFolder.hpp:601
#define I_ID(Itype)
Definition: atlcomcli.h:185
#define IDS_YES
Definition: resource.h:16
uint32_t ULONG_PTR
Definition: typedefs.h:63
BYTE Password
Definition: zippidl.hpp:25
#define IDS_MENUITEM
Definition: resource.h:56
ULONG64 UncompressedSize
Definition: zippidl.hpp:23
STDMETHODIMP GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd)
Definition: CZipFolder.hpp:133
#define EXTRACT_VERBW
Definition: precomp.h:27
const PCUITEMID_CHILD * PCUITEMID_CHILD_ARRAY
Definition: shtypes.idl:71
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDS_COL_PASSWORD
Definition: resource.h:32
Definition: IZip.hpp:8
#define IDS_COL_SIZE
Definition: resource.h:33
STDMETHODIMP GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv)
Definition: CZipFolder.hpp:100
#define MF_BYPOSITION
Definition: winuser.h:203
BOOL _GetFileTimeString(LPFILETIME lpFileTime, LPWSTR pwszResult, UINT cchResult)
Definition: CZipFolder.hpp:106
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
WCHAR * guid2string(REFCLSID iid)
Definition: Debug.cpp:21
#define STDMETHODIMP
Definition: basetyps.h:43
HRESULT _CExplorerCommandProvider_CreateInstance(IContextMenu *zipObject, REFIID riid, LPVOID *ppvOut)
#define S_FALSE
Definition: winerror.h:2357
STDMETHODIMP BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
Definition: CZipFolder.hpp:252
#define E_INVALIDARG
Definition: ddrawi.h:101
#define DFM_INVOKECOMMAND
Definition: precomp.h:45
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:136
STDMETHODIMP GetCommandString(UINT_PTR idCmd, UINT uFlags, UINT *pwReserved, LPSTR pszName, UINT cchMax)
Definition: CZipFolder.hpp:476
smooth NULL
Definition: ftsmooth.c:416
voidp zipFile
Definition: zip.h:69
#define CF_HDROP
Definition: constants.h:410
STDMETHODIMP SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut)
Definition: CZipFolder.hpp:453
#define MF_SEPARATOR
Definition: winuser.h:137
LONG_PTR LPARAM
Definition: windef.h:208
UINT indexMenu
Definition: shlobj.h:1307
#define IDS_NO
Definition: resource.h:17
Definition: bufpool.h:45
const char * LPCSTR
Definition: xmlstorage.h:183
struct _SFV_CREATE SFV_CREATE
#define IDS_HELPTEXT
Definition: resource.h:57
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:30
ULONG DosDate
Definition: zippidl.hpp:24
_Check_return_ _CRTIMP int __cdecl stricmp(_In_z_ const char *_Str1, _In_z_ const char *_Str2)
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:541
STDMETHODIMP QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
Definition: CZipFolder.hpp:524
STDMETHODIMP GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay)
Definition: CZipFolder.hpp:88
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:178
STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO pici)
Definition: CZipFolder.hpp:504
char Name[1]
Definition: zippidl.hpp:27
__wchar_t WCHAR
Definition: xmlstorage.h:180
static FolderViewColumns g_ColumnDefs[]
Definition: CZipFolder.hpp:20
BOOL WINAPI DosDateTimeToFileTime(IN WORD wFatDate, IN WORD wFatTime, OUT LPFILETIME lpFileTime)
Definition: time.c:75
#define DFM_GETDEFSTATICID
Definition: precomp.h:47
LONG HRESULT
Definition: typedefs.h:77
UINT idCmdFirst
Definition: shlobj.h:1308
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
unzFile ZEXPORT unzOpen2_64(const void *path, zlib_filefunc64_def *pzlib_filefunc_def)
Definition: unzip.c:778
#define MAX_PATH
Definition: compat.h:26
zlib_filefunc64_def g_FFunc
Definition: zipfldr.cpp:42
#define WINAPI
Definition: msvc.h:8
#define DFM_MERGECONTEXTMENU
Definition: precomp.h:44
STDMETHODIMP GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut)
Definition: CZipFolder.hpp:392
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDS_COL_COMPRSIZE
Definition: resource.h:31
DWORD_PTR WINAPI SHGetFileInfoA(LPCSTR path, DWORD dwFileAttributes, SHFILEINFOA *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:787
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define SHGFI_USEFILEATTRIBUTES
Definition: shellapi.h:179
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
UINT cchMax
unsigned __int64 ULONG64
Definition: imports.h:198
STDMETHODIMP GetDefaultSearchGUID(GUID *pguid)
Definition: CZipFolder.hpp:78
EXTERN_C HRESULT WINAPI SHCreateFileExtractIconW(LPCWSTR pszPath, DWORD dwFileAttributes, REFIID riid, void **ppv)
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
STDMETHODIMP_(unzFile) getZip()
Definition: CZipFolder.hpp:67
static const WCHAR L[]
Definition: oid.c:1250
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define InterlockedDecrement
Definition: armddk.h:52
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
GLenum GLsizei len
Definition: glext.h:6722
static DWORD WINAPI s_ExtractProc(LPVOID arg)
Definition: CZipFolder.hpp:638
STDMETHODIMP Initialize(PCIDLIST_ABSOLUTE pidlFolder, LPDATAOBJECT pDataObj, HKEY hkeyProgID)
Definition: CZipFolder.hpp:545
interface IDataObject * LPDATAOBJECT
Definition: objfwd.h:21
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
STDMETHODIMP GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags)
Definition: CZipFolder.hpp:93
STRSAFEAPI StringCchCopyExW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
Definition: strsafe.h:184
INT WINAPI GetDateFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpDateStr, INT cchOut)
Definition: lcformat.c:979
STRSAFEAPI StringCchCopyA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
Definition: strsafe.h:145
#define S_OK
Definition: intsafe.h:59
const ITEMIDLIST_ABSOLUTE UNALIGNED * PCUIDLIST_ABSOLUTE
Definition: shtypes.idl:63
#define InterlockedIncrement
Definition: armddk.h:53
static HRESULT CALLBACK ZipFolderMenuCallback(IShellFolder *psf, HWND hwnd, IDataObject *pdtobj, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CZipFolder.hpp:353
LIST_ENTRY Entries[5]
Definition: ExDoubleList.c:8
CAtlStringA CStringA
Definition: atlstr.h:131
#define IDS_COL_RATIO
Definition: resource.h:34
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
void _CZipExtract_runWizard(PCWSTR Filename)
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:561
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
#define E_NOTIMPL
Definition: ddrawi.h:99
HRESULT WINAPI SHParseDisplayName(LPCWSTR pszName, IBindCtx *pbc, LPITEMIDLIST *ppidl, SFGAOF sfgaoIn, SFGAOF *psfgaoOut)
Definition: pidl.c:1367
unzFile m_UnzipFile
Definition: CZipFolder.hpp:46
STDMETHODIMP Initialize(PCWSTR zipFile, PCSTR zipDir, PCUIDLIST_ABSOLUTE curDir, PCUIDLIST_RELATIVE pidl)
Definition: CZipFolder.hpp:630
const ZipPidlEntry * _ZipFromIL(LPCITEMIDLIST pidl)
Definition: zippidl.cpp:38
STDMETHODIMP GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut)
Definition: CZipFolder.hpp:317
unsigned int UINT
Definition: ndis.h:50
CStringW m_ZipFile
Definition: CZipFolder.hpp:43
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define IDS_COL_TYPE
Definition: resource.h:9
HANDLE hThread
Definition: wizard.c:27
#define MultiByteToWideChar
Definition: compat.h:100
STDMETHODIMP CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2)
Definition: CZipFolder.hpp:257
#define DPRINT1
Definition: precomp.h:8
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:639
const ITEMIDLIST_RELATIVE UNALIGNED * PCUIDLIST_RELATIVE
Definition: shtypes.idl:57
#define HRESULT_CODE(hr)
Definition: winerror.h:76
DWORD dwFileAttributes
GLuint res
Definition: glext.h:9613
#define HIWORD(l)
Definition: typedefs.h:246
unsigned int ULONG
Definition: retypes.h:1
#define DFM_INVOKECOMMANDEX
Definition: precomp.h:46
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define UNIMPLEMENTED
Definition: debug.h:114
CAtlStringW CStringW
Definition: atlstr.h:130
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
const char * PCSTR
Definition: typedefs.h:51
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HRESULT WINAPI CIDLData_CreateFromIDArray(PCIDLIST_ABSOLUTE pidlFolder, UINT cpidlFiles, PCUIDLIST_RELATIVE_ARRAY lppidlFiles, LPDATAOBJECT *ppdataObject)
Definition: shellord.c:1778
#define END_COM_MAP()
Definition: atlcom.h:552
CStringA m_ZipDir
Definition: CZipFolder.hpp:44
HRESULT _CEnumZipContents_CreateInstance(IZip *zip, DWORD flags, const char *prefix, REFIID riid, LPVOID *ppvOut)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
CHAR szTypeName[80]
Definition: shellapi.h:367
#define EXTERN_C
Definition: basetyps.h:12
STDMETHODIMP Initialize(PCIDLIST_ABSOLUTE pidl)
Definition: CZipFolder.hpp:608
INT WINAPI GetTimeFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpTimeStr, INT cchOut)
Definition: lcformat.c:1079
void Close()
Definition: CZipFolder.hpp:59
#define __FUNCTION__
Definition: types.h:112
GLuint64EXT * result
Definition: glext.h:11304
STDMETHODIMP GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet)
Definition: CZipFolder.hpp:435
UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
Definition: shellole.c:627
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
static TfClientId tid
LPARAM lParam
Definition: combotst.c:139
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)
STDMETHODIMP GetClassID(CLSID *lpClassId)
Definition: CZipFolder.hpp:623
#define EXTRACT_VERBA
Definition: precomp.h:26
#define IDS_COL_NAME
Definition: resource.h:29
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
STDMETHODIMP CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
Definition: CZipFolder.hpp:286