Esempio n. 1
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));
            }
        }
Esempio n. 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));
            }
        }
Esempio n. 3
0
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (disposing)
         {
             if (this.fdiHandle != null)
             {
                 this.fdiHandle.Dispose();
                 this.fdiHandle = null;
             }
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }
Esempio n. 4
0
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (disposing)
         {
             if (this.fdiHandle != null)
             {
                 this.fdiHandle.Dispose();
                 this.fdiHandle = null;
             }
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }