public CabFile(Stream stream) { if (stream == null) { throw new ArgumentNullException("stream"); } using (MemoryStream data = new MemoryStream()) { stream.CopyTo(data); _data = data.ToArray(); } _erf = new ERF(); _alloc = new FNALLOC(FnAlloc); _free = new FNFREE(FnFree); _close = new FNCLOSE(FnClose); _open = new FNOPEN(FnOpen); _read = new FNREAD(FnRead); _write = new FNWRITE(FnWrite); _seek = new FNSEEK(FnSeek); _extract = new FNFDINOTIFY(FnNotifyExtract); _erfHandle = GCHandle.Alloc(_erf, GCHandleType.Pinned); _hfdi = FDICreate( Marshal.GetFunctionPointerForDelegate(_alloc), Marshal.GetFunctionPointerForDelegate(_free), Marshal.GetFunctionPointerForDelegate(_open), Marshal.GetFunctionPointerForDelegate(_read), Marshal.GetFunctionPointerForDelegate(_write), Marshal.GetFunctionPointerForDelegate(_close), Marshal.GetFunctionPointerForDelegate(_seek) , -1, _erfHandle.AddrOfPinnedObject()); }
public static extern bool FDICopy( FdiHandle hfdi, string pszCabinet, string pszCabPath, int flags, FNFDINOTIFY pfnfdin, IntPtr pfnfdid, IntPtr pvUser);
public static unsafe extern bool FDICopy( FdiHandle hfdi, string pszCabinet, string pszCabPath, int flags, FNFDINOTIFY pfnfdin, void *pfnfdid, void *pvUser);