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); }
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)); }
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; }
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; }
/// <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(); } }
/// <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); }
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);