Пример #1
0
            public void ExtractAll()
            {
                Directory.CreateDirectory(_targetDirectory);
                NativeDelegates.PSP_FILE_CALLBACK setupApiCallback = SetupApiCallback;
                bool result = NativeMethods.SetupIterateCabinetW(_cabPath, 0, setupApiCallback, IntPtr.Zero);

                if (_callbackException != null)
                {
                    throw new Win32Exception("Extraction Failed", _callbackException);
                }

                if (!result)
                {
                    int error = Marshal.GetHRForLastWin32Error();
                    throw Marshal.GetExceptionForHR(error);
                }

                GC.KeepAlive(setupApiCallback);
            }
Пример #2
0
 internal static extern bool SetupIterateCabinetW(
     [MarshalAs(UnmanagedType.LPWStr)] string lpszCabinetFile,
     uint dwReserved,
     NativeDelegates.PSP_FILE_CALLBACK msgHandler,
     IntPtr context);