This patch is relative to CVS and should have no dependency relationship with cab_G_00, the still-pending SetupIterateCabinet patch. Some InstallShield installers free the ERF structure on the stack before FDIIsCabinet is called. In wine, all hell breaks loose. Since native cabinet.dll doesn't crash, I guess FDIIsCabinet mustn't touch that structure. License: Bugroff ChangeLog: * dlls/cabinet: fdi.c: Greg Turner <gmturner007@ameritech.net> - Don't touch perf in FDIIsCabinet, InstallShield may already have freed it. -- diff -ur --minimal --exclude-from=/home/greg/bin/winetreediff_excl ../wine.test/dlls/cabinet/fdi.c ./dlls/cabinet/fdi.c --- ../wine.test/dlls/cabinet/fdi.c 2003-08-06 22:21:04.000000000 -0500 +++ ./dlls/cabinet/fdi.c 2003-08-15 17:04:16.000000000 -0500 @@ -373,9 +373,11 @@ base_offset = FDI_getoffset(hfdi, hf); if (PFDI_SEEK(hfdi, hf, 0, SEEK_END) == -1) { - PFDI_INT(hfdi)->perf->erfOper = FDIERROR_NOT_A_CABINET; - PFDI_INT(hfdi)->perf->erfType = 0; - PFDI_INT(hfdi)->perf->fError = TRUE; + if (pmii) { + PFDI_INT(hfdi)->perf->erfOper = FDIERROR_NOT_A_CABINET; + PFDI_INT(hfdi)->perf->erfType = 0; + PFDI_INT(hfdi)->perf->fError = TRUE; + } return FALSE; } @@ -383,25 +385,31 @@ if ((cabsize == -1) || (base_offset == -1) || ( PFDI_SEEK(hfdi, hf, base_offset, SEEK_SET) == -1 )) { - PFDI_INT(hfdi)->perf->erfOper = FDIERROR_NOT_A_CABINET; - PFDI_INT(hfdi)->perf->erfType = 0; - PFDI_INT(hfdi)->perf->fError = TRUE; + if (pmii) { + PFDI_INT(hfdi)->perf->erfOper = FDIERROR_NOT_A_CABINET; + PFDI_INT(hfdi)->perf->erfType = 0; + PFDI_INT(hfdi)->perf->fError = TRUE; + } return FALSE; } /* read in the CFHEADER */ if (PFDI_READ(hfdi, hf, buf, cfhead_SIZEOF) != cfhead_SIZEOF) { - PFDI_INT(hfdi)->perf->erfOper = FDIERROR_NOT_A_CABINET; - PFDI_INT(hfdi)->perf->erfType = 0; - PFDI_INT(hfdi)->perf->fError = TRUE; + if (pmii) { + PFDI_INT(hfdi)->perf->erfOper = FDIERROR_NOT_A_CABINET; + PFDI_INT(hfdi)->perf->erfType = 0; + PFDI_INT(hfdi)->perf->fError = TRUE; + } return FALSE; } /* check basic MSCF signature */ if (EndGetI32(buf+cfhead_Signature) != 0x4643534d) { - PFDI_INT(hfdi)->perf->erfOper = FDIERROR_NOT_A_CABINET; - PFDI_INT(hfdi)->perf->erfType = 0; - PFDI_INT(hfdi)->perf->fError = TRUE; + if (pmii) { + PFDI_INT(hfdi)->perf->erfOper = FDIERROR_NOT_A_CABINET; + PFDI_INT(hfdi)->perf->erfType = 0; + PFDI_INT(hfdi)->perf->fError = TRUE; + } return FALSE; } @@ -410,9 +418,11 @@ if (num_folders == 0) { /* PONDERME: is this really invalid? */ WARN("weird cabinet detect failure: no folders in cabinet\n"); - PFDI_INT(hfdi)->perf->erfOper = FDIERROR_NOT_A_CABINET; - PFDI_INT(hfdi)->perf->erfType = 0; - PFDI_INT(hfdi)->perf->fError = TRUE; + if (pmii) { + PFDI_INT(hfdi)->perf->erfOper = FDIERROR_NOT_A_CABINET; + PFDI_INT(hfdi)->perf->erfType = 0; + PFDI_INT(hfdi)->perf->fError = TRUE; + } return FALSE; } @@ -421,9 +431,11 @@ if (num_files == 0) { /* PONDERME: is this really invalid? */ WARN("weird cabinet detect failure: no files in cabinet\n"); - PFDI_INT(hfdi)->perf->erfOper = FDIERROR_NOT_A_CABINET; - PFDI_INT(hfdi)->perf->erfType = 0; - PFDI_INT(hfdi)->perf->fError = TRUE; + if (pmii) { + PFDI_INT(hfdi)->perf->erfOper = FDIERROR_NOT_A_CABINET; + PFDI_INT(hfdi)->perf->erfType = 0; + PFDI_INT(hfdi)->perf->fError = TRUE; + } return FALSE; } @@ -438,9 +450,11 @@ (buf[cfhead_MajorVersion] == 1 && buf[cfhead_MinorVersion] > 3)) { WARN("cabinet format version > 1.3\n"); - PFDI_INT(hfdi)->perf->erfOper = FDIERROR_UNKNOWN_CABINET_VERSION; - PFDI_INT(hfdi)->perf->erfType = 0; /* ? */ - PFDI_INT(hfdi)->perf->fError = TRUE; + if (pmii) { + PFDI_INT(hfdi)->perf->erfOper = FDIERROR_UNKNOWN_CABINET_VERSION; + PFDI_INT(hfdi)->perf->erfType = 0; /* ? */ + PFDI_INT(hfdi)->perf->fError = TRUE; + } return FALSE; } @@ -451,9 +465,11 @@ if (flags & cfheadRESERVE_PRESENT) { if (PFDI_READ(hfdi, hf, buf, cfheadext_SIZEOF) != cfheadext_SIZEOF) { ERR("bunk reserve-sizes?\n"); - PFDI_INT(hfdi)->perf->erfOper = FDIERROR_CORRUPT_CABINET; - PFDI_INT(hfdi)->perf->erfType = 0; /* ? */ - PFDI_INT(hfdi)->perf->fError = TRUE; + if (pmii) { + PFDI_INT(hfdi)->perf->erfOper = FDIERROR_CORRUPT_CABINET; + PFDI_INT(hfdi)->perf->erfType = 0; /* ? */ + PFDI_INT(hfdi)->perf->fError = TRUE; + } return FALSE; } @@ -471,9 +487,11 @@ /* skip the reserved header */ if ((header_resv) && (PFDI_SEEK(hfdi, hf, header_resv, SEEK_CUR) == -1)) { ERR("seek failure: header_resv\n"); - PFDI_INT(hfdi)->perf->erfOper = FDIERROR_CORRUPT_CABINET; - PFDI_INT(hfdi)->perf->erfType = 0; /* ? */ - PFDI_INT(hfdi)->perf->fError = TRUE; + if (pmii) { + PFDI_INT(hfdi)->perf->erfOper = FDIERROR_CORRUPT_CABINET; + PFDI_INT(hfdi)->perf->erfType = 0; /* ? */ + PFDI_INT(hfdi)->perf->fError = TRUE; + } return FALSE; } } @@ -481,9 +499,11 @@ if (flags & cfheadPREV_CABINET) { prevname = FDI_read_string(hfdi, hf, cabsize); if (!prevname) { - PFDI_INT(hfdi)->perf->erfOper = FDIERROR_CORRUPT_CABINET; - PFDI_INT(hfdi)->perf->erfType = 0; /* ? */ - PFDI_INT(hfdi)->perf->fError = TRUE; + if (pmii) { + PFDI_INT(hfdi)->perf->erfOper = FDIERROR_CORRUPT_CABINET; + PFDI_INT(hfdi)->perf->erfType = 0; /* ? */ + PFDI_INT(hfdi)->perf->fError = TRUE; + } return FALSE; } else if (pmii) @@ -583,18 +603,18 @@ if (!hf) { ERR("(!hf)!\n"); - PFDI_INT(hfdi)->perf->erfOper = FDIERROR_CABINET_NOT_FOUND; + /* PFDI_INT(hfdi)->perf->erfOper = FDIERROR_CABINET_NOT_FOUND; PFDI_INT(hfdi)->perf->erfType = ERROR_INVALID_HANDLE; - PFDI_INT(hfdi)->perf->fError = TRUE; + PFDI_INT(hfdi)->perf->fError = TRUE; */ SetLastError(ERROR_INVALID_HANDLE); return FALSE; } if (!pfdici) { ERR("(!pfdici)!\n"); - PFDI_INT(hfdi)->perf->erfOper = FDIERROR_NONE; + /* PFDI_INT(hfdi)->perf->erfOper = FDIERROR_NONE; PFDI_INT(hfdi)->perf->erfType = ERROR_BAD_ARGUMENTS; - PFDI_INT(hfdi)->perf->fError = TRUE; + PFDI_INT(hfdi)->perf->fError = TRUE; */ SetLastError(ERROR_BAD_ARGUMENTS); return FALSE; } -- gmt "The difference between Congress and drunken sailors is that drunken sailors are spending their own money." -- Rep. Tom Feeney