internal int CabGetNextCabinet(Pointer pccab, uint cbPrevCab, Pointer pv) { try { FCI.CCAB ccab = new FCI.CCAB(); Marshal.PtrToStructure(pccab, ccab); ccab.szDisk = ""; ccab.szCab = ""; if (this.nameHandler != null) { ccab.szCab = this.nameHandler(ccab.iCab, this.nameContext); } this.cabNumbers[ccab.szCab] = (short)ccab.iCab; Marshal.StructureToPtr(ccab, pccab, false); return(1); } catch (Exception ex) { if (this.abortException == null) { this.abortException = ex; } return(0); } }
internal CabCreator(long maxCabSize, long maxFolderSize) : base() { this.fciAllocMemHandler = new FCI.PFNALLOC(this.CabAllocMem); this.fciFreeMemHandler = new FCI.PFNFREE(this.CabFreeMem); this.fciOpenStreamHandler = new FCI.PFNOPEN(this.CabOpenStreamEx); this.fciReadStreamHandler = new FCI.PFNREAD(this.CabReadStreamEx); this.fciWriteStreamHandler = new FCI.PFNWRITE(this.CabWriteStreamEx); this.fciCloseStreamHandler = new FCI.PFNCLOSE(this.CabCloseStreamEx); this.fciSeekStreamHandler = new FCI.PFNSEEK(this.CabSeekStreamEx); this.fciFilePlacedHandler = new FCI.PFNFILEPLACED(this.CabFilePlaced); this.fciGetOpenInfoHandler = new FCI.PFNGETOPENINFO(this.CabGetOpenInfo); this.fciGetNextCabinetHandler = new FCI.PFNGETNEXTCABINET(this.CabGetNextCabinet); this.fciStatusHandler = new FCI.PFNSTATUS(this.CabCreateStatus); this.fciDeleteFileHandler = new FCI.PFNDELETE(this.CabDeleteFile); this.fciGetTempFileHandler = new FCI.PFNGETTEMPFILE(this.CabGetTempFile); this.cabStream = null; this.cabNumbers = new Hashtable(1); this.ccab = new FCI.CCAB(); if (maxCabSize > 0 && maxCabSize < ccab.cb) { ccab.cb = (uint)maxCabSize; } if (maxFolderSize > 0 && maxFolderSize < ccab.cbFolderThresh) { ccab.cbFolderThresh = (uint)maxFolderSize; } this.maxCabSize = ccab.cb; this.maxFolderSize = ccab.cbFolderThresh; this.fciHandle = FCI.Create(this.erf, this.fciFilePlacedHandler, this.fciAllocMemHandler, this.fciFreeMemHandler, this.fciOpenStreamHandler, this.fciReadStreamHandler, this.fciWriteStreamHandler, this.fciCloseStreamHandler, this.fciSeekStreamHandler, this.fciDeleteFileHandler, this.fciGetTempFileHandler, ccab, Pointer.Zero); if (this.erf.fError) { int error = this.erf.erfOper; int errorCode = this.erf.erfType; this.erf.Dispose(); this.erf = null; this.fciHandle = Pointer.Zero; throw new CabinetCreateException(error, errorCode, this.abortException); } }
internal int CabFilePlaced(FCI.CCAB pccab, string pszFile, long cbFile, int fContinuation, Pointer pv) { return(0); }