cabinet: Read CAB size from the file header instead of calling FDI seek callback with SEEK_END.
SEEK_END is not supported by some callback implementations.
This commit is contained in:
parent
3cb5b93db9
commit
4ddb9f6915
|
@ -536,7 +536,7 @@ static BOOL FDI_read_entries(
|
|||
PMORE_ISCAB_INFO pmii)
|
||||
{
|
||||
int num_folders, num_files, header_resv, folder_resv = 0;
|
||||
LONG base_offset, cabsize;
|
||||
LONG cabsize;
|
||||
USHORT setid, cabidx, flags;
|
||||
cab_UBYTE buf[64], block_resv;
|
||||
char *prevname = NULL, *previnfo = NULL, *nextname = NULL, *nextinfo = NULL;
|
||||
|
@ -573,22 +573,6 @@ static BOOL FDI_read_entries(
|
|||
* -gmt
|
||||
*/
|
||||
|
||||
/* get basic offset & size info */
|
||||
base_offset = FDI_getoffset(fdi, hf);
|
||||
|
||||
if (fdi->seek(hf, 0, SEEK_END) == -1) {
|
||||
if (pmii) set_error( fdi, FDIERROR_NOT_A_CABINET, 0 );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
cabsize = FDI_getoffset(fdi, hf);
|
||||
|
||||
if ((cabsize == -1) || (base_offset == -1) ||
|
||||
( fdi->seek(hf, base_offset, SEEK_SET) == -1 )) {
|
||||
if (pmii) set_error( fdi, FDIERROR_NOT_A_CABINET, 0 );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* read in the CFHEADER */
|
||||
if (fdi->read(hf, buf, cfhead_SIZEOF) != cfhead_SIZEOF) {
|
||||
if (pmii) set_error( fdi, FDIERROR_NOT_A_CABINET, 0 );
|
||||
|
@ -601,6 +585,9 @@ static BOOL FDI_read_entries(
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* get the cabinet size */
|
||||
cabsize = EndGetI32(buf+cfhead_CabinetSize);
|
||||
|
||||
/* get the number of folders */
|
||||
num_folders = EndGetI16(buf+cfhead_NumFolders);
|
||||
|
||||
|
|
|
@ -762,7 +762,6 @@ static LONG CDECL fdi_mem_seek(INT_PTR hf, LONG dist, int seektype)
|
|||
|
||||
case SEEK_END:
|
||||
default:
|
||||
todo_wine
|
||||
ok(0, "seek: not expected type %d\n", seektype);
|
||||
return -1;
|
||||
}
|
||||
|
@ -879,18 +878,16 @@ static void test_FDICopy(void)
|
|||
|
||||
memset(&info, 0, sizeof(info));
|
||||
ret = FDIIsCabinet(hfdi, fd, &info);
|
||||
todo_wine {
|
||||
ok(ret, "FDIIsCabinet error %d\n", erf.erfOper);
|
||||
ok(info.cbCabinet == 0x59, "expected 0x59, got %#x\n", info.cbCabinet);
|
||||
ok(info.cFiles == 1, "expected 1, got %d\n", info.cFiles);
|
||||
ok(info.cFolders == 1, "expected 1, got %d\n", info.cFolders);
|
||||
ok(info.setID == 0x1225, "expected 0x1225, got %#x\n", info.setID);
|
||||
ok(info.iCabinet == 0x2013, "expected 0x2013, got %#x\n", info.iCabinet);
|
||||
}
|
||||
|
||||
fdi_mem_close(fd);
|
||||
|
||||
ret = FDICopy(hfdi, block, memory, 0, fdi_mem_notify, NULL, 0);
|
||||
todo_wine
|
||||
ok(ret, "FDICopy error %d\n", erf.erfOper);
|
||||
|
||||
FDIDestroy(hfdi);
|
||||
|
|
Loading…
Reference in New Issue