--- trunk/reactos/lib/msi/action.c 2005-02-12 21:46:45 UTC (rev 13517)
+++ trunk/reactos/lib/msi/action.c 2005-02-12 22:59:04 UTC (rev 13518)
@@ -49,100 +49,27 @@
#include "shlobj.h"
#include "wine/unicode.h"
#include "ver.h"
+#include "action.h"
-#define CUSTOM_ACTION_TYPE_MASK 0x3F
#define REG_PROGRESS_VALUE 13200
#define COMPONENT_PROGRESS_VALUE 24000
WINE_DEFAULT_DEBUG_CHANNEL(msi);
-typedef struct tagMSIFEATURE
-{
- WCHAR Feature[96];
- WCHAR Feature_Parent[96];
- WCHAR Title[0x100];
- WCHAR Description[0x100];
- INT Display;
- INT Level;
- WCHAR Directory[96];
- INT Attributes;
-
- INSTALLSTATE Installed;
- INSTALLSTATE ActionRequest;
- INSTALLSTATE Action;
-
- INT ComponentCount;
- INT Components[1024]; /* yes hardcoded limit.... I am bad */
- INT Cost;
-} MSIFEATURE;
-
-typedef struct tagMSICOMPONENT
-{
- WCHAR Component[96];
- WCHAR ComponentId[96];
- WCHAR Directory[96];
- INT Attributes;
- WCHAR Condition[0x100];
- WCHAR KeyPath[96];
-
- INSTALLSTATE Installed;
- INSTALLSTATE ActionRequest;
- INSTALLSTATE Action;
-
- BOOL Enabled;
- INT Cost;
-} MSICOMPONENT;
-
-typedef struct tagMSIFOLDER
-{
- LPWSTR Directory;
- LPWSTR TargetDefault;
- LPWSTR SourceDefault;
-
- LPWSTR ResolvedTarget;
- LPWSTR ResolvedSource;
- LPWSTR Property; /* initially set property */
- INT ParentIndex;
- INT State;
- /* 0 = uninitialized */
- /* 1 = existing */
- /* 2 = created remove if empty */
- /* 3 = created persist if empty */
- INT Cost;
- INT Space;
-}MSIFOLDER;
-
-typedef struct tagMSIFILE
-{
- LPWSTR File;
- INT ComponentIndex;
- LPWSTR FileName;
- INT FileSize;
- LPWSTR Version;
- LPWSTR Language;
- INT Attributes;
- INT Sequence;
-
- INT State;
- /* 0 = uninitialize */
- /* 1 = not present */
- /* 2 = present but replace */
- /* 3 = present do not replace */
- /* 4 = Installed */
- LPWSTR SourcePath;
- LPWSTR TargetPath;
- BOOL Temporary;
-}MSIFILE;
-
/*
* Prototypes
*/
static UINT ACTION_ProcessExecSequence(MSIPACKAGE *package, BOOL UIran);
static UINT ACTION_ProcessUISequence(MSIPACKAGE *package);
-
static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq);
-UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action);
+static UINT build_icon_path(MSIPACKAGE *package, LPCWSTR icon_name,
+ LPWSTR *FilePath);
+/*
+ * action handlers
+ */
+typedef UINT (*STANDARDACTIONHANDLER)(MSIPACKAGE*);
+
static UINT ACTION_LaunchConditions(MSIPACKAGE *package);
static UINT ACTION_CostInitialize(MSIPACKAGE *package);
static UINT ACTION_CreateFolders(MSIPACKAGE *package);
@@ -151,32 +78,26 @@
static UINT ACTION_InstallFiles(MSIPACKAGE *package);
static UINT ACTION_DuplicateFiles(MSIPACKAGE *package);
static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package);
-static UINT ACTION_CustomAction(MSIPACKAGE *package,const WCHAR *action);
static UINT ACTION_InstallInitialize(MSIPACKAGE *package);
static UINT ACTION_InstallValidate(MSIPACKAGE *package);
static UINT ACTION_ProcessComponents(MSIPACKAGE *package);
static UINT ACTION_RegisterTypeLibraries(MSIPACKAGE *package);
static UINT ACTION_RegisterClassInfo(MSIPACKAGE *package);
static UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package);
+static UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package);
+static UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package);
+static UINT ACTION_RegisterUser(MSIPACKAGE *package);
static UINT ACTION_CreateShortcuts(MSIPACKAGE *package);
static UINT ACTION_PublishProduct(MSIPACKAGE *package);
+static UINT ACTION_WriteIniValues(MSIPACKAGE *package);
+static UINT ACTION_SelfRegModules(MSIPACKAGE *package);
+static UINT ACTION_PublishFeatures(MSIPACKAGE *package);
+static UINT ACTION_RegisterProduct(MSIPACKAGE *package);
+static UINT ACTION_InstallExecute(MSIPACKAGE *package);
+static UINT ACTION_InstallFinalize(MSIPACKAGE *package);
+static UINT ACTION_ForceReboot(MSIPACKAGE *package);
+static UINT ACTION_ResolveSource(MSIPACKAGE *package);
-static UINT HANDLE_CustomType1(MSIPACKAGE *package, const LPWSTR source,
- const LPWSTR target, const INT type);
-static UINT HANDLE_CustomType2(MSIPACKAGE *package, const LPWSTR source,
- const LPWSTR target, const INT type);
-static UINT HANDLE_CustomType18(MSIPACKAGE *package, const LPWSTR source,
- const LPWSTR target, const INT type);
-static UINT HANDLE_CustomType50(MSIPACKAGE *package, const LPWSTR source,
- const LPWSTR target, const INT type);
-static UINT HANDLE_CustomType34(MSIPACKAGE *package, const LPWSTR source,
- const LPWSTR target, const INT type);
-
-static DWORD deformat_string(MSIPACKAGE *package, WCHAR* ptr,WCHAR** data);
-static LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name,
- BOOL source, BOOL set_prop, MSIFOLDER **folder);
-
-static int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path);
/*
* consts and values used
@@ -188,31 +109,30 @@
static const WCHAR cszDatabase[]={'D','A','T','A','B','A','S','E',0};
static const WCHAR c_collen[] = {'C',':','\\',0};
-static const WCHAR cszlsb[]={'[',0};
-static const WCHAR cszrsb[]={']',0};
static const WCHAR cszbs[]={'\\',0};
const static WCHAR szCreateFolders[] =
- {'C','r','e','a','t','e','F','o','l','d','e','r','s',0};
+{'C','r','e','a','t','e','F','o','l','d','e','r','s',0};
const static WCHAR szCostFinalize[] =
- {'C','o','s','t','F','i','n','a','l','i','z','e',0};
+{'C','o','s','t','F','i','n','a','l','i','z','e',0};
const static WCHAR szInstallFiles[] =
- {'I','n','s','t','a','l','l','F','i','l','e','s',0};
+{'I','n','s','t','a','l','l','F','i','l','e','s',0};
const static WCHAR szDuplicateFiles[] =
- {'D','u','p','l','i','c','a','t','e','F','i','l','e','s',0};
+{'D','u','p','l','i','c','a','t','e','F','i','l','e','s',0};
const static WCHAR szWriteRegistryValues[] =
{'W','r','i','t','e','R','e','g','i','s','t','r','y','V','a','l','u','e','s',0};
const static WCHAR szCostInitialize[] =
- {'C','o','s','t','I','n','i','t','i','a','l','i','z','e',0};
-const static WCHAR szFileCost[] = {'F','i','l','e','C','o','s','t',0};
+{'C','o','s','t','I','n','i','t','i','a','l','i','z','e',0};
+const static WCHAR szFileCost[] =
+{'F','i','l','e','C','o','s','t',0};
const static WCHAR szInstallInitialize[] =
- {'I','n','s','t','a','l','l','I','n','i','t','i','a','l','i','z','e',0};
+{'I','n','s','t','a','l','l','I','n','i','t','i','a','l','i','z','e',0};
const static WCHAR szInstallValidate[] =
- {'I','n','s','t','a','l','l','V','a','l','i','d','a','t','e',0};
+{'I','n','s','t','a','l','l','V','a','l','i','d','a','t','e',0};
const static WCHAR szLaunchConditions[] =
- {'L','a','u','n','c','h','C','o','n','d','i','t','i','o','n','s',0};
+{'L','a','u','n','c','h','C','o','n','d','i','t','i','o','n','s',0};
const static WCHAR szProcessComponents[] =
- {'P','r','o','c','e','s','s','C','o','m','p','o','n','e','n','t','s',0};
+{'P','r','o','c','e','s','s','C','o','m','p','o','n','e','n','t','s',0};
const static WCHAR szRegisterTypeLibraries[] =
{'R','e','g','i','s','t','e','r','T','y','p','e','L','i','b','r','a','r',
'i','e','s',0};
@@ -224,7 +144,210 @@
{'C','r','e','a','t','e','S','h','o','r','t','c','u','t','s',0};
const static WCHAR szPublishProduct[] =
{'P','u','b','l','i','s','h','P','r','o','d','u','c','t',0};
+const static WCHAR szWriteIniValues[] =
+{'W','r','i','t','e','I','n','i','V','a','l','u','e','s',0};
+const static WCHAR szSelfRegModules[] =
+{'S','e','l','f','R','e','g','M','o','d','u','l','e','s',0};
+const static WCHAR szPublishFeatures[] =
+{'P','u','b','l','i','s','h','F','e','a','t','u','r','e','s',0};
+const static WCHAR szRegisterProduct[] =
+{'R','e','g','i','s','t','e','r','P','r','o','d','u','c','t',0};
+const static WCHAR szInstallExecute[] =
+{'I','n','s','t','a','l','l','E','x','e','c','u','t','e',0};
+const static WCHAR szInstallExecuteAgain[] =
+{'I','n','s','t','a','l','l','E','x','e','c','u','t','e','A','g','a','i','n',0};
+const static WCHAR szInstallFinalize[] =
+{'I','n','s','t','a','l','l','F','i','n','a','l','i','z','e',0};
+const static WCHAR szForceReboot[] =
+{'F','o','r','c','e','R','e','b','o','o','t',0};
+const static WCHAR szResolveSource[] =
+{'R','e','s','o','l','v','e','S','o','u','r','c','e',0};
+const static WCHAR szAppSearch[] =
+{'A','p','p','S','e','a','r','c','h',0};
+const static WCHAR szAllocateRegistrySpace[] =
+{'A','l','l','o','c','a','t','e','R','e','g','i','s','t','r','y','S','p','a','c','e',0};
+const static WCHAR szBindImage[] =
+{'B','i','n','d','I','m','a','g','e',0};
+const static WCHAR szCCPSearch[] =
+{'C','C','P','S','e','a','r','c','h',0};
+const static WCHAR szDeleteServices[] =
+{'D','e','l','e','t','e','S','e','r','v','i','c','e','s',0};
+const static WCHAR szDisableRollback[] =
+{'D','i','s','a','b','l','e','R','o','l','l','b','a','c','k',0};
+const static WCHAR szExecuteAction[] =
+{'E','x','e','c','u','t','e','A','c','t','i','o','n',0};
+const static WCHAR szFindRelatedProducts[] =
+{'F','i','n','d','R','e','l','a','t','e','d','P','r','o','d','u','c','t','s',0};
+const static WCHAR szInstallAdminPackage[] =
+{'I','n','s','t','a','l','l','A','d','m','i','n','P','a','c','k','a','g','e',0};
+const static WCHAR szInstallSFPCatalogFile[] =
+{'I','n','s','t','a','l','l','S','F','P','C','a','t','a','l','o','g','F','i','l','e',0};
+const static WCHAR szIsolateComponents[] =
+{'I','s','o','l','a','t','e','C','o','m','p','o','n','e','n','t','s',0};
+const static WCHAR szMigrateFeatureStates[] =
+{'M','i','g','r','a','t','e','F','e','a','t','u','r','e','S','t','a','t','e','s',0};
+const static WCHAR szMoveFiles[] =
+{'M','o','v','e','F','i','l','e','s',0};
+const static WCHAR szMsiPublishAssemblies[] =
+{'M','s','i','P','u','b','l','i','s','h','A','s','s','e','m','b','l','i','e','s',0};
+const static WCHAR szMsiUnpublishAssemblies[] =
+{'M','s','i','U','n','p','u','b','l','i','s','h','A','s','s','e','m','b','l','i','e','s',0};
+const static WCHAR szInstallODBC[] =
+{'I','n','s','t','a','l','l','O','D','B','C',0};
+const static WCHAR szInstallServices[] =
+{'I','n','s','t','a','l','l','S','e','r','v','i','c','e','s',0};
+const static WCHAR szPatchFiles[] =
+{'P','a','t','c','h','F','i','l','e','s',0};
+const static WCHAR szPublishComponents[] =
+{'P','u','b','l','i','s','h','C','o','m','p','o','n','e','n','t','s',0};
+const static WCHAR szRegisterComPlus[] =
+{'R','e','g','i','s','t','e','r','C','o','m','P','l','u','s',0};
+const static WCHAR szRegisterExtensionInfo[] =
+{'R','e','g','i','s','t','e','r','E','x','t','e','n','s','i','o','n','I','n','f','o',0};
+const static WCHAR szRegisterFonts[] =
+{'R','e','g','i','s','t','e','r','F','o','n','t','s',0};
+const static WCHAR szRegisterMIMEInfo[] =
+{'R','e','g','i','s','t','e','r','M','I','M','E','I','n','f','o',0};
+const static WCHAR szRegisterUser[] =
+{'R','e','g','i','s','t','e','r','U','s','e','r',0};
+const static WCHAR szRemoveDuplicateFiles[] =
+{'R','e','m','o','v','e','D','u','p','l','i','c','a','t','e','F','i','l','e','s',0};
+const static WCHAR szRemoveEnvironmentStrings[] =
+{'R','e','m','o','v','e','E','n','v','i','r','o','n','m','e','n','t','S','t','r','i','n','g','s',0};
+const static WCHAR szRemoveExistingProducts[] =
+{'R','e','m','o','v','e','E','x','i','s','t','i','n','g','P','r','o','d','u','c','t','s',0};
+const static WCHAR szRemoveFiles[] =
+{'R','e','m','o','v','e','F','i','l','e','s',0};
+const static WCHAR szRemoveFolders[] =
+{'R','e','m','o','v','e','F','o','l','d','e','r','s',0};
+const static WCHAR szRemoveIniValues[] =
+{'R','e','m','o','v','e','I','n','i','V','a','l','u','e','s',0};
+const static WCHAR szRemoveODBC[] =
+{'R','e','m','o','v','e','O','D','B','C',0};
+const static WCHAR szRemoveRegistryValues[] =
+{'R','e','m','o','v','e','R','e','g','i','s','t','r','y','V','a','l','u','e','s',0};
+const static WCHAR szRemoveShortcuts[] =
+{'R','e','m','o','v','e','S','h','o','r','t','c','u','t','s',0};
+const static WCHAR szRMCCPSearch[] =
+{'R','M','C','C','P','S','e','a','r','c','h',0};
+const static WCHAR szScheduleReboot[] =
+{'S','c','h','e','d','u','l','e','R','e','b','o','o','t',0};
+const static WCHAR szSelfUnregModules[] =
+{'S','e','l','f','U','n','r','e','g','M','o','d','u','l','e','s',0};
+const static WCHAR szSetODBCFolders[] =
+{'S','e','t','O','D','B','C','F','o','l','d','e','r','s',0};
+const static WCHAR szStartServices[] =
+{'S','t','a','r','t','S','e','r','v','i','c','e','s',0};
+const static WCHAR szStopServices[] =
+{'S','t','o','p','S','e','r','v','i','c','e','s',0};
+const static WCHAR szUnpublishComponents[] =
+{'U','n','p','u','b','l','i','s','h','C','o','m','p','o','n','e','n','t','s',0};
+const static WCHAR szUnpublishFeatures[] =
+{'U','n','p','u','b','l','i','s','h','F','e','a','t','u','r','e','s',0};
+const static WCHAR szUnregisterClassInfo[] =
+{'U','n','r','e','g','i','s','t','e','r','C','l','a','s','s','I','n','f','o',0};
+const static WCHAR szUnregisterComPlus[] =
+{'U','n','r','e','g','i','s','t','e','r','C','o','m','P','l','u','s',0};
+const static WCHAR szUnregisterExtensionInfo[] =
+{'U','n','r','e','g','i','s','t','e','r','E','x','t','e','n','s','i','o','n','I','n','f','o',0};
+const static WCHAR szUnregisterFonts[] =
+{'U','n','r','e','g','i','s','t','e','r','F','o','n','t','s',0};
+const static WCHAR szUnregisterMIMEInfo[] =
+{'U','n','r','e','g','i','s','t','e','r','M','I','M','E','I','n','f','o',0};
+const static WCHAR szUnregisterProgIdInfo[] =
+{'U','n','r','e','g','i','s','t','e','r','P','r','o','g','I','d','I','n','f','o',0};
+const static WCHAR szUnregisterTypeLibraries[] =
+{'U','n','r','e','g','i','s','t','e','r','T','y','p','e','L','i','b','r','a','r','i','e','s',0};
+const static WCHAR szValidateProductID[] =
+{'V','a','l','i','d','a','t','e','P','r','o','d','u','c','t','I','D',0};
+const static WCHAR szWriteEnvironmentStrings[] =
+{'W','r','i','t','e','E','n','v','i','r','o','n','m','e','n','t','S','t','r','i','n','g','s',0};
+struct _actions {
+ LPCWSTR action;
+ STANDARDACTIONHANDLER handler;
+};
+
+struct _actions StandardActions[] = {
+ { szAllocateRegistrySpace, NULL},
+ { szAppSearch, ACTION_AppSearch },
+ { szBindImage, NULL},
+ { szCCPSearch, NULL},
+ { szCostFinalize, ACTION_CostFinalize },
+ { szCostInitialize, ACTION_CostInitialize },
+ { szCreateFolders, ACTION_CreateFolders },
+ { szCreateShortcuts, ACTION_CreateShortcuts },
+ { szDeleteServices, NULL},
+ { szDisableRollback, NULL},
+ { szDuplicateFiles, ACTION_DuplicateFiles},
+ { szExecuteAction, NULL},
+ { szFileCost, ACTION_FileCost },
+ { szFindRelatedProducts, NULL},
+ { szForceReboot, ACTION_ForceReboot },
+ { szInstallAdminPackage, NULL},
+ { szInstallExecute, ACTION_InstallExecute },
+ { szInstallExecuteAgain, ACTION_InstallExecute },
+ { szInstallFiles, ACTION_InstallFiles},
+ { szInstallFinalize, ACTION_InstallFinalize },
+ { szInstallInitialize, ACTION_InstallInitialize },
+ { szInstallSFPCatalogFile, NULL},
+ { szInstallValidate, ACTION_InstallValidate },
+ { szIsolateComponents, NULL},
+ { szLaunchConditions, ACTION_LaunchConditions },
+ { szMigrateFeatureStates, NULL},
+ { szMoveFiles, NULL},
+ { szMsiPublishAssemblies, NULL},
+ { szMsiUnpublishAssemblies, NULL},
+ { szInstallODBC, NULL},
+ { szInstallServices, NULL},
+ { szPatchFiles, NULL},
+ { szProcessComponents, ACTION_ProcessComponents },
+ { szPublishComponents, NULL},
+ { szPublishFeatures, ACTION_PublishFeatures },
+ { szPublishProduct, ACTION_PublishProduct },
+ { szRegisterClassInfo, ACTION_RegisterClassInfo },
+ { szRegisterComPlus, NULL},
+ { szRegisterExtensionInfo, ACTION_RegisterExtensionInfo },
+ { szRegisterFonts, NULL},
+ { szRegisterMIMEInfo, ACTION_RegisterMIMEInfo },
+ { szRegisterProduct, ACTION_RegisterProduct },
+ { szRegisterProgIdInfo, ACTION_RegisterProgIdInfo },
+ { szRegisterTypeLibraries, ACTION_RegisterTypeLibraries },
+ { szRegisterUser, ACTION_RegisterUser},
+ { szRemoveDuplicateFiles, NULL},
+ { szRemoveEnvironmentStrings, NULL},
+ { szRemoveExistingProducts, NULL},
+ { szRemoveFiles, NULL},
+ { szRemoveFolders, NULL},
+ { szRemoveIniValues, NULL},
+ { szRemoveODBC, NULL},
+ { szRemoveRegistryValues, NULL},
+ { szRemoveShortcuts, NULL},
+ { szResolveSource, ACTION_ResolveSource},
+ { szRMCCPSearch, NULL},
+ { szScheduleReboot, NULL},
+ { szSelfRegModules, ACTION_SelfRegModules },
+ { szSelfUnregModules, NULL},
+ { szSetODBCFolders, NULL},
+ { szStartServices, NULL},
+ { szStopServices, NULL},
+ { szUnpublishComponents, NULL},
+ { szUnpublishFeatures, NULL},
+ { szUnregisterClassInfo, NULL},
+ { szUnregisterComPlus, NULL},
+ { szUnregisterExtensionInfo, NULL},
+ { szUnregisterFonts, NULL},
+ { szUnregisterMIMEInfo, NULL},
+ { szUnregisterProgIdInfo, NULL},
+ { szUnregisterTypeLibraries, NULL},
+ { szValidateProductID, NULL},
+ { szWriteEnvironmentStrings, NULL},
+ { szWriteIniValues, ACTION_WriteIniValues },
+ { szWriteRegistryValues, ACTION_WriteRegistryValues},
+ { NULL, NULL},
+};
+
+
/********************************************************
* helper functions to get around current HACKS and such
********************************************************/
@@ -235,42 +358,8 @@
memmove(filename, p+1, (strlenW(p+1)+1)*sizeof(WCHAR));
}
-inline static char *strdupWtoA( const WCHAR *str )
+WCHAR *load_dynamic_stringW(MSIRECORD *row, INT index)
{
- char *ret = NULL;
- if (str)
- {
- DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL
-);
- if ((ret = HeapAlloc( GetProcessHeap(), 0, len )))
- WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
- }
- return ret;
-}
-
-inline static WCHAR *strdupAtoW( const char *str )
-{
- WCHAR *ret = NULL;
- if (str)
- {
- DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
- if ((ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
- MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
- }
- return ret;
-}
-
-static LPWSTR dupstrW(LPCWSTR src)
-{
- LPWSTR dest;
- if (!src) return NULL;
- dest = HeapAlloc(GetProcessHeap(), 0, (strlenW(src)+1)*sizeof(WCHAR));
- strcpyW(dest, src);
- return dest;
-}
-
-inline static WCHAR *load_dynamic_stringW(MSIRECORD *row, INT index)
-{
UINT rc;
DWORD sz;
LPWSTR ret;
@@ -301,8 +390,7 @@
return ret;
}
-inline static LPWSTR load_dynamic_property(MSIPACKAGE *package, LPCWSTR prop,
- UINT* rc)
+LPWSTR load_dynamic_property(MSIPACKAGE *package, LPCWSTR prop, UINT* rc)
{
DWORD sz = 0;
LPWSTR str;
@@ -328,7 +416,7 @@
return str;
}
-inline static int get_loaded_component(MSIPACKAGE* package, LPCWSTR Component )
+int get_loaded_component(MSIPACKAGE* package, LPCWSTR Component )
{
int rc = -1;
DWORD i;
@@ -344,7 +432,7 @@
return rc;
}
-inline static int get_loaded_feature(MSIPACKAGE* package, LPCWSTR Feature )
+int get_loaded_feature(MSIPACKAGE* package, LPCWSTR Feature )
{
int rc = -1;
DWORD i;
@@ -360,7 +448,7 @@
return rc;
}
-inline static int get_loaded_file(MSIPACKAGE* package, LPCWSTR file)
+int get_loaded_file(MSIPACKAGE* package, LPCWSTR file)
{
int rc = -1;
DWORD i;
@@ -376,8 +464,7 @@
return rc;
}
-
-static int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path)
+int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path)
{
DWORD i;
DWORD index;
@@ -408,7 +495,7 @@
return 0;
}
-void ACTION_remove_tracked_tempfiles(MSIPACKAGE* package)
+static void remove_tracked_tempfiles(MSIPACKAGE* package)
{
DWORD i;
@@ -426,13 +513,43 @@
}
}
+/* wrapper to resist a need for a full rewrite right now */
+DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data )
+{
+ if (ptr)
+ {
+ MSIRECORD *rec = MSI_CreateRecord(1);
+ DWORD size = 0;
+
+ MSI_RecordSetStringW(rec,0,ptr);
+ MSI_FormatRecordW(package,rec,NULL,&size);
+ if (size >= 0)
+ {
+ size++;
+ *data = HeapAlloc(GetProcessHeap(),0,size*sizeof(WCHAR));
+ if (size > 1)
+ MSI_FormatRecordW(package,rec,*data,&size);
+ else
+ *data[0] = 0;
+ msiobj_release( &rec->hdr );
+ return sizeof(WCHAR)*size;
+ }
+ msiobj_release( &rec->hdr );
+ }
+
+ *data = NULL;
+ return 0;
+}
+
/* Called when the package is being closed */
-extern void ACTION_free_package_structures( MSIPACKAGE* package)
+void ACTION_free_package_structures( MSIPACKAGE* package)
{
INT i;
TRACE("Freeing package action data\n");
+ remove_tracked_tempfiles(package);
+
/* No dynamic buffers in features */
if (package->features && package->loaded_features > 0)
HeapFree(GetProcessHeap(),0,package->features);
@@ -465,54 +582,16 @@
if (package->files && package->loaded_files > 0)
HeapFree(GetProcessHeap(),0,package->files);
-}
-static UINT ACTION_OpenQuery( MSIDATABASE *db, MSIQUERY **view, LPCWSTR fmt, ... )
-{
- LPWSTR szQuery;
- LPCWSTR p;
- UINT sz, rc;
- va_list va;
+ for (i = 0; i < package->DeferredActionCount; i++)
+ HeapFree(GetProcessHeap(),0,package->DeferredAction[i]);
+ HeapFree(GetProcessHeap(),0,package->DeferredAction);
- /* figure out how much space we need to allocate */
- va_start(va, fmt);
- sz = strlenW(fmt) + 1;
- p = fmt;
- while (*p)
- {
- p = strchrW(p, '%');
- if (!p)
- break;
- p++;
- switch (*p)
- {
- case 's': /* a string */
- sz += strlenW(va_arg(va,LPCWSTR));
- break;
- case 'd':
- case 'i': /* an integer -2147483648 seems to be longest */
- sz += 3*sizeof(int);
- (void)va_arg(va,int);
- break;
- case '%': /* a single % - leave it alone */
- break;
- default:
- FIXME("Unhandled character type %c\n",*p);
- }
- p++;
- }
- va_end(va);
+ for (i = 0; i < package->CommitActionCount; i++)
+ HeapFree(GetProcessHeap(),0,package->CommitAction[i]);
+ HeapFree(GetProcessHeap(),0,package->CommitAction);
- /* construct the string */
- szQuery = HeapAlloc(GetProcessHeap(), 0, sz*sizeof(WCHAR));
- va_start(va, fmt);
- vsnprintfW(szQuery, sz, fmt, va);
- va_end(va);
-
- /* perform the query */
- rc = MSI_DatabaseOpenViewW(db, szQuery, view);
- HeapFree(GetProcessHeap(), 0, szQuery);
- return rc;
+ HeapFree(GetProcessHeap(),0,package->PackagePath);
}
static void ui_progress(MSIPACKAGE *package, int a, int b, int c, int d )
@@ -526,6 +605,8 @@
MSI_RecordSetInteger(row,4,d);
MSI_ProcessMessage(package, INSTALLMESSAGE_PROGRESS, row);
msiobj_release(&row->hdr);
+
+ msi_dialog_check_messages(package->dialog, NULL);
}
static void ui_actiondata(MSIPACKAGE *package, LPCWSTR action, MSIRECORD * record)
@@ -538,11 +619,11 @@
UINT rc;
MSIQUERY * view;
MSIRECORD * row = 0;
- LPWSTR ptr;
+ DWORD size;
if (!package->LastAction || strcmpW(package->LastAction,action))
{
- rc = ACTION_OpenQuery(package->db, &view, Query_t, action);
+ rc = MSI_OpenQuery(package->db, &view, Query_t, action);
if (rc != ERROR_SUCCESS)
return;
@@ -568,12 +649,10 @@
}
/* update the cached actionformat */
- if (package->ActionFormat)
- HeapFree(GetProcessHeap(),0,package->ActionFormat);
+ HeapFree(GetProcessHeap(),0,package->ActionFormat);
package->ActionFormat = load_dynamic_stringW(row,3);
- if (package->LastAction)
- HeapFree(GetProcessHeap(),0,package->LastAction);
+ HeapFree(GetProcessHeap(),0,package->LastAction);
package->LastAction = dupstrW(action);
msiobj_release(&row->hdr);
@@ -581,39 +660,10 @@
msiobj_release(&view->hdr);
}
- message[0]=0;
- ptr = package->ActionFormat;
- while (*ptr)
- {
- LPWSTR ptr2;
- LPWSTR data=NULL;
- WCHAR tmp[1023];
- INT field;
+ MSI_RecordSetStringW(record,0,package->ActionFormat);
+ size = 1024;
+ MSI_FormatRecordW(package,record,message,&size);
- ptr2 = strchrW(ptr,'[');
- if (ptr2)
- {
- strncpyW(tmp,ptr,ptr2-ptr);
- tmp[ptr2-ptr]=0;
- strcatW(message,tmp);
- ptr2++;
- field = atoiW(ptr2);
- data = load_dynamic_stringW(record,field);
- if (data)
- {
- strcatW(message,data);
- HeapFree(GetProcessHeap(),0,data);
- }
- ptr=strchrW(ptr2,']');
- ptr++;
- }
- else
- {
- strcatW(message,ptr);
- break;
- }
- }
-
row = MSI_CreateRecord(1);
MSI_RecordSetStringW(row,1,message);
[truncated at 1000 lines; 12207 more skipped]