mirror of
https://github.com/reactos/reactos.git
synced 2024-08-18 17:37:02 +00:00
[CABINET]
* Sync with Wine 1.5.19. svn path=/trunk/; revision=57903
This commit is contained in:
parent
ff05a3b37a
commit
f33678fca7
|
@ -365,6 +365,7 @@ HRESULT WINAPI Extract(SESSION *dest, LPCSTR szCabName)
|
||||||
|
|
||||||
if ((end = strrchr(str, '\\')))
|
if ((end = strrchr(str, '\\')))
|
||||||
{
|
{
|
||||||
|
path = str;
|
||||||
end++;
|
end++;
|
||||||
name = HeapAlloc( GetProcessHeap(), 0, strlen(end) + 1 );
|
name = HeapAlloc( GetProcessHeap(), 0, strlen(end) + 1 );
|
||||||
if (!name)
|
if (!name)
|
||||||
|
@ -374,7 +375,6 @@ HRESULT WINAPI Extract(SESSION *dest, LPCSTR szCabName)
|
||||||
}
|
}
|
||||||
strcpy( name, end );
|
strcpy( name, end );
|
||||||
*end = 0;
|
*end = 0;
|
||||||
path = str;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -703,14 +703,14 @@ static BOOL FDI_read_entries(
|
||||||
pfdici->cFiles = num_files;
|
pfdici->cFiles = num_files;
|
||||||
pfdici->setID = setid;
|
pfdici->setID = setid;
|
||||||
pfdici->iCabinet = cabidx;
|
pfdici->iCabinet = cabidx;
|
||||||
pfdici->fReserve = (flags & cfheadRESERVE_PRESENT) ? TRUE : FALSE;
|
pfdici->fReserve = (flags & cfheadRESERVE_PRESENT) != 0;
|
||||||
pfdici->hasprev = (flags & cfheadPREV_CABINET) ? TRUE : FALSE;
|
pfdici->hasprev = (flags & cfheadPREV_CABINET) != 0;
|
||||||
pfdici->hasnext = (flags & cfheadNEXT_CABINET) ? TRUE : FALSE;
|
pfdici->hasnext = (flags & cfheadNEXT_CABINET) != 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* FDIIsCabinet (CABINET.21)
|
* FDIIsCabinet (CABINET.21)
|
||||||
*
|
*
|
||||||
* Informs the caller as to whether or not the provided file handle is
|
* Informs the caller as to whether or not the provided file handle is
|
||||||
* really a cabinet or not, filling out the provided PFDICABINETINFO
|
* really a cabinet or not, filling out the provided PFDICABINETINFO
|
||||||
|
@ -736,10 +736,7 @@ static BOOL FDI_read_entries(
|
||||||
* INCLUDES
|
* INCLUDES
|
||||||
* fdi.c
|
* fdi.c
|
||||||
*/
|
*/
|
||||||
BOOL __cdecl FDIIsCabinet(
|
BOOL __cdecl FDIIsCabinet(HFDI hfdi, INT_PTR hf, PFDICABINETINFO pfdici)
|
||||||
HFDI hfdi,
|
|
||||||
INT_PTR hf,
|
|
||||||
PFDICABINETINFO pfdici)
|
|
||||||
{
|
{
|
||||||
BOOL rv;
|
BOOL rv;
|
||||||
FDI_Int *fdi = get_fdi_ptr( hfdi );
|
FDI_Int *fdi = get_fdi_ptr( hfdi );
|
||||||
|
@ -749,13 +746,11 @@ BOOL __cdecl FDIIsCabinet(
|
||||||
if (!fdi) return FALSE;
|
if (!fdi) return FALSE;
|
||||||
|
|
||||||
if (!hf) {
|
if (!hf) {
|
||||||
ERR("(!hf)!\n");
|
|
||||||
SetLastError(ERROR_INVALID_HANDLE);
|
SetLastError(ERROR_INVALID_HANDLE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pfdici) {
|
if (!pfdici) {
|
||||||
ERR("(!pfdici)!\n");
|
|
||||||
SetLastError(ERROR_BAD_ARGUMENTS);
|
SetLastError(ERROR_BAD_ARGUMENTS);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -820,20 +815,20 @@ static int QTMfdi_init(int window, int level, fdi_decomp_state *decomp_state) {
|
||||||
|
|
||||||
/* initialize arithmetic coding models */
|
/* initialize arithmetic coding models */
|
||||||
|
|
||||||
QTMfdi_initmodel(&QTM(model7), &QTM(m7sym)[0], 7, 0);
|
QTMfdi_initmodel(&QTM(model7), QTM(m7sym), 7, 0);
|
||||||
|
|
||||||
QTMfdi_initmodel(&QTM(model00), &QTM(m00sym)[0], 0x40, 0x00);
|
QTMfdi_initmodel(&QTM(model00), QTM(m00sym), 0x40, 0x00);
|
||||||
QTMfdi_initmodel(&QTM(model40), &QTM(m40sym)[0], 0x40, 0x40);
|
QTMfdi_initmodel(&QTM(model40), QTM(m40sym), 0x40, 0x40);
|
||||||
QTMfdi_initmodel(&QTM(model80), &QTM(m80sym)[0], 0x40, 0x80);
|
QTMfdi_initmodel(&QTM(model80), QTM(m80sym), 0x40, 0x80);
|
||||||
QTMfdi_initmodel(&QTM(modelC0), &QTM(mC0sym)[0], 0x40, 0xC0);
|
QTMfdi_initmodel(&QTM(modelC0), QTM(mC0sym), 0x40, 0xC0);
|
||||||
|
|
||||||
/* model 4 depends on table size, ranges from 20 to 24 */
|
/* model 4 depends on table size, ranges from 20 to 24 */
|
||||||
QTMfdi_initmodel(&QTM(model4), &QTM(m4sym)[0], (msz < 24) ? msz : 24, 0);
|
QTMfdi_initmodel(&QTM(model4), QTM(m4sym), (msz < 24) ? msz : 24, 0);
|
||||||
/* model 5 depends on table size, ranges from 20 to 36 */
|
/* model 5 depends on table size, ranges from 20 to 36 */
|
||||||
QTMfdi_initmodel(&QTM(model5), &QTM(m5sym)[0], (msz < 36) ? msz : 36, 0);
|
QTMfdi_initmodel(&QTM(model5), QTM(m5sym), (msz < 36) ? msz : 36, 0);
|
||||||
/* model 6pos depends on table size, ranges from 20 to 42 */
|
/* model 6pos depends on table size, ranges from 20 to 42 */
|
||||||
QTMfdi_initmodel(&QTM(model6pos), &QTM(m6psym)[0], msz, 0);
|
QTMfdi_initmodel(&QTM(model6pos), QTM(m6psym), msz, 0);
|
||||||
QTMfdi_initmodel(&QTM(model6len), &QTM(m6lsym)[0], 27, 0);
|
QTMfdi_initmodel(&QTM(model6len), QTM(m6lsym), 27, 0);
|
||||||
|
|
||||||
return DECR_OK;
|
return DECR_OK;
|
||||||
}
|
}
|
||||||
|
@ -2046,7 +2041,7 @@ static int fdi_decomp(const struct fdi_file *fi, int savemode, fdi_decomp_state
|
||||||
/* outlen=0 means this block was the last contiguous part
|
/* outlen=0 means this block was the last contiguous part
|
||||||
of a split block, continued in the next cabinet */
|
of a split block, continued in the next cabinet */
|
||||||
if (outlen == 0) {
|
if (outlen == 0) {
|
||||||
int pathlen, filenamelen, idx, i;
|
int pathlen, filenamelen, i;
|
||||||
INT_PTR cabhf;
|
INT_PTR cabhf;
|
||||||
char fullpath[MAX_PATH], userpath[256];
|
char fullpath[MAX_PATH], userpath[256];
|
||||||
FDINOTIFICATION fdin;
|
FDINOTIFICATION fdin;
|
||||||
|
@ -2070,19 +2065,17 @@ static int fdi_decomp(const struct fdi_file *fi, int savemode, fdi_decomp_state
|
||||||
|
|
||||||
/* copy pszCabPath to userpath */
|
/* copy pszCabPath to userpath */
|
||||||
ZeroMemory(userpath, 256);
|
ZeroMemory(userpath, 256);
|
||||||
pathlen = (pszCabPath) ? strlen(pszCabPath) : 0;
|
pathlen = pszCabPath ? strlen(pszCabPath) : 0;
|
||||||
if (pathlen) {
|
if (pathlen) {
|
||||||
if (pathlen < 256) {
|
if (pathlen < 256) /* else we are in a weird place... let's leave it blank and see if the user fixes it */
|
||||||
for (i = 0; i <= pathlen; i++)
|
strcpy(userpath, pszCabPath);
|
||||||
userpath[i] = pszCabPath[i];
|
|
||||||
} /* else we are in a weird place... let's leave it blank and see if the user fixes it */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initial fdintNEXT_CABINET notification */
|
/* initial fdintNEXT_CABINET notification */
|
||||||
ZeroMemory(&fdin, sizeof(FDINOTIFICATION));
|
ZeroMemory(&fdin, sizeof(FDINOTIFICATION));
|
||||||
fdin.psz1 = (cab->mii.nextname) ? cab->mii.nextname : &emptystring;
|
fdin.psz1 = cab->mii.nextname ? cab->mii.nextname : &emptystring;
|
||||||
fdin.psz2 = (cab->mii.nextinfo) ? cab->mii.nextinfo : &emptystring;
|
fdin.psz2 = cab->mii.nextinfo ? cab->mii.nextinfo : &emptystring;
|
||||||
fdin.psz3 = &userpath[0];
|
fdin.psz3 = userpath;
|
||||||
fdin.fdie = FDIERROR_NONE;
|
fdin.fdie = FDIERROR_NONE;
|
||||||
fdin.pv = pvUser;
|
fdin.pv = pvUser;
|
||||||
|
|
||||||
|
@ -2091,7 +2084,7 @@ static int fdi_decomp(const struct fdi_file *fi, int savemode, fdi_decomp_state
|
||||||
do {
|
do {
|
||||||
|
|
||||||
pathlen = strlen(userpath);
|
pathlen = strlen(userpath);
|
||||||
filenamelen = (cab->mii.nextname) ? strlen(cab->mii.nextname) : 0;
|
filenamelen = cab->mii.nextname ? strlen(cab->mii.nextname) : 0;
|
||||||
|
|
||||||
/* slight overestimation here to save CPU cycles in the developer's brain */
|
/* slight overestimation here to save CPU cycles in the developer's brain */
|
||||||
if ((pathlen + filenamelen + 3) > MAX_PATH) {
|
if ((pathlen + filenamelen + 3) > MAX_PATH) {
|
||||||
|
@ -2100,13 +2093,14 @@ static int fdi_decomp(const struct fdi_file *fi, int savemode, fdi_decomp_state
|
||||||
}
|
}
|
||||||
|
|
||||||
/* paste the path and filename together */
|
/* paste the path and filename together */
|
||||||
idx = 0;
|
fullpath[0] = '\0';
|
||||||
if (pathlen) {
|
if (pathlen) {
|
||||||
for (i = 0; i < pathlen; i++) fullpath[idx++] = userpath[i];
|
strcpy(fullpath, userpath);
|
||||||
if (fullpath[idx - 1] != '\\') fullpath[idx++] = '\\';
|
if (fullpath[pathlen - 1] != '\\')
|
||||||
|
strcat(fullpath, "\\");
|
||||||
}
|
}
|
||||||
if (filenamelen) for (i = 0; i < filenamelen; i++) fullpath[idx++] = cab->mii.nextname[i];
|
if (filenamelen)
|
||||||
fullpath[idx] = '\0';
|
strcat(fullpath, cab->mii.nextname);
|
||||||
|
|
||||||
TRACE("full cab path/file name: %s\n", debugstr_a(fullpath));
|
TRACE("full cab path/file name: %s\n", debugstr_a(fullpath));
|
||||||
|
|
||||||
|
@ -2479,7 +2473,6 @@ BOOL __cdecl FDICopy(
|
||||||
FDICABINETINFO fdici;
|
FDICABINETINFO fdici;
|
||||||
FDINOTIFICATION fdin;
|
FDINOTIFICATION fdin;
|
||||||
INT_PTR cabhf, filehf = 0;
|
INT_PTR cabhf, filehf = 0;
|
||||||
int idx;
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
char fullpath[MAX_PATH];
|
char fullpath[MAX_PATH];
|
||||||
size_t pathlen, filenamelen;
|
size_t pathlen, filenamelen;
|
||||||
|
@ -2490,9 +2483,9 @@ BOOL __cdecl FDICopy(
|
||||||
fdi_decomp_state *decomp_state;
|
fdi_decomp_state *decomp_state;
|
||||||
FDI_Int *fdi = get_fdi_ptr( hfdi );
|
FDI_Int *fdi = get_fdi_ptr( hfdi );
|
||||||
|
|
||||||
TRACE("(hfdi == ^%p, pszCabinet == ^%p, pszCabPath == ^%p, flags == %0d, "
|
TRACE("(hfdi == ^%p, pszCabinet == %s, pszCabPath == %s, flags == %x, "
|
||||||
"pfnfdin == ^%p, pfnfdid == ^%p, pvUser == ^%p)\n",
|
"pfnfdin == ^%p, pfnfdid == ^%p, pvUser == ^%p)\n",
|
||||||
hfdi, pszCabinet, pszCabPath, flags, pfnfdin, pfnfdid, pvUser);
|
hfdi, debugstr_a(pszCabinet), debugstr_a(pszCabPath), flags, pfnfdin, pfnfdid, pvUser);
|
||||||
|
|
||||||
if (!fdi) return FALSE;
|
if (!fdi) return FALSE;
|
||||||
|
|
||||||
|
@ -2503,8 +2496,8 @@ BOOL __cdecl FDICopy(
|
||||||
}
|
}
|
||||||
ZeroMemory(decomp_state, sizeof(fdi_decomp_state));
|
ZeroMemory(decomp_state, sizeof(fdi_decomp_state));
|
||||||
|
|
||||||
pathlen = (pszCabPath) ? strlen(pszCabPath) : 0;
|
pathlen = pszCabPath ? strlen(pszCabPath) : 0;
|
||||||
filenamelen = (pszCabinet) ? strlen(pszCabinet) : 0;
|
filenamelen = pszCabinet ? strlen(pszCabinet) : 0;
|
||||||
|
|
||||||
/* slight overestimation here to save CPU cycles in the developer's brain */
|
/* slight overestimation here to save CPU cycles in the developer's brain */
|
||||||
if ((pathlen + filenamelen + 3) > MAX_PATH) {
|
if ((pathlen + filenamelen + 3) > MAX_PATH) {
|
||||||
|
@ -2515,12 +2508,11 @@ BOOL __cdecl FDICopy(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* paste the path and filename together */
|
/* paste the path and filename together */
|
||||||
idx = 0;
|
fullpath[0] = '\0';
|
||||||
if (pathlen) {
|
if (pathlen)
|
||||||
for (i = 0; i < pathlen; i++) fullpath[idx++] = pszCabPath[i];
|
strcpy(fullpath, pszCabPath);
|
||||||
}
|
if (filenamelen)
|
||||||
if (filenamelen) for (i = 0; i < filenamelen; i++) fullpath[idx++] = pszCabinet[i];
|
strcat(fullpath, pszCabinet);
|
||||||
fullpath[idx] = '\0';
|
|
||||||
|
|
||||||
TRACE("full cab path/file name: %s\n", debugstr_a(fullpath));
|
TRACE("full cab path/file name: %s\n", debugstr_a(fullpath));
|
||||||
|
|
||||||
|
@ -2535,7 +2527,7 @@ BOOL __cdecl FDICopy(
|
||||||
|
|
||||||
/* check if it's really a cabfile. Note that this doesn't implement the bug */
|
/* check if it's really a cabfile. Note that this doesn't implement the bug */
|
||||||
if (!FDI_read_entries(fdi, cabhf, &fdici, &(CAB(mii)))) {
|
if (!FDI_read_entries(fdi, cabhf, &fdici, &(CAB(mii)))) {
|
||||||
ERR("FDIIsCabinet failed: %u.\n", fdi->perf->erfOper);
|
WARN("FDI_read_entries failed: %u\n", fdi->perf->erfOper);
|
||||||
fdi->free(decomp_state);
|
fdi->free(decomp_state);
|
||||||
fdi->close(cabhf);
|
fdi->close(cabhf);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -2815,7 +2807,7 @@ BOOL __cdecl FDICopy(
|
||||||
fdin.pv = pvUser;
|
fdin.pv = pvUser;
|
||||||
fdin.psz1 = (char *)file->filename;
|
fdin.psz1 = (char *)file->filename;
|
||||||
fdin.hf = filehf;
|
fdin.hf = filehf;
|
||||||
fdin.cb = (file->attribs & cffile_A_EXEC) ? TRUE : FALSE; /* FIXME: is that right? */
|
fdin.cb = (file->attribs & cffile_A_EXEC) != 0; /* FIXME: is that right? */
|
||||||
fdin.date = file->date;
|
fdin.date = file->date;
|
||||||
fdin.time = file->time;
|
fdin.time = file->time;
|
||||||
fdin.attribs = file->attribs; /* FIXME: filter _A_EXEC? */
|
fdin.attribs = file->attribs; /* FIXME: filter _A_EXEC? */
|
||||||
|
|
|
@ -45,7 +45,7 @@ reactos/dll/win32/atl100 # Synced to Wine-1.5.19
|
||||||
reactos/dll/win32/avifil32 # Synced to Wine-1.3.37
|
reactos/dll/win32/avifil32 # Synced to Wine-1.3.37
|
||||||
reactos/dll/win32/bcrypt # Synced to Wine-1.5.19
|
reactos/dll/win32/bcrypt # Synced to Wine-1.5.19
|
||||||
reactos/dll/win32/browseui # Out of sync
|
reactos/dll/win32/browseui # Out of sync
|
||||||
reactos/dll/win32/cabinet # Synced to Wine-1.5.4
|
reactos/dll/win32/cabinet # Synced to Wine-1.5.19
|
||||||
reactos/dll/win32/clusapi # Synced to Wine-1.5.19
|
reactos/dll/win32/clusapi # Synced to Wine-1.5.19
|
||||||
reactos/dll/win32/comcat # Synced to Wine-1.5.4
|
reactos/dll/win32/comcat # Synced to Wine-1.5.4
|
||||||
reactos/dll/win32/comctl32 # Synced to Wine 1.3.37
|
reactos/dll/win32/comctl32 # Synced to Wine 1.3.37
|
||||||
|
|
Loading…
Reference in a new issue