Exemplo n.º 1
0
        /// <summary>
        /// Opens the specified MSI file and returns the database handle.
        /// </summary>
        /// <param name="msiFile">The msi file.</param>
        /// <returns>Handle to the MSI database.</returns>
        public static IntPtr Open(string msiFile)
        {
            IntPtr db = IntPtr.Zero;

            MsiExtensions.Invoke(() => MsiInterop.MsiOpenDatabase(msiFile, MsiDbPersistMode.ReadOnly, out db));
            return(db);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Releases the acquired resources
 /// </summary>
 /// <param name="disposing"></param>
 protected virtual void Dispose(bool disposing)
 {
     if (!disposedValue)
     {
         if (!db.Equals(IntPtr.Zero))
         {
             var dbr = db;
             db = IntPtr.Zero;
             MsiExtensions.Invoke(() => MsiInterop.MsiCloseHandle(dbr));
         }
         disposedValue = true;
     }
 }