cabinet: Fix the remaining todo_wine tests in fdi.c.
This commit is contained in:
parent
b799765fe6
commit
3dc669ffb5
|
@ -672,7 +672,7 @@ static BOOL write_cabinet( FCI_Int *fci, PFNFCISTATUS status_callback )
|
||||||
cfheader->cFiles = fci_endian_uword( fci->cFiles );
|
cfheader->cFiles = fci_endian_uword( fci->cFiles );
|
||||||
cfheader->flags = fci_endian_uword( flags );
|
cfheader->flags = fci_endian_uword( flags );
|
||||||
cfheader->setID = fci_endian_uword( fci->ccab.setID );
|
cfheader->setID = fci_endian_uword( fci->ccab.setID );
|
||||||
cfheader->iCabinet = fci_endian_uword( fci->ccab.iCab - 1 );
|
cfheader->iCabinet = fci_endian_uword( fci->ccab.iCab );
|
||||||
ptr = (char *)(cfheader + 1);
|
ptr = (char *)(cfheader + 1);
|
||||||
|
|
||||||
if (flags & cfheadRESERVE_PRESENT)
|
if (flags & cfheadRESERVE_PRESENT)
|
||||||
|
|
|
@ -436,10 +436,8 @@ HFDI __cdecl FDICreate(
|
||||||
|
|
||||||
if (!((fdi = pfnalloc(sizeof(FDI_Int))))) {
|
if (!((fdi = pfnalloc(sizeof(FDI_Int))))) {
|
||||||
perf->erfOper = FDIERROR_ALLOC_FAIL;
|
perf->erfOper = FDIERROR_ALLOC_FAIL;
|
||||||
perf->erfType = ERROR_NOT_ENOUGH_MEMORY;
|
perf->erfType = 0;
|
||||||
perf->fError = TRUE;
|
perf->fError = TRUE;
|
||||||
|
|
||||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,21 +601,9 @@ static BOOL FDI_read_entries(
|
||||||
|
|
||||||
/* get the number of folders */
|
/* get the number of folders */
|
||||||
num_folders = EndGetI16(buf+cfhead_NumFolders);
|
num_folders = EndGetI16(buf+cfhead_NumFolders);
|
||||||
if (num_folders == 0) {
|
|
||||||
/* PONDERME: is this really invalid? */
|
|
||||||
WARN("weird cabinet detect failure: no folders in cabinet\n");
|
|
||||||
if (pmii) set_error( fdi, FDIERROR_NOT_A_CABINET, 0 );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get the number of files */
|
/* get the number of files */
|
||||||
num_files = EndGetI16(buf+cfhead_NumFiles);
|
num_files = EndGetI16(buf+cfhead_NumFiles);
|
||||||
if (num_files == 0) {
|
|
||||||
/* PONDERME: is this really invalid? */
|
|
||||||
WARN("weird cabinet detect failure: no files in cabinet\n");
|
|
||||||
if (pmii) set_error( fdi, FDIERROR_NOT_A_CABINET, 0 );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* setid */
|
/* setid */
|
||||||
setid = EndGetI16(buf+cfhead_SetID);
|
setid = EndGetI16(buf+cfhead_SetID);
|
||||||
|
@ -2284,8 +2270,7 @@ static void free_decompression_temps(FDI_Int *fdi, const struct fdi_folder *fol,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_decompression_mem(FDI_Int *fdi,
|
static void free_decompression_mem(FDI_Int *fdi, fdi_decomp_state *decomp_state)
|
||||||
fdi_decomp_state *decomp_state, struct fdi_file *file)
|
|
||||||
{
|
{
|
||||||
struct fdi_folder *fol;
|
struct fdi_folder *fol;
|
||||||
while (decomp_state) {
|
while (decomp_state) {
|
||||||
|
@ -2305,7 +2290,7 @@ static void free_decompression_mem(FDI_Int *fdi,
|
||||||
fdi->free(fol);
|
fdi->free(fol);
|
||||||
}
|
}
|
||||||
while (CAB(firstfile)) {
|
while (CAB(firstfile)) {
|
||||||
file = CAB(firstfile);
|
struct fdi_file *file = CAB(firstfile);
|
||||||
if (file->filename) fdi->free(file->filename);
|
if (file->filename) fdi->free(file->filename);
|
||||||
CAB(firstfile) = CAB(firstfile)->next;
|
CAB(firstfile) = CAB(firstfile)->next;
|
||||||
fdi->free(file);
|
fdi->free(file);
|
||||||
|
@ -2531,7 +2516,6 @@ BOOL __cdecl FDICopy(
|
||||||
idx = 0;
|
idx = 0;
|
||||||
if (pathlen) {
|
if (pathlen) {
|
||||||
for (i = 0; i < pathlen; i++) fullpath[idx++] = pszCabPath[i];
|
for (i = 0; i < pathlen; i++) fullpath[idx++] = pszCabPath[i];
|
||||||
if (fullpath[idx - 1] != '\\') fullpath[idx++] = '\\';
|
|
||||||
}
|
}
|
||||||
if (filenamelen) for (i = 0; i < filenamelen; i++) fullpath[idx++] = pszCabinet[i];
|
if (filenamelen) for (i = 0; i < filenamelen; i++) fullpath[idx++] = pszCabinet[i];
|
||||||
fullpath[idx] = '\0';
|
fullpath[idx] = '\0';
|
||||||
|
@ -2547,13 +2531,6 @@ BOOL __cdecl FDICopy(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cabhf == 0) {
|
|
||||||
ERR("PFDI_OPEN returned zero for %s.\n", fullpath);
|
|
||||||
fdi->free(decomp_state);
|
|
||||||
set_error( fdi, FDIERROR_CABINET_NOT_FOUND, ERROR_FILE_NOT_FOUND );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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.\n");
|
ERR("FDIIsCabinet failed.\n");
|
||||||
|
@ -2859,8 +2836,8 @@ BOOL __cdecl FDICopy(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free_decompression_temps(fdi, fol, decomp_state);
|
if (fol) free_decompression_temps(fdi, fol, decomp_state);
|
||||||
free_decompression_mem(fdi, decomp_state, file);
|
free_decompression_mem(fdi, decomp_state);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
@ -2870,7 +2847,7 @@ BOOL __cdecl FDICopy(
|
||||||
|
|
||||||
if (filehf) fdi->close(filehf);
|
if (filehf) fdi->close(filehf);
|
||||||
|
|
||||||
free_decompression_mem(fdi, decomp_state, file);
|
free_decompression_mem(fdi, decomp_state);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,12 +239,9 @@ static void test_FDICreate(void)
|
||||||
ok(erf.erfOper == FDIERROR_ALLOC_FAIL,
|
ok(erf.erfOper == FDIERROR_ALLOC_FAIL,
|
||||||
"Expected FDIERROR_ALLOC_FAIL, got %d\n", erf.erfOper);
|
"Expected FDIERROR_ALLOC_FAIL, got %d\n", erf.erfOper);
|
||||||
ok(erf.fError == TRUE, "Expected TRUE, got %d\n", erf.fError);
|
ok(erf.fError == TRUE, "Expected TRUE, got %d\n", erf.fError);
|
||||||
todo_wine
|
ok(GetLastError() == 0xdeadbeef,
|
||||||
{
|
"Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||||
ok(GetLastError() == 0xdeadbeef,
|
ok(erf.erfType == 0, "Expected 0, got %d\n", erf.erfType);
|
||||||
"Expected 0xdeadbeef, got %d\n", GetLastError());
|
|
||||||
ok(erf.erfType == 0, "Expected 0, got %d\n", erf.erfType);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_FDIDestroy(void)
|
static void test_FDIDestroy(void)
|
||||||
|
@ -582,8 +579,7 @@ static void test_FDIIsCabinet(void)
|
||||||
ok(cabinfo.cFolders == 1, "Expected 1, got %d\n", cabinfo.cFolders);
|
ok(cabinfo.cFolders == 1, "Expected 1, got %d\n", cabinfo.cFolders);
|
||||||
ok(cabinfo.setID == 0xbeef, "Expected 0xbeef, got %d\n", cabinfo.setID);
|
ok(cabinfo.setID == 0xbeef, "Expected 0xbeef, got %d\n", cabinfo.setID);
|
||||||
ok(cabinfo.cbCabinet == 182, "Expected 182, got %d\n", cabinfo.cbCabinet);
|
ok(cabinfo.cbCabinet == 182, "Expected 182, got %d\n", cabinfo.cbCabinet);
|
||||||
todo_wine
|
ok(cabinfo.iCabinet == 0, "Expected 0, got %d\n", cabinfo.iCabinet);
|
||||||
ok(cabinfo.iCabinet == 0, "Expected 0, got %d\n", cabinfo.iCabinet);
|
|
||||||
|
|
||||||
fdi_close(fd);
|
fdi_close(fd);
|
||||||
FDIDestroy(hfdi);
|
FDIDestroy(hfdi);
|
||||||
|
@ -629,11 +625,8 @@ static void test_FDICopy(void)
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ret = FDICopy(hfdi, name, path, 0, CopyProgress, NULL, 0);
|
ret = FDICopy(hfdi, name, path, 0, CopyProgress, NULL, 0);
|
||||||
ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
|
ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
|
||||||
todo_wine
|
ok(GetLastError() == ERROR_INVALID_HANDLE,
|
||||||
{
|
"Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
|
||||||
ok(GetLastError() == ERROR_INVALID_HANDLE,
|
|
||||||
"Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
|
|
||||||
}
|
|
||||||
|
|
||||||
FDIDestroy(hfdi);
|
FDIDestroy(hfdi);
|
||||||
}
|
}
|
||||||
|
@ -649,7 +642,6 @@ static void test_FDICopy(void)
|
||||||
/* cabinet with no files or folders */
|
/* cabinet with no files or folders */
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ret = FDICopy(hfdi, name, path, 0, CopyProgress, NULL, 0);
|
ret = FDICopy(hfdi, name, path, 0, CopyProgress, NULL, 0);
|
||||||
todo_wine
|
|
||||||
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
|
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
|
||||||
ok(GetLastError() == 0, "Expected 0f, got %d\n", GetLastError());
|
ok(GetLastError() == 0, "Expected 0f, got %d\n", GetLastError());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue