Index: dll/win32/cabinet/cabinet_main.c =================================================================== --- dll/win32/cabinet/cabinet_main.c (revision 41034) +++ dll/win32/cabinet/cabinet_main.c (working copy) @@ -253,9 +253,12 @@ hFile = CreateFileA(szFullPath, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); - if (hFile == INVALID_HANDLE_VALUE) - hFile = 0; - else if (node) + if((hFile == INVALID_HANDLE_VALUE) && (GetLastError() == ERROR_FILE_EXISTS)) + { + /* File already exists but no handle is returned */ + SetLastError(ERROR_ACCESS_DENIED); + } + else if ((hFile != INVALID_HANDLE_VALUE) && node) node->DoExtract = FALSE; } Index: dll/win32/cabinet/fci.c =================================================================== --- dll/win32/cabinet/fci.c (revision 41034) +++ dll/win32/cabinet/fci.c (working copy) @@ -1667,7 +1667,7 @@ cfheader.flags |= cfheadRESERVE_PRESENT; } cfheader.setID = p_fci_internal->oldCCAB.setID; - cfheader.iCabinet = p_fci_internal->oldCCAB.iCab-1; + cfheader.iCabinet = p_fci_internal->oldCCAB.iCab; } else { if( p_fci_internal->pccab->cbReserveCFHeader != 0 || p_fci_internal->pccab->cbReserveCFFolder != 0 || @@ -1675,7 +1675,7 @@ cfheader.flags |= cfheadRESERVE_PRESENT; } cfheader.setID = p_fci_internal->pccab->setID; - cfheader.iCabinet = p_fci_internal->pccab->iCab-1; + cfheader.iCabinet = p_fci_internal->pccab->iCab; } /* create the cabinet */ Index: dll/win32/cabinet/fdi.c =================================================================== --- dll/win32/cabinet/fdi.c (revision 41034) +++ dll/win32/cabinet/fdi.c (working copy) @@ -380,10 +380,8 @@ if (!((rv = (*pfnalloc)(sizeof(FDI_Int))))) { perf->erfOper = FDIERROR_ALLOC_FAIL; - perf->erfType = ERROR_NOT_ENOUGH_MEMORY; + perf->erfType = 0; perf->fError = TRUE; - - SetLastError(ERROR_NOT_ENOUGH_MEMORY); return NULL; } @@ -2556,11 +2554,11 @@ /* check if it's really a cabfile. Note that this doesn't implement the bug */ if (!FDI_read_entries(hfdi, cabhf, &fdici, &(CAB(mii)))) { - ERR("FDIIsCabinet failed.\n"); + SetLastError(ERROR_INVALID_HANDLE); PFDI_CLOSE(hfdi, cabhf); return FALSE; } - + /* cabinet notification */ ZeroMemory(&fdin, sizeof(FDINOTIFICATION)); fdin.setID = fdici.setID;