ReactOS 0.4.17-dev-470-gf9e3448
CZipFolder.cpp
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 * Copyright 2023-2026 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
7 */
8
9#include "precomp.h"
10#include <ntquery.h> // PID_STG_*
11
12static const GUID FmtIdZipFolder = { 0xE88DCCE0, 0xB7B3, 0x11D1, { 0xA9,0xF0,0x00,0xAA,0x00,0x60,0xFA,0x31 } };
13
15{
23 // IDS_COL_METHOD, SHCOLSTATE_TYPE_STR, ... &FmtIdZipFolder, 3 },
24 // IDS_COL_CRC32, SHCOLSTATE_TYPE_STR, ... &FmtIdZipFolder, 5 },
25};
26
27static int MapScidToColumn(const SHCOLUMNID &scid)
28{
29 for (UINT i = 0; i < _countof(g_ColumnDefs); ++i)
30 {
31 if (IsEqual(scid, g_ColumnDefs[i]))
32 return i;
33 }
34 return -1;
35}
36
38{
39 for (PITEMID_CHILD pidl; List.Next(1, &pidl, NULL) == S_OK;)
40 {
41 ZipPidlEntry *p = (ZipPidlEntry*)pidl;
42 if (!lstrcmpiW(p->Name, Path))
43 return pidl;
44 CoTaskMemFree(pidl);
45 }
46 return NULL;
47}
48
50{
51}
52
54{
55 Close();
56}
57
59{
60 if (m_UnzipFile)
63}
64
65STDMETHODIMP_(unzFile) CZipFolder::getZip()
66{
67 if (!m_UnzipFile)
69 return m_UnzipFile;
70}
71
73{
75 m_ZipDir = zipDir;
76
77 m_CurDir.Attach(ILCombine(curDir, pidl));
78 return S_OK;
79}
80
82{
83 CComBSTR ZipFile;
84 ZipFile.Attach((BSTR)arg);
85
87
89 return 0;
90}
91
92// Adapted from CFileDefExt::GetFileTimeString
93BOOL CZipFolder::_GetFileTimeString(LPFILETIME lpFileTime, PWSTR pwszResult, UINT cchResult)
94{
95 SYSTEMTIME st;
96
97 if (!FileTimeToSystemTime(lpFileTime, &st))
98 return FALSE;
99
100 size_t cchRemaining = cchResult;
101 PWSTR pwszEnd = pwszResult;
102 int cchWritten = GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, pwszEnd, cchRemaining);
103 if (cchWritten)
104 --cchWritten; // GetDateFormatW returns count with terminating zero
105 else
106 return FALSE;
107 cchRemaining -= cchWritten;
108 pwszEnd += cchWritten;
109
110 StringCchCopyExW(pwszEnd, cchRemaining, L" ", &pwszEnd, &cchRemaining, 0);
111
112 cchWritten = GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &st, NULL, pwszEnd, cchRemaining);
113 if (cchWritten)
114 --cchWritten; // GetTimeFormatW returns count with terminating zero
115 else
116 return FALSE;
117
118 return TRUE;
119}
120
122{
126 return S_FALSE;
127
128 HRESULT hr = DeleteItems(pDataObj);
130 {
131 message.LoadString(IDS_CANTDELETEFILE);
133 }
134
135 return hr;
136}
137
139{
140
141 CDataObjectHIDA cida(pDataObj);
142 if (!cida || cida->cidl <= 0)
143 return E_FAIL;
144
145 // Get the target paths
146 CAtlList<CStringW> targetPaths;
147 for (UINT iFile = 0; iFile < cida->cidl; ++iFile)
148 {
149 PCUIDLIST_RELATIVE pidlRelative = HIDA_GetPIDLItem(cida, iFile);
150 const ZipPidlEntry* pEntry = _ZipFromIL(pidlRelative);
151 if (pEntry)
152 {
153 CStringW fullPath = m_ZipDir + pEntry->Name;
154 // For folders, end with a slash
155 if (pEntry->ZipType == ZIP_PIDL_DIRECTORY && fullPath.Right(1) != L"/")
156 fullPath += L"/";
157 targetPaths.AddTail(fullPath);
158 }
159 }
160
161 // Create a temporary file
162 WCHAR szTempPath[MAX_PATH], szTempFile[MAX_PATH];
164 GetTempFileNameW(szTempPath, L"ZIP", 0, szTempFile);
165
166 // Close the current handle to work with the ZIP file
167 Close();
168
169 zlib_filefunc64_def ffunc = {};
171
172 HRESULT hr = S_OK;
173 unzFile uf = unzOpen2_64(m_ZipFile, &ffunc);
174 zipFile zf = zipOpen2_64(szTempFile, APPEND_STATUS_CREATE, NULL, &ffunc);
175
176 if (!uf || !zf)
177 {
178 DPRINT1("Cannot open file\n");
179 if (uf) unzClose(uf);
180 if (zf) zipClose(zf, NULL);
181 return E_FAIL;
182 }
183
184 // Scan all entries in the original ZIP
185 if (unzGoToFirstFile(uf) == UNZ_OK)
186 {
187 do
188 {
189 // Read file entry
191 char szNameA[MAX_PATH];
192 if (unzGetCurrentFileInfo64(uf, &info, szNameA, sizeof(szNameA), NULL, 0, NULL, 0) != UNZ_OK)
193 continue;
194
195 // Read extra field
197 if (info.size_file_extra > 0)
198 {
199 extra.SetCount(info.size_file_extra);
200 unzGetCurrentFileInfo64(uf, NULL, NULL, 0, extra.GetData(), info.size_file_extra, NULL, 0);
201 }
202
203 CStringA utf8Name = CZipEnumerator::GetUtf8Name(szNameA, extra.GetData(), (DWORD)extra.GetCount());
204 CStringW currentEntryName;
205 if (utf8Name.GetLength() > 0)
206 currentEntryName = (LPWSTR)CA2WEX<MAX_PATH>(utf8Name, CP_UTF8);
207 else if (info.flag & MINIZIP_UTF8_FLAG)
208 currentEntryName = (LPWSTR)CA2WEX<MAX_PATH>(szNameA, CP_UTF8);
209 else
210 currentEntryName = (LPWSTR)CA2WEX<MAX_PATH>(szNameA, CP_ACP);
211
212 currentEntryName.Replace(L'\\', L'/');
213
214 // Check if it is on the deletion target list
215 bool bSkip = false;
216 POSITION pos = targetPaths.GetHeadPosition();
217 while (pos)
218 {
219 const CStringW& target = targetPaths.GetNext(pos);
220 // Check for an exact match (file) or a prefix match (folder)
221 if (currentEntryName == target || currentEntryName.Left(target.GetLength()) == target)
222 {
223 bSkip = true;
224 break;
225 }
226 }
227
228 if (!bSkip)
229 {
230 // If not to be deleted, copy to new ZIP
231 hr = CopyZipEntry(uf, zf, &info, szNameA);
233 break;
234 }
235 } while (unzGoToNextFile(uf) == UNZ_OK);
236 }
237
238 unzClose(uf);
239 zipClose(zf, NULL);
240
241 // Replace the original file with the temporary file
242 if (SUCCEEDED(hr) && ReplaceFileW(m_ZipFile, szTempFile, NULL, 0, NULL, NULL))
243 {
244 // Notify the shell that the folder contents have changed
246 }
247 else
248 {
249 DPRINT1("Failed to replace file\n");
250 DeleteFileW(szTempFile);
251 hr = E_FAIL;
252 }
253
254 return hr;
255}
256
258{
259 // Get extra field
261 if (info->size_file_extra > 0)
262 {
263 extra.SetCount(info->size_file_extra);
264 if (unzGetCurrentFileInfo64(uf, NULL, NULL, 0, extra.GetData(),
265 info->size_file_extra, NULL, 0) != UNZ_OK)
266 {
267 DPRINT1("Cannot get extra fields\n");
268 return E_FAIL;
269 }
270 }
271
272 if (unzOpenCurrentFile(uf) != UNZ_OK)
273 {
274 DPRINT1("Cannot open current file\n");
275 return E_FAIL;
276 }
277
278 zip_fileinfo zi = {0};
279 zi.dosDate = info->dosDate;
280 zi.internal_fa = info->internal_fa;
281 zi.external_fa = info->external_fa;
282
283 INT err = zipOpenNewFileInZip3_64(zf, nameA, &zi,
284 extra.GetData(), (UINT)extra.GetCount(),
285 extra.GetData(), (UINT)extra.GetCount(),
288 NULL, 0, info->flag);
289 if (err)
290 {
291 DPRINT1("err: %d\n", err);
293 return E_FAIL;
294 }
295
296 BYTE buffer[4096];
297 INT read;
298 while ((read = unzReadCurrentFile(uf, buffer, sizeof(buffer))) > 0)
300
303 return S_OK;
304}
305
307{
308 if (!pcsFlags || iColumn >= _countof(g_ColumnDefs))
309 return E_INVALIDARG;
310 *pcsFlags = g_ColumnDefs[iColumn].ColumnFlags;
311 return S_OK;
312}
313
315{
316 if (!pidl || !pscid || !pv)
317 return E_INVALIDARG;
318
319 V_VT(pv) = VT_EMPTY;
320
321 PCUIDLIST_RELATIVE curpidl = ILGetNext(pidl);
322 if (curpidl->mkid.cb != 0)
323 {
324 DPRINT1("ERROR, unhandled PIDL!\n");
325 return E_FAIL;
326 }
327 const ZipPidlEntry* zipEntry = _ZipFromIL(pidl);
328 if (!zipEntry)
329 return E_INVALIDARG;
330 bool isDir = zipEntry->IsDirectory();
331
332 // Handle the non-string columns here so the caller gets the correct variant type
333 if (!isDir && IsEqual(*pscid, g_ColumnDefs[COL_SIZE]))
334 {
335 V_VT(pv) = VT_UI8;
336 V_UI8(pv) = zipEntry->UncompressedSize;
337 return S_OK;
338 }
339 else if (!isDir && IsEqual(*pscid, g_ColumnDefs[COL_COMPRSIZE]))
340 {
341 V_VT(pv) = VT_UI8;
342 V_UI8(pv) = zipEntry->CompressedSize;
343 return S_OK;
344 }
345 else if (!isDir && IsEqual(*pscid, g_ColumnDefs[COL_DATE_MOD]))
346 {
347 if (DosDateTimeToVariantTime(HIWORD(zipEntry->DosDate), LOWORD(zipEntry->DosDate), &V_DATE(pv)))
348 {
349 V_VT(pv) = VT_DATE;
350 return S_OK;
351 }
352 }
353
354 HRESULT hr = E_FAIL;
355 int col = MapScidToColumn(*pscid);
356 if (col >= 0)
357 {
359 if (SUCCEEDED(hr = GetDetailsOf(pidl, col, &sd)))
360 {
362 if (SUCCEEDED(hr = StrRetToStrW(&sd.str, pidl, &str)))
363 {
365 if (SUCCEEDED(hr))
366 V_VT(pv) = VT_BSTR;
367 }
368 }
369 }
370 return hr;
371}
372
374{
375 if (iColumn >= _countof(g_ColumnDefs))
376 return E_FAIL;
377
378 psd->cxChar = g_ColumnDefs[iColumn].cxChar;
379 psd->fmt = g_ColumnDefs[iColumn].fmt;
380
381 if (pidl == NULL)
382 {
383 return SHSetStrRet(&psd->str, _AtlBaseModule.GetResourceInstance(), g_ColumnDefs[iColumn].iResource);
384 }
385
386 PCUIDLIST_RELATIVE curpidl = ILGetNext(pidl);
387 if (curpidl->mkid.cb != 0)
388 {
389 DPRINT1("ERROR, unhandled PIDL!\n");
390 return E_FAIL;
391 }
392
393 const ZipPidlEntry* zipEntry = _ZipFromIL(pidl);
394 if (!zipEntry)
395 return E_INVALIDARG;
396
397 WCHAR Buffer[100];
398 bool isDir = zipEntry->ZipType == ZIP_PIDL_DIRECTORY;
399 switch (iColumn)
400 {
401 case COL_NAME:
402 return GetDisplayNameOf(pidl, SHGDN_INFOLDER, &psd->str);
403 case COL_TYPE:
404 {
405 SHFILEINFOW shfi;
407 ULONG_PTR firet = SHGetFileInfoW(zipEntry->Name, dwAttributes, &shfi, sizeof(shfi), SHGFI_USEFILEATTRIBUTES | SHGFI_TYPENAME);
408 if (!firet)
409 return E_FAIL;
410 return SHSetStrRet(&psd->str, shfi.szTypeName);
411 }
412 case COL_COMPRSIZE:
413 case COL_SIZE:
414 {
415 if (isDir)
416 return SHSetStrRet(&psd->str, L"");
417
418 ULONG64 Size = iColumn == COL_COMPRSIZE ? zipEntry->CompressedSize : zipEntry->UncompressedSize;
420 return E_FAIL;
421 return SHSetStrRet(&psd->str, Buffer);
422 }
423 case COL_PASSWORD:
424 if (isDir)
425 return SHSetStrRet(&psd->str, L"");
426 return SHSetStrRet(&psd->str, _AtlBaseModule.GetResourceInstance(), zipEntry->Password ? IDS_YES : IDS_NO);
427 case COL_RATIO:
428 {
429 if (isDir)
430 return SHSetStrRet(&psd->str, L"");
431
432 int ratio = 0;
433 if (zipEntry->UncompressedSize)
434 ratio = 100 - (int)((zipEntry->CompressedSize*100)/zipEntry->UncompressedSize);
435 StringCchPrintfW(Buffer, _countof(Buffer), L"%d%%", ratio);
436 return SHSetStrRet(&psd->str, Buffer);
437 }
438 case COL_DATE_MOD:
439 {
440 if (isDir)
441 return SHSetStrRet(&psd->str, L"");
442 FILETIME ftLocal;
443 DosDateTimeToFileTime((WORD)(zipEntry->DosDate>>16), (WORD)zipEntry->DosDate, &ftLocal);
444 if (!_GetFileTimeString(&ftLocal, Buffer, _countof(Buffer)))
445 return E_FAIL;
446 return SHSetStrRet(&psd->str, Buffer);
447 }
448 }
449
451 return E_NOTIMPL;
452}
453
455{
457 {
458 pscid->fmtid = *g_ColumnDefs[column].pkg;
459 pscid->pid = g_ColumnDefs[column].pki;
460 return S_OK;
461 }
462 return E_FAIL;
463}
464
465STDMETHODIMP CZipFolder::ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes)
466{
467 if (pchEaten)
468 *pchEaten = 0;
469
472 HRESULT hr = EnumObjects(hwndOwner, dwFlags, &pEnum);
473 if (FAILED(hr))
474 return hr;
475
476 PIDLIST_RELATIVE pidl = FindItem(*pEnum, lpszDisplayName);
477 if (!pidl)
479
480 *ppidl = pidl;
481 if (pchEaten)
482 *pchEaten = lstrlenW(lpszDisplayName);
483 if (pdwAttributes)
484 GetAttributesOf(1, ppidl, (SFGAOF*)pdwAttributes);
485 return S_OK;
486}
487
489{
490 if (riid == IID_IShellFolder)
491 {
492 CStringW newZipDir = m_ZipDir;
493 PCUIDLIST_RELATIVE curpidl = pidl;
494 while (curpidl->mkid.cb)
495 {
496 const ZipPidlEntry* zipEntry = _ZipFromIL(curpidl);
497 if (!zipEntry)
498 {
499 return E_FAIL;
500 }
501 newZipDir += zipEntry->Name;
502 newZipDir += L'/';
503
504 curpidl = ILGetNext(curpidl);
505 }
506 return ShellObjectCreatorInit<CZipFolder>(m_ZipFile, newZipDir, m_CurDir, pidl, riid, ppvOut);
507 }
508 DbgPrint("%s(%S) UNHANDLED\n", __FUNCTION__, guid2string(riid));
509 return E_NOTIMPL;
510}
511
513{
514 const ZipPidlEntry* zipEntry1 = _ZipFromIL(pidl1);
515 const ZipPidlEntry* zipEntry2 = _ZipFromIL(pidl2);
516
517 if (!zipEntry1 || !zipEntry2)
518 return E_INVALIDARG;
519
520 int result = 0;
521 if (zipEntry1->ZipType != zipEntry2->ZipType)
522 result = zipEntry1->ZipType - zipEntry2->ZipType;
523 else
524 result = StrCmpIW(zipEntry1->Name, zipEntry2->Name);
525
526 if (!result && zipEntry1->ZipType == ZIP_PIDL_DIRECTORY)
527 {
528 PCUIDLIST_RELATIVE child1 = ILGetNext(pidl1);
529 PCUIDLIST_RELATIVE child2 = ILGetNext(pidl2);
530
531 if (child1->mkid.cb && child2->mkid.cb)
532 return CompareIDs(lParam, child1, child2);
533 else if (child1->mkid.cb)
534 result = 1;
535 else if (child2->mkid.cb)
536 result = -1;
537 }
538
540}
541
543{
544 m_hwnd = hwndOwner ? hwndOwner : m_hwnd;
545
546 static const GUID UnknownIID = // {93F81976-6A0D-42C3-94DD-AA258A155470}
547 {0x93F81976, 0x6A0D, 0x42C3, {0x94, 0xDD, 0xAA, 0x25, 0x8A, 0x15, 0x54, 0x70}};
548 if (riid == IID_IShellView)
549 {
550 SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this};
552
553 HRESULT hr = _CFolderViewCB_CreateInstance(IID_PPV_ARG(IShellFolderViewCB, &pcb));
555 return hr;
556
557 sfvparams.psfvcb = pcb;
558 hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppvOut);
559
560 return hr;
561 }
562 else if (riid == IID_IExplorerCommandProvider)
563 {
565 }
566 else if (riid == IID_IContextMenu)
567 {
568 // Folder context menu
569 return QueryInterface(riid, ppvOut);
570 }
571 else if (riid == IID_IDropTarget)
572 {
573 *ppvOut = static_cast<IDropTarget*>(this);
574 AddRef();
575 return S_OK;
576 }
577 if (UnknownIID != riid)
578 DbgPrint("%s(%S) UNHANDLED\n", __FUNCTION__, guid2string(riid));
579 return E_NOTIMPL;
580}
581
583{
584 if (!rgfInOut || !cidl || !apidl)
585 return E_INVALIDARG;
586
587 *rgfInOut = 0;
588
589 //static DWORD dwFileAttrs = SFGAO_STREAM | SFGAO_HASPROPSHEET | SFGAO_CANDELETE | SFGAO_CANCOPY | SFGAO_CANMOVE;
590 //static DWORD dwFolderAttrs = SFGAO_FOLDER | SFGAO_DROPTARGET | SFGAO_HASPROPSHEET | SFGAO_CANDELETE | SFGAO_STORAGE | SFGAO_CANCOPY | SFGAO_CANMOVE;
591 static DWORD dwFileAttrs = SFGAO_CANDELETE | SFGAO_STREAM;
592 static DWORD dwFolderAttrs = SFGAO_CANDELETE | SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_BROWSABLE | SFGAO_DROPTARGET;
593
594 while (cidl > 0 && *apidl)
595 {
596 const ZipPidlEntry* zipEntry = _ZipFromIL(*apidl);
597
598 if (zipEntry)
599 {
600 if (zipEntry->ZipType == ZIP_PIDL_FILE)
601 *rgfInOut |= dwFileAttrs;
602 else
603 *rgfInOut |= dwFolderAttrs;
604 }
605 else
606 {
607 *rgfInOut = 0;
608 }
609
610 apidl++;
611 cidl--;
612 }
613
614 *rgfInOut &= ~SFGAO_FILESYSTEM;
615 *rgfInOut &= ~SFGAO_VALIDATE;
616 return S_OK;
617}
618
620 IShellFolder *psf, HWND hwnd, IDataObject *pdtobj,
622{
623 CZipFolder* pThis = static_cast<CZipFolder*>(psf);
624 if (!pThis)
625 return E_FAIL;
626
627 pThis->m_pDataObj = pdtobj;
628
629 switch (uMsg)
630 {
632 {
633 CComQIIDPtr<I_ID(IContextMenu)> spContextMenu(psf);
634 if (!spContextMenu)
635 {
636 DPRINT1("E_NOINTERFACE\n");
637 return E_NOINTERFACE;
638 }
639
640 QCMINFO *pqcminfo = (QCMINFO *)lParam;
641 HRESULT hr = spContextMenu->QueryContextMenu(pqcminfo->hmenu,
642 pqcminfo->indexMenu,
643 pqcminfo->idCmdFirst,
644 pqcminfo->idCmdLast,
645 CMF_NORMAL);
647 return hr;
648
649 pqcminfo->idCmdFirst += HRESULT_CODE(hr);
650 return S_OK;
651 }
653 return E_NOTIMPL;
655 {
656 if (wParam == DFM_CMD_DELETE)
657 return pThis->DoDeleteItems(pdtobj);
658
659 CComQIIDPtr<I_ID(IContextMenu)> spContextMenu(psf);
660 if (!spContextMenu)
661 {
662 DPRINT1("E_NOINTERFACE\n");
663 return E_NOINTERFACE;
664 }
665
666 CMINVOKECOMMANDINFO ici = { sizeof(ici) };
667 ici.hwnd = hwnd;
668 ici.lpVerb = (LPSTR)wParam;
669 ici.nShow = SW_SHOWNORMAL;
670
671 return spContextMenu->InvokeCommand(&ici);
672 }
673 case DFM_GETDEFSTATICID: // Required for Windows 7 to pick a default
674 return S_FALSE;
675 case DFM_WM_INITMENUPOPUP: // FIXME: Make it effective in `CDefViewBckgrndMenu`
676 {
677 // Disable [Paste] / [Paste link] menu items
680 break;
681 }
682 }
683 return E_NOTIMPL;
684}
685
687{
688 m_hwnd = hwndOwner ? hwndOwner : m_hwnd;
689 if ((riid == IID_IExtractIconA || riid == IID_IExtractIconW) && cidl == 1)
690 {
691 const ZipPidlEntry* zipEntry = _ZipFromIL(*apidl);
692 if (zipEntry)
693 {
695 return SHCreateFileExtractIconW(zipEntry->Name, dwAttributes, riid, ppvOut);
696 }
697 }
698 else if (riid == IID_IContextMenu && cidl >= 0)
699 {
700 // Context menu of an object inside the zip
701 const ZipPidlEntry* zipEntry = _ZipFromIL(*apidl);
702 if (zipEntry)
703 {
704 HKEY keys[1] = {0};
705 int nkeys = 0;
706 if (zipEntry->ZipType == ZIP_PIDL_DIRECTORY)
707 {
709 if (res != ERROR_SUCCESS)
710 return E_FAIL;
711 nkeys++;
712 }
713 return CDefFolderMenu_Create2(NULL, hwndOwner, cidl, apidl, this, ZipFolderMenuCallback, nkeys, keys, (IContextMenu**)ppvOut);
714 }
715 }
716 else if (riid == IID_IDataObject && cidl >= 1)
717 {
718 return CIDLData_CreateFromIDArray(m_CurDir, cidl, apidl, (IDataObject**)ppvOut);
719 }
720 else if (riid == IID_IDropTarget)
721 {
722 AddRef();
723 *ppvOut = static_cast<IDropTarget*>(this);
724 return S_OK;
725 }
726
727 DbgPrint("%s(%S) UNHANDLED\n", __FUNCTION__ , guid2string(riid));
728 return E_NOINTERFACE;
729}
730
732{
733 if (!pidl)
734 return S_FALSE;
735
736 PCUIDLIST_RELATIVE curpidl = ILGetNext(pidl);
737 if (curpidl->mkid.cb != 0)
738 {
739 DPRINT1("ERROR, unhandled PIDL!\n");
740 return E_FAIL;
741 }
742
743 const ZipPidlEntry* zipEntry = _ZipFromIL(pidl);
744 if (!zipEntry)
745 return E_FAIL;
746
748 {
750 return SHSetStrRet(strRet, zipEntry->Name);
751
754 return E_FAIL;
755 UINT cch = lstrlenW(parent) + 1 + lstrlenW(zipEntry->Name) + 1;
756 strRet->uType = STRRET_WSTR;
757 strRet->pOleStr = (LPWSTR)SHAlloc(cch * sizeof(WCHAR));
758 if (!strRet->pOleStr)
759 return E_OUTOFMEMORY;
760 lstrcpyW(strRet->pOleStr, parent);
761 PathAppendW(strRet->pOleStr, zipEntry->Name);
762 return S_OK;
763 }
764
765 SHFILEINFOW fi;
767 if (SHGetFileInfoW(zipEntry->Name, attr, &fi, sizeof(fi), SHGFI_DISPLAYNAME | SHGFI_USEFILEATTRIBUTES))
768 return SHSetStrRet(strRet, fi.szDisplayName);
769 return SHSetStrRet(strRet, zipEntry->Name);
770}
771
773{
774 if (idCmd != 0)
775 return E_INVALIDARG;
776
777 switch (uFlags)
778 {
779 case GCS_VERBA:
780 return StringCchCopyA(pszName, cchMax, EXTRACT_VERBA);
781 case GCS_VERBW:
782 return StringCchCopyW((PWSTR)pszName, cchMax, EXTRACT_VERBW);
783 case GCS_HELPTEXTA:
784 {
786 return StringCchCopyA(pszName, cchMax, helpText);
787 }
788 case GCS_HELPTEXTW:
789 {
791 return StringCchCopyW((PWSTR)pszName, cchMax, helpText);
792 }
793 case GCS_VALIDATEA:
794 case GCS_VALIDATEW:
795 return S_OK;
796 }
797
798 return E_INVALIDARG;
799}
800
802{
803 if (!pici || (pici->cbSize != sizeof(CMINVOKECOMMANDINFO) && pici->cbSize != sizeof(CMINVOKECOMMANDINFOEX)))
804 return E_INVALIDARG;
805
806 if (pici->lpVerb == MAKEINTRESOURCEA(0) ||
807 (!IS_INTRESOURCE(pici->lpVerb) && !strcmp(pici->lpVerb, EXTRACT_VERBA)))
808 {
809 BSTR ZipFile = m_ZipFile.AllocSysString();
811
812 DWORD tid;
814 if (hThread)
815 {
817 return S_OK;
818 }
819 }
820
821 if (pici->lpVerb == MAKEINTRESOURCEA(DFM_CMD_DELETE) ||
822 (!IS_INTRESOURCE(pici->lpVerb) && !strcmp(pici->lpVerb, "delete")))
823 {
825 }
826
827 return E_INVALIDARG;
828}
829
831{
832 UINT idCmd = idCmdFirst;
833
834 if (!(uFlags & CMF_DEFAULTONLY))
835 {
837
838 if (indexMenu)
839 InsertMenuW(hmenu, indexMenu++, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
840 InsertMenuW(hmenu, indexMenu++, MF_BYPOSITION | MF_STRING, idCmd++, menuText); // Command 0
841 }
842
843 return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, idCmd - idCmdFirst);
844}
845
847{
848 FORMATETC etc = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
849 STGMEDIUM stg;
850
851 HRESULT hr = pDataObj->GetData(&etc, &stg);
853 return hr;
854
855 hr = E_FAIL;
856 HDROP hdrop = (HDROP)GlobalLock(stg.hGlobal);
857 if (hdrop)
858 {
859 UINT uNumFiles = DragQueryFileW(hdrop, 0xFFFFFFFF, NULL, 0);
860 if (uNumFiles == 1)
861 {
862 WCHAR szFile[MAX_PATH * 2];
863 if (DragQueryFileW(hdrop, 0, szFile, _countof(szFile)))
864 {
866 hr = SHParseDisplayName(szFile, NULL, &pidl, 0, NULL);
868 {
869 hr = Initialize(pidl);
870 }
871 }
872 else
873 {
874 DbgPrint("Failed to query the file.\r\n");
875 }
876 }
877 else
878 {
879 DbgPrint("Invalid number of files: %d\r\n", uNumFiles);
880 }
881 GlobalUnlock(stg.hGlobal);
882 }
883 else
884 {
885 DbgPrint("Could not lock stg.hGlobal\r\n");
886 }
887 ReleaseStgMedium(&stg);
888 return hr;
889}
890
892{
893 WCHAR tmpPath[MAX_PATH];
894
895 if (SHGetPathFromIDListW(pidl, tmpPath))
896 {
897 m_ZipFile = tmpPath;
898 m_CurDir.Attach(ILClone(pidl));
899 return S_OK;
900 }
901 DbgPrint("%s() => Unable to parse pidl\n", __FUNCTION__);
902 return E_INVALIDARG;
903}
904
906{
907 return S_FALSE;
908}
909
911{
913
916 if (SUCCEEDED(hr))
917 {
918 m_CurDir.Attach(pidl.Detach());
919 }
920
921 return S_OK;
922}
923
925{
926 return E_NOTIMPL;
927}
928
930{
931 return S_OK;
932}
933
935{
936 if (!ppszFileName)
937 return E_INVALIDARG;
938
939 *ppszFileName = NULL;
940
941 if (m_ZipFile.IsEmpty())
942 return S_FALSE;
943
944 *ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_ZipFile.GetLength() + 1) * sizeof(WCHAR));
945 if (!*ppszFileName)
946 return E_OUTOFMEMORY;
947
948 wcscpy(*ppszFileName, m_ZipFile);
949 return S_OK;
950}
951
953{
954 *pdwEffect &= DROPEFFECT_COPY;
955 return S_OK;
956}
957
959{
960 *pdwEffect &= DROPEFFECT_COPY;
961 return S_OK;
962}
963
965{
966 return S_OK;
967}
968
969STDMETHODIMP CZipFolder::Drop(IDataObject* pDataObj, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect)
970{
971 STGMEDIUM sm;
972 FORMATETC fe = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
973 HRESULT hr = pDataObj->GetData(&fe, &sm);
975 return hr;
976
977 HDROP hDrop = (HDROP)GlobalLock(sm.hGlobal);
978 if (hDrop)
979 {
980 // Close the ZIP file before appending (it will be automatically
981 // reopened next time getZip() is called)
982 Close();
983
984 // Create creator
986
987 pCreator->SetNotifyPidl(m_CurDir);
988
989 // Add dropped files
990 UINT fileCount = DragQueryFileW(hDrop, 0xFFFFFFFF, NULL, 0);
991 for (UINT i = 0; i < fileCount; i++)
992 {
995 pCreator->DoAddItem(szFilePath);
996 }
997
998 CZipCreator::runThread(pCreator);
999
1000 GlobalUnlock(sm.hGlobal);
1001 *pdwEffect = DROPEFFECT_COPY;
1002 }
1003 ReleaseStgMedium(&sm);
1004
1005 return S_OK;
1006}
LONG g_ModuleRefCnt
Definition: ACPPage.cpp:13
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:4824
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)
HRESULT _CExplorerCommandProvider_CreateInstance(IContextMenu *zipObject, REFIID riid, LPVOID *ppvOut)
EXTERN_C HRESULT WINAPI SHCreateFileExtractIconW(_In_ LPCWSTR pszFile, _In_ DWORD dwFileAttributes, _In_ REFIID riid, _Outptr_ void **ppv)
HRESULT _CFolderViewCB_CreateInstance(REFIID riid, LPVOID *ppvOut)
static FolderViewColumns g_ColumnDefs[]
Definition: CFontExt.cpp:34
void _CZipExtract_runWizard(PCWSTR Filename)
static PIDLIST_RELATIVE FindItem(IEnumIDList &List, PCWSTR Path)
Definition: CZipFolder.cpp:37
static const FolderViewColumn g_ColumnDefs[]
Definition: CZipFolder.cpp:14
static int MapScidToColumn(const SHCOLUMNID &scid)
Definition: CZipFolder.cpp:27
static const GUID FmtIdZipFolder
Definition: CZipFolder.cpp:12
@ COL_COMPRSIZE
Definition: CZipFolder.hpp:15
@ COL_PASSWORD
Definition: CZipFolder.hpp:16
@ COL_RATIO
Definition: CZipFolder.hpp:18
@ COL_NAME
Definition: CZipFolder.hpp:13
@ COL_DATE_MOD
Definition: CZipFolder.hpp:19
@ COL_TYPE
Definition: CZipFolder.hpp:14
@ COL_SIZE
Definition: CZipFolder.hpp:17
WCHAR * guid2string(REFCLSID iid)
Definition: Debug.cpp:21
PRTL_UNICODE_STRING_BUFFER Path
UINT cchMax
#define read
Definition: acwin.h:97
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define I_ID(Itype)
Definition: atlcomcli.h:215
#define IDS_YES
Definition: resource.h:16
#define IDS_NO
Definition: resource.h:17
#define IDS_COL_TYPE
Definition: resource.h:9
#define CF_HDROP
Definition: constants.h:410
#define DPRINT1
Definition: precomp.h:8
#define STDMETHODIMP
Definition: basetyps.h:43
#define STDMETHODIMP_(t)
Definition: basetyps.h:44
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
EXTERN_C void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
POSITION AddTail(INARGTYPE element)
Definition: atlcoll.h:629
POSITION GetHeadPosition() const
Definition: atlcoll.h:554
E & GetNext(_Inout_ POSITION &pos)
Definition: atlcoll.h:566
void Attach(BSTR bstr)
Definition: atlcomcli.h:379
bool IsEmpty() const noexcept
Definition: atlsimpstr.h:394
int GetLength() const noexcept
Definition: atlsimpstr.h:362
CStringT Right(int nCount) const
Definition: cstringt.h:788
int Replace(PCXSTR pszOld, PCXSTR pszNew)
Definition: cstringt.h:886
CStringT Left(int nCount) const
Definition: cstringt.h:776
BSTR AllocSysString() const
Definition: cstringt.h:1063
Definition: bufpool.h:45
T * Detach()
Definition: atlalloc.h:168
static BOOL runThread(CZipCreator *pCreator)
static CZipCreator * DoCreate(PCWSTR pszExistingZip=NULL, PCWSTR pszTargetDir=NULL)
void SetNotifyPidl(PCIDLIST_ABSOLUTE pidl)
Definition: CZipCreator.hpp:26
virtual void DoAddItem(PCWSTR pszFile)
STDMETHODIMP GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv) override
Definition: CZipFolder.cpp:314
STDMETHODIMP MapColumnToSCID(UINT column, SHCOLUMNID *pscid) override
Definition: CZipFolder.cpp:454
HRESULT DeleteItems(CComPtr< IDataObject > pDataObj)
Definition: CZipFolder.cpp:138
CStringW m_ZipFile
Definition: CZipFolder.hpp:54
STDMETHODIMP Save(LPCOLESTR pszFileName, BOOL fRemember) override
Definition: CZipFolder.cpp:924
STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) override
Definition: CZipFolder.cpp:958
STDMETHODIMP CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2) override
Definition: CZipFolder.cpp:512
HRESULT CopyZipEntry(unzFile uf, zipFile zf, unz_file_info64 *info, LPCSTR nameA)
Definition: CZipFolder.cpp:257
STDMETHODIMP GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd) override
Definition: CZipFolder.cpp:373
STDMETHODIMP IsDirty() override
Definition: CZipFolder.cpp:905
STDMETHODIMP EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList) override
Definition: CZipFolder.hpp:106
STDMETHODIMP DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) override
Definition: CZipFolder.cpp:952
STDMETHODIMP SaveCompleted(LPCOLESTR pszFileName) override
Definition: CZipFolder.cpp:929
STDMETHODIMP ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes) override
Definition: CZipFolder.cpp:465
STDMETHODIMP DragLeave() override
Definition: CZipFolder.cpp:964
STDMETHODIMP GetCurFile(LPOLESTR *ppszFileName) override
Definition: CZipFolder.cpp:934
static HRESULT CALLBACK ZipFolderMenuCallback(IShellFolder *psf, HWND hwnd, IDataObject *pdtobj, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CZipFolder.cpp:619
STDMETHODIMP QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override
Definition: CZipFolder.cpp:830
HRESULT DoDeleteItems(CComPtr< IDataObject > pDataObj)
Definition: CZipFolder.cpp:121
void Close()
Definition: CZipFolder.cpp:58
STDMETHODIMP Load(LPCOLESTR pszFileName, DWORD dwMode) override
Definition: CZipFolder.cpp:910
STDMETHODIMP GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut) override
Definition: CZipFolder.cpp:582
STDMETHODIMP GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet) override
Definition: CZipFolder.cpp:731
STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO pici) override
Definition: CZipFolder.cpp:801
CComHeapPtr< ITEMIDLIST > m_CurDir
Definition: CZipFolder.hpp:56
unzFile m_UnzipFile
Definition: CZipFolder.hpp:57
STDMETHODIMP GetCommandString(UINT_PTR idCmd, UINT uFlags, UINT *pwReserved, LPSTR pszName, UINT cchMax) override
Definition: CZipFolder.cpp:772
CComPtr< IDataObject > m_pDataObj
Definition: CZipFolder.hpp:58
HRESULT Initialize(PCWSTR zipFile, PCWSTR zipDir, PCUIDLIST_ABSOLUTE curDir, PCUIDLIST_RELATIVE pidl)
Definition: CZipFolder.cpp:72
STDMETHODIMP CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut) override
Definition: CZipFolder.cpp:542
STDMETHODIMP GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut) override
Definition: CZipFolder.cpp:686
CStringW m_ZipDir
Definition: CZipFolder.hpp:55
STDMETHODIMP BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
Definition: CZipFolder.cpp:488
static DWORD WINAPI s_ExtractProc(LPVOID arg)
Definition: CZipFolder.cpp:81
STDMETHODIMP Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) override
Definition: CZipFolder.cpp:969
BOOL _GetFileTimeString(LPFILETIME lpFileTime, PWSTR pwszResult, UINT cchResult)
Definition: CZipFolder.cpp:93
STDMETHODIMP GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags) override
Definition: CZipFolder.cpp:306
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
HRESULT hr
Definition: delayimp.cpp:582
#define ERROR_SUCCESS
Definition: deptool.c:10
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define IDS_COL_NAME
Definition: resource.h:17
#define IDS_COL_SIZE
Definition: resource.h:18
#define DFM_GETDEFSTATICID
Definition: precomp.h:47
#define DFM_INVOKECOMMANDEX
Definition: precomp.h:46
#define DFM_MERGECONTEXTMENU
Definition: precomp.h:44
#define DFM_INVOKECOMMAND
Definition: precomp.h:45
zlib_filefunc64_def g_FFunc
Definition: zipfldr.cpp:45
#define EXTRACT_VERBA
Definition: precomp.h:25
#define EXTRACT_VERBW
Definition: precomp.h:26
#define MINIZIP_UTF8_FLAG
Definition: precomp.h:43
#define IDS_COL_DATE_MOD
Definition: resource.h:44
#define IDS_COL_RATIO
Definition: resource.h:43
#define IDS_CONFIRMDELETE_TEXT
Definition: resource.h:71
#define IDS_MENUITEM
Definition: resource.h:74
#define IDS_FRIENDLYNAME
Definition: resource.h:76
#define IDS_COL_COMPRSIZE
Definition: resource.h:40
#define IDS_CANTDELETEFILE
Definition: resource.h:56
#define IDS_COL_PASSWORD
Definition: resource.h:41
#define IDS_HELPTEXT
Definition: resource.h:75
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
UINT uFlags
Definition: api.c:59
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
#define CloseHandle
Definition: compat.h:739
#define CP_ACP
Definition: compat.h:109
OLECHAR * BSTR
Definition: compat.h:2293
#define MAX_PATH
Definition: compat.h:34
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define CALLBACK
Definition: compat.h:35
#define lstrcpyW
Definition: compat.h:749
@ VT_UI8
Definition: compat.h:2315
@ VT_BSTR
Definition: compat.h:2303
@ VT_DATE
Definition: compat.h:2302
@ VT_EMPTY
Definition: compat.h:2295
#define lstrlenW
Definition: compat.h:750
#define Z_DEFLATED
Definition: zlib.h:146
#define Z_DEFAULT_STRATEGY
Definition: zlib.h:137
#define MAX_WBITS
Definition: zlib.h:151
#define Z_DEFAULT_COMPRESSION
Definition: zlib.h:130
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI ReplaceFileW(LPCWSTR lpReplacedFileName, LPCWSTR lpReplacementFileName, LPCWSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved)
Definition: move.c:1090
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:1999
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
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:183
BOOL WINAPI DosDateTimeToFileTime(IN WORD wFatDate, IN WORD wFatTime, OUT LPFILETIME lpFileTime)
Definition: time.c:75
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4171
#define IS_INTRESOURCE(x)
Definition: loader.c:613
const UINT * keys
Definition: locale.c:418
int WINAPI StrCmpIW(const WCHAR *str, const WCHAR *comp)
Definition: string.c:464
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3324
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2014
UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
Definition: shellole.c:666
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:348
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:854
HRESULT WINAPI StrRetToStrW(LPSTRRET lpStrRet, const ITEMIDLIST *pidl, LPWSTR *ppszName)
Definition: string.c:349
#define FAILED_UNEXPECTEDLY
Definition: utils.cpp:33
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:29
#define pt(x, y)
Definition: drawing.c:79
#define L(x)
Definition: resources.c:13
r parent
Definition: btrfs.c:3010
#define __FUNCTION__
Definition: types.h:116
@ IsEqual
Definition: fatprocs.h:1887
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DEF_MEM_LEVEL
Definition: zutil.h:53
PLIST_ENTRY pEntry
Definition: fxioqueue.cpp:4484
GLuint res
Definition: glext.h:9613
GLuint buffer
Definition: glext.h:5915
GLuint64EXT * result
Definition: glext.h:11304
GLfloat GLfloat p
Definition: glext.h:8902
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define DbgPrint
Definition: hal.h:12
unsigned int UINT
Definition: sysinfo.c:13
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
@ extra
Definition: id3.c:95
REFIID riid
Definition: atlbase.h:39
static TfClientId tid
HRESULT GetData([in, unique] FORMATETC *pformatetcIn, [out] STGMEDIUM *pmedium)
const DWORD DROPEFFECT_COPY
Definition: oleidl.idl:930
ULONG SFGAOF
Definition: shobjidl.idl:222
@ SHCONTF_INCLUDESUPERHIDDEN
Definition: shobjidl.idl:184
@ SHCONTF_INCLUDEHIDDEN
Definition: shobjidl.idl:175
@ SHCONTF_NONFOLDERS
Definition: shobjidl.idl:174
ULONG AddRef()
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
void fill_win32_filefunc64W(zlib_filefunc64_def *pzlib_filefunc_def)
Definition: iowin32.c:457
static ERESOURCE GlobalLock
Definition: sys_arch.c:8
INT WINAPI GetTimeFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpTimeStr, INT cchOut)
Definition: lcformat.c:1101
INT WINAPI GetDateFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpDateStr, INT cchOut)
Definition: lcformat.c:1001
LONG_PTR LPARAM
Definition: minwindef.h:175
UINT_PTR WPARAM
Definition: minwindef.h:174
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
unsigned __int64 ULONG64
Definition: imports.h:198
static char szTempPath[MAX_PATH]
Definition: data.c:16
static const WCHAR sd[]
Definition: suminfo.c:286
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
static HMENU hmenu
Definition: win.c:78
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
HANDLE hThread
Definition: wizard.c:28
#define KEY_READ
Definition: nt_native.h:1026
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define LOCALE_USER_DEFAULT
#define PID_STG_STORAGETYPE
Definition: ntquery.h:50
#define PID_STG_WRITETIME
Definition: ntquery.h:60
#define PID_STG_SIZE
Definition: ntquery.h:58
#define PID_STG_NAME
Definition: ntquery.h:56
interface IBindCtx * LPBC
Definition: objfwd.h:18
interface IDataObject * LPDATAOBJECT
Definition: objfwd.h:21
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
#define V_DATE(A)
Definition: oleauto.h:231
#define V_UI8(A)
Definition: oleauto.h:272
const GUID IID_IDataObject
#define PathAppendW
Definition: pathcch.h:310
#define LOWORD(l)
Definition: pedump.c:82
short WCHAR
Definition: pedump.c:58
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:238
HRESULT WINAPI SHParseDisplayName(LPCWSTR pszName, IBindCtx *pbc, LPITEMIDLIST *ppidl, SFGAOF sfgaoIn, SFGAOF *psfgaoOut)
Definition: pidl.c:1548
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:817
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1496
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:977
static char title[]
Definition: ps.c:92
#define LVCFMT_LEFT
Definition: commctrl.h:2603
#define LVCFMT_RIGHT
Definition: commctrl.h:2604
#define REFIID
Definition: guiddef.h:118
static WCHAR szFilePath[]
Definition: qotd.c:14
#define err(...)
const WCHAR * str
#define CP_UTF8
Definition: nls.h:20
wcscpy
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:430
_In_ UINT _In_ UINT cch
Definition: shellapi.h:432
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:166
#define SHGFI_TYPENAME
Definition: shellapi.h:167
#define SHGFI_USEFILEATTRIBUTES
Definition: shellapi.h:181
HRESULT WINAPI CIDLData_CreateFromIDArray(PCIDLIST_ABSOLUTE pidlFolder, UINT cpidlFiles, PCUIDLIST_RELATIVE_ARRAY lppidlFiles, LPDATAOBJECT *ppdataObject)
Definition: shellord.c:2436
static PCUIDLIST_RELATIVE HIDA_GetPIDLItem(CIDA const *pida, SIZE_T i)
Definition: shellutils.h:721
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:686
#define DFM_CMD_DELETE
Definition: shlobj.h:2625
#define DFM_WM_INITMENUPOPUP
Definition: shlobj.h:2614
#define SHCNE_UPDATEDIR
Definition: shlobj.h:1918
struct _SFV_CREATE SFV_CREATE
#define SHCNF_IDLIST
Definition: shlobj.h:1938
#define FCIDM_SHVIEW_INSERTLINK
Definition: shresdef.h:875
#define FCIDM_SHVIEW_INSERT
Definition: shresdef.h:873
@ STRRET_WSTR
Definition: shtypes.idl:85
const ITEMIDLIST_ABSOLUTE UNALIGNED * PCUIDLIST_ABSOLUTE
Definition: shtypes.idl:63
const PCUITEMID_CHILD * PCUITEMID_CHILD_ARRAY
Definition: shtypes.idl:71
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70
@ SHCOLSTATE_TYPE_INT
Definition: shtypes.idl:122
@ SHCOLSTATE_TYPE_DATE
Definition: shtypes.idl:123
@ SHCOLSTATE_TYPE_STR
Definition: shtypes.idl:121
@ SHCOLSTATE_ONBYDEFAULT
Definition: shtypes.idl:125
const ITEMIDLIST_RELATIVE UNALIGNED * PCUIDLIST_RELATIVE
Definition: shtypes.idl:57
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
STRSAFEAPI StringCchCopyExW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
Definition: strsafe.h:184
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
STRSAFEAPI StringCchCopyA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
Definition: strsafe.h:145
static CStringA GetUtf8Name(PCSTR originalName, const BYTE *extraField, DWORD extraFieldLen)
STRRET str
Definition: shtypes.idl:108
WCHAR Name[1]
Definition: zippidl.hpp:27
ULONG64 UncompressedSize
Definition: zippidl.hpp:24
BOOLEAN Password
Definition: zippidl.hpp:20
ZipPidlType ZipType
Definition: zippidl.hpp:21
ULONG DosDate
Definition: zippidl.hpp:25
ULONG64 CompressedSize
Definition: zippidl.hpp:23
bool IsDirectory() const
Definition: zippidl.hpp:29
HMENU hmenu
Definition: shlobj.h:1406
UINT idCmdLast
Definition: shlobj.h:1409
UINT idCmdFirst
Definition: shlobj.h:1408
UINT indexMenu
Definition: shlobj.h:1407
IShellFolderViewCB * psfvcb
Definition: shlobj.h:1376
WCHAR szTypeName[80]
Definition: shellapi.h:388
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:387
UINT uType
Definition: shtypes.idl:93
LPWSTR pOleStr
Definition: shtypes.idl:96
Definition: cookie.c:202
Definition: tftpd.h:60
Definition: tools.h:99
uLong dosDate
Definition: zip.h:102
uLong internal_fa
Definition: zip.h:105
uLong external_fa
Definition: zip.h:106
uint16_t * PWSTR
Definition: typedefs.h:56
const char * LPCSTR
Definition: typedefs.h:52
const uint16_t * PCWSTR
Definition: typedefs.h:57
uint16_t * LPWSTR
Definition: typedefs.h:56
char * LPSTR
Definition: typedefs.h:51
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
unzFile ZEXPORT unzOpen2_64(const void *path, zlib_filefunc64_def *pzlib_filefunc_def)
Definition: unzip.c:783
int ZEXPORT unzGetCurrentFileInfo64(unzFile file, unz_file_info64 *pfile_info, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
Definition: unzip.c:1129
int ZEXPORT unzGoToFirstFile(unzFile file)
Definition: unzip.c:1183
int ZEXPORT unzOpenCurrentFile(unzFile file)
Definition: unzip.c:1648
int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len)
Definition: unzip.c:1691
int ZEXPORT unzCloseCurrentFile(unzFile file)
Definition: unzip.c:2014
int ZEXPORT unzGoToNextFile(unzFile file)
Definition: unzip.c:1204
int ZEXPORT unzClose(unzFile file)
Definition: unzip.c:813
voidp unzFile
Definition: unzip.h:70
#define UNZ_OK
Definition: unzip.h:74
INT WINAPI DosDateTimeToVariantTime(USHORT wDosDate, USHORT wDosTime, double *pDateOut)
Definition: variant.c:1211
DWORD dwAttributes
Definition: vdmdbg.h:34
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:44
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
_In_ ULONG_PTR iFile
Definition: winddi.h:3835
#define WINAPI
Definition: msvc.h:6
#define FACILITY_NULL
Definition: winerror.h:24
#define S_FALSE
Definition: winerror.h:3451
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define E_NOINTERFACE
Definition: winerror.h:3479
#define SEVERITY_SUCCESS
Definition: winerror.h:177
#define HRESULT_CODE(hr)
Definition: winerror.h:188
#define DATE_SHORTDATE
Definition: winnls.h:216
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define SW_SHOWNORMAL
Definition: winuser.h:781
#define MF_BYCOMMAND
Definition: winuser.h:202
BOOL WINAPI InsertMenuW(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
#define MF_STRING
Definition: winuser.h:138
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_ICONERROR
Definition: winuser.h:798
#define MF_SEPARATOR
Definition: winuser.h:137
#define MF_BYPOSITION
Definition: winuser.h:203
#define MB_ICONWARNING
Definition: winuser.h:797
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDYES
Definition: winuser.h:846
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MB_YESNOCANCEL
Definition: winuser.h:829
#define MF_GRAYED
Definition: winuser.h:129
static void Initialize()
Definition: xlate.c:212
#define IID_PPV_ARG(Itype, ppType)
unsigned char BYTE
Definition: xxhash.c:193
int ZEXPORT zipClose(zipFile file, const char *global_comment)
Definition: zip.c:1883
zipFile ZEXPORT zipOpen2_64(const void *pathname, int append, zipcharpc *globalcomment, zlib_filefunc64_def *pzlib_filefunc_def)
Definition: zip.c:938
int ZEXPORT zipWriteInFileInZip(zipFile file, const void *buf, unsigned int len)
Definition: zip.c:1408
int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, uInt size_extrafield_local, const void *extrafield_global, uInt size_extrafield_global, const char *comment, int method, int level, int raw, int windowBits, int memLevel, int strategy, const char *password, uLong crcForCrypting, int zip64)
Definition: zip.c:1302
int ZEXPORT zipCloseFileInZip(zipFile file)
Definition: zip.c:1751
#define APPEND_STATUS_CREATE
Definition: zip.h:112
voidp zipFile
Definition: zip.h:69
const ZipPidlEntry * _ZipFromIL(LPCITEMIDLIST pidl)
Definition: zippidl.cpp:41
@ ZIP_PIDL_FILE
Definition: zippidl.hpp:12
@ ZIP_PIDL_DIRECTORY
Definition: zippidl.hpp:11