ReactOS 0.4.16-dev-716-g2b2bdab
cabview.h File Reference
#include "precomp.h"
#include "resource.h"
Include dependency graph for cabview.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  EXTRACTCALLBACKDATA
 
class  CEnumIDList
 
class  CCabFolder
 

Macros

#define FLATFOLDER   TRUE
 

Typedefs

typedef HRESULT(CALLBACKEXTRACTCALLBACK) (EXTRACTCALLBACKMSG msg, const EXTRACTCALLBACKDATA &data, LPVOID cookie)
 

Enumerations

enum  EXTRACTCALLBACKMSG { ECM_BEGIN , ECM_FILE , ECM_PREPAREPATH , ECM_ERROR }
 

Functions

HRESULT ExtractCabinet (LPCWSTR cab, LPCWSTR destination, EXTRACTCALLBACK callback, LPVOID cookie)
 

Variables

EXTERN_C const GUID CLSID_CabFolder
 

Macro Definition Documentation

◆ FLATFOLDER

#define FLATFOLDER   TRUE

Definition at line 12 of file cabview.h.

Typedef Documentation

◆ EXTRACTCALLBACK

Definition at line 23 of file cabview.h.

Enumeration Type Documentation

◆ EXTRACTCALLBACKMSG

Enumerator
ECM_BEGIN 
ECM_FILE 
ECM_PREPAREPATH 
ECM_ERROR 

Definition at line 16 of file cabview.h.

@ ECM_ERROR
Definition: cabview.h:16
@ ECM_BEGIN
Definition: cabview.h:16
@ ECM_FILE
Definition: cabview.h:16
@ ECM_PREPAREPATH
Definition: cabview.h:16

Function Documentation

◆ ExtractCabinet()

HRESULT ExtractCabinet ( LPCWSTR  cab,
LPCWSTR  destination,
EXTRACTCALLBACK  callback,
LPVOID  cookie 
)

Definition at line 189 of file extract.cpp.

190{
191 BOOL quick = !destination;
192 if (!destination)
193 destination = L"?:"; // Dummy path for callers that enumerate without extracting
196 ERF erf = { };
197 HFDI hfdi;
198 UINT total = 0, files = 0;
199 HRESULT hr = Init(hfdi, erf);
201 return hr;
202
204 INT_PTR hf = quick ? -1 : CabOpenEx(cab, GENERIC_READ, share, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL);
205 if (hf != -1)
206 {
208 if (FDIIsCabinet(hfdi, hf, &ci))
209 {
210 total = ci.cbCabinet;
211 files = ci.cFiles;
212 }
213 CabClose(hf);
214 }
215
217 char buf[MAX_PATH * 2], *name = 0;
218 if (!WideCharToMultiByte(CP_UTF8, 0, cab, -1, buf, _countof(buf), NULL, NULL))
219 {
220 *buf = '\0';
222 }
223 for (UINT i = 0; buf[i]; ++i)
224 {
225 if (buf[i] == '\\' || buf[i] == '/')
226 name = &buf[i + 1];
227 }
228 if (name > buf && *name)
229 {
230 // Format the name the way FDI likes it
231 name[-1] = ANSI_NULL;
232 char namebuf[MAX_PATH];
233 namebuf[0] = '\\';
234 lstrcpyA(namebuf + 1, name);
235 name = namebuf;
236
237 FDINOTIFICATION fdin;
238 fdin.cb = total;
239 fdin.hf = files;
240 noti.Path = cab;
241 noti.pfdin = &fdin;
242 callback(ECM_BEGIN, noti, cookie);
243
244 hr = FDICopy(hfdi, name, buf, 0, ExtractCabinetCallback, NULL, &data) ? S_OK : HResultFrom(erf);
245 }
246 FDIDestroy(hfdi);
247 return hr;
248}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define NULL
Definition: types.h:112
BOOL __cdecl FDIIsCabinet(HFDI hfdi, INT_PTR hf, PFDICABINETINFO pfdici)
Definition: fdi.c:696
BOOL __cdecl FDICopy(HFDI hfdi, char *pszCabinet, char *pszCabPath, int flags, PFNFDINOTIFY pfnfdin, PFNFDIDECRYPT pfnfdid, void *pvUser)
Definition: fdi.c:2431
BOOL __cdecl FDIDestroy(HFDI hfdi)
Definition: fdi.c:2831
#define OPEN_EXISTING
Definition: compat.h:775
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define WideCharToMultiByte
Definition: compat.h:111
#define FILE_SHARE_READ
Definition: compat.h:136
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
static HRESULT HResultFrom(const ERF &erf)
Definition: extract.cpp:45
static INT_PTR CabOpenEx(LPCWSTR path, UINT access, UINT share, UINT disp, UINT attr)
Definition: extract.cpp:77
unsigned int BOOL
Definition: ntddk_ex.h:94
size_t total
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
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 S_OK
Definition: intsafe.h:52
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
double __cdecl erf(double)
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static IPrintDialogCallback callback
Definition: printdlg.c:326
unsigned int UINT
Definition: ndis.h:50
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
#define ANSI_NULL
#define L(x)
Definition: ntvdm.h:50
#define CP_UTF8
Definition: nls.h:20
HRESULT hr
Definition: shlfolder.c:183
#define _countof(array)
Definition: sndvol32.h:70
Definition: fci.h:44
const FDINOTIFICATION * pfdin
Definition: cabview.h:20
USHORT cFiles
Definition: fdi.h:148
LONG cbCabinet
Definition: fdi.h:146
INT_PTR hf
Definition: fdi.h:233
LONG cb
Definition: fdi.h:227
Definition: cookie.c:34
Definition: name.c:39
int32_t INT_PTR
Definition: typedefs.h:64
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92

Referenced by ExtractFilesThread(), and CEnumIDList::Fill().

Variable Documentation

◆ CLSID_CabFolder

EXTERN_C const GUID CLSID_CabFolder

Definition at line 14 of file cabview.h.

Referenced by CCabFolder::GetClassID().