G
Guest
When I'm trying to write a single feature to an MSI DB using C# there is so little documentation that I have had to piece together everything by hand. Any help would be appreciated
I tried in C# to set up the MSIOpenDatabase to open an existing MSI DB. I get a handle of 1. I'm not sure what I'm doing wrong. The RC is 0, so it thinks it's successful. Help
Looking through the various SDK msi*.h files, I found that the value for the MSIDBOPEN_TRANSACT is actually 1, so that's what I put in. I've tried to look for another way to do it, and can't seem to find it. And I think that may be my problem, but I can't find a decent answer
Thanks
Pau
public const int MSIDBOPEN_TRANSACT = 1
tr
{
msiName = txtManufacturer.Text + "_" + txtPackageName.Text + "_" + txtVersion.Text + "_" + txtOS.Text
msiFileName= msiName+".msi"
//System.IO.File.Copy("template.msi",msiFileName,true)
//Load template.ms
IntPtr dbHandle = IntPtr.Zero
rc = CallMsi.MsiOpenDatabase(msiFileName,MSIDBOPEN_TRANSACT, ref dbHandle)
//CallMsi to MsiSummaryInfoSetProperty to input each of the summary info properties
rc = CallMsi.MsiSummaryInfoSetProperty(dbHandle,PID_TITLE, VT_LPSTR,0,ref file_time,msiName)
rc = CallMsi.MsiSummaryInfoPersist(dbHandle)
//Check to see if MsiSetProperty is needed
//Save file by correct name
rc = CallMsi.MsiDatabaseCommit(dbHandle)
rc = CallMsi.MsiCloseHandle(dbHandle)
}
catch ( Exception d
{
Console.WriteLine ( d ) ;
}
I tried in C# to set up the MSIOpenDatabase to open an existing MSI DB. I get a handle of 1. I'm not sure what I'm doing wrong. The RC is 0, so it thinks it's successful. Help
Looking through the various SDK msi*.h files, I found that the value for the MSIDBOPEN_TRANSACT is actually 1, so that's what I put in. I've tried to look for another way to do it, and can't seem to find it. And I think that may be my problem, but I can't find a decent answer
Thanks
Pau
public const int MSIDBOPEN_TRANSACT = 1
tr
{
msiName = txtManufacturer.Text + "_" + txtPackageName.Text + "_" + txtVersion.Text + "_" + txtOS.Text
msiFileName= msiName+".msi"
//System.IO.File.Copy("template.msi",msiFileName,true)
//Load template.ms
IntPtr dbHandle = IntPtr.Zero
rc = CallMsi.MsiOpenDatabase(msiFileName,MSIDBOPEN_TRANSACT, ref dbHandle)
//CallMsi to MsiSummaryInfoSetProperty to input each of the summary info properties
rc = CallMsi.MsiSummaryInfoSetProperty(dbHandle,PID_TITLE, VT_LPSTR,0,ref file_time,msiName)
rc = CallMsi.MsiSummaryInfoPersist(dbHandle)
//Check to see if MsiSetProperty is needed
//Save file by correct name
rc = CallMsi.MsiDatabaseCommit(dbHandle)
rc = CallMsi.MsiCloseHandle(dbHandle)
}
catch ( Exception d
{
Console.WriteLine ( d ) ;
}