mirror of
https://github.com/reactos/reactos.git
synced 2025-04-22 13:10:39 +00:00
[CABINET]
* Sync to Wine 1.3.37. svn path=/trunk/; revision=55103
This commit is contained in:
parent
e4bb3d1eb0
commit
5cf9ee2b66
7 changed files with 1278 additions and 2560 deletions
|
@ -1,7 +1,11 @@
|
||||||
|
|
||||||
add_definitions(-D__WINESRC__)
|
add_definitions(
|
||||||
|
-D__WINESRC__
|
||||||
|
-DHAVE_ZLIB)
|
||||||
|
|
||||||
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
|
include_directories(
|
||||||
|
${REACTOS_SOURCE_DIR}/include/reactos/wine
|
||||||
|
${REACTOS_SOURCE_DIR}/include/reactos/libs/zlib)
|
||||||
|
|
||||||
spec2def(cabinet.dll cabinet.spec)
|
spec2def(cabinet.dll cabinet.spec)
|
||||||
|
|
||||||
|
@ -16,8 +20,8 @@ list(APPEND SOURCE
|
||||||
add_library(cabinet SHARED ${SOURCE})
|
add_library(cabinet SHARED ${SOURCE})
|
||||||
|
|
||||||
set_module_type(cabinet win32dll ENTRYPOINT 0)
|
set_module_type(cabinet win32dll ENTRYPOINT 0)
|
||||||
target_link_libraries(cabinet wine)
|
target_link_libraries(cabinet wine zlib)
|
||||||
add_importlibs(cabinet kernel32 ntdll)
|
add_importlibs(cabinet msvcrt kernel32 ntdll)
|
||||||
add_importlib_target(cabinet.spec)
|
add_importlib_target(cabinet.spec)
|
||||||
add_pch(cabinet cabinet.h)
|
add_pch(cabinet cabinet.h)
|
||||||
add_dependencies(cabinet psdk)
|
add_dependencies(cabinet psdk)
|
||||||
|
|
|
@ -306,136 +306,11 @@ typedef struct cds_forward {
|
||||||
} methods;
|
} methods;
|
||||||
} cab_decomp_state;
|
} cab_decomp_state;
|
||||||
|
|
||||||
/* _Int as in "Internal" fyi */
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
unsigned int FCI_Intmagic;
|
|
||||||
PERF perf;
|
|
||||||
PFNFCIFILEPLACED pfnfiledest;
|
|
||||||
PFNFCIALLOC pfnalloc;
|
|
||||||
PFNFCIFREE pfnfree;
|
|
||||||
PFNFCIOPEN pfnopen;
|
|
||||||
PFNFCIREAD pfnread;
|
|
||||||
PFNFCIWRITE pfnwrite;
|
|
||||||
PFNFCICLOSE pfnclose;
|
|
||||||
PFNFCISEEK pfnseek;
|
|
||||||
PFNFCIDELETE pfndelete;
|
|
||||||
PFNFCIGETTEMPFILE pfnfcigtf;
|
|
||||||
PCCAB pccab;
|
|
||||||
BOOL fPrevCab;
|
|
||||||
BOOL fNextCab;
|
|
||||||
BOOL fSplitFolder;
|
|
||||||
cab_ULONG statusFolderCopied;
|
|
||||||
cab_ULONG statusFolderTotal;
|
|
||||||
BOOL fGetNextCabInVain;
|
|
||||||
void *pv;
|
|
||||||
char szPrevCab[CB_MAX_CABINET_NAME]; /* previous cabinet name */
|
|
||||||
char szPrevDisk[CB_MAX_DISK_NAME]; /* disk name of previous cabinet */
|
|
||||||
CCAB oldCCAB;
|
|
||||||
char* data_in; /* uncompressed data blocks */
|
|
||||||
cab_UWORD cdata_in;
|
|
||||||
char* data_out; /* compressed data blocks */
|
|
||||||
ULONG cCompressedBytesInFolder;
|
|
||||||
cab_UWORD cFolders;
|
|
||||||
cab_UWORD cFiles;
|
|
||||||
cab_ULONG cDataBlocks;
|
|
||||||
cab_ULONG cbFileRemainer; /* uncompressed, yet to be written data */
|
|
||||||
/* of spanned file of a spanning folder of a spanning cabinet */
|
|
||||||
char szFileNameCFDATA1[CB_MAX_FILENAME];
|
|
||||||
int handleCFDATA1;
|
|
||||||
char szFileNameCFFILE1[CB_MAX_FILENAME];
|
|
||||||
int handleCFFILE1;
|
|
||||||
char szFileNameCFDATA2[CB_MAX_FILENAME];
|
|
||||||
int handleCFDATA2;
|
|
||||||
char szFileNameCFFILE2[CB_MAX_FILENAME];
|
|
||||||
int handleCFFILE2;
|
|
||||||
char szFileNameCFFOLDER[CB_MAX_FILENAME];
|
|
||||||
int handleCFFOLDER;
|
|
||||||
cab_ULONG sizeFileCFDATA1;
|
|
||||||
cab_ULONG sizeFileCFFILE1;
|
|
||||||
cab_ULONG sizeFileCFDATA2;
|
|
||||||
cab_ULONG sizeFileCFFILE2;
|
|
||||||
cab_ULONG sizeFileCFFOLDER;
|
|
||||||
BOOL fNewPrevious;
|
|
||||||
cab_ULONG estimatedCabinetSize;
|
|
||||||
} FCI_Int, *PFCI_Int;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
unsigned int FDI_Intmagic;
|
|
||||||
PFNALLOC pfnalloc;
|
|
||||||
PFNFREE pfnfree;
|
|
||||||
PFNOPEN pfnopen;
|
|
||||||
PFNREAD pfnread;
|
|
||||||
PFNWRITE pfnwrite;
|
|
||||||
PFNCLOSE pfnclose;
|
|
||||||
PFNSEEK pfnseek;
|
|
||||||
PERF perf;
|
|
||||||
} FDI_Int, *PFDI_Int;
|
|
||||||
|
|
||||||
/* cast an HFCI into a PFCI_Int */
|
|
||||||
#define PFCI_INT(hfci) ((PFCI_Int)(hfci))
|
|
||||||
|
|
||||||
/* cast an HFDI into a PFDI_Int */
|
|
||||||
#define PFDI_INT(hfdi) ((PFDI_Int)(hfdi))
|
|
||||||
|
|
||||||
/* quick pfci method invokers */
|
|
||||||
#define PFCI_ALLOC(hfdi, size) ((*PFCI_INT(hfdi)->pfnalloc) (size))
|
|
||||||
#define PFCI_FREE(hfdi, ptr) ((*PFCI_INT(hfdi)->pfnfree) (ptr))
|
|
||||||
#define PFCI_GETTEMPFILE(hfci,name,length) ((*PFCI_INT(hfci)->pfnfcigtf)(name,length,PFCI_INT(hfci)->pv))
|
|
||||||
#define PFCI_DELETE(hfci,name,err,pv) ((*PFCI_INT(hfci)->pfndelete)(name,err,pv))
|
|
||||||
#define PFCI_OPEN(hfci,name,oflag,pmode,err,pv) ((*PFCI_INT(hfci)->pfnopen)(name,oflag,pmode,err,pv))
|
|
||||||
#define PFCI_READ(hfci,hf,memory,cb,err,pv)((*PFCI_INT(hfci)->pfnread)(hf,memory,cb,err,pv))
|
|
||||||
#define PFCI_WRITE(hfci,hf,memory,cb,err,pv) ((*PFCI_INT(hfci)->pfnwrite)(hf,memory,cb,err,pv))
|
|
||||||
#define PFCI_CLOSE(hfci,hf,err,pv) ((*PFCI_INT(hfci)->pfnclose)(hf,err,pv))
|
|
||||||
#define PFCI_SEEK(hfci,hf,dist,seektype,err,pv)((*PFCI_INT(hfci)->pfnseek)(hf,dist,seektype,err,pv))
|
|
||||||
#define PFCI_FILEPLACED(hfci,pccab,name,cb,cont,pv)((*PFCI_INT(hfci)->pfnfiledest)(pccab,name,cb,cont,pv))
|
|
||||||
|
|
||||||
/* quickie pfdi method invokers */
|
|
||||||
#define PFDI_ALLOC(hfdi, size) ((*PFDI_INT(hfdi)->pfnalloc) (size))
|
|
||||||
#define PFDI_FREE(hfdi, ptr) ((*PFDI_INT(hfdi)->pfnfree) (ptr))
|
|
||||||
#define PFDI_OPEN(hfdi, file, flag, mode) ((*PFDI_INT(hfdi)->pfnopen) (file, flag, mode))
|
|
||||||
#define PFDI_READ(hfdi, hf, pv, cb) ((*PFDI_INT(hfdi)->pfnread) (hf, pv, cb))
|
|
||||||
#define PFDI_WRITE(hfdi, hf, pv, cb) ((*PFDI_INT(hfdi)->pfnwrite) (hf, pv, cb))
|
|
||||||
#define PFDI_CLOSE(hfdi, hf) ((*PFDI_INT(hfdi)->pfnclose) (hf))
|
|
||||||
#define PFDI_SEEK(hfdi, hf, dist, type) ((*PFDI_INT(hfdi)->pfnseek) (hf, dist, type))
|
|
||||||
|
|
||||||
#define FCI_INT_MAGIC 0xfcfcfc05
|
|
||||||
#define FDI_INT_MAGIC 0xfdfdfd05
|
|
||||||
|
|
||||||
#define REALLY_IS_FCI(hfci) ( \
|
|
||||||
((hfci) != NULL) && \
|
|
||||||
(PFCI_INT(hfci)->FCI_Intmagic == FCI_INT_MAGIC) )
|
|
||||||
|
|
||||||
#define REALLY_IS_FDI(hfdi) ( \
|
|
||||||
((hfdi) != NULL) && \
|
|
||||||
(PFDI_INT(hfdi)->FDI_Intmagic == FDI_INT_MAGIC) )
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* the rest of these are somewhat kludgy macros which are shared between fdi.c
|
* the rest of these are somewhat kludgy macros which are shared between fdi.c
|
||||||
* and cabextract.c.
|
* and cabextract.c.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define ZIPNEEDBITS(n) {while(k<(n)){cab_LONG c=*(ZIP(inpos)++);\
|
|
||||||
b|=((cab_ULONG)c)<<k;k+=8;}}
|
|
||||||
#define ZIPDUMPBITS(n) {b>>=(n);k-=(n);}
|
|
||||||
|
|
||||||
/* endian-neutral reading of little-endian data */
|
|
||||||
#define EndGetI32(a) ((((a)[3])<<24)|(((a)[2])<<16)|(((a)[1])<<8)|((a)[0]))
|
|
||||||
#define EndGetI16(a) ((((a)[1])<<8)|((a)[0]))
|
|
||||||
|
|
||||||
#define CAB(x) (decomp_state->x)
|
|
||||||
#define ZIP(x) (decomp_state->methods.zip.x)
|
|
||||||
#define QTM(x) (decomp_state->methods.qtm.x)
|
|
||||||
#define LZX(x) (decomp_state->methods.lzx.x)
|
|
||||||
#define DECR_OK (0)
|
|
||||||
#define DECR_DATAFORMAT (1)
|
|
||||||
#define DECR_ILLEGALDATA (2)
|
|
||||||
#define DECR_NOMEMORY (3)
|
|
||||||
#define DECR_CHECKSUM (4)
|
|
||||||
#define DECR_INPUT (5)
|
|
||||||
#define DECR_OUTPUT (6)
|
|
||||||
#define DECR_USERABORT (7)
|
|
||||||
|
|
||||||
/* Bitstream reading macros (Quantum / normal byte order)
|
/* Bitstream reading macros (Quantum / normal byte order)
|
||||||
*
|
*
|
||||||
* Q_INIT_BITSTREAM should be used first to set up the system
|
* Q_INIT_BITSTREAM should be used first to set up the system
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
<importlibrary definition="cabinet.spec" />
|
<importlibrary definition="cabinet.spec" />
|
||||||
<include base="cabinet">.</include>
|
<include base="cabinet">.</include>
|
||||||
<include base="ReactOS">include/reactos/wine</include>
|
<include base="ReactOS">include/reactos/wine</include>
|
||||||
|
<include base="ReactOS">include/reactos/libs/zlib</include>
|
||||||
<define name="__WINESRC__" />
|
<define name="__WINESRC__" />
|
||||||
|
<define name="HAVE_ZLIB" />
|
||||||
<file>cabinet_main.c</file>
|
<file>cabinet_main.c</file>
|
||||||
<file>fci.c</file>
|
<file>fci.c</file>
|
||||||
<file>fdi.c</file>
|
<file>fdi.c</file>
|
||||||
|
@ -13,6 +15,7 @@
|
||||||
<file>cabinet.rc</file>
|
<file>cabinet.rc</file>
|
||||||
<pch>cabinet.h</pch>
|
<pch>cabinet.h</pch>
|
||||||
<library>wine</library>
|
<library>wine</library>
|
||||||
|
<library>zlib</library>
|
||||||
<library>ntdll</library>
|
<library>ntdll</library>
|
||||||
</module>
|
</module>
|
||||||
</group>
|
</group>
|
||||||
|
|
|
@ -331,7 +331,7 @@ HRESULT WINAPI Extract(SESSION *dest, LPCSTR szCabName)
|
||||||
{
|
{
|
||||||
HRESULT res = S_OK;
|
HRESULT res = S_OK;
|
||||||
HFDI hfdi;
|
HFDI hfdi;
|
||||||
char *str, *path, *name;
|
char *str, *end, *path = NULL, *name = NULL;
|
||||||
|
|
||||||
TRACE("(%p, %s)\n", dest, szCabName);
|
TRACE("(%p, %s)\n", dest, szCabName);
|
||||||
|
|
||||||
|
@ -363,13 +363,22 @@ HRESULT WINAPI Extract(SESSION *dest, LPCSTR szCabName)
|
||||||
}
|
}
|
||||||
lstrcpyA(str, szCabName);
|
lstrcpyA(str, szCabName);
|
||||||
|
|
||||||
path = str;
|
if ((end = strrchr(str, '\\')))
|
||||||
name = strrchr(path, '\\');
|
{
|
||||||
if (name)
|
end++;
|
||||||
*name++ = 0;
|
name = HeapAlloc( GetProcessHeap(), 0, strlen(end) + 1 );
|
||||||
|
if (!name)
|
||||||
|
{
|
||||||
|
res = E_OUTOFMEMORY;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
strcpy( name, end );
|
||||||
|
*end = 0;
|
||||||
|
path = str;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
name = path;
|
name = str;
|
||||||
path = NULL;
|
path = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,10 +388,9 @@ HRESULT WINAPI Extract(SESSION *dest, LPCSTR szCabName)
|
||||||
fdi_notify_extract, NULL, dest))
|
fdi_notify_extract, NULL, dest))
|
||||||
res = HRESULT_FROM_WIN32(GetLastError());
|
res = HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, str);
|
|
||||||
end:
|
end:
|
||||||
|
HeapFree(GetProcessHeap(), 0, path);
|
||||||
|
HeapFree(GetProcessHeap(), 0, name);
|
||||||
FDIDestroy(hfdi);
|
FDIDestroy(hfdi);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -45,7 +45,7 @@ reactos/dll/win32/atl # Autosync
|
||||||
reactos/dll/win32/avifil32 # Autosync
|
reactos/dll/win32/avifil32 # Autosync
|
||||||
reactos/dll/win32/bcrypt # Synced to Wine-1.3.37
|
reactos/dll/win32/bcrypt # Synced to Wine-1.3.37
|
||||||
reactos/dll/win32/browseui # Out of sync
|
reactos/dll/win32/browseui # Out of sync
|
||||||
reactos/dll/win32/cabinet # Autosync
|
reactos/dll/win32/cabinet # Synced to Wine-1.3.37
|
||||||
reactos/dll/win32/clusapi # Autosync
|
reactos/dll/win32/clusapi # Autosync
|
||||||
reactos/dll/win32/comcat # Autosync
|
reactos/dll/win32/comcat # Autosync
|
||||||
reactos/dll/win32/comctl32 # Synced to Wine 1.3.14
|
reactos/dll/win32/comctl32 # Synced to Wine 1.3.14
|
||||||
|
|
Loading…
Reference in a new issue