Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Patch-Dateien per MsiOpenDatabase öffnen


1 reply to this topic

EdWin1409

EdWin1409
  • Full Members
  • 1 posts

Posted 17 April 2007 - 18:55

Hallo,

ich kämpfe schon seit einiger Zeit mit einem Problem, für welches ich bisher noch keine Lösung gefunden habe. Es geht darum, daß ich Patch-Files (MSP) per MSI-Api öffnen möchte um an die Informationen in der Tabelle MsiPatchMetadata ranzukommen. Ich nutze dafür die Funktion MsiOpenDatabase, leider bekomme ich immer einen Fehler 'InvalidParameter'. Hier mal der Codeausschnitt mit dem ich experimentiere (C#) :

MsiError err;
IntPtr handle;
err = MsiInterop.MsiOpenDatabase(@"C:\patch.msp", MsiDbPersistMode.PatchFile, out handle);
MsiInterop.MsiCloseHandle(handle);

Die Api-Deklaration sieht wie folgt aus :

[DllImport(MSI_LIB, CharSet = CharSet.Auto)]
extern static public MsiError MsiOpenDatabase(string path, MsiDbPersistMode persist,
out IntPtr handle);
internal enum MsiDbPersistMode
{
ReadOnly = 0,
Transact = 1,
Direct = 2,
Create = 3,
CreateDirect = 4,
PatchFile = 8
}

Lt. Api-Dokumentation sollte dies ab Installer > 2.0 möglich sein, auf meinem System ist MSI in Version 3.1 installiert.

Was mache ich falsch ? Der Versuch ein MSI-Paket über o.g. Methodik zu öffnen funktioniert ohne Probleme, natürlich nur wenn ich MsiDbPersistMode auf z.B. ReadOnly umstelle.

Gruß,

Jürgen

akerl

akerl
  • Full Members
  • 104 posts

Posted 26 April 2007 - 07:49

Hi Jürgen,
Beim DatabaseOpenMode handelt es sich um ein Enum-Feld, so dass Du mehrere Werte kombinieren kannst. Siehe:

/// <summary>Add this flag to indicate a patch file and open the file read-only.
</summary>
Patch = 32,

/// <summary>Add this flag to indicate a patch file and open the file in transaction mode.
</summary>
PatchTransact = 33,

/// <summary>Add this flag to indicate a patch file and open the file with drirect read/write access.
</summary>
PatchDirect = 34,

Gruß
Andreas

Andreas Kerl

Inside Windows Installer 4.5
ISBN 3-86645-431-7