cabinet: Close the opened file handle even in error cases
James Hawkins
truiken at gmail.com
Fri Dec 15 03:47:15 CST 2006
Hi,
This is confirmed with native cabinet and is necessary for the next msi patch.
Changelog:
* Close the opened file handle even in error cases.
dlls/cabinet/fdi.c | 33 +++++++++++----------------------
1 files changed, 11 insertions(+), 22 deletions(-)
--
James Hawkins
-------------- next part --------------
diff --git a/dlls/cabinet/fdi.c b/dlls/cabinet/fdi.c
index 0cb319c..f09bb69 100644
--- a/dlls/cabinet/fdi.c
+++ b/dlls/cabinet/fdi.c
@@ -2809,6 +2809,17 @@ BOOL __cdecl FDICopy(
err = fdi_decomp(file, 1, decomp_state, pszCabPath, pfnfdin, pvUser);
if (err) CAB(current) = NULL; else CAB(offset) += file->length;
+ /* fdintCLOSE_FILE_INFO notification */
+ ZeroMemory(&fdin, sizeof(FDINOTIFICATION));
+ fdin.pv = pvUser;
+ fdin.psz1 = (char *)file->filename;
+ fdin.hf = filehf;
+ fdin.cb = (file->attribs & cffile_A_EXEC) ? TRUE : FALSE; /* FIXME: is that right? */
+ fdin.date = file->date;
+ fdin.time = file->time;
+ fdin.attribs = file->attribs; /* FIXME: filter _A_EXEC? */
+ ((*pfnfdin)(fdintCLOSE_FILE_INFO, &fdin));
+
switch (err) {
case DECR_OK:
break;
@@ -2829,28 +2840,6 @@ BOOL __cdecl FDICopy(
PFDI_INT(hfdi)->perf->fError = TRUE;
goto bail_and_fail;
}
-
- /* fdintCLOSE_FILE_INFO notification */
- ZeroMemory(&fdin, sizeof(FDINOTIFICATION));
- fdin.pv = pvUser;
- fdin.psz1 = (char *)file->filename;
- fdin.hf = filehf;
- fdin.cb = (file->attribs & cffile_A_EXEC) ? TRUE : FALSE; /* FIXME: is that right? */
- fdin.date = file->date;
- fdin.time = file->time;
- fdin.attribs = file->attribs; /* FIXME: filter _A_EXEC? */
- err = ((*pfnfdin)(fdintCLOSE_FILE_INFO, &fdin));
- if (err == FALSE || err == -1) {
- /*
- * SDK states that even though they indicated failure,
- * we are not supposed to try and close the file, so we
- * just treat this like all the others
- */
- PFDI_INT(hfdi)->perf->erfOper = FDIERROR_USER_ABORT;
- PFDI_INT(hfdi)->perf->erfType = 0;
- PFDI_INT(hfdi)->perf->fError = TRUE;
- goto bail_and_fail;
- }
}
}
--
1.4.4.2
More information about the wine-patches
mailing list