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