I'm having trouble getting MsiDatabaseApplyTransform to behave the way I want
and I can't seem to find any useful documentation.
Here's the code I've written. MsiDatabaseApplyTransform and MsiDatabaseCommit
both return ERROR_SUCCESS, but the msi database hasn't been changed. An
interesting piece of information is that DeleteFile returns
ERROR_SHARING_VIOLATION when I try to delete the mst file. Something is
obviously happening, but what? How can I force the transformed database to
commit?
I can get the script "WiUseXfm.vbs" to work with the same two files, but this
code doesn't work.
{
MSIHANDLE hAppInstaller;
UINT result;
transformFile = "c:\\temp\\transform.mst";
result = MsiOpenDatabase("C:\\temp\\app.msi",
MSIDBOPEN_DIRECT,
&hAppInstaller);
if (ERROR_SUCCESS != result) {
return;
}
if (MsiGetDatabaseState(hAppInstaller) != MSIDBSTATE_WRITE) {
goto err;
}
// This returns ERROR_SUCCESS for me
result = MsiDatabaseApplyTransform(hAppInstaller,
transformFile, 0);
if (ERROR_SUCCESS != result) {
goto err;
}
// This returns ERROR_SUCCESS for me
result = MsiDatabaseCommit(pData->hDatabase);
if (ERROR_SUCCESS != result) {
goto err;
}
err:
if (!DeleteFile(transformFile)) {
// GetLastError returns ERROR_SHARING_VIOLATION
DWORD err = GetLastError();
}
MsiCloseHandle(hAppInstaller);
}
Thanks in advance!
Mike
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.
How to programmatically apply a transform?
Started by
mmorris
, May 26 2004 23:41
2 replies to this topic
Posted 27 May 2004 - 11:51
Are you calling this while your installation is running, or at design time?
Stefan Krüger
InstallSite.org twitter facebook