Пример #1
0
        internal CabUnpacker(CabEngine cabEngine)
            : base(cabEngine)
        {
            this.fdiAllocMemHandler = this.CabAllocMem;
            this.fdiFreeMemHandler = this.CabFreeMem;
            this.fdiOpenStreamHandler = this.CabOpenStream;
            this.fdiReadStreamHandler = this.CabReadStream;
            this.fdiWriteStreamHandler = this.CabWriteStream;
            this.fdiCloseStreamHandler = this.CabCloseStream;
            this.fdiSeekStreamHandler = this.CabSeekStream;

            this.fdiHandle = NativeMethods.FDI.Create(
                this.fdiAllocMemHandler,
                this.fdiFreeMemHandler,
                this.fdiOpenStreamHandler,
                this.fdiReadStreamHandler,
                this.fdiWriteStreamHandler,
                this.fdiCloseStreamHandler,
                this.fdiSeekStreamHandler,
                NativeMethods.FDI.CPU_80386,
                this.ErfHandle.AddrOfPinnedObject());
            if (this.Erf.Error)
            {
                int error = this.Erf.Oper;
                int errorCode = this.Erf.Type;
                this.ErfHandle.Free();
                throw new CabException(
                    error,
                    errorCode,
                    CabException.GetErrorMessage(error, errorCode, true));
            }
        }
Пример #2
0
        public CabUnpacker(CabEngine cabEngine)
            : base(cabEngine)
        {
            this.fdiAllocMemHandler    = this.CabAllocMem;
            this.fdiFreeMemHandler     = this.CabFreeMem;
            this.fdiOpenStreamHandler  = this.CabOpenStream;
            this.fdiReadStreamHandler  = this.CabReadStream;
            this.fdiWriteStreamHandler = this.CabWriteStream;
            this.fdiCloseStreamHandler = this.CabCloseStream;
            this.fdiSeekStreamHandler  = this.CabSeekStream;

            this.fdiHandle = NativeMethods.FDI.Create(
                this.fdiAllocMemHandler,
                this.fdiFreeMemHandler,
                this.fdiOpenStreamHandler,
                this.fdiReadStreamHandler,
                this.fdiWriteStreamHandler,
                this.fdiCloseStreamHandler,
                this.fdiSeekStreamHandler,
                NativeMethods.FDI.CPU_80386,
                this.ErfHandle.AddrOfPinnedObject());
            if (this.Erf.Error)
            {
                int error     = this.Erf.Oper;
                int errorCode = this.Erf.Type;
                this.ErfHandle.Free();
                throw new CabException(
                          error,
                          errorCode,
                          CabException.GetErrorMessage(error, errorCode, true));
            }
        }
 public CabUnpacker(CabEngine cabEngine)
     : base(cabEngine)
 {
     fdiAllocMemHandler    = base.CabAllocMem;
     fdiFreeMemHandler     = base.CabFreeMem;
     fdiOpenStreamHandler  = base.CabOpenStream;
     fdiReadStreamHandler  = base.CabReadStream;
     fdiWriteStreamHandler = base.CabWriteStream;
     fdiCloseStreamHandler = base.CabCloseStream;
     fdiSeekStreamHandler  = base.CabSeekStream;
     fdiHandle             = NativeMethods.FDI.Create(fdiAllocMemHandler, fdiFreeMemHandler, fdiOpenStreamHandler, fdiReadStreamHandler, fdiWriteStreamHandler, fdiCloseStreamHandler, fdiSeekStreamHandler, 1, base.ErfHandle.AddrOfPinnedObject());
     if (base.Erf.Error)
     {
         int oper = base.Erf.Oper;
         int type = base.Erf.Type;
         base.ErfHandle.Free();
         throw new CabException(oper, type, CabException.GetErrorMessage(oper, type, extracting: true));
     }
 }