ReactOS  0.4.15-dev-5122-g72bdbdd
CZipExtract Class Reference
Inheritance diagram for CZipExtract:
Collaboration diagram for CZipExtract:

Classes

class  CCompleteSettingsPage
 
class  CExtractSettingsPage
 

Public Member Functions

 CZipExtract (PCWSTR Filename)
 
 ~CZipExtract ()
 
void Close ()
 
STDMETHODIMP QueryInterface (REFIID riid, void **ppvObject)
 
 STDMETHODIMP_ (ULONG) AddRef(void)
 
 STDMETHODIMP_ (ULONG) Release(void)
 
 STDMETHODIMP_ (unzFile) getZip()
 
void runWizard ()
 
eZipExtractError ExtractSingle (HWND hDlg, LPCSTR FullPath, bool is_dir, unz_file_info64 *Info, CStringA Name, CStringA Password, bool *bOverwriteAll, const bool *bCancel, int *ErrorCode)
 
bool Extract (HWND hDlg, HWND hProgress, const bool *bCancel)
 
int ShowExtractError (HWND hDlg, LPCSTR path, int Error, eZipExtractError ErrorType)
 
- Public Member Functions inherited from IUnknown
ULONG AddRef ()
 
ULONG Release ()
 

Static Public Member Functions

static INT CALLBACK s_PropSheetCallbackProc (HWND hwndDlg, UINT uMsg, LPARAM lParam)
 

Private Attributes

CStringW m_Filename
 
CStringW m_Directory
 
CStringA m_Password
 
bool m_DirectoryChanged
 
unzFile uf
 

Additional Inherited Members

- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 

Detailed Description

Definition at line 10 of file CZipExtract.cpp.

Constructor & Destructor Documentation

◆ CZipExtract()

CZipExtract::CZipExtract ( PCWSTR  Filename)
inline

Definition at line 19 of file CZipExtract.cpp.

20  :m_DirectoryChanged(false)
21  ,uf(NULL)
22  {
25  PWSTR Dir = m_Directory.GetBuffer();
28  }
CStringW m_Filename
Definition: CZipExtract.cpp:13
uint16_t * PWSTR
Definition: typedefs.h:56
IN PVCB IN PBCB OUT PDIRENT IN USHORT IN POEM_STRING Filename
Definition: fatprocs.h:934
bool m_DirectoryChanged
Definition: CZipExtract.cpp:16
CStringW m_Directory
Definition: CZipExtract.cpp:14
void ReleaseBuffer(_In_ int nNewLength=-1)
Definition: atlsimpstr.h:372
void WINAPI PathRemoveExtensionW(LPWSTR lpszPath)
Definition: path.c:823
unzFile uf
Definition: CZipExtract.cpp:17
#define NULL
Definition: types.h:112

◆ ~CZipExtract()

CZipExtract::~CZipExtract ( )
inline

Definition at line 30 of file CZipExtract.cpp.

31  {
32  if (uf)
33  {
34  DPRINT1("WARNING: uf not closed!\n");
35  Close();
36  }
37  }
void Close()
Definition: CZipExtract.cpp:39
unzFile uf
Definition: CZipExtract.cpp:17
#define DPRINT1
Definition: precomp.h:8

Member Function Documentation

◆ Close()

void CZipExtract::Close ( )
inline

Definition at line 39 of file CZipExtract.cpp.

40  {
41  if (uf)
42  unzClose(uf);
43  uf = NULL;
44  }
int ZEXPORT unzClose(unzFile file)
Definition: unzip.c:808
unzFile uf
Definition: CZipExtract.cpp:17
#define NULL
Definition: types.h:112

Referenced by Extract(), and ~CZipExtract().

◆ Extract()

bool CZipExtract::Extract ( HWND  hDlg,
HWND  hProgress,
const bool bCancel 
)
inline

Definition at line 554 of file CZipExtract.cpp.

555  {
558  int err = unzGetGlobalInfo64(uf, &gi);
559  if (err != UNZ_OK)
560  {
561  DPRINT1("ERROR, unzGetGlobalInfo64: 0x%x\n", err);
562  Close();
563  return false;
564  }
565 
566  CZipEnumerator zipEnum;
567  if (!zipEnum.initialize(this))
568  {
569  DPRINT1("ERROR, zipEnum.initialize\n");
570  Close();
571  return false;
572  }
573 
574  CWindow Progress(hProgress);
575  Progress.SendMessage(PBM_SETRANGE32, 0, gi.number_entry);
576  Progress.SendMessage(PBM_SETPOS, 0, 0);
577 
578  CStringA BaseDirectory = m_Directory;
579  CStringA Name;
582  int CurrentFile = 0;
583  bool bOverwriteAll = false;
584  while (zipEnum.next(Name, Info))
585  {
586  if (*bCancel)
587  {
588  Close();
589  return false;
590  }
591 
592  bool is_dir = Name.GetLength() > 0 && Name[Name.GetLength()-1] == '/';
593 
594  char CombinedPath[MAX_PATH * 2] = { 0 };
595  PathCombineA(CombinedPath, BaseDirectory, Name);
596  CStringA FullPath = CombinedPath;
597  FullPath.Replace('/', '\\'); /* SHPathPrepareForWriteA does not handle '/' */
598  Retry:
599  eZipExtractError Result = ExtractSingle(hDlg, FullPath, is_dir, &Info, Name, Password, &bOverwriteAll, bCancel, &err);
600  if (Result != eDirectoryError)
601  CurrentFile++;
602  switch (Result)
603  {
604  case eNoError:
605  break;
606 
607  case eExtractAbort:
608  case eUnpackError:
609  {
610  Close();
611  return false;
612  }
613 
614  case eDirectoryError:
615  {
616  char StrippedPath[MAX_PATH] = { 0 };
617 
618  StrCpyNA(StrippedPath, FullPath, _countof(StrippedPath));
619  if (!is_dir)
620  PathRemoveFileSpecA(StrippedPath);
621  PathStripPathA(StrippedPath);
622  if (ShowExtractError(hDlg, (LPCSTR)&StrippedPath, err, eDirectoryError) == IDRETRY)
623  goto Retry;
624  Close();
625  return false;
626  }
627 
628  case eFileError:
629  {
630  int Result = ShowExtractError(hDlg, FullPath, err, eFileError);
631  switch (Result)
632  {
633  case IDABORT:
634  Close();
635  return false;
636  case IDRETRY:
637  CurrentFile--;
638  goto Retry;
639  case IDIGNORE:
640  break;
641  }
642  break;
643  }
644 
645  case eOpenError:
646  {
647  if (err == UNZ_BADZIPFILE &&
648  Info.compression_method != 0 &&
649  Info.compression_method != Z_DEFLATED &&
650  Info.compression_method != Z_BZIP2ED)
651  {
652  if (ShowExtractError(hDlg, FullPath, Info.compression_method, eOpenError) == IDYES)
653  break;
654  }
655  Close();
656  return false;
657  }
658  }
659  if (Result == eNoError && is_dir)
660  continue;
661  Progress.SendMessage(PBM_SETPOS, CurrentFile, 0);
662  }
663 
664  Close();
665  return true;
666  }
#define PBM_SETRANGE32
Definition: commctrl.h:2188
#define IDABORT
Definition: winuser.h:826
#define IDYES
Definition: winuser.h:829
CStringW m_Filename
Definition: CZipExtract.cpp:13
int ShowExtractError(HWND hDlg, LPCSTR path, int Error, eZipExtractError ErrorType)
#define UNZ_OK
Definition: unzip.h:74
CStringA m_Password
Definition: CZipExtract.cpp:15
#define UNZ_BADZIPFILE
Definition: unzip.h:79
#define PBM_SETPOS
Definition: commctrl.h:2184
bool initialize(IZip *zip)
void Close()
Definition: CZipExtract.cpp:39
BOOL WINAPI PathRemoveFileSpecA(LPSTR lpszPath)
Definition: path.c:586
CStringW m_Directory
Definition: CZipExtract.cpp:14
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
int ZEXPORT unzGetGlobalInfo64(unzFile file, unz_global_info64 *pglobal_info)
Definition: unzip.c:828
struct NameRec_ * Name
Definition: cdprocs.h:459
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define Z_BZIP2ED
Definition: unzip.h:62
const char * LPCSTR
Definition: xmlstorage.h:183
#define StrCpyNA
Definition: shlwapi.h:1514
unzFile uf
Definition: CZipExtract.cpp:17
#define _countof(array)
Definition: sndvol32.h:68
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
PCXSTR GetString() const
Definition: atlsimpstr.h:361
LPSTR WINAPI PathCombineA(LPSTR lpszDest, LPCSTR lpszDir, LPCSTR lpszFile)
Definition: path.c:159
#define IDRETRY
Definition: winuser.h:827
void WINAPI PathStripPathA(LPSTR lpszPath)
Definition: path.c:677
_In_ PSCSI_REQUEST_BLOCK _Out_ NTSTATUS _Inout_ BOOLEAN * Retry
Definition: classpnp.h:310
#define err(...)
#define Z_DEFLATED
Definition: zlib.h:146
eZipExtractError ExtractSingle(HWND hDlg, LPCSTR FullPath, bool is_dir, unz_file_info64 *Info, CStringA Name, CStringA Password, bool *bOverwriteAll, const bool *bCancel, int *ErrorCode)
int Replace(PCXSTR pszOld, PCXSTR pszNew)
Definition: cstringt.h:811
bool next(CStringA &name, unz_file_info64 &info)
eZipExtractError
Definition: precomp.h:79
#define DPRINT1
Definition: precomp.h:8
#define IDIGNORE
Definition: winuser.h:828
ZPOS64_T number_entry
Definition: unzip.h:98

Referenced by CZipExtract::CExtractSettingsPage::ExtractEntry().

◆ ExtractSingle()

eZipExtractError CZipExtract::ExtractSingle ( HWND  hDlg,
LPCSTR  FullPath,
bool  is_dir,
unz_file_info64 Info,
CStringA  Name,
CStringA  Password,
bool bOverwriteAll,
const bool bCancel,
int ErrorCode 
)
inline

Definition at line 371 of file CZipExtract.cpp.

382  {
383  int err;
384  BYTE Buffer[2048];
386  HRESULT hr = SHPathPrepareForWriteA(hDlg, NULL, FullPath, dwFlags);
387  if (FAILED_UNEXPECTEDLY(hr))
388  {
389  *ErrorCode = hr;
390  return eDirectoryError;
391  }
392  if (is_dir)
393  return eNoError;
394 
395  if (Info->flag & MINIZIP_PASSWORD_FLAG)
396  {
398  do
399  {
400  /* If there is a password set, try it */
401  if (!Password.IsEmpty())
402  {
404  if (err == UNZ_OK)
405  {
406  /* Try to read some bytes, because unzOpenCurrentFilePassword does not return failure */
407  char Buf[10];
408  err = unzReadCurrentFile(uf, Buf, sizeof(Buf));
410  if (err >= UNZ_OK)
411  {
412  /* 're'-open the file so that we can begin to extract */
414  break;
415  }
416  }
417  }
419  } while (Response == eAccept);
420 
421  if (Response == eSkip)
422  {
423  return eNoError;
424  }
425  else if (Response == eAbort)
426  {
427  return eExtractAbort;
428  }
429  }
430  else
431  {
433  }
434 
435  if (err != UNZ_OK)
436  {
437  DPRINT1("ERROR, unzOpenCurrentFilePassword: 0x%x\n", err);
438  *ErrorCode = err;
439  return eOpenError;
440  }
441 
444  {
446  if (dwErr == ERROR_FILE_EXISTS)
447  {
448  bool bOverwrite = *bOverwriteAll;
449  if (!*bOverwriteAll)
450  {
451  eZipConfirmResponse Result = _CZipAskReplace(hDlg, FullPath);
452  switch (Result)
453  {
454  case eYesToAll:
455  *bOverwriteAll = true;
456  /* fall through */
457  case eYes:
458  bOverwrite = true;
459  break;
460  case eNo:
461  break;
462  case eCancel:
464  return eExtractAbort;
465  }
466  }
467 
468  if (bOverwrite)
469  {
472  {
473  dwErr = GetLastError();
474  }
475  }
476  else
477  {
479  return eNoError;
480  }
481  }
483  {
485  DPRINT1("ERROR, CreateFileA: 0x%x (%s)\n", dwErr, *bOverwriteAll ? "Y" : "N");
486  *ErrorCode = dwErr;
487  return eFileError;
488  }
489  }
490 
491  do
492  {
493  if (*bCancel)
494  {
496  BOOL deleteResult = DeleteFileA(FullPath);
497  if (!deleteResult)
498  DPRINT1("ERROR, DeleteFileA: 0x%x\n", GetLastError());
499  return eExtractAbort;
500  }
501 
502  err = unzReadCurrentFile(uf, Buffer, sizeof(Buffer));
503 
504  if (err < 0)
505  {
506  DPRINT1("ERROR, unzReadCurrentFile: 0x%x\n", err);
507  break;
508  }
509  else if (err > 0)
510  {
511  DWORD dwWritten;
512  if (!WriteFile(hFile, Buffer, err, &dwWritten, NULL))
513  {
514  DPRINT1("ERROR, WriteFile: 0x%x\n", GetLastError());
515  break;
516  }
517  if (dwWritten != (DWORD)err)
518  {
519  DPRINT1("ERROR, WriteFile: dwWritten:%d err:%d\n", dwWritten, err);
520  break;
521  }
522  }
523 
524  } while (err > 0);
525 
526  /* Update Filetime */
527  FILETIME LocalFileTime;
528  DosDateTimeToFileTime((WORD)(Info->dosDate >> 16), (WORD)Info->dosDate, &LocalFileTime);
529  FILETIME FileTime;
530  LocalFileTimeToFileTime(&LocalFileTime, &FileTime);
531  SetFileTime(hFile, &FileTime, &FileTime, &FileTime);
532 
533  /* Done */
535 
536  if (err)
537  {
539  DPRINT1("ERROR, unzReadCurrentFile2: 0x%x\n", err);
540  *ErrorCode = err;
541  return eUnpackError;
542  }
543  else
544  {
546  if (err != UNZ_OK)
547  {
548  DPRINT1("ERROR(non-fatal), unzCloseCurrentFile: 0x%x\n", err);
549  }
550  }
551  return eNoError;
552  }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define ERROR_FILE_EXISTS
Definition: winerror.h:165
#define CloseHandle
Definition: compat.h:598
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
HRESULT hr
Definition: shlfolder.c:183
eZipPasswordResponse _CZipAskPassword(HWND hDlg, const char *filename, CStringA &Password)
Definition: precomp.h:71
#define UNZ_OK
Definition: unzip.h:74
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
BOOL WINAPI SetFileTime(IN HANDLE hFile, CONST FILETIME *lpCreationTime OPTIONAL, CONST FILETIME *lpLastAccessTime OPTIONAL, CONST FILETIME *lpLastWriteTime OPTIONAL)
Definition: fileinfo.c:948
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
BOOL WINAPI LocalFileTimeToFileTime(IN CONST FILETIME *lpLocalFileTime, OUT LPFILETIME lpFileTime)
Definition: time.c:253
int ZEXPORT unzOpenCurrentFile(unzFile file)
Definition: unzip.c:1641
#define SHPPFW_DIRCREATE
Definition: shlobj.h:303
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GENERIC_WRITE
Definition: nt_native.h:90
eZipConfirmResponse _CZipAskReplace(HWND hDlg, PCSTR FullPath)
Definition: precomp.h:63
eZipConfirmResponse
Definition: precomp.h:69
int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len)
Definition: unzip.c:1684
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
Definition: precomp.h:73
Definition: bufpool.h:45
DWORD dwErr
Definition: service.c:36
unzFile uf
Definition: CZipExtract.cpp:17
int ZEXPORT unzCloseCurrentFile(unzFile file)
Definition: unzip.c:2004
BOOL WINAPI DosDateTimeToFileTime(IN WORD wFatDate, IN WORD wFatTime, OUT LPFILETIME lpFileTime)
Definition: time.c:75
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
int ZEXPORT unzOpenCurrentFilePassword(unzFile file, const char *password)
Definition: unzip.c:1646
Definition: ncftp.h:89
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define MINIZIP_PASSWORD_FLAG
Definition: precomp.h:43
#define err(...)
_In_ HANDLE hFile
Definition: mswsock.h:90
unsigned char BYTE
Definition: xxhash.c:193
EXTERN_C HRESULT WINAPI SHPathPrepareForWriteA(HWND hwnd, IUnknown *modless, LPCSTR path, DWORD flags)
Definition: shlfileop.cpp:2291
#define CREATE_ALWAYS
Definition: disk.h:72
#define NULL
Definition: types.h:112
eZipPasswordResponse
Definition: precomp.h:60
#define DPRINT1
Definition: precomp.h:8
Definition: precomp.h:62
#define SHPPFW_NONE
Definition: shlobj.h:302
#define SHPPFW_IGNOREFILENAME
Definition: shlobj.h:306
#define CREATE_NEW
Definition: disk.h:69
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:599

Referenced by Extract().

◆ QueryInterface()

STDMETHODIMP CZipExtract::QueryInterface ( REFIID  riid,
void **  ppvObject 
)
inline

Implements IUnknown.

Definition at line 47 of file CZipExtract.cpp.

48  {
49  if (riid == IID_IUnknown)
50  {
51  *ppvObject = this;
52  AddRef();
53  return S_OK;
54  }
55  return E_NOINTERFACE;
56  }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
const GUID IID_IUnknown
ULONG AddRef()
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:52

◆ runWizard()

void CZipExtract::runWizard ( )
inline

Definition at line 347 of file CZipExtract.cpp.

348  {
349  PROPSHEETHEADERW psh = { sizeof(psh), 0 };
350  psh.dwFlags = PSH_WIZARD97 | PSH_HEADER | PSH_USEICONID | PSH_USECALLBACK;
351  psh.hInstance = _AtlBaseModule.GetResourceInstance();
352 
353  CExtractSettingsPage extractPage(this, &m_Password);
354  CCompleteSettingsPage completePage(this);
355  HPROPSHEETPAGE hpsp[] =
356  {
357  extractPage.Create(),
358  completePage.Create()
359  };
360 
361  psh.phpage = hpsp;
362  psh.nPages = _countof(hpsp);
364  psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK);
365  psh.pszbmHeader = MAKEINTRESOURCE(IDB_HEADER);
367 
368  PropertySheetW(&psh);
369  }
#define MAKEINTRESOURCE
Definition: winuser.h:591
CStringA m_Password
Definition: CZipExtract.cpp:15
#define PSH_USECALLBACK
Definition: prsht.h:48
#define IDB_HEADER
Definition: resource.h:30
#define PSH_USEICONID
Definition: prsht.h:42
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
PFNPROPSHEETCALLBACK pfnCallback
Definition: prsht.h:311
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2905
#define IDI_ZIPFLDR
Definition: resource.h:4
HINSTANCE hInstance
Definition: prsht.h:296
#define _countof(array)
Definition: sndvol32.h:68
LPCWSTR pszIcon
Definition: prsht.h:299
DWORD dwFlags
Definition: prsht.h:294
static INT CALLBACK s_PropSheetCallbackProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
HPROPSHEETPAGE * phpage
Definition: prsht.h:309
#define IDB_WATERMARK
Definition: resource.h:4

Referenced by _CZipExtract_runWizard().

◆ s_PropSheetCallbackProc()

static INT CALLBACK CZipExtract::s_PropSheetCallbackProc ( HWND  hwndDlg,
UINT  uMsg,
LPARAM  lParam 
)
inlinestatic

Definition at line 335 of file CZipExtract.cpp.

336  {
337  if (uMsg == PSCB_INITIALIZED)
338  {
339  HICON hIcon = LoadIconW(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCEW(IDI_ZIPFLDR));
340  CWindow dlg(hwndDlg);
341  dlg.SetIcon(hIcon, TRUE);
342  }
343 
344  return 0;
345  }
static HICON
Definition: imagelist.c:84
#define TRUE
Definition: types.h:120
#define IDI_ZIPFLDR
Definition: resource.h:4
#define PSCB_INITIALIZED
Definition: prsht.h:75
HICON hIcon
Definition: msconfig.c:44
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by runWizard().

◆ ShowExtractError()

int CZipExtract::ShowExtractError ( HWND  hDlg,
LPCSTR  path,
int  Error,
eZipExtractError  ErrorType 
)
inline

Definition at line 668 of file CZipExtract.cpp.

669  {
671  CStringA strErr, strText;
672  PSTR Win32ErrorString;
673 
674  if (ErrorType == eFileError || ErrorType == eOpenError)
676  else
677  strText.LoadString(GetModuleHandleA("shell32.dll"), 128); // IDS_CREATEFOLDER_DENIED
678 
679  strText.FormatMessage(strText.GetString(), path);
680 
681  if (ErrorType == eFileError || HRESULT_FACILITY(Error) == FACILITY_WIN32)
682  {
684  NULL, ErrorType == eFileError ? Error : HRESULT_CODE(Error), 0,
685  (PSTR)&Win32ErrorString, 0, NULL) != 0)
686  {
687  strErr.SetString(Win32ErrorString);
688  LocalFree(Win32ErrorString);
689  }
690  }
691  if (ErrorType == eOpenError)
693  else if (strErr.GetLength() == 0)
694  strErr.Format(IDS_UNKNOWNERROR, Error);
695 
696  strText.Append("\r\n\r\n" + strErr);
697 
698  UINT mbFlags = MB_ICONWARNING;
699  if (ErrorType == eDirectoryError)
700  mbFlags |= MB_RETRYCANCEL;
701  else if (ErrorType == eFileError)
702  mbFlags |= MB_ABORTRETRYIGNORE;
703  else if (ErrorType == eOpenError)
704  mbFlags |= MB_YESNO;
705 
706  return MessageBoxA(hDlg, strText, strTitle, mbFlags);
707  }
int GetLength() const
Definition: atlsimpstr.h:356
GLsizei const GLchar ** path
Definition: glext.h:7234
#define IDS_DECOMPRESSERROR
Definition: resource.h:54
DWORD WINAPI FormatMessageA(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:483
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:753
#define IDS_ERRORTITLE
Definition: resource.h:47
#define MB_ICONWARNING
Definition: winuser.h:780
#define IDS_UNKNOWNERROR
Definition: resource.h:55
#define MB_YESNO
Definition: winuser.h:811
#define HRESULT_FACILITY(hr)
Definition: winerror.h:79
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:416
void SetString(_In_opt_z_ PCXSTR pszSrc)
Definition: atlsimpstr.h:303
#define IDS_CANTEXTRACTFILE
Definition: resource.h:53
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:420
PCXSTR GetString() const
Definition: atlsimpstr.h:361
BOOL Error
Definition: chkdsk.c:66
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
void Append(_In_count_(nLength) PCXSTR pszSrc, _In_ int nLength)
Definition: atlsimpstr.h:265
#define FACILITY_WIN32
Definition: winerror.h:27
void __cdecl FormatMessage(UINT nFormatID,...)
Definition: cstringt.h:780
#define MB_ABORTRETRYIGNORE
Definition: winuser.h:785
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
signed char * PSTR
Definition: retypes.h:7
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define HRESULT_CODE(hr)
Definition: winerror.h:76
BOOL LoadString(_In_ UINT nID)
Definition: cstringt.h:591
#define MB_RETRYCANCEL
Definition: winuser.h:799
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
int WINAPI MessageBoxA(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)

Referenced by Extract().

◆ STDMETHODIMP_() [1/3]

CZipExtract::STDMETHODIMP_ ( ULONG  )
inline

Definition at line 57 of file CZipExtract.cpp.

58  {
59  return 2;
60  }

◆ STDMETHODIMP_() [2/3]

CZipExtract::STDMETHODIMP_ ( ULONG  )
inline

Definition at line 61 of file CZipExtract.cpp.

62  {
63  return 1;
64  }

◆ STDMETHODIMP_() [3/3]

CZipExtract::STDMETHODIMP_ ( unzFile  )
inlinevirtual

Reimplemented from IZip.

Definition at line 65 of file CZipExtract.cpp.

66  {
67  return uf;
68  }
unzFile uf
Definition: CZipExtract.cpp:17

Member Data Documentation

◆ m_Directory

◆ m_DirectoryChanged

◆ m_Filename

CStringW CZipExtract::m_Filename
private

Definition at line 13 of file CZipExtract.cpp.

Referenced by CZipExtract(), and Extract().

◆ m_Password

CStringA CZipExtract::m_Password
private

Definition at line 15 of file CZipExtract.cpp.

Referenced by Extract(), and runWizard().

◆ uf

unzFile CZipExtract::uf
private

Definition at line 17 of file CZipExtract.cpp.

Referenced by Close(), Extract(), ExtractSingle(), STDMETHODIMP_(), and ~CZipExtract().


The documentation for this class was generated from the following file: