Example #1
0
 internal static extern IntPtr FdiCreate(
     FdiMemAllocDelegate fnMemAlloc,
     FdiMemFreeDelegate fnMemFree,
     FdiFileOpenDelegate fnFileOpen,
     FdiFileReadDelegate fnFileRead,
     FdiFileWriteDelegate fnFileWrite,
     FdiFileCloseDelegate fnFileClose,
     FdiFileSeekDelegate fnFileSeek,
     int cpuType,
     [MarshalAs(UnmanagedType.LPStruct)] CabError erf);
 internal static extern IntPtr FdiCreate(
     FdiMemAllocDelegate fnMemAlloc,
     FdiMemFreeDelegate fnMemFree,
     FdiFileOpenDelegate fnFileOpen,
     FdiFileReadDelegate fnFileRead,
     FdiFileWriteDelegate fnFileWrite,
     FdiFileCloseDelegate fnFileClose,
     FdiFileSeekDelegate fnFileSeek,
     int cpuType,
     [MarshalAs(UnmanagedType.LPStruct)] CabError erf);
 /// <summary>
 /// Initializes a new instance of the CabDecompressor class.
 /// </summary>
 public CabDecompressor()
 {
     //gerrard: initializing new private members
     FileReadDelegate  = new FdiFileReadDelegate(FileRead);
     FileOpenDelegate  = new FdiFileOpenDelegate(FileOpen);
     MemAllocDelegate  = new FdiMemAllocDelegate(MemAlloc);
     FileSeekDelegate  = new FdiFileSeekDelegate(FileSeek);
     MemFreeDelegate   = new FdiMemFreeDelegate(MemFree);
     FileWriteDelegate = new FdiFileWriteDelegate(FileWrite);
     FileCloseDelegate = new FdiFileCloseDelegate(FileClose);
 }
Example #4
0
 private static IntPtr FdiCreate(
     FdiMemAllocDelegate fnMemAlloc,
     FdiMemFreeDelegate fnMemFree,
     FdiFileOpenDelegate fnFileOpen,
     FdiFileReadDelegate fnFileRead,
     FdiFileWriteDelegate fnFileWrite,
     FdiFileCloseDelegate fnFileClose,
     FdiFileSeekDelegate fnFileSeek,
     CabError erf)
 {
     return(FdiCreate(fnMemAlloc, fnMemFree, fnFileOpen, fnFileRead, fnFileWrite,
                      fnFileClose, fnFileSeek, CpuTypeUnknown, erf));
 }
Example #5
0
 public CabExtract(byte[] inputData)
 {
     _fileReadDelegate  = FileRead;
     _fileOpenDelegate  = InputFileOpen;
     _femAllocDelegate  = MemAlloc;
     _fileSeekDelegate  = FileSeek;
     _memFreeDelegate   = MemFree;
     _fileWriteDelegate = FileWrite;
     _fileCloseDelegate = InputFileClose;
     _inputData         = inputData;
     _decompressFiles   = new List <CabDecompressFile>();
     _erf  = new CabError();
     _hfdi = IntPtr.Zero;
 }
Example #6
0
 public CabExtract(byte[] inputData, bool leaveOpen = false)
 {
     _fileReadDelegate  = FileRead;
     _fileOpenDelegate  = InputFileOpen;
     _femAllocDelegate  = MemAlloc;
     _fileSeekDelegate  = FileSeek;
     _memFreeDelegate   = MemFree;
     _fileWriteDelegate = FileWrite;
     _fileCloseDelegate = InputFileClose;
     _inputData         = inputData;
     _decompressAll     = false; // Default value
     _decompressFiles   = new List <DecompressFile>();
     _erf  = new CabError();
     _hfdi = IntPtr.Zero;
 }
Example #7
0
        /// <summary>
        /// Constructor recieves cab file's binary data as stream
        /// </summary>
        /// <param name="inputData"></param>
        public CabExtract(Stream stream, bool leaveOpen = false)
        {
            _fileReadDelegate  = FileRead;
            _fileOpenDelegate  = InputFileOpen;
            _femAllocDelegate  = MemAlloc;
            _fileSeekDelegate  = FileSeek;
            _memFreeDelegate   = MemFree;
            _fileWriteDelegate = FileWrite;
            _fileCloseDelegate = InputFileClose;

            _decompressAll   = false; // Default value
            _decompressFiles = new List <DecompressFile>();
            _erf             = new CabError();
            _hfdi            = IntPtr.Zero;

            _inputData = new byte[stream.Length];
            stream.Read(_inputData, 0, _inputData.Length);
            if (leaveOpen == false)
            {
                stream.Close();
            }
        }
Example #8
0
 /// <summary>
 /// Create an FDI context.
 /// </summary>
 /// <param name="fnMemAlloc">Memory allocation delegate.</param>
 /// <param name="fnMemFree">Memory free delegate.</param>
 /// <param name="fnFileOpen">File open delegate.</param>
 /// <param name="fnFileRead">File read delegate.</param>
 /// <param name="fnFileWrite">File write delegate.</param>
 /// <param name="fnFileClose">File close delegate.</param>
 /// <param name="fnFileSeek">File seek delegate.</param>
 /// <param name="erf">Error structure that will be filled in with error information.</param>
 /// <returns>On success, returns a non-null FDI context handle.
 /// If an error occurs, the return value will be IntPtr.Zero,
 /// and the passed CabError structure will contain error information.</returns>
 public static IntPtr FdiCreate(
     FdiMemAllocDelegate fnMemAlloc,
     FdiMemFreeDelegate fnMemFree,
     FdiFileOpenDelegate fnFileOpen,
     FdiFileReadDelegate fnFileRead,
     FdiFileWriteDelegate fnFileWrite,
     FdiFileCloseDelegate fnFileClose,
     FdiFileSeekDelegate fnFileSeek,
     ref CabError erf)
 {
     return FdiCreate(fnMemAlloc, fnMemFree, fnFileOpen, fnFileRead, fnFileWrite,
         fnFileClose, fnFileSeek, cpuTypeUnknown, ref erf);
 }
Example #9
0
 private static extern IntPtr FdiCreate(
     FdiMemAllocDelegate fnMemAlloc,
     FdiMemFreeDelegate fnMemFree,
     FdiFileOpenDelegate fnFileOpen,
     FdiFileReadDelegate fnFileRead,
     FdiFileWriteDelegate fnFileWrite,
     FdiFileCloseDelegate fnFileClose,
     FdiFileSeekDelegate fnFileSeek,
     int cpuType,    // ignored by 32-bit FDI
     ref CabError erf);
Example #10
0
 /// <summary>
 /// Initializes a new instance of the CabDecompressor class.
 /// </summary>
 public CabDecompressor()
 {
     //gerrard: initializing new private members
     FileReadDelegate = new FdiFileReadDelegate(FileRead);
     FileOpenDelegate = new FdiFileOpenDelegate(FileOpen);
     MemAllocDelegate = new FdiMemAllocDelegate(MemAlloc);
     FileSeekDelegate = new FdiFileSeekDelegate(FileSeek);
     MemFreeDelegate = new FdiMemFreeDelegate(MemFree);
     FileWriteDelegate = new FdiFileWriteDelegate(FileWrite);
     FileCloseDelegate = new FdiFileCloseDelegate(FileClose);
 }