2004-06-28 22:34:35 +02:00
|
|
|
/*
|
|
|
|
* Implementation of the Microsoft Installer (msi.dll)
|
|
|
|
*
|
2005-06-17 22:56:55 +02:00
|
|
|
* Copyright 2004,2005 Aric Stewart for CodeWeavers
|
2004-06-28 22:34:35 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2004-07-04 02:25:00 +02:00
|
|
|
* Pages I need
|
2004-06-28 22:34:35 +02:00
|
|
|
*
|
|
|
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/installexecutesequence_table.asp
|
|
|
|
|
|
|
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/standard_actions_reference.asp
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
2004-10-07 05:06:48 +02:00
|
|
|
#define COBJMACROS
|
|
|
|
|
2004-06-28 22:34:35 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
#include "winreg.h"
|
|
|
|
#include "wine/debug.h"
|
2005-02-24 13:47:43 +01:00
|
|
|
#include "msidefs.h"
|
2004-06-28 22:34:35 +02:00
|
|
|
#include "msipriv.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "shlobj.h"
|
|
|
|
#include "wine/unicode.h"
|
2005-04-11 18:10:33 +02:00
|
|
|
#include "winver.h"
|
2005-01-25 21:17:09 +01:00
|
|
|
#include "action.h"
|
2004-06-28 22:34:35 +02:00
|
|
|
|
2005-01-03 21:00:13 +01:00
|
|
|
#define REG_PROGRESS_VALUE 13200
|
|
|
|
#define COMPONENT_PROGRESS_VALUE 24000
|
2004-06-28 22:34:35 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msi);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Prototypes
|
|
|
|
*/
|
2004-07-10 00:25:34 +02:00
|
|
|
static UINT ACTION_ProcessExecSequence(MSIPACKAGE *package, BOOL UIran);
|
|
|
|
static UINT ACTION_ProcessUISequence(MSIPACKAGE *package);
|
2005-03-24 20:03:45 +01:00
|
|
|
static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq, BOOL UI);
|
2005-01-31 17:23:12 +01:00
|
|
|
|
2004-06-28 22:34:35 +02:00
|
|
|
/*
|
|
|
|
* consts and values used
|
|
|
|
*/
|
2005-03-01 11:41:52 +01:00
|
|
|
static const WCHAR c_colon[] = {'C',':','\\',0};
|
2005-06-17 22:56:55 +02:00
|
|
|
|
2004-07-06 20:48:15 +02:00
|
|
|
const static WCHAR szCreateFolders[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'C','r','e','a','t','e','F','o','l','d','e','r','s',0};
|
2004-07-06 20:48:15 +02:00
|
|
|
const static WCHAR szCostFinalize[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'C','o','s','t','F','i','n','a','l','i','z','e',0};
|
2005-06-17 22:56:55 +02:00
|
|
|
const WCHAR szInstallFiles[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'I','n','s','t','a','l','l','F','i','l','e','s',0};
|
2005-06-17 22:56:55 +02:00
|
|
|
const WCHAR szDuplicateFiles[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'D','u','p','l','i','c','a','t','e','F','i','l','e','s',0};
|
2004-07-06 20:48:15 +02:00
|
|
|
const static WCHAR szWriteRegistryValues[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'W','r','i','t','e','R','e','g','i','s','t','r','y',
|
|
|
|
'V','a','l','u','e','s',0};
|
2004-07-06 20:48:15 +02:00
|
|
|
const static WCHAR szCostInitialize[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'C','o','s','t','I','n','i','t','i','a','l','i','z','e',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szFileCost[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'F','i','l','e','C','o','s','t',0};
|
2004-07-06 20:48:15 +02:00
|
|
|
const static WCHAR szInstallInitialize[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'I','n','s','t','a','l','l','I','n','i','t','i','a','l','i','z','e',0};
|
2004-07-06 20:48:15 +02:00
|
|
|
const static WCHAR szInstallValidate[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'I','n','s','t','a','l','l','V','a','l','i','d','a','t','e',0};
|
2004-07-06 20:48:15 +02:00
|
|
|
const static WCHAR szLaunchConditions[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'L','a','u','n','c','h','C','o','n','d','i','t','i','o','n','s',0};
|
2004-07-06 20:50:02 +02:00
|
|
|
const static WCHAR szProcessComponents[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'P','r','o','c','e','s','s','C','o','m','p','o','n','e','n','t','s',0};
|
2005-06-17 22:56:55 +02:00
|
|
|
const static WCHAR szRegisterTypeLibraries[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'R','e','g','i','s','t','e','r','T','y','p','e',
|
|
|
|
'L','i','b','r','a','r','i','e','s',0};
|
2005-06-16 17:51:44 +02:00
|
|
|
const WCHAR szRegisterClassInfo[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'R','e','g','i','s','t','e','r','C','l','a','s','s','I','n','f','o',0};
|
2005-06-16 17:51:44 +02:00
|
|
|
const WCHAR szRegisterProgIdInfo[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'R','e','g','i','s','t','e','r','P','r','o','g','I','d','I','n','f','o',0};
|
2004-07-06 21:00:23 +02:00
|
|
|
const static WCHAR szCreateShortcuts[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'C','r','e','a','t','e','S','h','o','r','t','c','u','t','s',0};
|
2004-07-06 21:00:23 +02:00
|
|
|
const static WCHAR szPublishProduct[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'P','u','b','l','i','s','h','P','r','o','d','u','c','t',0};
|
2005-01-14 16:59:26 +01:00
|
|
|
const static WCHAR szWriteIniValues[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'W','r','i','t','e','I','n','i','V','a','l','u','e','s',0};
|
2005-01-17 14:40:39 +01:00
|
|
|
const static WCHAR szSelfRegModules[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'S','e','l','f','R','e','g','M','o','d','u','l','e','s',0};
|
2005-01-17 14:40:39 +01:00
|
|
|
const static WCHAR szPublishFeatures[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'P','u','b','l','i','s','h','F','e','a','t','u','r','e','s',0};
|
2005-01-19 20:07:40 +01:00
|
|
|
const static WCHAR szRegisterProduct[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'R','e','g','i','s','t','e','r','P','r','o','d','u','c','t',0};
|
2005-01-19 20:07:40 +01:00
|
|
|
const static WCHAR szInstallExecute[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'I','n','s','t','a','l','l','E','x','e','c','u','t','e',0};
|
2005-01-19 20:07:40 +01:00
|
|
|
const static WCHAR szInstallExecuteAgain[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'I','n','s','t','a','l','l','E','x','e','c','u','t','e',
|
|
|
|
'A','g','a','i','n',0};
|
2005-01-19 20:07:40 +01:00
|
|
|
const static WCHAR szInstallFinalize[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'I','n','s','t','a','l','l','F','i','n','a','l','i','z','e',0};
|
2005-01-19 20:07:40 +01:00
|
|
|
const static WCHAR szForceReboot[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'F','o','r','c','e','R','e','b','o','o','t',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szResolveSource[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'R','e','s','o','l','v','e','S','o','u','r','c','e',0};
|
2005-06-16 17:51:44 +02:00
|
|
|
const WCHAR szAppSearch[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'A','p','p','S','e','a','r','c','h',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szAllocateRegistrySpace[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'A','l','l','o','c','a','t','e','R','e','g','i','s','t','r','y',
|
|
|
|
'S','p','a','c','e',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szBindImage[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'B','i','n','d','I','m','a','g','e',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szCCPSearch[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'C','C','P','S','e','a','r','c','h',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szDeleteServices[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'D','e','l','e','t','e','S','e','r','v','i','c','e','s',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szDisableRollback[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'D','i','s','a','b','l','e','R','o','l','l','b','a','c','k',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szExecuteAction[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'E','x','e','c','u','t','e','A','c','t','i','o','n',0};
|
2005-06-16 17:51:44 +02:00
|
|
|
const WCHAR szFindRelatedProducts[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'F','i','n','d','R','e','l','a','t','e','d',
|
|
|
|
'P','r','o','d','u','c','t','s',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szInstallAdminPackage[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'I','n','s','t','a','l','l','A','d','m','i','n',
|
|
|
|
'P','a','c','k','a','g','e',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szInstallSFPCatalogFile[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'I','n','s','t','a','l','l','S','F','P','C','a','t','a','l','o','g',
|
|
|
|
'F','i','l','e',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szIsolateComponents[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'I','s','o','l','a','t','e','C','o','m','p','o','n','e','n','t','s',0};
|
2005-06-17 22:56:55 +02:00
|
|
|
const WCHAR szMigrateFeatureStates[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'M','i','g','r','a','t','e','F','e','a','t','u','r','e',
|
|
|
|
'S','t','a','t','e','s',0};
|
2005-06-17 22:56:55 +02:00
|
|
|
const WCHAR szMoveFiles[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'M','o','v','e','F','i','l','e','s',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szMsiPublishAssemblies[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'M','s','i','P','u','b','l','i','s','h',
|
|
|
|
'A','s','s','e','m','b','l','i','e','s',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szMsiUnpublishAssemblies[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'M','s','i','U','n','p','u','b','l','i','s','h',
|
|
|
|
'A','s','s','e','m','b','l','i','e','s',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szInstallODBC[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'I','n','s','t','a','l','l','O','D','B','C',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szInstallServices[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'I','n','s','t','a','l','l','S','e','r','v','i','c','e','s',0};
|
2005-06-17 22:56:55 +02:00
|
|
|
const WCHAR szPatchFiles[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'P','a','t','c','h','F','i','l','e','s',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szPublishComponents[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'P','u','b','l','i','s','h','C','o','m','p','o','n','e','n','t','s',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szRegisterComPlus[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'R','e','g','i','s','t','e','r','C','o','m','P','l','u','s',0};
|
2005-06-16 17:51:44 +02:00
|
|
|
const WCHAR szRegisterExtensionInfo[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'R','e','g','i','s','t','e','r','E','x','t','e','n','s','i','o','n',
|
|
|
|
'I','n','f','o',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szRegisterFonts[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'R','e','g','i','s','t','e','r','F','o','n','t','s',0};
|
2005-06-16 17:51:44 +02:00
|
|
|
const WCHAR szRegisterMIMEInfo[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'R','e','g','i','s','t','e','r','M','I','M','E','I','n','f','o',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szRegisterUser[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'R','e','g','i','s','t','e','r','U','s','e','r',0};
|
2005-06-17 22:56:55 +02:00
|
|
|
const WCHAR szRemoveDuplicateFiles[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'R','e','m','o','v','e','D','u','p','l','i','c','a','t','e',
|
|
|
|
'F','i','l','e','s',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szRemoveEnvironmentStrings[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'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};
|
2005-06-17 22:56:55 +02:00
|
|
|
const WCHAR szRemoveExistingProducts[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'R','e','m','o','v','e','E','x','i','s','t','i','n','g',
|
|
|
|
'P','r','o','d','u','c','t','s',0};
|
2005-06-17 22:56:55 +02:00
|
|
|
const WCHAR szRemoveFiles[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'R','e','m','o','v','e','F','i','l','e','s',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szRemoveFolders[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'R','e','m','o','v','e','F','o','l','d','e','r','s',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szRemoveIniValues[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'R','e','m','o','v','e','I','n','i','V','a','l','u','e','s',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szRemoveODBC[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'R','e','m','o','v','e','O','D','B','C',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szRemoveRegistryValues[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'R','e','m','o','v','e','R','e','g','i','s','t','r','y',
|
|
|
|
'V','a','l','u','e','s',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szRemoveShortcuts[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'R','e','m','o','v','e','S','h','o','r','t','c','u','t','s',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szRMCCPSearch[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'R','M','C','C','P','S','e','a','r','c','h',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szScheduleReboot[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'S','c','h','e','d','u','l','e','R','e','b','o','o','t',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szSelfUnregModules[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'S','e','l','f','U','n','r','e','g','M','o','d','u','l','e','s',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szSetODBCFolders[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'S','e','t','O','D','B','C','F','o','l','d','e','r','s',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szStartServices[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'S','t','a','r','t','S','e','r','v','i','c','e','s',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szStopServices[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'S','t','o','p','S','e','r','v','i','c','e','s',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szUnpublishComponents[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'U','n','p','u','b','l','i','s','h',
|
|
|
|
'C','o','m','p','o','n','e','n','t','s',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szUnpublishFeatures[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'U','n','p','u','b','l','i','s','h','F','e','a','t','u','r','e','s',0};
|
2005-06-17 22:56:55 +02:00
|
|
|
const WCHAR szUnregisterClassInfo[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'U','n','r','e','g','i','s','t','e','r','C','l','a','s','s',
|
|
|
|
'I','n','f','o',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szUnregisterComPlus[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'U','n','r','e','g','i','s','t','e','r','C','o','m','P','l','u','s',0};
|
2005-06-17 22:56:55 +02:00
|
|
|
const WCHAR szUnregisterExtensionInfo[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'U','n','r','e','g','i','s','t','e','r',
|
|
|
|
'E','x','t','e','n','s','i','o','n','I','n','f','o',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szUnregisterFonts[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'U','n','r','e','g','i','s','t','e','r','F','o','n','t','s',0};
|
2005-06-17 22:56:55 +02:00
|
|
|
const WCHAR szUnregisterMIMEInfo[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'U','n','r','e','g','i','s','t','e','r','M','I','M','E','I','n','f','o',0};
|
2005-06-17 22:56:55 +02:00
|
|
|
const WCHAR szUnregisterProgIdInfo[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'U','n','r','e','g','i','s','t','e','r','P','r','o','g','I','d',
|
|
|
|
'I','n','f','o',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szUnregisterTypeLibraries[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'U','n','r','e','g','i','s','t','e','r','T','y','p','e',
|
|
|
|
'L','i','b','r','a','r','i','e','s',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szValidateProductID[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'V','a','l','i','d','a','t','e','P','r','o','d','u','c','t','I','D',0};
|
2005-02-02 10:29:30 +01:00
|
|
|
const static WCHAR szWriteEnvironmentStrings[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'W','r','i','t','e','E','n','v','i','r','o','n','m','e','n','t',
|
|
|
|
'S','t','r','i','n','g','s',0};
|
2005-01-31 17:23:12 +01:00
|
|
|
|
2005-09-28 20:10:44 +02:00
|
|
|
/* action handlers */
|
|
|
|
typedef UINT (*STANDARDACTIONHANDLER)(MSIPACKAGE*);
|
|
|
|
|
2005-01-31 17:23:12 +01:00
|
|
|
struct _actions {
|
|
|
|
LPCWSTR action;
|
|
|
|
STANDARDACTIONHANDLER handler;
|
|
|
|
};
|
|
|
|
|
2005-09-28 20:10:44 +02:00
|
|
|
static struct _actions StandardActions[];
|
2005-01-31 17:23:12 +01:00
|
|
|
|
2005-06-20 17:33:10 +02:00
|
|
|
|
|
|
|
/********************************************************
|
|
|
|
* helper functions
|
|
|
|
********************************************************/
|
|
|
|
|
2005-05-27 11:11:18 +02:00
|
|
|
static void ce_actiontext(MSIPACKAGE* package, LPCWSTR action)
|
|
|
|
{
|
|
|
|
static const WCHAR szActionText[] =
|
|
|
|
{'A','c','t','i','o','n','T','e','x','t',0};
|
|
|
|
MSIRECORD *row;
|
|
|
|
|
|
|
|
row = MSI_CreateRecord(1);
|
|
|
|
MSI_RecordSetStringW(row,1,action);
|
|
|
|
ControlEvent_FireSubscribedEvent(package,szActionText, row);
|
|
|
|
msiobj_release(&row->hdr);
|
2005-01-03 15:29:09 +01:00
|
|
|
}
|
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
static void ui_actionstart(MSIPACKAGE *package, LPCWSTR action)
|
2004-07-06 20:48:15 +02:00
|
|
|
{
|
|
|
|
static const WCHAR template_s[]=
|
2005-03-01 12:45:19 +01:00
|
|
|
{'A','c','t','i','o','n',' ','%','s',':',' ','%','s','.',' ', '%','s',
|
|
|
|
'.',0};
|
2004-07-06 20:48:15 +02:00
|
|
|
static const WCHAR format[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'H','H','\'',':','\'','m','m','\'',':','\'','s','s',0};
|
2004-07-06 20:48:15 +02:00
|
|
|
static const WCHAR Query_t[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
2005-05-20 11:40:42 +02:00
|
|
|
'`','A','c','t','i','o', 'n','T','e','x','t','`',' ',
|
|
|
|
'W','H','E','R','E', ' ','`','A','c','t','i','o','n','`',' ','=',
|
|
|
|
' ','\'','%','s','\'',0};
|
2004-07-06 20:48:15 +02:00
|
|
|
WCHAR message[1024];
|
|
|
|
WCHAR timet[0x100];
|
2004-07-10 00:25:34 +02:00
|
|
|
MSIRECORD * row = 0;
|
2005-06-07 23:34:05 +02:00
|
|
|
LPCWSTR ActionText;
|
2005-08-25 11:50:08 +02:00
|
|
|
LPWSTR deformated;
|
2004-07-06 20:48:15 +02:00
|
|
|
|
|
|
|
GetTimeFormatW(LOCALE_USER_DEFAULT, 0, NULL, format, timet, 0x100);
|
|
|
|
|
2005-06-02 12:29:57 +02:00
|
|
|
row = MSI_QueryGetRecord( package->db, Query_t, action );
|
|
|
|
if (!row)
|
2004-07-06 20:48:15 +02:00
|
|
|
return;
|
|
|
|
|
2005-06-07 23:34:05 +02:00
|
|
|
ActionText = MSI_RecordGetString(row,2);
|
2005-08-25 11:50:08 +02:00
|
|
|
deformat_string(package, ActionText, &deformated);
|
2004-07-06 20:48:15 +02:00
|
|
|
|
2005-08-25 11:50:08 +02:00
|
|
|
sprintfW(message,template_s,timet,action,deformated);
|
|
|
|
ce_actiontext(package, deformated);
|
2005-06-07 23:34:05 +02:00
|
|
|
msiobj_release(&row->hdr);
|
2004-07-06 20:48:15 +02:00
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
row = MSI_CreateRecord(1);
|
|
|
|
MSI_RecordSetStringW(row,1,message);
|
2004-07-06 20:48:15 +02:00
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONSTART, row);
|
|
|
|
msiobj_release(&row->hdr);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(deformated);
|
2004-07-06 20:48:15 +02:00
|
|
|
}
|
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
static void ui_actioninfo(MSIPACKAGE *package, LPCWSTR action, BOOL start,
|
2004-07-06 20:48:15 +02:00
|
|
|
UINT rc)
|
|
|
|
{
|
2004-07-10 00:25:34 +02:00
|
|
|
MSIRECORD * row;
|
2004-07-06 20:48:15 +02:00
|
|
|
static const WCHAR template_s[]=
|
2005-03-01 12:45:19 +01:00
|
|
|
{'A','c','t','i','o','n',' ','s','t','a','r','t',' ','%','s',':',' ',
|
|
|
|
'%','s', '.',0};
|
2004-07-06 20:48:15 +02:00
|
|
|
static const WCHAR template_e[]=
|
2005-03-01 12:45:19 +01:00
|
|
|
{'A','c','t','i','o','n',' ','e','n','d','e','d',' ','%','s',':',' ',
|
|
|
|
'%','s', '.',' ','R','e','t','u','r','n',' ','v','a','l','u','e',' ',
|
|
|
|
'%','i','.',0};
|
2004-07-06 20:48:15 +02:00
|
|
|
static const WCHAR format[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'H','H','\'',':','\'','m','m','\'',':','\'','s','s',0};
|
2004-07-06 20:48:15 +02:00
|
|
|
WCHAR message[1024];
|
|
|
|
WCHAR timet[0x100];
|
|
|
|
|
|
|
|
GetTimeFormatW(LOCALE_USER_DEFAULT, 0, NULL, format, timet, 0x100);
|
|
|
|
if (start)
|
|
|
|
sprintfW(message,template_s,timet,action);
|
|
|
|
else
|
|
|
|
sprintfW(message,template_e,timet,action,rc);
|
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
row = MSI_CreateRecord(1);
|
|
|
|
MSI_RecordSetStringW(row,1,message);
|
2004-07-06 20:48:15 +02:00
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
MSI_ProcessMessage(package, INSTALLMESSAGE_INFO, row);
|
|
|
|
msiobj_release(&row->hdr);
|
2004-07-06 20:48:15 +02:00
|
|
|
}
|
|
|
|
|
2005-09-29 12:32:39 +02:00
|
|
|
static int msi_get_property_int( MSIPACKAGE *package, LPCWSTR prop, int def )
|
|
|
|
{
|
|
|
|
LPWSTR str = msi_dup_property( package, prop );
|
|
|
|
int val = str ? atoiW( str ) : def;
|
|
|
|
msi_free( str );
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2005-09-28 17:12:32 +02:00
|
|
|
static UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine )
|
|
|
|
{
|
|
|
|
LPCWSTR ptr,ptr2;
|
|
|
|
BOOL quote;
|
|
|
|
DWORD len;
|
|
|
|
LPWSTR prop = NULL, val = NULL;
|
|
|
|
|
|
|
|
if (!szCommandLine)
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
|
|
|
|
ptr = szCommandLine;
|
|
|
|
|
|
|
|
while (*ptr)
|
|
|
|
{
|
|
|
|
if (*ptr==' ')
|
|
|
|
{
|
|
|
|
ptr++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("Looking at %s\n",debugstr_w(ptr));
|
|
|
|
|
|
|
|
ptr2 = strchrW(ptr,'=');
|
|
|
|
if (!ptr2)
|
|
|
|
{
|
|
|
|
ERR("command line contains unknown string : %s\n", debugstr_w(ptr));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
quote = FALSE;
|
|
|
|
|
|
|
|
len = ptr2-ptr;
|
|
|
|
prop = msi_alloc((len+1)*sizeof(WCHAR));
|
|
|
|
memcpy(prop,ptr,len*sizeof(WCHAR));
|
|
|
|
prop[len]=0;
|
|
|
|
ptr2++;
|
|
|
|
|
|
|
|
len = 0;
|
|
|
|
ptr = ptr2;
|
|
|
|
while (*ptr && (quote || (!quote && *ptr!=' ')))
|
|
|
|
{
|
|
|
|
if (*ptr == '"')
|
|
|
|
quote = !quote;
|
|
|
|
ptr++;
|
|
|
|
len++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*ptr2=='"')
|
|
|
|
{
|
|
|
|
ptr2++;
|
|
|
|
len -= 2;
|
|
|
|
}
|
|
|
|
val = msi_alloc((len+1)*sizeof(WCHAR));
|
|
|
|
memcpy(val,ptr2,len*sizeof(WCHAR));
|
|
|
|
val[len] = 0;
|
|
|
|
|
|
|
|
if (lstrlenW(prop) > 0)
|
|
|
|
{
|
|
|
|
TRACE("Found commandline property (%s) = (%s)\n",
|
|
|
|
debugstr_w(prop), debugstr_w(val));
|
|
|
|
MSI_SetPropertyW(package,prop,val);
|
|
|
|
}
|
|
|
|
msi_free(val);
|
|
|
|
msi_free(prop);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-06-28 22:34:35 +02:00
|
|
|
/****************************************************
|
|
|
|
* TOP level entry points
|
|
|
|
*****************************************************/
|
|
|
|
|
2005-09-30 12:32:41 +02:00
|
|
|
UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath,
|
|
|
|
LPCWSTR szCommandLine )
|
2004-06-28 22:34:35 +02:00
|
|
|
{
|
|
|
|
UINT rc;
|
2005-03-24 20:03:45 +01:00
|
|
|
BOOL ui = FALSE;
|
2004-07-10 00:25:34 +02:00
|
|
|
static const WCHAR szUILevel[] = {'U','I','L','e','v','e','l',0};
|
2005-01-17 14:40:39 +01:00
|
|
|
static const WCHAR szAction[] = {'A','C','T','I','O','N',0};
|
|
|
|
static const WCHAR szInstall[] = {'I','N','S','T','A','L','L',0};
|
|
|
|
|
|
|
|
MSI_SetPropertyW(package, szAction, szInstall);
|
2005-05-27 21:24:22 +02:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
package->script = msi_alloc(sizeof(MSISCRIPT));
|
2005-05-27 21:24:22 +02:00
|
|
|
memset(package->script,0,sizeof(MSISCRIPT));
|
2004-06-28 22:34:35 +02:00
|
|
|
|
2005-06-30 22:45:43 +02:00
|
|
|
package->script->InWhatSequence = SEQUENCE_INSTALL;
|
|
|
|
|
2004-06-29 05:44:01 +02:00
|
|
|
if (szPackagePath)
|
|
|
|
{
|
2004-12-22 16:25:30 +01:00
|
|
|
LPWSTR p, check, path;
|
2004-06-29 05:44:01 +02:00
|
|
|
|
2005-03-16 12:31:35 +01:00
|
|
|
package->PackagePath = strdupW(szPackagePath);
|
|
|
|
path = strdupW(szPackagePath);
|
2004-12-22 16:25:30 +01:00
|
|
|
p = strrchrW(path,'\\');
|
2004-06-29 05:44:01 +02:00
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
p++;
|
|
|
|
*p=0;
|
|
|
|
}
|
2005-02-08 15:26:49 +01:00
|
|
|
else
|
|
|
|
{
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(path);
|
|
|
|
path = msi_alloc(MAX_PATH*sizeof(WCHAR));
|
2005-02-08 15:26:49 +01:00
|
|
|
GetCurrentDirectoryW(MAX_PATH,path);
|
|
|
|
strcatW(path,cszbs);
|
|
|
|
}
|
2004-06-29 05:44:01 +02:00
|
|
|
|
2005-09-15 17:04:08 +02:00
|
|
|
check = msi_dup_property( package, cszSourceDir );
|
2004-12-22 19:15:50 +01:00
|
|
|
if (!check)
|
2004-12-22 16:25:30 +01:00
|
|
|
MSI_SetPropertyW(package, cszSourceDir, path);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(check);
|
|
|
|
msi_free(path);
|
2004-06-29 05:44:01 +02:00
|
|
|
}
|
2004-06-28 22:34:35 +02:00
|
|
|
|
2005-09-28 17:12:32 +02:00
|
|
|
msi_parse_command_line( package, szCommandLine );
|
2005-09-29 12:32:39 +02:00
|
|
|
|
|
|
|
if ( msi_get_property_int(package, szUILevel, 0) >= INSTALLUILEVEL_REDUCED )
|
2004-07-04 02:26:54 +02:00
|
|
|
{
|
2005-09-29 12:32:39 +02:00
|
|
|
package->script->InWhatSequence |= SEQUENCE_UI;
|
|
|
|
rc = ACTION_ProcessUISequence(package);
|
|
|
|
ui = TRUE;
|
|
|
|
if (rc == ERROR_SUCCESS)
|
2004-07-04 02:26:54 +02:00
|
|
|
{
|
2005-09-29 12:32:39 +02:00
|
|
|
package->script->InWhatSequence |= SEQUENCE_EXEC;
|
|
|
|
rc = ACTION_ProcessExecSequence(package,TRUE);
|
2004-07-04 02:26:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2004-07-10 00:25:34 +02:00
|
|
|
rc = ACTION_ProcessExecSequence(package,FALSE);
|
2005-01-27 12:12:56 +01:00
|
|
|
|
|
|
|
if (rc == -1)
|
|
|
|
{
|
|
|
|
/* install was halted but should be considered a success */
|
|
|
|
rc = ERROR_SUCCESS;
|
|
|
|
}
|
2004-07-04 02:26:54 +02:00
|
|
|
|
2005-05-27 21:24:22 +02:00
|
|
|
package->script->CurrentlyScripting= FALSE;
|
|
|
|
|
2004-12-27 20:00:26 +01:00
|
|
|
/* process the ending type action */
|
|
|
|
if (rc == ERROR_SUCCESS)
|
2005-03-24 20:03:45 +01:00
|
|
|
ACTION_PerformActionSequence(package,-1,ui);
|
2005-01-27 12:12:56 +01:00
|
|
|
else if (rc == ERROR_INSTALL_USEREXIT)
|
2005-03-24 20:03:45 +01:00
|
|
|
ACTION_PerformActionSequence(package,-2,ui);
|
2005-01-27 12:12:56 +01:00
|
|
|
else if (rc == ERROR_INSTALL_SUSPEND)
|
2005-03-24 20:03:45 +01:00
|
|
|
ACTION_PerformActionSequence(package,-4,ui);
|
2005-05-27 21:24:22 +02:00
|
|
|
else /* failed */
|
|
|
|
ACTION_PerformActionSequence(package,-3,ui);
|
2005-01-25 21:17:09 +01:00
|
|
|
|
|
|
|
/* finish up running custom actions */
|
|
|
|
ACTION_FinishCustomActions(package);
|
2004-12-27 20:00:26 +01:00
|
|
|
|
2004-07-04 02:26:54 +02:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-03-24 20:03:45 +01:00
|
|
|
static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq, BOOL UI)
|
2004-12-27 20:00:26 +01:00
|
|
|
{
|
2005-06-02 12:29:57 +02:00
|
|
|
UINT rc = ERROR_SUCCESS;
|
2004-12-27 20:00:26 +01:00
|
|
|
MSIRECORD * row = 0;
|
2005-03-01 12:45:19 +01:00
|
|
|
static const WCHAR ExecSeqQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
2005-05-20 11:40:42 +02:00
|
|
|
'`','I','n','s','t','a','l','l','E','x','e','c','u','t','e',
|
|
|
|
'S','e','q','u','e','n','c','e','`',' ', 'W','H','E','R','E',' ',
|
|
|
|
'`','S','e','q','u','e','n','c','e','`',' ', '=',' ','%','i',0};
|
2004-12-27 20:00:26 +01:00
|
|
|
|
2005-03-24 20:03:45 +01:00
|
|
|
static const WCHAR UISeqQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
2005-05-20 11:40:42 +02:00
|
|
|
'`','I','n','s','t','a','l','l','U','I','S','e','q','u','e','n','c','e',
|
|
|
|
'`', ' ', 'W','H','E','R','E',' ','`','S','e','q','u','e','n','c','e','`',
|
2005-03-24 20:03:45 +01:00
|
|
|
' ', '=',' ','%','i',0};
|
|
|
|
|
|
|
|
if (UI)
|
2005-06-02 12:29:57 +02:00
|
|
|
row = MSI_QueryGetRecord(package->db, UISeqQuery, seq);
|
2005-03-24 20:03:45 +01:00
|
|
|
else
|
2005-06-02 12:29:57 +02:00
|
|
|
row = MSI_QueryGetRecord(package->db, ExecSeqQuery, seq);
|
2004-12-27 20:00:26 +01:00
|
|
|
|
2005-06-02 12:29:57 +02:00
|
|
|
if (row)
|
2004-12-27 20:00:26 +01:00
|
|
|
{
|
2005-06-07 23:34:05 +02:00
|
|
|
LPCWSTR action, cond;
|
|
|
|
|
2004-12-27 20:00:26 +01:00
|
|
|
TRACE("Running the actions\n");
|
|
|
|
|
|
|
|
/* check conditions */
|
2005-06-07 23:34:05 +02:00
|
|
|
cond = MSI_RecordGetString(row,2);
|
|
|
|
if (cond)
|
2004-12-27 20:00:26 +01:00
|
|
|
{
|
2005-06-07 23:34:05 +02:00
|
|
|
/* this is a hack to skip errors in the condition code */
|
|
|
|
if (MSI_EvaluateConditionW(package, cond) == MSICONDITION_FALSE)
|
|
|
|
goto end;
|
2004-12-27 20:00:26 +01:00
|
|
|
}
|
|
|
|
|
2005-06-07 23:34:05 +02:00
|
|
|
action = MSI_RecordGetString(row,1);
|
|
|
|
if (!action)
|
2004-12-27 20:00:26 +01:00
|
|
|
{
|
2005-06-07 23:34:05 +02:00
|
|
|
ERR("failed to fetch action\n");
|
|
|
|
rc = ERROR_FUNCTION_FAILED;
|
2004-12-27 20:00:26 +01:00
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
|
2005-03-24 20:03:45 +01:00
|
|
|
if (UI)
|
2005-06-07 23:34:05 +02:00
|
|
|
rc = ACTION_PerformUIAction(package,action);
|
2005-03-24 20:03:45 +01:00
|
|
|
else
|
2005-06-07 23:34:05 +02:00
|
|
|
rc = ACTION_PerformAction(package,action,FALSE);
|
2004-12-27 20:00:26 +01:00
|
|
|
end:
|
2005-06-02 12:29:57 +02:00
|
|
|
msiobj_release(&row->hdr);
|
2004-12-27 20:00:26 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
rc = ERROR_SUCCESS;
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
2004-07-04 02:26:54 +02:00
|
|
|
|
2005-06-20 17:33:10 +02:00
|
|
|
typedef struct {
|
|
|
|
MSIPACKAGE* package;
|
|
|
|
BOOL UI;
|
|
|
|
} iterate_action_param;
|
|
|
|
|
|
|
|
static UINT ITERATE_Actions(MSIRECORD *row, LPVOID param)
|
|
|
|
{
|
|
|
|
iterate_action_param *iap= (iterate_action_param*)param;
|
|
|
|
UINT rc;
|
|
|
|
LPCWSTR cond, action;
|
|
|
|
|
|
|
|
action = MSI_RecordGetString(row,1);
|
|
|
|
if (!action)
|
|
|
|
{
|
|
|
|
ERR("Error is retrieving action name\n");
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check conditions */
|
|
|
|
cond = MSI_RecordGetString(row,2);
|
|
|
|
if (cond)
|
|
|
|
{
|
|
|
|
/* this is a hack to skip errors in the condition code */
|
|
|
|
if (MSI_EvaluateConditionW(iap->package, cond) == MSICONDITION_FALSE)
|
|
|
|
{
|
|
|
|
TRACE("Skipping action: %s (condition is false)\n",
|
|
|
|
debugstr_w(action));
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (iap->UI)
|
|
|
|
rc = ACTION_PerformUIAction(iap->package,action);
|
|
|
|
else
|
|
|
|
rc = ACTION_PerformAction(iap->package,action,FALSE);
|
|
|
|
|
2005-07-06 17:44:51 +02:00
|
|
|
msi_dialog_check_messages( NULL );
|
|
|
|
|
|
|
|
if (iap->package->CurrentInstallState != ERROR_SUCCESS )
|
|
|
|
rc = iap->package->CurrentInstallState;
|
|
|
|
|
2005-06-20 17:33:10 +02:00
|
|
|
if (rc == ERROR_FUNCTION_NOT_CALLED)
|
|
|
|
rc = ERROR_SUCCESS;
|
|
|
|
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
ERR("Execution halted due to error (%i)\n",rc);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-09-21 12:55:23 +02:00
|
|
|
UINT MSI_Sequence( MSIPACKAGE *package, LPCWSTR szTable, INT iSequenceMode )
|
|
|
|
{
|
|
|
|
MSIQUERY * view;
|
|
|
|
UINT r;
|
|
|
|
static const WCHAR query[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
|
|
|
'`','%','s','`',
|
|
|
|
' ','W','H','E','R','E',' ',
|
|
|
|
'`','S','e','q','u','e','n','c','e','`',' ',
|
|
|
|
'>',' ','0',' ','O','R','D','E','R',' ','B','Y',' ',
|
|
|
|
'`','S','e','q','u','e','n','c','e','`',0};
|
|
|
|
iterate_action_param iap;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FIXME: probably should be checking UILevel in the
|
|
|
|
* ACTION_PerformUIAction/ACTION_PerformAction
|
|
|
|
* rather than saving the UI level here. Those
|
|
|
|
* two functions can be merged too.
|
|
|
|
*/
|
|
|
|
iap.package = package;
|
|
|
|
iap.UI = TRUE;
|
|
|
|
|
|
|
|
TRACE("%p %s %i\n", package, debugstr_w(szTable), iSequenceMode );
|
|
|
|
|
|
|
|
r = MSI_OpenQuery( package->db, &view, query, szTable );
|
|
|
|
if (r == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
r = MSI_IterateRecords( view, NULL, ITERATE_Actions, &iap );
|
|
|
|
msiobj_release(&view->hdr);
|
|
|
|
}
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
static UINT ACTION_ProcessExecSequence(MSIPACKAGE *package, BOOL UIran)
|
2004-07-04 02:26:54 +02:00
|
|
|
{
|
2004-07-10 00:25:34 +02:00
|
|
|
MSIQUERY * view;
|
2004-07-04 02:26:54 +02:00
|
|
|
UINT rc;
|
2005-03-01 12:45:19 +01:00
|
|
|
static const WCHAR ExecSeqQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ',
|
2005-05-20 11:40:42 +02:00
|
|
|
'`','I','n','s','t','a','l','l','E','x','e','c','u','t','e',
|
|
|
|
'S','e','q','u','e','n','c','e','`',' ', 'W','H','E','R','E',' ',
|
|
|
|
'`','S','e','q','u','e','n','c','e','`',' ', '>',' ','%','i',' ',
|
2005-03-01 12:45:19 +01:00
|
|
|
'O','R','D','E','R',' ', 'B','Y',' ',
|
2005-05-20 11:40:42 +02:00
|
|
|
'`','S','e','q','u','e','n','c','e','`',0 };
|
2004-07-10 00:25:34 +02:00
|
|
|
MSIRECORD * row = 0;
|
2005-03-01 12:45:19 +01:00
|
|
|
static const WCHAR IVQuery[] =
|
2005-05-20 11:40:42 +02:00
|
|
|
{'S','E','L','E','C','T',' ','`','S','e','q','u','e','n','c','e','`',
|
|
|
|
' ', 'F','R','O','M',' ','`','I','n','s','t','a','l','l',
|
|
|
|
'E','x','e','c','u','t','e','S','e','q','u','e','n','c','e','`',' ',
|
|
|
|
'W','H','E','R','E',' ','`','A','c','t','i','o','n','`',' ','=',
|
|
|
|
' ','\'', 'I','n','s','t','a','l','l',
|
|
|
|
'V','a','l','i','d','a','t','e','\'', 0};
|
2004-12-22 16:05:07 +01:00
|
|
|
INT seq = 0;
|
2005-06-20 17:33:10 +02:00
|
|
|
iterate_action_param iap;
|
2004-07-04 02:26:54 +02:00
|
|
|
|
2005-06-20 17:33:10 +02:00
|
|
|
iap.package = package;
|
|
|
|
iap.UI = FALSE;
|
2005-02-24 13:47:43 +01:00
|
|
|
|
2005-05-27 21:24:22 +02:00
|
|
|
if (package->script->ExecuteSequenceRun)
|
2005-02-24 13:47:43 +01:00
|
|
|
{
|
|
|
|
TRACE("Execute Sequence already Run\n");
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-05-27 21:24:22 +02:00
|
|
|
package->script->ExecuteSequenceRun = TRUE;
|
2005-06-20 17:33:10 +02:00
|
|
|
|
2004-12-22 16:05:07 +01:00
|
|
|
/* get the sequence number */
|
2004-07-04 02:26:54 +02:00
|
|
|
if (UIran)
|
|
|
|
{
|
2005-06-02 12:29:57 +02:00
|
|
|
row = MSI_QueryGetRecord(package->db, IVQuery);
|
|
|
|
if( !row )
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
2004-07-10 00:25:34 +02:00
|
|
|
seq = MSI_RecordGetInteger(row,1);
|
|
|
|
msiobj_release(&row->hdr);
|
2004-07-04 02:26:54 +02:00
|
|
|
}
|
2004-12-22 16:05:07 +01:00
|
|
|
|
2005-01-21 17:19:11 +01:00
|
|
|
rc = MSI_OpenQuery(package->db, &view, ExecSeqQuery, seq);
|
2004-06-28 22:34:35 +02:00
|
|
|
if (rc == ERROR_SUCCESS)
|
|
|
|
{
|
2005-06-20 17:33:10 +02:00
|
|
|
TRACE("Running the actions\n");
|
2004-06-28 22:34:35 +02:00
|
|
|
|
2005-06-20 17:33:10 +02:00
|
|
|
rc = MSI_IterateRecords(view, NULL, ITERATE_Actions, &iap);
|
2004-07-10 00:25:34 +02:00
|
|
|
msiobj_release(&view->hdr);
|
2004-06-28 22:34:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
static UINT ACTION_ProcessUISequence(MSIPACKAGE *package)
|
2004-07-04 02:26:54 +02:00
|
|
|
{
|
2004-07-10 00:25:34 +02:00
|
|
|
MSIQUERY * view;
|
2004-07-04 02:26:54 +02:00
|
|
|
UINT rc;
|
2005-03-01 12:45:19 +01:00
|
|
|
static const WCHAR ExecSeqQuery [] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
2005-05-20 11:40:42 +02:00
|
|
|
'`','I','n','s','t','a','l','l',
|
|
|
|
'U','I','S','e','q','u','e','n','c','e','`',
|
|
|
|
' ','W','H','E','R','E',' ',
|
|
|
|
'`','S','e','q','u','e','n','c','e','`',' ',
|
2005-03-01 12:45:19 +01:00
|
|
|
'>',' ','0',' ','O','R','D','E','R',' ','B','Y',' ',
|
2005-05-20 11:40:42 +02:00
|
|
|
'`','S','e','q','u','e','n','c','e','`',0};
|
2005-06-20 17:33:10 +02:00
|
|
|
iterate_action_param iap;
|
|
|
|
|
|
|
|
iap.package = package;
|
|
|
|
iap.UI = TRUE;
|
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
|
2004-07-04 02:26:54 +02:00
|
|
|
|
|
|
|
if (rc == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
TRACE("Running the actions \n");
|
|
|
|
|
2005-06-20 17:33:10 +02:00
|
|
|
rc = MSI_IterateRecords(view, NULL, ITERATE_Actions, &iap);
|
2004-07-10 00:25:34 +02:00
|
|
|
msiobj_release(&view->hdr);
|
2004-07-04 02:26:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2004-06-28 22:34:35 +02:00
|
|
|
/********************************************************
|
|
|
|
* ACTION helper functions and functions that perform the actions
|
|
|
|
*******************************************************/
|
2005-05-27 21:24:22 +02:00
|
|
|
static BOOL ACTION_HandleStandardAction(MSIPACKAGE *package, LPCWSTR action,
|
|
|
|
UINT* rc, BOOL force )
|
2005-02-01 19:46:26 +01:00
|
|
|
{
|
|
|
|
BOOL ret = FALSE;
|
2005-05-27 21:24:22 +02:00
|
|
|
BOOL run = force;
|
2005-02-01 19:46:26 +01:00
|
|
|
int i;
|
2005-05-27 21:24:22 +02:00
|
|
|
|
|
|
|
if (!run && !package->script->CurrentlyScripting)
|
|
|
|
run = TRUE;
|
|
|
|
|
|
|
|
if (!run)
|
|
|
|
{
|
|
|
|
if (strcmpW(action,szInstallFinalize) == 0 ||
|
|
|
|
strcmpW(action,szInstallExecute) == 0 ||
|
|
|
|
strcmpW(action,szInstallExecuteAgain) == 0)
|
|
|
|
run = TRUE;
|
|
|
|
}
|
|
|
|
|
2005-02-01 19:46:26 +01:00
|
|
|
i = 0;
|
|
|
|
while (StandardActions[i].action != NULL)
|
|
|
|
{
|
|
|
|
if (strcmpW(StandardActions[i].action, action)==0)
|
|
|
|
{
|
2005-05-27 21:24:22 +02:00
|
|
|
if (!run)
|
2005-02-02 10:29:30 +01:00
|
|
|
{
|
2005-05-27 21:24:22 +02:00
|
|
|
ui_actioninfo(package, action, TRUE, 0);
|
|
|
|
*rc = schedule_action(package,INSTALL_SCRIPT,action);
|
|
|
|
ui_actioninfo(package, action, FALSE, *rc);
|
2005-02-02 10:29:30 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-05-27 21:24:22 +02:00
|
|
|
ui_actionstart(package, action);
|
|
|
|
if (StandardActions[i].handler)
|
|
|
|
{
|
|
|
|
*rc = StandardActions[i].handler(package);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-09-06 11:23:18 +02:00
|
|
|
FIXME("unhandled standard action %s\n",debugstr_w(action));
|
2005-05-27 21:24:22 +02:00
|
|
|
*rc = ERROR_SUCCESS;
|
|
|
|
}
|
2005-02-02 10:29:30 +01:00
|
|
|
}
|
2005-02-01 19:46:26 +01:00
|
|
|
ret = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-06-07 22:29:51 +02:00
|
|
|
static BOOL ACTION_HandleCustomAction( MSIPACKAGE* package, LPCWSTR action,
|
|
|
|
UINT* rc, BOOL force )
|
2005-02-01 19:46:26 +01:00
|
|
|
{
|
|
|
|
BOOL ret=FALSE;
|
|
|
|
UINT arc;
|
|
|
|
|
2005-05-27 21:24:22 +02:00
|
|
|
arc = ACTION_CustomAction(package,action, force);
|
2005-02-01 19:46:26 +01:00
|
|
|
|
|
|
|
if (arc != ERROR_CALL_NOT_IMPLEMENTED)
|
|
|
|
{
|
|
|
|
*rc = arc;
|
|
|
|
ret = TRUE;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
2004-06-28 22:34:35 +02:00
|
|
|
|
|
|
|
/*
|
2005-01-26 22:09:04 +01:00
|
|
|
* A lot of actions are really important even if they don't do anything
|
|
|
|
* explicit... Lots of properties are set at the beginning of the installation
|
|
|
|
* CostFinalize does a bunch of work to translate the directories and such
|
2004-06-28 22:34:35 +02:00
|
|
|
*
|
2004-07-04 02:25:00 +02:00
|
|
|
* But until I get write access to the database that is hard, so I am going to
|
2004-06-28 22:34:35 +02:00
|
|
|
* hack it to see if I can get something to run.
|
|
|
|
*/
|
2005-05-27 21:24:22 +02:00
|
|
|
UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, BOOL force)
|
2004-06-28 22:34:35 +02:00
|
|
|
{
|
2004-07-06 20:48:15 +02:00
|
|
|
UINT rc = ERROR_SUCCESS;
|
2005-02-01 19:46:26 +01:00
|
|
|
BOOL handled;
|
2004-06-28 22:34:35 +02:00
|
|
|
|
|
|
|
TRACE("Performing action (%s)\n",debugstr_w(action));
|
2004-07-04 02:36:58 +02:00
|
|
|
|
2005-05-27 21:24:22 +02:00
|
|
|
handled = ACTION_HandleStandardAction(package, action, &rc, force);
|
2005-02-01 19:46:26 +01:00
|
|
|
|
|
|
|
if (!handled)
|
2005-05-27 21:24:22 +02:00
|
|
|
handled = ACTION_HandleCustomAction(package, action, &rc, force);
|
2005-02-01 19:46:26 +01:00
|
|
|
|
|
|
|
if (!handled)
|
2005-01-31 17:23:12 +01:00
|
|
|
{
|
2005-09-06 11:23:18 +02:00
|
|
|
FIXME("unhandled msi action %s\n",debugstr_w(action));
|
2005-02-01 19:46:26 +01:00
|
|
|
rc = ERROR_FUNCTION_NOT_CALLED;
|
2005-01-31 17:23:12 +01:00
|
|
|
}
|
2004-06-29 06:04:13 +02:00
|
|
|
|
2005-02-01 19:46:26 +01:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action)
|
|
|
|
{
|
|
|
|
UINT rc = ERROR_SUCCESS;
|
|
|
|
BOOL handled = FALSE;
|
|
|
|
|
|
|
|
TRACE("Performing action (%s)\n",debugstr_w(action));
|
|
|
|
|
2005-05-27 21:24:22 +02:00
|
|
|
handled = ACTION_HandleStandardAction(package, action, &rc,TRUE);
|
2005-02-01 19:46:26 +01:00
|
|
|
|
2005-01-31 17:23:12 +01:00
|
|
|
if (!handled)
|
2005-05-27 21:24:22 +02:00
|
|
|
handled = ACTION_HandleCustomAction(package, action, &rc, FALSE);
|
2005-01-31 17:23:12 +01:00
|
|
|
|
2005-07-06 17:44:51 +02:00
|
|
|
if( !handled && ACTION_DialogBox(package,action) == ERROR_SUCCESS )
|
|
|
|
handled = TRUE;
|
2005-02-09 14:24:31 +01:00
|
|
|
|
2005-02-01 19:46:26 +01:00
|
|
|
if (!handled)
|
|
|
|
{
|
2005-09-06 11:23:18 +02:00
|
|
|
FIXME("unhandled msi action %s\n",debugstr_w(action));
|
2005-02-01 19:46:26 +01:00
|
|
|
rc = ERROR_FUNCTION_NOT_CALLED;
|
2005-01-31 17:23:12 +01:00
|
|
|
}
|
2004-06-28 22:34:35 +02:00
|
|
|
|
2004-07-06 20:48:15 +02:00
|
|
|
return rc;
|
2004-06-28 22:34:35 +02:00
|
|
|
}
|
|
|
|
|
2005-06-21 22:03:46 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Actual Action Handlers
|
|
|
|
*/
|
|
|
|
|
|
|
|
static UINT ITERATE_CreateFolders(MSIRECORD *row, LPVOID param)
|
|
|
|
{
|
|
|
|
MSIPACKAGE *package = (MSIPACKAGE*)param;
|
|
|
|
LPCWSTR dir;
|
|
|
|
LPWSTR full_path;
|
|
|
|
MSIRECORD *uirow;
|
|
|
|
MSIFOLDER *folder;
|
|
|
|
|
|
|
|
dir = MSI_RecordGetString(row,1);
|
|
|
|
if (!dir)
|
|
|
|
{
|
|
|
|
ERR("Unable to get folder id \n");
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
full_path = resolve_folder(package,dir,FALSE,FALSE,&folder);
|
|
|
|
if (!full_path)
|
|
|
|
{
|
|
|
|
ERR("Unable to resolve folder id %s\n",debugstr_w(dir));
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("Folder is %s\n",debugstr_w(full_path));
|
|
|
|
|
|
|
|
/* UI stuff */
|
|
|
|
uirow = MSI_CreateRecord(1);
|
|
|
|
MSI_RecordSetStringW(uirow,1,full_path);
|
|
|
|
ui_actiondata(package,szCreateFolders,uirow);
|
|
|
|
msiobj_release( &uirow->hdr );
|
|
|
|
|
|
|
|
if (folder->State == 0)
|
|
|
|
create_full_pathW(full_path);
|
|
|
|
|
|
|
|
folder->State = 3;
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(full_path);
|
2005-06-21 22:03:46 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-06-28 22:34:35 +02:00
|
|
|
/*
|
|
|
|
* Also we cannot enable/disable components either, so for now I am just going
|
2004-07-04 02:25:00 +02:00
|
|
|
* to do all the directories for all the components.
|
2004-06-28 22:34:35 +02:00
|
|
|
*/
|
2004-07-10 00:25:34 +02:00
|
|
|
static UINT ACTION_CreateFolders(MSIPACKAGE *package)
|
2004-06-28 22:34:35 +02:00
|
|
|
{
|
2005-03-01 12:45:19 +01:00
|
|
|
static const WCHAR ExecSeqQuery[] =
|
2005-05-20 11:40:42 +02:00
|
|
|
{'S','E','L','E','C','T',' ',
|
|
|
|
'`','D','i','r','e','c','t','o','r','y','_','`',
|
2005-03-01 12:45:19 +01:00
|
|
|
' ','F','R','O','M',' ',
|
2005-05-20 11:40:42 +02:00
|
|
|
'`','C','r','e','a','t','e','F','o','l','d','e','r','`',0 };
|
2004-06-28 22:34:35 +02:00
|
|
|
UINT rc;
|
2004-07-10 00:25:34 +02:00
|
|
|
MSIQUERY *view;
|
2004-06-30 21:38:36 +02:00
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view );
|
2004-06-28 22:34:35 +02:00
|
|
|
if (rc != ERROR_SUCCESS)
|
2004-07-20 03:22:37 +02:00
|
|
|
return ERROR_SUCCESS;
|
2004-06-28 22:34:35 +02:00
|
|
|
|
2005-06-21 22:03:46 +02:00
|
|
|
rc = MSI_IterateRecords(view, NULL, ITERATE_CreateFolders, package);
|
2004-07-10 00:25:34 +02:00
|
|
|
msiobj_release(&view->hdr);
|
2004-06-28 22:34:35 +02:00
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
static MSICOMPONENT* load_component( MSIRECORD * row )
|
2004-07-04 02:32:48 +02:00
|
|
|
{
|
2005-08-22 11:15:23 +02:00
|
|
|
MSICOMPONENT *comp;
|
2004-07-04 02:32:48 +02:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
comp = msi_alloc_zero( sizeof(MSICOMPONENT) );
|
2005-08-22 11:15:23 +02:00
|
|
|
if (!comp)
|
|
|
|
return comp;
|
2004-07-04 02:32:48 +02:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
/* fill in the data */
|
2005-09-12 14:07:15 +02:00
|
|
|
comp->Component = load_dynamic_stringW( row, 1 );
|
2004-07-04 02:32:48 +02:00
|
|
|
|
2005-09-12 14:07:15 +02:00
|
|
|
TRACE("Loading Component %s\n", debugstr_w(comp->Component));
|
2004-07-04 02:32:48 +02:00
|
|
|
|
2005-09-12 14:07:15 +02:00
|
|
|
comp->ComponentId = load_dynamic_stringW( row, 2 );
|
|
|
|
comp->Directory = load_dynamic_stringW( row, 3 );
|
2005-08-22 11:15:23 +02:00
|
|
|
comp->Attributes = MSI_RecordGetInteger(row,4);
|
2005-09-06 13:39:01 +02:00
|
|
|
comp->Condition = load_dynamic_stringW( row, 5 );
|
2005-09-12 14:07:15 +02:00
|
|
|
comp->KeyPath = load_dynamic_stringW( row, 6 );
|
2004-07-04 02:32:48 +02:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
comp->Installed = INSTALLSTATE_ABSENT;
|
|
|
|
comp->Action = INSTALLSTATE_UNKNOWN;
|
|
|
|
comp->ActionRequest = INSTALLSTATE_UNKNOWN;
|
2004-12-27 20:06:22 +01:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
comp->Enabled = TRUE;
|
2004-07-04 02:32:48 +02:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
return comp;
|
2004-07-04 02:32:48 +02:00
|
|
|
}
|
|
|
|
|
2005-06-23 18:43:24 +02:00
|
|
|
typedef struct {
|
|
|
|
MSIPACKAGE *package;
|
2005-08-22 16:09:17 +02:00
|
|
|
MSIFEATURE *feature;
|
2005-06-23 18:43:24 +02:00
|
|
|
} _ilfs;
|
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
static UINT add_feature_component( MSIFEATURE *feature, MSICOMPONENT *comp )
|
2005-08-19 12:03:11 +02:00
|
|
|
{
|
|
|
|
ComponentList *cl;
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
cl = msi_alloc( sizeof (*cl) );
|
2005-08-19 12:03:11 +02:00
|
|
|
if ( !cl )
|
|
|
|
return ERROR_NOT_ENOUGH_MEMORY;
|
2005-08-22 11:15:23 +02:00
|
|
|
cl->component = comp;
|
2005-08-22 16:09:17 +02:00
|
|
|
list_add_tail( &feature->Components, &cl->entry );
|
2005-08-19 12:03:11 +02:00
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
static UINT iterate_component_check( MSIRECORD *row, LPVOID param )
|
2005-06-23 18:43:24 +02:00
|
|
|
{
|
|
|
|
_ilfs* ilfs= (_ilfs*)param;
|
2005-08-22 11:15:23 +02:00
|
|
|
MSIPACKAGE *package = ilfs->package;
|
2005-08-22 16:09:17 +02:00
|
|
|
MSIFEATURE *feature = ilfs->feature;
|
2005-08-22 11:15:23 +02:00
|
|
|
MSICOMPONENT *comp;
|
|
|
|
|
|
|
|
comp = load_component( row );
|
|
|
|
if (!comp)
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
2005-06-23 18:43:24 +02:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
list_add_tail( &package->components, &comp->entry );
|
2005-08-22 16:09:17 +02:00
|
|
|
add_feature_component( feature, comp );
|
2005-06-23 18:43:24 +02:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
TRACE("Loaded new component %p\n", comp);
|
2005-06-23 18:43:24 +02:00
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT iterate_load_featurecomponents(MSIRECORD *row, LPVOID param)
|
2004-07-04 02:32:48 +02:00
|
|
|
{
|
2005-06-23 18:43:24 +02:00
|
|
|
_ilfs* ilfs= (_ilfs*)param;
|
|
|
|
LPCWSTR component;
|
|
|
|
DWORD rc;
|
2005-08-22 11:15:23 +02:00
|
|
|
MSICOMPONENT *comp;
|
2005-06-23 18:43:24 +02:00
|
|
|
MSIQUERY * view;
|
|
|
|
static const WCHAR Query[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R', 'O','M',' ',
|
|
|
|
'`','C','o','m','p','o','n','e','n','t','`',' ',
|
|
|
|
'W','H','E','R','E',' ',
|
|
|
|
'`','C','o','m','p','o','n','e','n','t','`',' ',
|
|
|
|
'=','\'','%','s','\'',0};
|
|
|
|
|
|
|
|
component = MSI_RecordGetString(row,1);
|
|
|
|
|
|
|
|
/* check to see if the component is already loaded */
|
2005-08-22 11:15:23 +02:00
|
|
|
comp = get_loaded_component( ilfs->package, component );
|
|
|
|
if (comp)
|
2005-06-23 18:43:24 +02:00
|
|
|
{
|
2005-08-22 11:15:23 +02:00
|
|
|
TRACE("Component %s already loaded\n", debugstr_w(component) );
|
2005-08-22 16:09:17 +02:00
|
|
|
add_feature_component( ilfs->feature, comp );
|
2005-06-23 18:43:24 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = MSI_OpenQuery(ilfs->package->db, &view, Query, component);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
|
|
|
|
rc = MSI_IterateRecords(view, NULL, iterate_component_check, ilfs);
|
|
|
|
msiobj_release( &view->hdr );
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT load_feature(MSIRECORD * row, LPVOID param)
|
|
|
|
{
|
|
|
|
MSIPACKAGE* package = (MSIPACKAGE*)param;
|
2005-08-22 16:09:17 +02:00
|
|
|
MSIFEATURE* feature;
|
2005-03-01 12:45:19 +01:00
|
|
|
static const WCHAR Query1[] =
|
2005-05-20 11:40:42 +02:00
|
|
|
{'S','E','L','E','C','T',' ',
|
|
|
|
'`','C','o','m','p','o','n','e','n','t','_','`',
|
|
|
|
' ','F','R','O','M',' ','`','F','e','a','t','u','r','e',
|
|
|
|
'C','o','m','p','o','n','e','n','t','s','`',' ',
|
|
|
|
'W','H','E','R','E',' ',
|
|
|
|
'`','F','e', 'a','t','u','r','e','_','`',' ','=','\'','%','s','\'',0};
|
2004-07-10 00:25:34 +02:00
|
|
|
MSIQUERY * view;
|
|
|
|
UINT rc;
|
2005-06-23 18:43:24 +02:00
|
|
|
_ilfs ilfs;
|
|
|
|
|
2004-07-04 02:32:48 +02:00
|
|
|
/* fill in the data */
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
feature = msi_alloc_zero( sizeof (MSIFEATURE) );
|
2005-08-22 16:09:17 +02:00
|
|
|
if (!feature)
|
|
|
|
return ERROR_NOT_ENOUGH_MEMORY;
|
2005-08-19 12:03:11 +02:00
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
list_init( &feature->Components );
|
2004-07-04 02:32:48 +02:00
|
|
|
|
2005-09-13 12:37:37 +02:00
|
|
|
feature->Feature = load_dynamic_stringW( row, 1 );
|
2004-07-04 02:32:48 +02:00
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
TRACE("Loading feature %s\n",debugstr_w(feature->Feature));
|
2004-07-04 02:32:48 +02:00
|
|
|
|
2005-09-13 12:37:37 +02:00
|
|
|
feature->Feature_Parent = load_dynamic_stringW( row, 2 );
|
2005-09-08 14:42:31 +02:00
|
|
|
feature->Title = load_dynamic_stringW( row, 3 );
|
|
|
|
feature->Description = load_dynamic_stringW( row, 4 );
|
2004-07-04 02:32:48 +02:00
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
if (!MSI_RecordIsNull(row,5))
|
2005-08-22 16:09:17 +02:00
|
|
|
feature->Display = MSI_RecordGetInteger(row,5);
|
2004-07-04 02:32:48 +02:00
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
feature->Level= MSI_RecordGetInteger(row,6);
|
2005-09-13 12:37:37 +02:00
|
|
|
feature->Directory = load_dynamic_stringW( row, 7 );
|
2005-08-22 16:09:17 +02:00
|
|
|
feature->Attributes = MSI_RecordGetInteger(row,8);
|
2004-07-04 02:32:48 +02:00
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
feature->Installed = INSTALLSTATE_ABSENT;
|
|
|
|
feature->Action = INSTALLSTATE_UNKNOWN;
|
|
|
|
feature->ActionRequest = INSTALLSTATE_UNKNOWN;
|
2004-12-27 20:06:22 +01:00
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
list_add_tail( &package->features, &feature->entry );
|
2004-07-04 02:32:48 +02:00
|
|
|
|
|
|
|
/* load feature components */
|
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
rc = MSI_OpenQuery( package->db, &view, Query1, feature->Feature );
|
2004-07-10 00:25:34 +02:00
|
|
|
if (rc != ERROR_SUCCESS)
|
2005-06-23 18:43:24 +02:00
|
|
|
return ERROR_SUCCESS;
|
2004-07-04 02:32:48 +02:00
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
ilfs.package = package;
|
|
|
|
ilfs.feature = feature;
|
|
|
|
|
2005-06-23 18:43:24 +02:00
|
|
|
MSI_IterateRecords(view, NULL, iterate_load_featurecomponents , &ilfs);
|
2004-07-10 00:25:34 +02:00
|
|
|
msiobj_release(&view->hdr);
|
2005-06-23 18:43:24 +02:00
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
2004-07-04 02:32:48 +02:00
|
|
|
}
|
|
|
|
|
2005-06-23 18:43:24 +02:00
|
|
|
static UINT load_file(MSIRECORD *row, LPVOID param)
|
2004-07-04 02:35:52 +02:00
|
|
|
{
|
2005-06-23 18:43:24 +02:00
|
|
|
MSIPACKAGE* package = (MSIPACKAGE*)param;
|
2005-06-09 22:30:59 +02:00
|
|
|
LPCWSTR component;
|
2005-08-23 12:03:17 +02:00
|
|
|
MSIFILE *file;
|
2004-07-04 02:35:52 +02:00
|
|
|
|
|
|
|
/* fill in the data */
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
file = msi_alloc_zero( sizeof (MSIFILE) );
|
2005-08-23 12:03:17 +02:00
|
|
|
if (!file)
|
|
|
|
return ERROR_NOT_ENOUGH_MEMORY;
|
2004-12-22 16:05:07 +01:00
|
|
|
|
2005-08-23 12:03:17 +02:00
|
|
|
file->File = load_dynamic_stringW( row, 1 );
|
2004-07-04 02:35:52 +02:00
|
|
|
|
2005-08-23 12:03:17 +02:00
|
|
|
component = MSI_RecordGetString( row, 2 );
|
|
|
|
file->Component = get_loaded_component( package, component );
|
2005-06-09 22:30:59 +02:00
|
|
|
|
2005-08-23 12:03:17 +02:00
|
|
|
if (!file->Component)
|
2005-06-09 22:30:59 +02:00
|
|
|
ERR("Unfound Component %s\n",debugstr_w(component));
|
2004-07-04 02:32:48 +02:00
|
|
|
|
2005-08-23 12:03:17 +02:00
|
|
|
file->FileName = load_dynamic_stringW( row, 3 );
|
|
|
|
reduce_to_longfilename( file->FileName );
|
2005-05-18 15:23:52 +02:00
|
|
|
|
2005-08-23 12:03:17 +02:00
|
|
|
file->ShortName = load_dynamic_stringW( row, 3 );
|
|
|
|
reduce_to_shortfilename( file->ShortName );
|
2004-07-04 02:35:52 +02:00
|
|
|
|
2005-08-23 12:03:17 +02:00
|
|
|
file->FileSize = MSI_RecordGetInteger( row, 4 );
|
|
|
|
file->Version = load_dynamic_stringW( row, 5 );
|
|
|
|
file->Language = load_dynamic_stringW( row, 6 );
|
|
|
|
file->Attributes = MSI_RecordGetInteger( row, 7 );
|
|
|
|
file->Sequence = MSI_RecordGetInteger( row, 8 );
|
|
|
|
|
|
|
|
file->State = 0;
|
2004-07-04 02:35:52 +02:00
|
|
|
|
2005-08-23 12:03:17 +02:00
|
|
|
TRACE("File Loaded (%s)\n",debugstr_w(file->File));
|
2004-07-04 02:35:52 +02:00
|
|
|
|
2005-08-23 12:03:17 +02:00
|
|
|
list_add_tail( &package->files, &file->entry );
|
2004-07-04 02:35:52 +02:00
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-05-18 19:46:12 +02:00
|
|
|
static UINT load_all_files(MSIPACKAGE *package)
|
2004-07-04 02:35:52 +02:00
|
|
|
{
|
2004-07-10 00:25:34 +02:00
|
|
|
MSIQUERY * view;
|
2004-07-04 02:35:52 +02:00
|
|
|
UINT rc;
|
2005-03-01 12:45:19 +01:00
|
|
|
static const WCHAR Query[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ',
|
2005-05-20 11:40:42 +02:00
|
|
|
'`','F','i','l','e','`',' ', 'O','R','D','E','R',' ','B','Y',' ',
|
|
|
|
'`','S','e','q','u','e','n','c','e','`', 0};
|
2004-07-04 02:35:52 +02:00
|
|
|
|
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
rc = MSI_DatabaseOpenViewW(package->db, Query, &view);
|
2004-07-04 02:35:52 +02:00
|
|
|
if (rc != ERROR_SUCCESS)
|
2004-07-20 03:22:37 +02:00
|
|
|
return ERROR_SUCCESS;
|
2004-07-04 02:35:52 +02:00
|
|
|
|
2005-06-23 18:43:24 +02:00
|
|
|
rc = MSI_IterateRecords(view, NULL, load_file, package);
|
2004-07-10 00:25:34 +02:00
|
|
|
msiobj_release(&view->hdr);
|
2004-07-04 02:32:48 +02:00
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-05-18 19:46:12 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* I am not doing any of the costing functionality yet.
|
|
|
|
* Mostly looking at doing the Component and Feature loading
|
|
|
|
*
|
|
|
|
* The native MSI does A LOT of modification to tables here. Mostly adding
|
|
|
|
* a lot of temporary columns to the Feature and Component tables.
|
|
|
|
*
|
|
|
|
* note: Native msi also tracks the short filename. But I am only going to
|
|
|
|
* track the long ones. Also looking at this directory table
|
|
|
|
* it appears that the directory table does not get the parents
|
|
|
|
* resolved base on property only based on their entries in the
|
|
|
|
* directory table.
|
|
|
|
*/
|
|
|
|
static UINT ACTION_CostInitialize(MSIPACKAGE *package)
|
|
|
|
{
|
|
|
|
MSIQUERY * view;
|
|
|
|
UINT rc;
|
|
|
|
static const WCHAR Query_all[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ',
|
2005-05-20 11:40:42 +02:00
|
|
|
'`','F','e','a','t','u','r','e','`',0};
|
2005-05-18 19:46:12 +02:00
|
|
|
static const WCHAR szCosting[] =
|
|
|
|
{'C','o','s','t','i','n','g','C','o','m','p','l','e','t','e',0 };
|
|
|
|
static const WCHAR szZero[] = { '0', 0 };
|
|
|
|
WCHAR buffer[3];
|
|
|
|
DWORD sz = 3;
|
|
|
|
|
|
|
|
MSI_GetPropertyW(package, szCosting, buffer, &sz);
|
|
|
|
if (buffer[0]=='1')
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
|
|
|
|
MSI_SetPropertyW(package, szCosting, szZero);
|
|
|
|
MSI_SetPropertyW(package, cszRootDrive , c_colon);
|
|
|
|
|
|
|
|
rc = MSI_DatabaseOpenViewW(package->db,Query_all,&view);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
return rc;
|
|
|
|
|
2005-06-23 18:43:24 +02:00
|
|
|
rc = MSI_IterateRecords(view, NULL, load_feature, package);
|
2005-05-18 19:46:12 +02:00
|
|
|
msiobj_release(&view->hdr);
|
|
|
|
|
|
|
|
load_all_files(package);
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-06-07 22:29:51 +02:00
|
|
|
static UINT execute_script(MSIPACKAGE *package, UINT script )
|
2005-05-27 21:24:22 +02:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
UINT rc = ERROR_SUCCESS;
|
|
|
|
|
|
|
|
TRACE("Executing Script %i\n",script);
|
|
|
|
|
|
|
|
for (i = 0; i < package->script->ActionCount[script]; i++)
|
|
|
|
{
|
|
|
|
LPWSTR action;
|
|
|
|
action = package->script->Actions[script][i];
|
|
|
|
ui_actionstart(package, action);
|
|
|
|
TRACE("Executing Action (%s)\n",debugstr_w(action));
|
|
|
|
rc = ACTION_PerformAction(package, action, TRUE);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(package->script->Actions[script][i]);
|
2005-05-27 21:24:22 +02:00
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
break;
|
|
|
|
}
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(package->script->Actions[script]);
|
2005-05-27 21:24:22 +02:00
|
|
|
|
|
|
|
package->script->ActionCount[script] = 0;
|
|
|
|
package->script->Actions[script] = NULL;
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-05-18 19:46:12 +02:00
|
|
|
static UINT ACTION_FileCost(MSIPACKAGE *package)
|
|
|
|
{
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-08-23 20:15:44 +02:00
|
|
|
static MSIFOLDER *load_folder( MSIPACKAGE *package, LPCWSTR dir )
|
2004-07-04 02:32:48 +02:00
|
|
|
{
|
2004-12-22 16:25:30 +01:00
|
|
|
static const WCHAR Query[] =
|
2005-03-01 12:45:19 +01:00
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
2005-05-20 11:40:42 +02:00
|
|
|
'`','D','i','r','e','c', 't','o','r','y','`',' ',
|
|
|
|
'W','H','E','R','E',' ', '`', 'D','i','r','e','c','t', 'o','r','y','`',
|
|
|
|
' ','=',' ','\'','%','s','\'',
|
2005-03-01 12:45:19 +01:00
|
|
|
0};
|
2005-06-09 22:30:59 +02:00
|
|
|
LPWSTR ptargetdir, targetdir, srcdir;
|
|
|
|
LPCWSTR parent;
|
2005-05-16 23:37:35 +02:00
|
|
|
LPWSTR shortname = NULL;
|
2004-07-10 00:25:34 +02:00
|
|
|
MSIRECORD * row = 0;
|
2005-08-23 20:15:44 +02:00
|
|
|
MSIFOLDER *folder;
|
2004-06-29 05:44:01 +02:00
|
|
|
|
2004-07-04 02:32:48 +02:00
|
|
|
TRACE("Looking for dir %s\n",debugstr_w(dir));
|
2004-06-28 22:34:35 +02:00
|
|
|
|
2005-08-23 20:15:44 +02:00
|
|
|
folder = get_loaded_folder( package, dir );
|
|
|
|
if (folder)
|
|
|
|
return folder;
|
2004-06-28 22:34:35 +02:00
|
|
|
|
2004-07-04 02:32:48 +02:00
|
|
|
TRACE("Working to load %s\n",debugstr_w(dir));
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
folder = msi_alloc_zero( sizeof (MSIFOLDER) );
|
2005-08-23 20:15:44 +02:00
|
|
|
if (!folder)
|
|
|
|
return NULL;
|
2004-07-04 02:32:48 +02:00
|
|
|
|
2005-08-23 20:15:44 +02:00
|
|
|
folder->Directory = strdupW(dir);
|
2004-06-30 21:38:36 +02:00
|
|
|
|
2005-06-02 12:29:57 +02:00
|
|
|
row = MSI_QueryGetRecord(package->db, Query, dir);
|
|
|
|
if (!row)
|
2005-08-23 20:15:44 +02:00
|
|
|
return NULL;
|
2004-06-28 22:34:35 +02:00
|
|
|
|
2005-03-08 17:23:36 +01:00
|
|
|
ptargetdir = targetdir = load_dynamic_stringW(row,3);
|
2004-06-28 22:34:35 +02:00
|
|
|
|
|
|
|
/* split src and target dir */
|
|
|
|
if (strchrW(targetdir,':'))
|
|
|
|
{
|
|
|
|
srcdir=strchrW(targetdir,':');
|
|
|
|
*srcdir=0;
|
|
|
|
srcdir ++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
srcdir=NULL;
|
|
|
|
|
|
|
|
/* for now only pick long filename versions */
|
|
|
|
if (strchrW(targetdir,'|'))
|
|
|
|
{
|
2005-05-16 23:37:35 +02:00
|
|
|
shortname = targetdir;
|
2004-06-28 22:34:35 +02:00
|
|
|
targetdir = strchrW(targetdir,'|');
|
|
|
|
*targetdir = 0;
|
|
|
|
targetdir ++;
|
|
|
|
}
|
2005-05-16 23:37:35 +02:00
|
|
|
/* for the sourcedir pick the short filename */
|
2004-06-28 22:34:35 +02:00
|
|
|
if (srcdir && strchrW(srcdir,'|'))
|
|
|
|
{
|
2005-05-16 23:37:35 +02:00
|
|
|
LPWSTR p = strchrW(srcdir,'|');
|
|
|
|
*p = 0;
|
2004-06-28 22:34:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* now check for root dirs */
|
|
|
|
if (targetdir[0] == '.' && targetdir[1] == 0)
|
|
|
|
targetdir = NULL;
|
|
|
|
|
2004-12-22 16:25:30 +01:00
|
|
|
if (targetdir)
|
2004-06-28 22:34:35 +02:00
|
|
|
{
|
2004-12-22 16:25:30 +01:00
|
|
|
TRACE(" TargetDefault = %s\n",debugstr_w(targetdir));
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free( folder->TargetDefault);
|
2005-08-23 20:15:44 +02:00
|
|
|
folder->TargetDefault = strdupW(targetdir);
|
2004-06-28 22:34:35 +02:00
|
|
|
}
|
|
|
|
|
2004-12-22 16:25:30 +01:00
|
|
|
if (srcdir)
|
2005-08-23 20:15:44 +02:00
|
|
|
folder->SourceDefault = strdupW(srcdir);
|
2005-05-16 23:37:35 +02:00
|
|
|
else if (shortname)
|
2005-08-23 20:15:44 +02:00
|
|
|
folder->SourceDefault = strdupW(shortname);
|
2004-12-22 16:25:30 +01:00
|
|
|
else if (targetdir)
|
2005-08-23 20:15:44 +02:00
|
|
|
folder->SourceDefault = strdupW(targetdir);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(ptargetdir);
|
2005-08-23 20:15:44 +02:00
|
|
|
TRACE(" SourceDefault = %s\n", debugstr_w( folder->SourceDefault ));
|
2004-12-22 16:25:30 +01:00
|
|
|
|
2005-06-09 22:30:59 +02:00
|
|
|
parent = MSI_RecordGetString(row,2);
|
2004-12-22 16:25:30 +01:00
|
|
|
if (parent)
|
2004-06-28 22:34:35 +02:00
|
|
|
{
|
2005-08-23 20:15:44 +02:00
|
|
|
folder->Parent = load_folder( package, parent );
|
|
|
|
if ( folder->Parent )
|
|
|
|
TRACE("loaded parent %p %s\n", folder->Parent,
|
|
|
|
debugstr_w(folder->Parent->Directory));
|
|
|
|
else
|
|
|
|
ERR("failed to load parent folder %s\n", debugstr_w(parent));
|
2004-07-04 02:32:48 +02:00
|
|
|
}
|
2004-06-28 22:34:35 +02:00
|
|
|
|
2005-09-15 17:04:08 +02:00
|
|
|
folder->Property = msi_dup_property( package, dir );
|
2004-06-28 22:34:35 +02:00
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
msiobj_release(&row->hdr);
|
2005-08-23 20:15:44 +02:00
|
|
|
|
|
|
|
list_add_tail( &package->folders, &folder->entry );
|
|
|
|
|
|
|
|
TRACE("%s returning %p\n",debugstr_w(dir),folder);
|
|
|
|
|
|
|
|
return folder;
|
2004-06-28 22:34:35 +02:00
|
|
|
}
|
|
|
|
|
2005-02-22 16:47:00 +01:00
|
|
|
/* scan for and update current install states */
|
2005-06-07 22:29:51 +02:00
|
|
|
static void ACTION_UpdateInstallStates(MSIPACKAGE *package)
|
2005-02-22 16:47:00 +01:00
|
|
|
{
|
2005-08-22 11:15:23 +02:00
|
|
|
MSICOMPONENT *comp;
|
2005-08-22 16:09:17 +02:00
|
|
|
MSIFEATURE *feature;
|
2005-02-22 16:47:00 +01:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry )
|
2005-02-22 16:47:00 +01:00
|
|
|
{
|
|
|
|
INSTALLSTATE res;
|
2005-08-22 11:15:23 +02:00
|
|
|
res = MsiGetComponentPathW( package->ProductCode,
|
|
|
|
comp->ComponentId, NULL, NULL);
|
2005-02-22 16:47:00 +01:00
|
|
|
if (res < 0)
|
|
|
|
res = INSTALLSTATE_ABSENT;
|
2005-08-22 11:15:23 +02:00
|
|
|
comp->Installed = res;
|
2005-02-22 16:47:00 +01:00
|
|
|
}
|
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
|
2005-02-22 16:47:00 +01:00
|
|
|
{
|
2005-08-19 12:03:11 +02:00
|
|
|
ComponentList *cl;
|
2005-02-22 16:47:00 +01:00
|
|
|
INSTALLSTATE res = -10;
|
2005-08-19 12:03:11 +02:00
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( cl, &feature->Components, ComponentList, entry )
|
2005-02-22 16:47:00 +01:00
|
|
|
{
|
2005-08-22 11:15:23 +02:00
|
|
|
comp= cl->component;
|
2005-08-19 12:03:11 +02:00
|
|
|
|
2005-02-22 16:47:00 +01:00
|
|
|
if (res == -10)
|
2005-08-22 11:15:23 +02:00
|
|
|
res = comp->Installed;
|
2005-02-22 16:47:00 +01:00
|
|
|
else
|
|
|
|
{
|
2005-08-22 11:15:23 +02:00
|
|
|
if (res == comp->Installed)
|
2005-02-22 16:47:00 +01:00
|
|
|
continue;
|
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
if (res != comp->Installed)
|
2005-02-22 16:47:00 +01:00
|
|
|
res = INSTALLSTATE_INCOMPLETE;
|
|
|
|
}
|
|
|
|
}
|
2005-08-25 21:19:10 +02:00
|
|
|
feature->Installed = res;
|
2005-02-22 16:47:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL process_state_property (MSIPACKAGE* package, LPCWSTR property,
|
|
|
|
INSTALLSTATE state)
|
2004-12-27 20:02:59 +01:00
|
|
|
{
|
|
|
|
static const WCHAR all[]={'A','L','L',0};
|
2005-09-08 13:03:35 +02:00
|
|
|
LPWSTR override;
|
2005-08-22 16:09:17 +02:00
|
|
|
MSIFEATURE *feature;
|
2004-12-27 20:02:59 +01:00
|
|
|
|
2005-09-15 17:04:08 +02:00
|
|
|
override = msi_dup_property( package, property );
|
2005-09-08 13:03:35 +02:00
|
|
|
if (!override)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
|
2004-12-27 20:02:59 +01:00
|
|
|
{
|
2005-09-08 13:03:35 +02:00
|
|
|
if (strcmpiW(override,all)==0)
|
2004-12-27 20:06:22 +01:00
|
|
|
{
|
2005-09-08 13:03:35 +02:00
|
|
|
feature->ActionRequest= state;
|
|
|
|
feature->Action = state;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
LPWSTR ptr = override;
|
|
|
|
LPWSTR ptr2 = strchrW(override,',');
|
2004-12-27 20:12:35 +01:00
|
|
|
|
2005-09-08 13:03:35 +02:00
|
|
|
while (ptr)
|
|
|
|
{
|
|
|
|
if ((ptr2 && strncmpW(ptr,feature->Feature, ptr2-ptr)==0)
|
|
|
|
|| (!ptr2 && strcmpW(ptr,feature->Feature)==0))
|
2004-12-27 20:12:35 +01:00
|
|
|
{
|
2005-09-08 13:03:35 +02:00
|
|
|
feature->ActionRequest= state;
|
|
|
|
feature->Action = state;
|
|
|
|
break;
|
2004-12-27 20:12:35 +01:00
|
|
|
}
|
2005-09-08 13:03:35 +02:00
|
|
|
if (ptr2)
|
|
|
|
{
|
|
|
|
ptr=ptr2+1;
|
|
|
|
ptr2 = strchrW(ptr,',');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
2004-12-27 20:12:35 +01:00
|
|
|
}
|
2004-12-27 20:06:22 +01:00
|
|
|
}
|
|
|
|
}
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(override);
|
2005-02-22 16:47:00 +01:00
|
|
|
|
2005-09-08 13:03:35 +02:00
|
|
|
return TRUE;
|
2005-02-22 16:47:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT SetFeatureStates(MSIPACKAGE *package)
|
|
|
|
{
|
2005-09-29 12:32:39 +02:00
|
|
|
int install_level;
|
2005-03-01 12:45:19 +01:00
|
|
|
static const WCHAR szlevel[] =
|
|
|
|
{'I','N','S','T','A','L','L','L','E','V','E','L',0};
|
|
|
|
static const WCHAR szAddLocal[] =
|
|
|
|
{'A','D','D','L','O','C','A','L',0};
|
|
|
|
static const WCHAR szRemove[] =
|
|
|
|
{'R','E','M','O','V','E',0};
|
2005-02-22 16:47:00 +01:00
|
|
|
BOOL override = FALSE;
|
2005-08-22 11:15:23 +02:00
|
|
|
MSICOMPONENT* component;
|
2005-08-22 16:09:17 +02:00
|
|
|
MSIFEATURE *feature;
|
|
|
|
|
2005-02-22 16:47:00 +01:00
|
|
|
|
|
|
|
/* I do not know if this is where it should happen.. but */
|
|
|
|
|
|
|
|
TRACE("Checking Install Level\n");
|
|
|
|
|
2005-09-29 12:32:39 +02:00
|
|
|
install_level = msi_get_property_int( package, szlevel, 1 );
|
2005-02-22 16:47:00 +01:00
|
|
|
|
|
|
|
/* ok hereis the _real_ rub
|
2005-03-02 14:53:50 +01:00
|
|
|
* all these activation/deactivation things happen in order and things
|
|
|
|
* later on the list override things earlier on the list.
|
2005-02-22 16:47:00 +01:00
|
|
|
* 1) INSTALLLEVEL processing
|
|
|
|
* 2) ADDLOCAL
|
|
|
|
* 3) REMOVE
|
|
|
|
* 4) ADDSOURCE
|
|
|
|
* 5) ADDDEFAULT
|
|
|
|
* 6) REINSTALL
|
|
|
|
* 7) COMPADDLOCAL
|
|
|
|
* 8) COMPADDSOURCE
|
|
|
|
* 9) FILEADDLOCAL
|
|
|
|
* 10) FILEADDSOURCE
|
|
|
|
* 11) FILEADDDEFAULT
|
2005-03-02 14:53:50 +01:00
|
|
|
* I have confirmed that if ADDLOCAL is stated then the INSTALLLEVEL is
|
|
|
|
* ignored for all the features. seems strange, especially since it is not
|
2005-02-22 16:47:00 +01:00
|
|
|
* documented anywhere, but it is how it works.
|
|
|
|
*
|
2005-03-02 14:53:50 +01:00
|
|
|
* I am still ignoring a lot of these. But that is ok for now, ADDLOCAL and
|
|
|
|
* REMOVE are the big ones, since we don't handle administrative installs
|
|
|
|
* yet anyway.
|
2005-02-22 16:47:00 +01:00
|
|
|
*/
|
|
|
|
override |= process_state_property(package,szAddLocal,INSTALLSTATE_LOCAL);
|
|
|
|
override |= process_state_property(package,szRemove,INSTALLSTATE_ABSENT);
|
|
|
|
|
|
|
|
if (!override)
|
2004-12-27 20:06:22 +01:00
|
|
|
{
|
2005-08-22 16:09:17 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
|
2004-12-27 20:06:22 +01:00
|
|
|
{
|
2005-08-22 16:09:17 +02:00
|
|
|
BOOL feature_state = ((feature->Level > 0) &&
|
|
|
|
(feature->Level <= install_level));
|
2004-12-27 20:02:59 +01:00
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
if ((feature_state) && (feature->Action == INSTALLSTATE_UNKNOWN))
|
2004-12-27 20:06:22 +01:00
|
|
|
{
|
2005-08-22 16:09:17 +02:00
|
|
|
if (feature->Attributes & msidbFeatureAttributesFavorSource)
|
2005-05-13 15:56:39 +02:00
|
|
|
{
|
2005-08-22 16:09:17 +02:00
|
|
|
feature->ActionRequest = INSTALLSTATE_SOURCE;
|
|
|
|
feature->Action = INSTALLSTATE_SOURCE;
|
2005-05-13 15:56:39 +02:00
|
|
|
}
|
2005-08-22 16:09:17 +02:00
|
|
|
else if (feature->Attributes & msidbFeatureAttributesFavorAdvertise)
|
2005-05-13 15:56:39 +02:00
|
|
|
{
|
2005-08-22 16:09:17 +02:00
|
|
|
feature->ActionRequest = INSTALLSTATE_ADVERTISED;
|
|
|
|
feature->Action = INSTALLSTATE_ADVERTISED;
|
2005-05-13 15:56:39 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-08-22 16:09:17 +02:00
|
|
|
feature->ActionRequest = INSTALLSTATE_LOCAL;
|
|
|
|
feature->Action = INSTALLSTATE_LOCAL;
|
2005-05-13 15:56:39 +02:00
|
|
|
}
|
2004-12-27 20:06:22 +01:00
|
|
|
}
|
2004-12-27 20:02:59 +01:00
|
|
|
}
|
2004-12-27 20:06:22 +01:00
|
|
|
}
|
2005-06-08 21:20:02 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* set the Preselected Property */
|
|
|
|
static const WCHAR szPreselected[] = {'P','r','e','s','e','l','e','c','t','e','d',0};
|
|
|
|
static const WCHAR szOne[] = { '1', 0 };
|
|
|
|
|
|
|
|
MSI_SetPropertyW(package,szPreselected,szOne);
|
|
|
|
}
|
2004-12-27 20:06:22 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* now we want to enable or disable components base on feature
|
|
|
|
*/
|
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
|
2004-12-27 20:06:22 +01:00
|
|
|
{
|
2005-08-19 12:03:11 +02:00
|
|
|
ComponentList *cl;
|
|
|
|
|
2004-12-27 20:06:22 +01:00
|
|
|
TRACE("Examining Feature %s (Installed %i, Action %i, Request %i)\n",
|
|
|
|
debugstr_w(feature->Feature), feature->Installed, feature->Action,
|
|
|
|
feature->ActionRequest);
|
2004-12-27 20:02:59 +01:00
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( cl, &feature->Components, ComponentList, entry )
|
2004-12-27 20:02:59 +01:00
|
|
|
{
|
2005-08-22 11:15:23 +02:00
|
|
|
component = cl->component;
|
2004-12-27 20:06:22 +01:00
|
|
|
|
|
|
|
if (!component->Enabled)
|
|
|
|
{
|
2005-02-22 16:47:00 +01:00
|
|
|
component->Action = INSTALLSTATE_UNKNOWN;
|
|
|
|
component->ActionRequest = INSTALLSTATE_UNKNOWN;
|
2004-12-27 20:06:22 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (feature->Action == INSTALLSTATE_LOCAL)
|
2005-02-22 16:47:00 +01:00
|
|
|
{
|
2004-12-27 20:06:22 +01:00
|
|
|
component->Action = INSTALLSTATE_LOCAL;
|
|
|
|
component->ActionRequest = INSTALLSTATE_LOCAL;
|
2005-02-22 16:47:00 +01:00
|
|
|
}
|
2005-05-13 15:56:39 +02:00
|
|
|
else if (feature->ActionRequest == INSTALLSTATE_SOURCE)
|
|
|
|
{
|
|
|
|
if ((component->Action == INSTALLSTATE_UNKNOWN) ||
|
|
|
|
(component->Action == INSTALLSTATE_ABSENT) ||
|
|
|
|
(component->Action == INSTALLSTATE_ADVERTISED))
|
|
|
|
|
|
|
|
{
|
|
|
|
component->Action = INSTALLSTATE_SOURCE;
|
|
|
|
component->ActionRequest = INSTALLSTATE_SOURCE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (feature->ActionRequest == INSTALLSTATE_ADVERTISED)
|
|
|
|
{
|
|
|
|
if ((component->Action == INSTALLSTATE_UNKNOWN) ||
|
|
|
|
(component->Action == INSTALLSTATE_ABSENT))
|
|
|
|
|
|
|
|
{
|
|
|
|
component->Action = INSTALLSTATE_ADVERTISED;
|
|
|
|
component->ActionRequest = INSTALLSTATE_ADVERTISED;
|
|
|
|
}
|
|
|
|
}
|
2005-02-22 16:47:00 +01:00
|
|
|
else if (feature->ActionRequest == INSTALLSTATE_ABSENT)
|
|
|
|
{
|
|
|
|
if (component->Action == INSTALLSTATE_UNKNOWN)
|
|
|
|
{
|
|
|
|
component->Action = INSTALLSTATE_ABSENT;
|
|
|
|
component->ActionRequest = INSTALLSTATE_ABSENT;
|
|
|
|
}
|
|
|
|
}
|
2004-12-27 20:06:22 +01:00
|
|
|
}
|
2004-12-27 20:02:59 +01:00
|
|
|
}
|
|
|
|
}
|
2004-12-27 20:06:22 +01:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( component, &package->components, MSICOMPONENT, entry )
|
2004-12-27 20:06:22 +01:00
|
|
|
{
|
|
|
|
TRACE("Result: Component %s (Installed %i, Action %i, Request %i)\n",
|
|
|
|
debugstr_w(component->Component), component->Installed,
|
|
|
|
component->Action, component->ActionRequest);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-12-27 20:02:59 +01:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-06-21 22:50:12 +02:00
|
|
|
static UINT ITERATE_CostFinalizeDirectories(MSIRECORD *row, LPVOID param)
|
|
|
|
{
|
|
|
|
MSIPACKAGE *package = (MSIPACKAGE*)param;
|
|
|
|
LPCWSTR name;
|
|
|
|
LPWSTR path;
|
|
|
|
|
|
|
|
name = MSI_RecordGetString(row,1);
|
|
|
|
|
|
|
|
/* This helper function now does ALL the work */
|
|
|
|
TRACE("Dir %s ...\n",debugstr_w(name));
|
|
|
|
load_folder(package,name);
|
|
|
|
path = resolve_folder(package,name,FALSE,TRUE,NULL);
|
|
|
|
TRACE("resolves to %s\n",debugstr_w(path));
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(path);
|
2005-06-21 22:50:12 +02:00
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ITERATE_CostFinalizeConditions(MSIRECORD *row, LPVOID param)
|
|
|
|
{
|
|
|
|
MSIPACKAGE *package = (MSIPACKAGE*)param;
|
2005-08-22 16:09:17 +02:00
|
|
|
LPCWSTR name;
|
|
|
|
MSIFEATURE *feature;
|
2005-06-21 22:50:12 +02:00
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
name = MSI_RecordGetString( row, 1 );
|
2005-06-21 22:50:12 +02:00
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
feature = get_loaded_feature( package, name );
|
|
|
|
if (!feature)
|
|
|
|
ERR("FAILED to find loaded feature %s\n",debugstr_w(name));
|
2005-06-21 22:50:12 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
LPCWSTR Condition;
|
|
|
|
Condition = MSI_RecordGetString(row,3);
|
|
|
|
|
2005-06-24 13:51:29 +02:00
|
|
|
if (MSI_EvaluateConditionW(package,Condition) == MSICONDITION_TRUE)
|
2005-06-21 22:50:12 +02:00
|
|
|
{
|
|
|
|
int level = MSI_RecordGetInteger(row,2);
|
2005-08-22 16:09:17 +02:00
|
|
|
TRACE("Reseting feature %s to level %i\n", debugstr_w(name), level);
|
|
|
|
feature->Level = level;
|
2005-06-21 22:50:12 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-06-28 22:34:35 +02:00
|
|
|
/*
|
2005-01-26 22:09:04 +01:00
|
|
|
* A lot is done in this function aside from just the costing.
|
2004-07-04 02:25:00 +02:00
|
|
|
* The costing needs to be implemented at some point but for now I am going
|
2004-06-28 22:34:35 +02:00
|
|
|
* to focus on the directory building
|
|
|
|
*
|
|
|
|
*/
|
2004-07-10 00:25:34 +02:00
|
|
|
static UINT ACTION_CostFinalize(MSIPACKAGE *package)
|
2004-06-28 22:34:35 +02:00
|
|
|
{
|
2005-03-01 12:45:19 +01:00
|
|
|
static const WCHAR ExecSeqQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
2005-05-20 11:40:42 +02:00
|
|
|
'`','D','i','r','e','c','t','o','r','y','`',0};
|
2005-03-01 12:45:19 +01:00
|
|
|
static const WCHAR ConditionQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
2005-05-20 11:40:42 +02:00
|
|
|
'`','C','o','n','d','i','t','i','o','n','`',0};
|
2005-03-01 12:45:19 +01:00
|
|
|
static const WCHAR szCosting[] =
|
|
|
|
{'C','o','s','t','i','n','g','C','o','m','p','l','e','t','e',0 };
|
|
|
|
static const WCHAR szlevel[] =
|
|
|
|
{'I','N','S','T','A','L','L','L','E','V','E','L',0};
|
2004-07-10 00:25:34 +02:00
|
|
|
static const WCHAR szOne[] = { '1', 0 };
|
2005-08-22 11:15:23 +02:00
|
|
|
MSICOMPONENT *comp;
|
2005-08-23 12:03:17 +02:00
|
|
|
MSIFILE *file;
|
2004-06-28 22:34:35 +02:00
|
|
|
UINT rc;
|
2004-07-10 00:25:34 +02:00
|
|
|
MSIQUERY * view;
|
2004-12-27 19:56:30 +01:00
|
|
|
LPWSTR level;
|
2005-05-13 15:56:39 +02:00
|
|
|
DWORD sz = 3;
|
|
|
|
WCHAR buffer[3];
|
|
|
|
|
|
|
|
MSI_GetPropertyW(package, szCosting, buffer, &sz);
|
|
|
|
if (buffer[0]=='1')
|
|
|
|
return ERROR_SUCCESS;
|
2004-06-29 05:44:01 +02:00
|
|
|
|
2004-06-28 22:34:35 +02:00
|
|
|
TRACE("Building Directory properties\n");
|
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
|
2004-07-20 03:22:37 +02:00
|
|
|
if (rc == ERROR_SUCCESS)
|
2004-06-28 22:34:35 +02:00
|
|
|
{
|
2005-06-21 22:50:12 +02:00
|
|
|
rc = MSI_IterateRecords(view, NULL, ITERATE_CostFinalizeDirectories,
|
|
|
|
package);
|
2004-07-20 03:22:37 +02:00
|
|
|
msiobj_release(&view->hdr);
|
|
|
|
}
|
2004-06-28 22:34:35 +02:00
|
|
|
|
2005-08-23 12:03:17 +02:00
|
|
|
TRACE("File calculations\n");
|
2004-07-04 02:35:52 +02:00
|
|
|
|
2005-08-23 12:03:17 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
|
2004-07-04 02:35:52 +02:00
|
|
|
{
|
2005-09-09 16:48:51 +02:00
|
|
|
MSICOMPONENT* comp = file->Component;
|
|
|
|
LPWSTR p;
|
2004-07-04 02:35:52 +02:00
|
|
|
|
2005-09-09 16:48:51 +02:00
|
|
|
if (!comp)
|
|
|
|
continue;
|
2004-07-04 02:35:52 +02:00
|
|
|
|
2005-09-09 16:48:51 +02:00
|
|
|
/* calculate target */
|
|
|
|
p = resolve_folder(package, comp->Directory, FALSE, FALSE, NULL);
|
2004-12-22 16:25:30 +01:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(file->TargetPath);
|
2004-12-22 19:46:17 +01:00
|
|
|
|
2005-09-09 16:48:51 +02:00
|
|
|
TRACE("file %s is named %s\n",
|
|
|
|
debugstr_w(file->File),debugstr_w(file->FileName));
|
2004-12-22 19:46:17 +01:00
|
|
|
|
2005-09-09 16:48:51 +02:00
|
|
|
file->TargetPath = build_directory_name(2, p, file->FileName);
|
2004-12-22 19:46:17 +01:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(p);
|
2004-07-04 02:35:52 +02:00
|
|
|
|
2005-09-09 16:48:51 +02:00
|
|
|
TRACE("file %s resolves to %s\n",
|
|
|
|
debugstr_w(file->File),debugstr_w(file->TargetPath));
|
2004-12-22 19:46:17 +01:00
|
|
|
|
2005-09-09 16:48:51 +02:00
|
|
|
if (GetFileAttributesW(file->TargetPath) == INVALID_FILE_ATTRIBUTES)
|
|
|
|
{
|
|
|
|
file->State = 1;
|
|
|
|
comp->Cost += file->FileSize;
|
|
|
|
continue;
|
|
|
|
}
|
2004-12-22 19:46:17 +01:00
|
|
|
|
2005-09-09 16:48:51 +02:00
|
|
|
if (file->Version)
|
|
|
|
{
|
|
|
|
DWORD handle;
|
|
|
|
DWORD versize;
|
|
|
|
UINT sz;
|
|
|
|
LPVOID version;
|
|
|
|
static const WCHAR name[] =
|
|
|
|
{'\\',0};
|
|
|
|
static const WCHAR name_fmt[] =
|
|
|
|
{'%','u','.','%','u','.','%','u','.','%','u',0};
|
|
|
|
WCHAR filever[0x100];
|
|
|
|
VS_FIXEDFILEINFO *lpVer;
|
|
|
|
|
|
|
|
TRACE("Version comparison.. \n");
|
|
|
|
versize = GetFileVersionInfoSizeW(file->TargetPath,&handle);
|
2005-09-20 13:59:14 +02:00
|
|
|
version = msi_alloc(versize);
|
2005-09-09 16:48:51 +02:00
|
|
|
GetFileVersionInfoW(file->TargetPath, 0, versize, version);
|
|
|
|
|
|
|
|
VerQueryValueW(version, name, (LPVOID*)&lpVer, &sz);
|
|
|
|
|
|
|
|
sprintfW(filever,name_fmt,
|
|
|
|
HIWORD(lpVer->dwFileVersionMS),
|
|
|
|
LOWORD(lpVer->dwFileVersionMS),
|
|
|
|
HIWORD(lpVer->dwFileVersionLS),
|
|
|
|
LOWORD(lpVer->dwFileVersionLS));
|
|
|
|
|
|
|
|
TRACE("new %s old %s\n", debugstr_w(file->Version),
|
|
|
|
debugstr_w(filever));
|
|
|
|
if (strcmpiW(filever,file->Version)<0)
|
2004-07-04 02:35:52 +02:00
|
|
|
{
|
2005-09-09 16:48:51 +02:00
|
|
|
file->State = 2;
|
|
|
|
FIXME("cost should be diff in size\n");
|
2004-07-04 02:35:52 +02:00
|
|
|
comp->Cost += file->FileSize;
|
|
|
|
}
|
|
|
|
else
|
2005-09-09 16:48:51 +02:00
|
|
|
file->State = 3;
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(version);
|
2005-09-09 16:48:51 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
file->State = 3;
|
2004-07-04 02:35:52 +02:00
|
|
|
}
|
|
|
|
|
2004-07-04 02:36:58 +02:00
|
|
|
TRACE("Evaluating Condition Table\n");
|
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
rc = MSI_DatabaseOpenViewW(package->db, ConditionQuery, &view);
|
2004-07-20 03:22:37 +02:00
|
|
|
if (rc == ERROR_SUCCESS)
|
|
|
|
{
|
2005-06-21 22:50:12 +02:00
|
|
|
rc = MSI_IterateRecords(view, NULL, ITERATE_CostFinalizeConditions,
|
|
|
|
package);
|
2005-01-04 21:36:12 +01:00
|
|
|
msiobj_release(&view->hdr);
|
2004-07-20 03:22:37 +02:00
|
|
|
}
|
2004-07-04 02:36:58 +02:00
|
|
|
|
|
|
|
TRACE("Enabling or Disabling Components\n");
|
2005-08-22 11:15:23 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry )
|
2004-07-04 02:36:58 +02:00
|
|
|
{
|
2005-09-06 13:39:01 +02:00
|
|
|
if (comp->Condition)
|
2004-07-04 02:36:58 +02:00
|
|
|
{
|
2004-07-10 00:25:34 +02:00
|
|
|
if (MSI_EvaluateConditionW(package,
|
2005-08-22 11:15:23 +02:00
|
|
|
comp->Condition) == MSICONDITION_FALSE)
|
2004-07-04 02:36:58 +02:00
|
|
|
{
|
2005-08-22 11:15:23 +02:00
|
|
|
TRACE("Disabling component %s\n", debugstr_w(comp->Component));
|
|
|
|
comp->Enabled = FALSE;
|
2004-07-04 02:36:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
MSI_SetPropertyW(package,szCosting,szOne);
|
2004-12-27 19:56:30 +01:00
|
|
|
/* set default run level if not set */
|
2005-09-15 17:04:08 +02:00
|
|
|
level = msi_dup_property( package, szlevel );
|
2004-12-27 19:56:30 +01:00
|
|
|
if (!level)
|
|
|
|
MSI_SetPropertyW(package,szlevel, szOne);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(level);
|
2004-12-27 20:02:59 +01:00
|
|
|
|
2005-02-22 16:47:00 +01:00
|
|
|
ACTION_UpdateInstallStates(package);
|
2004-12-27 20:02:59 +01:00
|
|
|
|
2005-02-22 16:47:00 +01:00
|
|
|
return SetFeatureStates(package);
|
2004-06-28 22:34:35 +02:00
|
|
|
}
|
|
|
|
|
2005-01-26 22:09:04 +01:00
|
|
|
/* OK this value is "interpreted" and then formatted based on the
|
2004-06-29 06:07:22 +02:00
|
|
|
first few characters */
|
2005-06-09 22:30:59 +02:00
|
|
|
static LPSTR parse_value(MSIPACKAGE *package, LPCWSTR value, DWORD *type,
|
2004-06-28 22:34:35 +02:00
|
|
|
DWORD *size)
|
|
|
|
{
|
|
|
|
LPSTR data = NULL;
|
2004-06-29 06:07:22 +02:00
|
|
|
if (value[0]=='#' && value[1]!='#' && value[1]!='%')
|
2004-06-28 22:34:35 +02:00
|
|
|
{
|
2004-06-29 06:07:22 +02:00
|
|
|
if (value[1]=='x')
|
|
|
|
{
|
|
|
|
LPWSTR ptr;
|
|
|
|
CHAR byte[5];
|
2005-05-16 23:37:35 +02:00
|
|
|
LPWSTR deformated = NULL;
|
2004-06-29 06:07:22 +02:00
|
|
|
int count;
|
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
deformat_string(package, &value[2], &deformated);
|
2004-06-29 06:07:22 +02:00
|
|
|
|
|
|
|
/* binary value type */
|
2005-05-16 23:37:35 +02:00
|
|
|
ptr = deformated;
|
|
|
|
*type = REG_BINARY;
|
|
|
|
if (strlenW(ptr)%2)
|
|
|
|
*size = (strlenW(ptr)/2)+1;
|
|
|
|
else
|
|
|
|
*size = strlenW(ptr)/2;
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
data = msi_alloc(*size);
|
2005-05-16 23:37:35 +02:00
|
|
|
|
2004-06-29 06:07:22 +02:00
|
|
|
byte[0] = '0';
|
|
|
|
byte[1] = 'x';
|
|
|
|
byte[4] = 0;
|
|
|
|
count = 0;
|
2005-05-16 23:37:35 +02:00
|
|
|
/* if uneven pad with a zero in front */
|
|
|
|
if (strlenW(ptr)%2)
|
|
|
|
{
|
|
|
|
byte[2]= '0';
|
|
|
|
byte[3]= *ptr;
|
|
|
|
ptr++;
|
|
|
|
data[count] = (BYTE)strtol(byte,NULL,0);
|
|
|
|
count ++;
|
|
|
|
TRACE("Uneven byte count\n");
|
|
|
|
}
|
2004-06-29 06:07:22 +02:00
|
|
|
while (*ptr)
|
|
|
|
{
|
|
|
|
byte[2]= *ptr;
|
|
|
|
ptr++;
|
|
|
|
byte[3]= *ptr;
|
|
|
|
ptr++;
|
|
|
|
data[count] = (BYTE)strtol(byte,NULL,0);
|
|
|
|
count ++;
|
|
|
|
}
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(deformated);
|
2004-06-29 06:07:22 +02:00
|
|
|
|
|
|
|
TRACE("Data %li bytes(%i)\n",*size,count);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
LPWSTR deformated;
|
2005-02-24 13:47:43 +01:00
|
|
|
LPWSTR p;
|
|
|
|
DWORD d = 0;
|
2004-07-10 00:25:34 +02:00
|
|
|
deformat_string(package, &value[1], &deformated);
|
2004-06-29 06:07:22 +02:00
|
|
|
|
|
|
|
*type=REG_DWORD;
|
|
|
|
*size = sizeof(DWORD);
|
2005-09-20 13:59:14 +02:00
|
|
|
data = msi_alloc(*size);
|
2005-02-24 13:47:43 +01:00
|
|
|
p = deformated;
|
|
|
|
if (*p == '-')
|
|
|
|
p++;
|
|
|
|
while (*p)
|
|
|
|
{
|
|
|
|
if ( (*p < '0') || (*p > '9') )
|
|
|
|
break;
|
|
|
|
d *= 10;
|
|
|
|
d += (*p - '0');
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
if (deformated[0] == '-')
|
|
|
|
d = -d;
|
|
|
|
*(LPDWORD)data = d;
|
|
|
|
TRACE("DWORD %li\n",*(LPDWORD)data);
|
2004-06-29 06:07:22 +02:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(deformated);
|
2004-06-29 06:07:22 +02:00
|
|
|
}
|
2004-06-28 22:34:35 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-01-25 21:17:09 +01:00
|
|
|
static const WCHAR szMulti[] = {'[','~',']',0};
|
2005-06-09 22:30:59 +02:00
|
|
|
LPCWSTR ptr;
|
2004-06-29 06:07:22 +02:00
|
|
|
*type=REG_SZ;
|
|
|
|
|
2004-06-28 22:34:35 +02:00
|
|
|
if (value[0]=='#')
|
2004-06-29 06:07:22 +02:00
|
|
|
{
|
|
|
|
if (value[1]=='%')
|
|
|
|
{
|
|
|
|
ptr = &value[2];
|
|
|
|
*type=REG_EXPAND_SZ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ptr = &value[1];
|
|
|
|
}
|
|
|
|
else
|
2004-06-28 22:34:35 +02:00
|
|
|
ptr=value;
|
|
|
|
|
2005-01-25 21:17:09 +01:00
|
|
|
if (strstrW(value,szMulti))
|
|
|
|
*type = REG_MULTI_SZ;
|
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
*size = deformat_string(package, ptr,(LPWSTR*)&data);
|
2004-06-28 22:34:35 +02:00
|
|
|
}
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
2005-06-21 22:21:18 +02:00
|
|
|
static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param)
|
2004-06-28 22:34:35 +02:00
|
|
|
{
|
2005-06-21 22:21:18 +02:00
|
|
|
MSIPACKAGE *package = (MSIPACKAGE*)param;
|
|
|
|
static const WCHAR szHCR[] =
|
|
|
|
{'H','K','E','Y','_','C','L','A','S','S','E','S','_',
|
|
|
|
'R','O','O','T','\\',0};
|
|
|
|
static const WCHAR szHCU[] =
|
|
|
|
{'H','K','E','Y','_','C','U','R','R','E','N','T','_',
|
|
|
|
'U','S','E','R','\\',0};
|
|
|
|
static const WCHAR szHLM[] =
|
|
|
|
{'H','K','E','Y','_','L','O','C','A','L','_',
|
|
|
|
'M','A','C','H','I','N','E','\\',0};
|
|
|
|
static const WCHAR szHU[] =
|
|
|
|
{'H','K','E','Y','_','U','S','E','R','S','\\',0};
|
|
|
|
|
|
|
|
LPSTR value_data = NULL;
|
|
|
|
HKEY root_key, hkey;
|
|
|
|
DWORD type,size;
|
|
|
|
LPWSTR deformated;
|
|
|
|
LPCWSTR szRoot, component, name, key, value;
|
2005-08-22 11:15:23 +02:00
|
|
|
MSICOMPONENT *comp;
|
2005-06-21 22:21:18 +02:00
|
|
|
MSIRECORD * uirow;
|
|
|
|
LPWSTR uikey;
|
|
|
|
INT root;
|
|
|
|
BOOL check_first = FALSE;
|
2004-06-28 22:34:35 +02:00
|
|
|
UINT rc;
|
|
|
|
|
2005-06-21 22:21:18 +02:00
|
|
|
ui_progress(package,2,0,0,0);
|
2004-07-04 02:36:58 +02:00
|
|
|
|
2005-06-21 22:21:18 +02:00
|
|
|
value = NULL;
|
|
|
|
key = NULL;
|
|
|
|
uikey = NULL;
|
|
|
|
name = NULL;
|
2004-06-28 22:34:35 +02:00
|
|
|
|
2005-06-21 22:21:18 +02:00
|
|
|
component = MSI_RecordGetString(row, 6);
|
2005-08-22 11:15:23 +02:00
|
|
|
comp = get_loaded_component(package,component);
|
2005-08-24 12:57:27 +02:00
|
|
|
if (!comp)
|
|
|
|
return ERROR_SUCCESS;
|
2004-07-06 20:48:15 +02:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
if (!ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_LOCAL))
|
2004-06-28 22:34:35 +02:00
|
|
|
{
|
2005-06-21 22:21:18 +02:00
|
|
|
TRACE("Skipping write due to disabled component %s\n",
|
|
|
|
debugstr_w(component));
|
2005-01-31 17:23:12 +01:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
comp->Action = comp->Installed;
|
2005-01-31 17:23:12 +01:00
|
|
|
|
2005-06-21 22:21:18 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2004-07-04 02:36:58 +02:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
comp->Action = INSTALLSTATE_LOCAL;
|
2005-01-31 17:23:12 +01:00
|
|
|
|
2005-06-21 22:21:18 +02:00
|
|
|
name = MSI_RecordGetString(row, 4);
|
|
|
|
if( MSI_RecordIsNull(row,5) && name )
|
|
|
|
{
|
|
|
|
/* null values can have special meanings */
|
|
|
|
if (name[0]=='-' && name[1] == 0)
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
else if ((name[0]=='+' && name[1] == 0) ||
|
|
|
|
(name[0] == '*' && name[1] == 0))
|
2005-02-24 13:47:43 +01:00
|
|
|
name = NULL;
|
2005-06-21 22:21:18 +02:00
|
|
|
check_first = TRUE;
|
|
|
|
}
|
2004-06-28 22:34:35 +02:00
|
|
|
|
2005-06-21 22:21:18 +02:00
|
|
|
root = MSI_RecordGetInteger(row,2);
|
|
|
|
key = MSI_RecordGetString(row, 3);
|
|
|
|
|
|
|
|
/* get the root key */
|
|
|
|
switch (root)
|
|
|
|
{
|
2005-06-24 13:51:29 +02:00
|
|
|
case -1:
|
|
|
|
{
|
|
|
|
static const WCHAR szALLUSER[] = {'A','L','L','U','S','E','R','S',0};
|
2005-09-15 17:04:08 +02:00
|
|
|
LPWSTR all_users = msi_dup_property( package, szALLUSER );
|
2005-06-24 13:51:29 +02:00
|
|
|
if (all_users && all_users[0] == '1')
|
|
|
|
{
|
|
|
|
root_key = HKEY_LOCAL_MACHINE;
|
|
|
|
szRoot = szHLM;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
root_key = HKEY_CURRENT_USER;
|
|
|
|
szRoot = szHCU;
|
|
|
|
}
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(all_users);
|
2005-06-24 13:51:29 +02:00
|
|
|
}
|
|
|
|
break;
|
2005-06-21 22:21:18 +02:00
|
|
|
case 0: root_key = HKEY_CLASSES_ROOT;
|
|
|
|
szRoot = szHCR;
|
|
|
|
break;
|
|
|
|
case 1: root_key = HKEY_CURRENT_USER;
|
|
|
|
szRoot = szHCU;
|
|
|
|
break;
|
|
|
|
case 2: root_key = HKEY_LOCAL_MACHINE;
|
|
|
|
szRoot = szHLM;
|
|
|
|
break;
|
|
|
|
case 3: root_key = HKEY_USERS;
|
|
|
|
szRoot = szHU;
|
|
|
|
break;
|
|
|
|
default:
|
2004-06-28 22:34:35 +02:00
|
|
|
ERR("Unknown root %i\n",root);
|
|
|
|
root_key=NULL;
|
2004-12-22 16:05:07 +01:00
|
|
|
szRoot = NULL;
|
2004-06-28 22:34:35 +02:00
|
|
|
break;
|
2005-06-21 22:21:18 +02:00
|
|
|
}
|
|
|
|
if (!root_key)
|
|
|
|
return ERROR_SUCCESS;
|
2004-06-28 22:34:35 +02:00
|
|
|
|
2005-06-21 22:21:18 +02:00
|
|
|
deformat_string(package, key , &deformated);
|
|
|
|
size = strlenW(deformated) + strlenW(szRoot) + 1;
|
2005-09-20 13:59:14 +02:00
|
|
|
uikey = msi_alloc(size*sizeof(WCHAR));
|
2005-06-21 22:21:18 +02:00
|
|
|
strcpyW(uikey,szRoot);
|
|
|
|
strcatW(uikey,deformated);
|
2005-01-06 20:34:16 +01:00
|
|
|
|
2005-06-21 22:21:18 +02:00
|
|
|
if (RegCreateKeyW( root_key, deformated, &hkey))
|
|
|
|
{
|
|
|
|
ERR("Could not create key %s\n",debugstr_w(deformated));
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(deformated);
|
|
|
|
msi_free(uikey);
|
2005-06-21 22:21:18 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(deformated);
|
2004-06-29 06:07:22 +02:00
|
|
|
|
2005-06-21 22:21:18 +02:00
|
|
|
value = MSI_RecordGetString(row,5);
|
|
|
|
if (value)
|
|
|
|
value_data = parse_value(package, value, &type, &size);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
static const WCHAR szEmpty[] = {0};
|
|
|
|
value_data = (LPSTR)strdupW(szEmpty);
|
|
|
|
size = 0;
|
|
|
|
type = REG_SZ;
|
|
|
|
}
|
2004-06-28 22:34:35 +02:00
|
|
|
|
2005-06-21 22:21:18 +02:00
|
|
|
deformat_string(package, name, &deformated);
|
2005-01-06 20:34:16 +01:00
|
|
|
|
2005-06-21 22:21:18 +02:00
|
|
|
/* get the double nulls to terminate SZ_MULTI */
|
|
|
|
if (type == REG_MULTI_SZ)
|
|
|
|
size +=sizeof(WCHAR);
|
2005-05-23 18:24:20 +02:00
|
|
|
|
2005-06-21 22:21:18 +02:00
|
|
|
if (!check_first)
|
|
|
|
{
|
|
|
|
TRACE("Setting value %s of %s\n",debugstr_w(deformated),
|
|
|
|
debugstr_w(uikey));
|
2005-07-06 12:33:30 +02:00
|
|
|
RegSetValueExW(hkey, deformated, 0, type, (LPBYTE)value_data, size);
|
2005-06-21 22:21:18 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DWORD sz = 0;
|
|
|
|
rc = RegQueryValueExW(hkey, deformated, NULL, NULL, NULL, &sz);
|
|
|
|
if (rc == ERROR_SUCCESS || rc == ERROR_MORE_DATA)
|
2005-05-20 11:40:42 +02:00
|
|
|
{
|
2005-06-21 22:21:18 +02:00
|
|
|
TRACE("value %s of %s checked already exists\n",
|
|
|
|
debugstr_w(deformated), debugstr_w(uikey));
|
2005-05-20 11:40:42 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-06-21 22:21:18 +02:00
|
|
|
TRACE("Checked and setting value %s of %s\n",
|
|
|
|
debugstr_w(deformated), debugstr_w(uikey));
|
|
|
|
if (deformated || size)
|
2005-07-06 12:33:30 +02:00
|
|
|
RegSetValueExW(hkey, deformated, 0, type, (LPBYTE) value_data, size);
|
2005-05-20 11:40:42 +02:00
|
|
|
}
|
2005-06-21 22:21:18 +02:00
|
|
|
}
|
|
|
|
RegCloseKey(hkey);
|
2004-07-06 20:48:15 +02:00
|
|
|
|
2005-06-21 22:21:18 +02:00
|
|
|
uirow = MSI_CreateRecord(3);
|
|
|
|
MSI_RecordSetStringW(uirow,2,deformated);
|
|
|
|
MSI_RecordSetStringW(uirow,1,uikey);
|
2004-07-06 20:48:15 +02:00
|
|
|
|
2005-06-21 22:21:18 +02:00
|
|
|
if (type == REG_SZ)
|
|
|
|
MSI_RecordSetStringW(uirow,3,(LPWSTR)value_data);
|
|
|
|
else
|
|
|
|
MSI_RecordSetStringW(uirow,3,value);
|
2004-07-06 20:48:15 +02:00
|
|
|
|
2005-06-21 22:21:18 +02:00
|
|
|
ui_actiondata(package,szWriteRegistryValues,uirow);
|
|
|
|
msiobj_release( &uirow->hdr );
|
2004-07-06 20:48:15 +02:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(value_data);
|
|
|
|
msi_free(deformated);
|
|
|
|
msi_free(uikey);
|
2005-06-21 22:21:18 +02:00
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package)
|
|
|
|
{
|
|
|
|
UINT rc;
|
|
|
|
MSIQUERY * view;
|
|
|
|
static const WCHAR ExecSeqQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
|
|
|
'`','R','e','g','i','s','t','r','y','`',0 };
|
|
|
|
|
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
|
|
|
|
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
|
|
|
|
/* increment progress bar each time action data is sent */
|
|
|
|
ui_progress(package,1,REG_PROGRESS_VALUE,1,0);
|
|
|
|
|
|
|
|
rc = MSI_IterateRecords(view, NULL, ITERATE_WriteRegistryValues, package);
|
2004-06-28 22:34:35 +02:00
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
msiobj_release(&view->hdr);
|
2004-06-28 22:34:35 +02:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
static UINT ACTION_InstallInitialize(MSIPACKAGE *package)
|
2004-07-04 02:36:58 +02:00
|
|
|
{
|
2005-05-27 21:24:22 +02:00
|
|
|
package->script->CurrentlyScripting = TRUE;
|
|
|
|
|
2004-07-04 02:36:58 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-12-27 20:02:59 +01:00
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
static UINT ACTION_InstallValidate(MSIPACKAGE *package)
|
2004-07-04 02:36:58 +02:00
|
|
|
{
|
2005-08-22 11:15:23 +02:00
|
|
|
MSICOMPONENT *comp;
|
2004-07-04 02:36:58 +02:00
|
|
|
DWORD progress = 0;
|
2005-01-03 21:00:13 +01:00
|
|
|
DWORD total = 0;
|
2005-03-01 12:45:19 +01:00
|
|
|
static const WCHAR q1[]=
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ',
|
2005-05-20 11:40:42 +02:00
|
|
|
'`','R','e','g','i','s','t','r','y','`',0};
|
2004-07-04 02:36:58 +02:00
|
|
|
UINT rc;
|
2004-07-10 00:25:34 +02:00
|
|
|
MSIQUERY * view;
|
2005-08-22 16:09:17 +02:00
|
|
|
MSIFEATURE *feature;
|
2005-08-23 12:03:17 +02:00
|
|
|
MSIFILE *file;
|
2004-07-04 02:36:58 +02:00
|
|
|
|
2005-09-21 12:20:03 +02:00
|
|
|
TRACE("InstallValidate\n");
|
2004-07-04 02:36:58 +02:00
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
rc = MSI_DatabaseOpenViewW(package->db, q1, &view);
|
2005-09-21 12:20:03 +02:00
|
|
|
if (rc == ERROR_SUCCESS)
|
2004-07-10 00:25:34 +02:00
|
|
|
{
|
2005-09-21 12:20:03 +02:00
|
|
|
MSI_IterateRecords( view, &progress, NULL, package );
|
|
|
|
msiobj_release( &view->hdr );
|
|
|
|
total += progress * REG_PROGRESS_VALUE;
|
2004-07-10 00:25:34 +02:00
|
|
|
}
|
2004-07-04 02:36:58 +02:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry )
|
|
|
|
total += COMPONENT_PROGRESS_VALUE;
|
2005-09-21 12:20:03 +02:00
|
|
|
|
2005-08-23 12:03:17 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
|
|
|
|
total += file->FileSize;
|
2005-09-21 12:20:03 +02:00
|
|
|
|
2005-01-03 21:00:13 +01:00
|
|
|
ui_progress(package,0,total,0,0);
|
2004-07-04 02:36:58 +02:00
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
|
2005-05-13 15:56:39 +02:00
|
|
|
{
|
|
|
|
TRACE("Feature: %s; Installed: %i; Action %i; Request %i\n",
|
|
|
|
debugstr_w(feature->Feature), feature->Installed, feature->Action,
|
|
|
|
feature->ActionRequest);
|
|
|
|
}
|
|
|
|
|
2004-07-04 02:36:58 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-06-22 20:03:08 +02:00
|
|
|
static UINT ITERATE_LaunchConditions(MSIRECORD *row, LPVOID param)
|
|
|
|
{
|
|
|
|
MSIPACKAGE* package = (MSIPACKAGE*)param;
|
|
|
|
LPCWSTR cond = NULL;
|
|
|
|
LPCWSTR message = NULL;
|
|
|
|
static const WCHAR title[]=
|
|
|
|
{'I','n','s','t','a','l','l',' ','F','a', 'i','l','e','d',0};
|
|
|
|
|
|
|
|
cond = MSI_RecordGetString(row,1);
|
|
|
|
|
|
|
|
if (MSI_EvaluateConditionW(package,cond) != MSICONDITION_TRUE)
|
|
|
|
{
|
|
|
|
LPWSTR deformated;
|
|
|
|
message = MSI_RecordGetString(row,2);
|
|
|
|
deformat_string(package,message,&deformated);
|
|
|
|
MessageBoxW(NULL,deformated,title,MB_OK);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(deformated);
|
2005-06-22 20:03:08 +02:00
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
static UINT ACTION_LaunchConditions(MSIPACKAGE *package)
|
2004-07-06 20:47:09 +02:00
|
|
|
{
|
|
|
|
UINT rc;
|
2004-07-19 21:35:05 +02:00
|
|
|
MSIQUERY * view = NULL;
|
2005-03-01 12:45:19 +01:00
|
|
|
static const WCHAR ExecSeqQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
2005-05-20 11:40:42 +02:00
|
|
|
'`','L','a','u','n','c','h','C','o','n','d','i','t','i','o','n','`',0};
|
2004-07-06 20:47:09 +02:00
|
|
|
|
|
|
|
TRACE("Checking launch conditions\n");
|
|
|
|
|
2004-07-10 00:25:34 +02:00
|
|
|
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
|
2004-07-06 20:47:09 +02:00
|
|
|
if (rc != ERROR_SUCCESS)
|
2004-07-20 03:22:37 +02:00
|
|
|
return ERROR_SUCCESS;
|
2004-07-06 20:47:09 +02:00
|
|
|
|
2005-06-22 20:03:08 +02:00
|
|
|
rc = MSI_IterateRecords(view, NULL, ITERATE_LaunchConditions, package);
|
2004-07-10 00:25:34 +02:00
|
|
|
msiobj_release(&view->hdr);
|
2005-06-22 20:03:08 +02:00
|
|
|
|
2004-07-06 20:47:09 +02:00
|
|
|
return rc;
|
|
|
|
}
|
2004-07-04 02:36:58 +02:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
static LPWSTR resolve_keypath( MSIPACKAGE* package, MSICOMPONENT *cmp )
|
2004-07-06 20:50:02 +02:00
|
|
|
{
|
|
|
|
|
2005-09-12 14:07:15 +02:00
|
|
|
if (!cmp->KeyPath)
|
|
|
|
return resolve_folder(package,cmp->Directory,FALSE,FALSE,NULL);
|
|
|
|
|
2005-02-24 13:47:43 +01:00
|
|
|
if (cmp->Attributes & msidbComponentAttributesRegistryKeyPath)
|
2004-07-06 20:50:02 +02:00
|
|
|
{
|
2005-01-17 14:40:39 +01:00
|
|
|
MSIRECORD * row = 0;
|
2005-06-02 12:29:57 +02:00
|
|
|
UINT root,len;
|
2005-06-09 22:30:59 +02:00
|
|
|
LPWSTR deformated,buffer,deformated_name;
|
|
|
|
LPCWSTR key,name;
|
2005-03-01 12:45:19 +01:00
|
|
|
static const WCHAR ExecSeqQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
2005-05-20 11:40:42 +02:00
|
|
|
'`','R','e','g','i','s','t','r','y','`',' ',
|
|
|
|
'W','H','E','R','E',' ', '`','R','e','g','i','s','t','r','y','`',
|
|
|
|
' ','=',' ' ,'\'','%','s','\'',0 };
|
2005-02-24 13:47:43 +01:00
|
|
|
static const WCHAR fmt[]={'%','0','2','i',':','\\','%','s','\\',0};
|
2005-03-01 12:45:19 +01:00
|
|
|
static const WCHAR fmt2[]=
|
|
|
|
{'%','0','2','i',':','\\','%','s','\\','%','s',0};
|
2005-01-17 14:40:39 +01:00
|
|
|
|
2005-06-02 12:29:57 +02:00
|
|
|
row = MSI_QueryGetRecord(package->db, ExecSeqQuery,cmp->KeyPath);
|
|
|
|
if (!row)
|
2005-01-17 14:40:39 +01:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
root = MSI_RecordGetInteger(row,2);
|
2005-06-09 22:30:59 +02:00
|
|
|
key = MSI_RecordGetString(row, 3);
|
|
|
|
name = MSI_RecordGetString(row, 4);
|
2005-01-17 14:40:39 +01:00
|
|
|
deformat_string(package, key , &deformated);
|
|
|
|
deformat_string(package, name, &deformated_name);
|
|
|
|
|
2005-03-08 17:44:51 +01:00
|
|
|
len = strlenW(deformated) + 6;
|
2005-01-17 14:40:39 +01:00
|
|
|
if (deformated_name)
|
|
|
|
len+=strlenW(deformated_name);
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
buffer = msi_alloc( len *sizeof(WCHAR));
|
2005-01-17 14:40:39 +01:00
|
|
|
|
|
|
|
if (deformated_name)
|
|
|
|
sprintfW(buffer,fmt2,root,deformated,deformated_name);
|
|
|
|
else
|
|
|
|
sprintfW(buffer,fmt,root,deformated);
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(deformated);
|
|
|
|
msi_free(deformated_name);
|
2005-01-17 14:40:39 +01:00
|
|
|
msiobj_release(&row->hdr);
|
|
|
|
|
|
|
|
return buffer;
|
|
|
|
}
|
2005-02-24 13:47:43 +01:00
|
|
|
else if (cmp->Attributes & msidbComponentAttributesODBCDataSource)
|
2005-01-17 14:40:39 +01:00
|
|
|
{
|
|
|
|
FIXME("UNIMPLEMENTED keypath as ODBC Source\n");
|
2004-12-22 19:46:17 +01:00
|
|
|
return NULL;
|
2004-07-06 20:50:02 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-08-23 12:03:17 +02:00
|
|
|
MSIFILE *file = get_loaded_file( package, cmp->KeyPath );
|
2004-07-06 20:51:16 +02:00
|
|
|
|
2005-08-23 12:03:17 +02:00
|
|
|
if (file)
|
|
|
|
return strdupW( file->TargetPath );
|
2004-07-06 20:50:02 +02:00
|
|
|
}
|
2004-12-22 19:46:17 +01:00
|
|
|
return NULL;
|
2004-07-06 20:50:02 +02:00
|
|
|
}
|
|
|
|
|
2005-06-20 16:18:03 +02:00
|
|
|
static HKEY openSharedDLLsKey(void)
|
2005-02-24 13:47:43 +01:00
|
|
|
{
|
|
|
|
HKEY hkey=0;
|
2005-03-01 12:45:19 +01:00
|
|
|
static const WCHAR path[] =
|
|
|
|
{'S','o','f','t','w','a','r','e','\\',
|
|
|
|
'M','i','c','r','o','s','o','f','t','\\',
|
|
|
|
'W','i','n','d','o','w','s','\\',
|
|
|
|
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
|
|
|
|
'S','h','a','r','e','d','D','L','L','s',0};
|
2005-02-24 13:47:43 +01:00
|
|
|
|
|
|
|
RegCreateKeyW(HKEY_LOCAL_MACHINE,path,&hkey);
|
|
|
|
return hkey;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ACTION_GetSharedDLLsCount(LPCWSTR dll)
|
|
|
|
{
|
|
|
|
HKEY hkey;
|
|
|
|
DWORD count=0;
|
|
|
|
DWORD type;
|
|
|
|
DWORD sz = sizeof(count);
|
|
|
|
DWORD rc;
|
|
|
|
|
|
|
|
hkey = openSharedDLLsKey();
|
|
|
|
rc = RegQueryValueExW(hkey, dll, NULL, &type, (LPBYTE)&count, &sz);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
count = 0;
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ACTION_WriteSharedDLLsCount(LPCWSTR path, UINT count)
|
|
|
|
{
|
|
|
|
HKEY hkey;
|
|
|
|
|
|
|
|
hkey = openSharedDLLsKey();
|
|
|
|
if (count > 0)
|
2005-09-15 16:58:38 +02:00
|
|
|
msi_reg_set_val_dword( hkey, path, count );
|
2005-02-24 13:47:43 +01:00
|
|
|
else
|
|
|
|
RegDeleteValueW(hkey,path);
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return TRUE if the count should be written out and FALSE if not
|
|
|
|
*/
|
2005-08-22 11:15:23 +02:00
|
|
|
static void ACTION_RefCountComponent( MSIPACKAGE* package, MSICOMPONENT *comp )
|
2005-02-24 13:47:43 +01:00
|
|
|
{
|
2005-08-22 16:09:17 +02:00
|
|
|
MSIFEATURE *feature;
|
2005-02-24 13:47:43 +01:00
|
|
|
INT count = 0;
|
|
|
|
BOOL write = FALSE;
|
|
|
|
|
|
|
|
/* only refcount DLLs */
|
2005-09-12 14:07:15 +02:00
|
|
|
if (comp->KeyPath == NULL ||
|
2005-08-22 11:15:23 +02:00
|
|
|
comp->Attributes & msidbComponentAttributesRegistryKeyPath ||
|
|
|
|
comp->Attributes & msidbComponentAttributesODBCDataSource)
|
2005-02-24 13:47:43 +01:00
|
|
|
write = FALSE;
|
|
|
|
else
|
|
|
|
{
|
2005-08-22 11:15:23 +02:00
|
|
|
count = ACTION_GetSharedDLLsCount( comp->FullKeypath);
|
2005-02-24 13:47:43 +01:00
|
|
|
write = (count > 0);
|
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
if (comp->Attributes & msidbComponentAttributesSharedDllRefCount)
|
2005-02-24 13:47:43 +01:00
|
|
|
write = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* increment counts */
|
2005-08-22 16:09:17 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
|
2005-02-24 13:47:43 +01:00
|
|
|
{
|
2005-08-19 12:03:11 +02:00
|
|
|
ComponentList *cl;
|
2005-02-24 13:47:43 +01:00
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
if (!ACTION_VerifyFeatureForAction( feature, INSTALLSTATE_LOCAL ))
|
2005-02-24 13:47:43 +01:00
|
|
|
continue;
|
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( cl, &feature->Components, ComponentList, entry )
|
2005-02-24 13:47:43 +01:00
|
|
|
{
|
2005-08-22 11:15:23 +02:00
|
|
|
if ( cl->component == comp )
|
2005-02-24 13:47:43 +01:00
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
2005-08-23 12:03:17 +02:00
|
|
|
|
2005-02-24 13:47:43 +01:00
|
|
|
/* decrement counts */
|
2005-08-22 16:09:17 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
|
2005-02-24 13:47:43 +01:00
|
|
|
{
|
2005-08-19 12:03:11 +02:00
|
|
|
ComponentList *cl;
|
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
if (!ACTION_VerifyFeatureForAction( feature, INSTALLSTATE_ABSENT ))
|
2005-02-24 13:47:43 +01:00
|
|
|
continue;
|
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( cl, &feature->Components, ComponentList, entry )
|
2005-02-24 13:47:43 +01:00
|
|
|
{
|
2005-08-22 11:15:23 +02:00
|
|
|
if ( cl->component == comp )
|
2005-02-24 13:47:43 +01:00
|
|
|
count--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ref count all the files in the component */
|
|
|
|
if (write)
|
2005-08-23 12:03:17 +02:00
|
|
|
{
|
|
|
|
MSIFILE *file;
|
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
|
2005-02-24 13:47:43 +01:00
|
|
|
{
|
2005-08-23 12:03:17 +02:00
|
|
|
if (file->Component == comp)
|
|
|
|
ACTION_WriteSharedDLLsCount( file->TargetPath, count );
|
2005-02-24 13:47:43 +01:00
|
|
|
}
|
2005-08-23 12:03:17 +02:00
|
|
|
}
|
2005-02-24 13:47:43 +01:00
|
|
|
|
|
|
|
/* add a count for permenent */
|
2005-08-22 11:15:23 +02:00
|
|
|
if (comp->Attributes & msidbComponentAttributesPermanent)
|
2005-02-24 13:47:43 +01:00
|
|
|
count ++;
|
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
comp->RefCount = count;
|
2005-02-24 13:47:43 +01:00
|
|
|
|
|
|
|
if (write)
|
2005-08-22 11:15:23 +02:00
|
|
|
ACTION_WriteSharedDLLsCount( comp->FullKeypath, comp->RefCount );
|
2005-02-24 13:47:43 +01:00
|
|
|
}
|
|
|
|
|
2004-07-06 21:00:23 +02:00
|
|
|
/*
|
|
|
|
* Ok further analysis makes me think that this work is
|
|
|
|
* actually done in the PublishComponents and PublishFeatures
|
2004-07-09 21:33:25 +02:00
|
|
|
* step, and not here. It appears like the keypath and all that is
|
|
|
|
* resolved in this step, however actually written in the Publish steps.
|
2004-07-09 21:43:29 +02:00
|
|
|
* But we will leave it here for now because it is unclear
|
2004-07-06 21:00:23 +02:00
|
|
|
*/
|
2004-07-10 00:25:34 +02:00
|
|
|
static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
|
2004-07-06 20:50:02 +02:00
|
|
|
{
|
2005-01-25 12:05:37 +01:00
|
|
|
WCHAR squished_pc[GUID_SIZE];
|
|
|
|
WCHAR squished_cc[GUID_SIZE];
|
2004-07-06 20:50:02 +02:00
|
|
|
UINT rc;
|
2005-08-22 11:15:23 +02:00
|
|
|
MSICOMPONENT *comp;
|
2005-01-25 12:05:37 +01:00
|
|
|
HKEY hkey=0,hkey2=0;
|
2004-07-06 20:50:02 +02:00
|
|
|
|
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
|
|
|
|
/* writes the Component and Features values to the registry */
|
|
|
|
|
2005-01-25 12:05:37 +01:00
|
|
|
rc = MSIREG_OpenComponents(&hkey);
|
2004-07-06 20:50:02 +02:00
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
goto end;
|
2005-01-03 21:00:13 +01:00
|
|
|
|
2005-07-07 22:27:06 +02:00
|
|
|
squash_guid(package->ProductCode,squished_pc);
|
2005-01-03 21:00:13 +01:00
|
|
|
ui_progress(package,1,COMPONENT_PROGRESS_VALUE,1,0);
|
2005-08-22 11:15:23 +02:00
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry )
|
2004-07-06 20:50:02 +02:00
|
|
|
{
|
2005-01-03 21:00:13 +01:00
|
|
|
ui_progress(package,2,0,0,0);
|
2005-09-12 14:07:15 +02:00
|
|
|
if (comp->ComponentId)
|
2004-07-06 20:50:02 +02:00
|
|
|
{
|
2004-07-10 00:25:34 +02:00
|
|
|
MSIRECORD * uirow;
|
2004-07-06 20:50:02 +02:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
squash_guid(comp->ComponentId,squished_cc);
|
2004-07-06 20:50:02 +02:00
|
|
|
|
2005-09-22 12:49:17 +02:00
|
|
|
msi_free(comp->FullKeypath);
|
|
|
|
comp->FullKeypath = resolve_keypath( package, comp );
|
2005-02-24 13:47:43 +01:00
|
|
|
|
|
|
|
/* do the refcounting */
|
2005-08-22 11:15:23 +02:00
|
|
|
ACTION_RefCountComponent( package, comp );
|
2005-02-24 13:47:43 +01:00
|
|
|
|
2005-05-18 19:46:12 +02:00
|
|
|
TRACE("Component %s (%s), Keypath=%s, RefCount=%i\n",
|
2005-08-22 11:15:23 +02:00
|
|
|
debugstr_w(comp->Component),
|
2005-05-18 19:46:12 +02:00
|
|
|
debugstr_w(squished_cc),
|
2005-08-22 11:15:23 +02:00
|
|
|
debugstr_w(comp->FullKeypath),
|
|
|
|
comp->RefCount);
|
2005-02-24 13:47:43 +01:00
|
|
|
/*
|
|
|
|
* Write the keypath out if the component is to be registered
|
|
|
|
* and delete the key if the component is to be deregistered
|
|
|
|
*/
|
2005-08-22 11:15:23 +02:00
|
|
|
if (ACTION_VerifyComponentForAction(package, comp,
|
2005-02-24 13:47:43 +01:00
|
|
|
INSTALLSTATE_LOCAL))
|
|
|
|
{
|
2005-05-13 15:56:39 +02:00
|
|
|
rc = RegCreateKeyW(hkey,squished_cc,&hkey2);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
continue;
|
|
|
|
|
2005-09-22 12:49:17 +02:00
|
|
|
if (comp->FullKeypath)
|
2005-02-24 13:47:43 +01:00
|
|
|
{
|
2005-09-22 12:49:17 +02:00
|
|
|
msi_reg_set_val_str( hkey2, squished_pc, comp->FullKeypath );
|
2005-02-24 13:47:43 +01:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
if (comp->Attributes & msidbComponentAttributesPermanent)
|
2005-02-24 13:47:43 +01:00
|
|
|
{
|
2005-03-01 12:45:19 +01:00
|
|
|
static const WCHAR szPermKey[] =
|
|
|
|
{ '0','0','0','0','0','0','0','0','0','0','0','0',
|
2005-09-15 16:58:38 +02:00
|
|
|
'0','0','0','0','0','0','0','0','0','0','0','0',
|
2005-03-01 12:45:19 +01:00
|
|
|
'0','0','0','0','0','0','0','0',0};
|
2005-02-24 13:47:43 +01:00
|
|
|
|
2005-09-22 12:49:17 +02:00
|
|
|
msi_reg_set_val_str( hkey2, szPermKey, comp->FullKeypath );
|
2005-02-24 13:47:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
RegCloseKey(hkey2);
|
|
|
|
|
|
|
|
/* UI stuff */
|
|
|
|
uirow = MSI_CreateRecord(3);
|
2005-07-07 22:27:06 +02:00
|
|
|
MSI_RecordSetStringW(uirow,1,package->ProductCode);
|
2005-08-22 11:15:23 +02:00
|
|
|
MSI_RecordSetStringW(uirow,2,comp->ComponentId);
|
2005-09-22 12:49:17 +02:00
|
|
|
MSI_RecordSetStringW(uirow,3,comp->FullKeypath);
|
2005-02-24 13:47:43 +01:00
|
|
|
ui_actiondata(package,szProcessComponents,uirow);
|
|
|
|
msiobj_release( &uirow->hdr );
|
|
|
|
}
|
|
|
|
}
|
2005-08-22 11:15:23 +02:00
|
|
|
else if (ACTION_VerifyComponentForAction(package, comp,
|
2005-02-24 13:47:43 +01:00
|
|
|
INSTALLSTATE_ABSENT))
|
2004-12-22 19:46:17 +01:00
|
|
|
{
|
2005-02-24 13:47:43 +01:00
|
|
|
DWORD res;
|
2005-05-13 15:56:39 +02:00
|
|
|
|
|
|
|
rc = RegOpenKeyW(hkey,squished_cc,&hkey2);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
continue;
|
|
|
|
|
2005-02-24 13:47:43 +01:00
|
|
|
RegDeleteValueW(hkey2,squished_pc);
|
|
|
|
|
|
|
|
/* if the key is empty delete it */
|
|
|
|
res = RegEnumKeyExW(hkey2,0,NULL,0,0,NULL,0,NULL);
|
2005-01-25 12:05:37 +01:00
|
|
|
RegCloseKey(hkey2);
|
2005-02-24 13:47:43 +01:00
|
|
|
if (res == ERROR_NO_MORE_ITEMS)
|
|
|
|
RegDeleteKeyW(hkey,squished_cc);
|
2004-07-06 20:50:02 +02:00
|
|
|
|
2004-12-22 19:46:17 +01:00
|
|
|
/* UI stuff */
|
2005-02-24 13:47:43 +01:00
|
|
|
uirow = MSI_CreateRecord(2);
|
2005-07-07 22:27:06 +02:00
|
|
|
MSI_RecordSetStringW(uirow,1,package->ProductCode);
|
2005-08-22 11:15:23 +02:00
|
|
|
MSI_RecordSetStringW(uirow,2,comp->ComponentId);
|
2004-12-22 19:46:17 +01:00
|
|
|
ui_actiondata(package,szProcessComponents,uirow);
|
|
|
|
msiobj_release( &uirow->hdr );
|
|
|
|
}
|
2004-07-06 20:50:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
end:
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-03-30 12:19:08 +02:00
|
|
|
typedef struct {
|
|
|
|
CLSID clsid;
|
|
|
|
LPWSTR source;
|
|
|
|
|
|
|
|
LPWSTR path;
|
|
|
|
ITypeLib *ptLib;
|
|
|
|
} typelib_struct;
|
|
|
|
|
2005-06-07 22:29:51 +02:00
|
|
|
static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule, LPCWSTR lpszType,
|
2005-03-30 12:19:08 +02:00
|
|
|
LPWSTR lpszName, LONG_PTR lParam)
|
|
|
|
{
|
|
|
|
TLIBATTR *attr;
|
|
|
|
typelib_struct *tl_struct = (typelib_struct*) lParam;
|
|
|
|
static const WCHAR fmt[] = {'%','s','\\','%','i',0};
|
|
|
|
int sz;
|
|
|
|
HRESULT res;
|
|
|
|
|
|
|
|
if (!IS_INTRESOURCE(lpszName))
|
|
|
|
{
|
|
|
|
ERR("Not Int Resource Name %s\n",debugstr_w(lpszName));
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
sz = strlenW(tl_struct->source)+4;
|
|
|
|
sz *= sizeof(WCHAR);
|
|
|
|
|
2005-06-02 17:13:57 +02:00
|
|
|
if ((INT)lpszName == 1)
|
|
|
|
tl_struct->path = strdupW(tl_struct->source);
|
|
|
|
else
|
|
|
|
{
|
2005-09-20 13:59:14 +02:00
|
|
|
tl_struct->path = msi_alloc(sz);
|
2005-06-02 17:13:57 +02:00
|
|
|
sprintfW(tl_struct->path,fmt,tl_struct->source, lpszName);
|
|
|
|
}
|
2005-03-30 12:19:08 +02:00
|
|
|
|
|
|
|
TRACE("trying %s\n", debugstr_w(tl_struct->path));
|
|
|
|
res = LoadTypeLib(tl_struct->path,&tl_struct->ptLib);
|
|
|
|
if (!SUCCEEDED(res))
|
|
|
|
{
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(tl_struct->path);
|
2005-03-30 12:19:08 +02:00
|
|
|
tl_struct->path = NULL;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ITypeLib_GetLibAttr(tl_struct->ptLib, &attr);
|
|
|
|
if (IsEqualGUID(&(tl_struct->clsid),&(attr->guid)))
|
|
|
|
{
|
|
|
|
ITypeLib_ReleaseTLibAttr(tl_struct->ptLib, attr);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(tl_struct->path);
|
2005-03-30 12:19:08 +02:00
|
|
|
tl_struct->path = NULL;
|
|
|
|
|
|
|
|
ITypeLib_ReleaseTLibAttr(tl_struct->ptLib, attr);
|
|
|
|
ITypeLib_Release(tl_struct->ptLib);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2005-06-22 20:27:34 +02:00
|
|
|
static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param)
|
2004-07-06 20:51:16 +02:00
|
|
|
{
|
2005-06-22 20:27:34 +02:00
|
|
|
MSIPACKAGE* package = (MSIPACKAGE*)param;
|
|
|
|
LPCWSTR component;
|
2005-08-22 11:15:23 +02:00
|
|
|
MSICOMPONENT *comp;
|
2005-08-23 12:03:17 +02:00
|
|
|
MSIFILE *file;
|
2005-06-22 20:27:34 +02:00
|
|
|
typelib_struct tl_struct;
|
|
|
|
HMODULE module;
|
|
|
|
static const WCHAR szTYPELIB[] = {'T','Y','P','E','L','I','B',0};
|
|
|
|
|
|
|
|
component = MSI_RecordGetString(row,3);
|
2005-08-22 11:15:23 +02:00
|
|
|
comp = get_loaded_component(package,component);
|
|
|
|
if (!comp)
|
2004-07-20 03:22:37 +02:00
|
|
|
return ERROR_SUCCESS;
|
2004-07-06 20:51:16 +02:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
if (!ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_LOCAL))
|
2004-07-06 20:51:16 +02:00
|
|
|
{
|
2005-06-22 20:27:34 +02:00
|
|
|
TRACE("Skipping typelib reg due to disabled component\n");
|
2004-07-06 20:51:16 +02:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
comp->Action = comp->Installed;
|
2004-07-06 20:51:16 +02:00
|
|
|
|
2005-06-22 20:27:34 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2004-07-06 20:51:16 +02:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
comp->Action = INSTALLSTATE_LOCAL;
|
2004-07-06 20:51:16 +02:00
|
|
|
|
2005-08-23 12:03:17 +02:00
|
|
|
file = get_loaded_file( package, comp->KeyPath );
|
|
|
|
if (!file)
|
2005-06-22 20:27:34 +02:00
|
|
|
return ERROR_SUCCESS;
|
2005-01-31 17:23:12 +01:00
|
|
|
|
2005-08-23 12:03:17 +02:00
|
|
|
module = LoadLibraryExW( file->TargetPath, NULL, LOAD_LIBRARY_AS_DATAFILE );
|
2005-06-22 20:27:34 +02:00
|
|
|
if (module != NULL)
|
|
|
|
{
|
|
|
|
LPWSTR guid;
|
|
|
|
guid = load_dynamic_stringW(row,1);
|
|
|
|
CLSIDFromString(guid, &tl_struct.clsid);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(guid);
|
2005-08-23 12:03:17 +02:00
|
|
|
tl_struct.source = strdupW( file->TargetPath );
|
2005-06-22 20:27:34 +02:00
|
|
|
tl_struct.path = NULL;
|
2004-07-06 20:51:16 +02:00
|
|
|
|
2005-06-22 20:27:34 +02:00
|
|
|
EnumResourceNamesW(module, szTYPELIB, Typelib_EnumResNameProc,
|
|
|
|
(LONG_PTR)&tl_struct);
|
2005-01-31 17:23:12 +01:00
|
|
|
|
2005-06-22 20:27:34 +02:00
|
|
|
if (tl_struct.path != NULL)
|
2004-07-06 20:51:16 +02:00
|
|
|
{
|
2005-06-22 20:27:34 +02:00
|
|
|
LPWSTR help = NULL;
|
|
|
|
LPCWSTR helpid;
|
|
|
|
HRESULT res;
|
2004-07-06 20:51:16 +02:00
|
|
|
|
2005-06-22 20:27:34 +02:00
|
|
|
helpid = MSI_RecordGetString(row,6);
|
2004-07-06 20:51:16 +02:00
|
|
|
|
2005-06-22 20:27:34 +02:00
|
|
|
if (helpid)
|
|
|
|
help = resolve_folder(package,helpid,FALSE,FALSE,NULL);
|
|
|
|
res = RegisterTypeLib(tl_struct.ptLib,tl_struct.path,help);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(help);
|
2004-12-22 16:25:30 +01:00
|
|
|
|
2005-06-22 20:27:34 +02:00
|
|
|
if (!SUCCEEDED(res))
|
|
|
|
ERR("Failed to register type library %s\n",
|
|
|
|
debugstr_w(tl_struct.path));
|
|
|
|
else
|
2004-07-06 20:51:16 +02:00
|
|
|
{
|
2005-06-22 20:27:34 +02:00
|
|
|
ui_actiondata(package,szRegisterTypeLibraries,row);
|
2005-03-30 12:19:08 +02:00
|
|
|
|
2005-06-22 20:27:34 +02:00
|
|
|
TRACE("Registered %s\n", debugstr_w(tl_struct.path));
|
2005-03-30 12:19:08 +02:00
|
|
|
}
|
2005-06-22 20:27:34 +02:00
|
|
|
|
|
|
|
ITypeLib_Release(tl_struct.ptLib);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(tl_struct.path);
|
2004-07-06 20:51:16 +02:00
|
|
|
}
|
|
|
|
else
|
2005-06-22 20:27:34 +02:00
|
|
|
ERR("Failed to load type library %s\n",
|
|
|
|
debugstr_w(tl_struct.source));
|
|
|
|
|
|
|
|
FreeLibrary(module);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(tl_struct.source);
|
2004-07-06 20:51:16 +02:00
|
|
|
}
|
2005-06-22 20:27:34 +02:00
|
|
|
else
|
2005-08-23 12:03:17 +02:00
|
|
|
ERR("Could not load file! %s\n", debugstr_w(file->TargetPath));
|
2005-06-22 20:27:34 +02:00
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ACTION_RegisterTypeLibraries(MSIPACKAGE *package)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* OK this is a bit confusing.. I am given a _Component key and I believe
|
|
|
|
* that the file that is being registered as a type library is the "key file
|
|
|
|
* of that component" which I interpret to mean "The file in the KeyPath of
|
|
|
|
* that component".
|
|
|
|
*/
|
|
|
|
UINT rc;
|
|
|
|
MSIQUERY * view;
|
|
|
|
static const WCHAR Query[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
|
|
|
'`','T','y','p','e','L','i','b','`',0};
|
|
|
|
|
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
|
|
|
|
rc = MSI_DatabaseOpenViewW(package->db, Query, &view);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
|
|
|
|
rc = MSI_IterateRecords(view, NULL, ITERATE_RegisterTypeLibraries, package);
|
2004-07-10 00:25:34 +02:00
|
|
|
msiobj_release(&view->hdr);
|
2004-07-06 20:51:16 +02:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param)
|
2004-07-06 21:00:23 +02:00
|
|
|
{
|
2005-06-24 13:58:21 +02:00
|
|
|
MSIPACKAGE *package = (MSIPACKAGE*)param;
|
|
|
|
LPWSTR target_file, target_folder;
|
|
|
|
LPCWSTR buffer;
|
|
|
|
WCHAR filename[0x100];
|
|
|
|
DWORD sz;
|
2005-08-22 11:15:23 +02:00
|
|
|
MSICOMPONENT *comp;
|
2005-06-24 13:58:21 +02:00
|
|
|
static const WCHAR szlnk[]={'.','l','n','k',0};
|
2004-07-06 21:00:23 +02:00
|
|
|
IShellLinkW *sl;
|
|
|
|
IPersistFile *pf;
|
|
|
|
HRESULT res;
|
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
buffer = MSI_RecordGetString(row,4);
|
2005-08-22 11:15:23 +02:00
|
|
|
comp = get_loaded_component(package,buffer);
|
|
|
|
if (!comp)
|
2004-07-20 03:22:37 +02:00
|
|
|
return ERROR_SUCCESS;
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
if (!ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_LOCAL))
|
2004-07-06 21:00:23 +02:00
|
|
|
{
|
2005-06-24 13:58:21 +02:00
|
|
|
TRACE("Skipping shortcut creation due to disabled component\n");
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
comp->Action = comp->Installed;
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
comp->Action = INSTALLSTATE_LOCAL;
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
ui_actiondata(package,szCreateShortcuts,row);
|
2005-01-31 17:23:12 +01:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
res = CoCreateInstance( &CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IShellLinkW, (LPVOID *) &sl );
|
2005-01-31 17:23:12 +01:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
if (FAILED(res))
|
|
|
|
{
|
|
|
|
ERR("Is IID_IShellLink\n");
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
res = IShellLinkW_QueryInterface( sl, &IID_IPersistFile,(LPVOID*) &pf );
|
|
|
|
if( FAILED( res ) )
|
|
|
|
{
|
|
|
|
ERR("Is IID_IPersistFile\n");
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2005-01-31 17:23:12 +01:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
buffer = MSI_RecordGetString(row,2);
|
|
|
|
target_folder = resolve_folder(package, buffer,FALSE,FALSE,NULL);
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
/* may be needed because of a bug somehwere else */
|
|
|
|
create_full_pathW(target_folder);
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
sz = 0x100;
|
|
|
|
MSI_RecordGetStringW(row,3,filename,&sz);
|
|
|
|
reduce_to_longfilename(filename);
|
|
|
|
if (!strchrW(filename,'.') || strcmpiW(strchrW(filename,'.'),szlnk))
|
|
|
|
strcatW(filename,szlnk);
|
|
|
|
target_file = build_directory_name(2, target_folder, filename);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(target_folder);
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
buffer = MSI_RecordGetString(row,5);
|
|
|
|
if (strchrW(buffer,'['))
|
|
|
|
{
|
|
|
|
LPWSTR deformated;
|
|
|
|
deformat_string(package,buffer,&deformated);
|
|
|
|
IShellLinkW_SetPath(sl,deformated);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(deformated);
|
2005-06-24 13:58:21 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FIXME("poorly handled shortcut format, advertised shortcut\n");
|
2005-09-22 12:49:17 +02:00
|
|
|
IShellLinkW_SetPath(sl,comp->FullKeypath);
|
2005-06-24 13:58:21 +02:00
|
|
|
}
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
if (!MSI_RecordIsNull(row,6))
|
|
|
|
{
|
|
|
|
LPWSTR deformated;
|
|
|
|
buffer = MSI_RecordGetString(row,6);
|
|
|
|
deformat_string(package,buffer,&deformated);
|
|
|
|
IShellLinkW_SetArguments(sl,deformated);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(deformated);
|
2005-06-24 13:58:21 +02:00
|
|
|
}
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
if (!MSI_RecordIsNull(row,7))
|
|
|
|
{
|
|
|
|
buffer = MSI_RecordGetString(row,7);
|
|
|
|
IShellLinkW_SetDescription(sl,buffer);
|
|
|
|
}
|
2004-12-27 19:56:30 +01:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
if (!MSI_RecordIsNull(row,8))
|
|
|
|
IShellLinkW_SetHotkey(sl,MSI_RecordGetInteger(row,8));
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
if (!MSI_RecordIsNull(row,9))
|
|
|
|
{
|
2005-09-22 12:33:57 +02:00
|
|
|
LPWSTR Path;
|
2005-06-24 13:58:21 +02:00
|
|
|
INT index;
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
buffer = MSI_RecordGetString(row,9);
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-09-22 12:33:57 +02:00
|
|
|
Path = build_icon_path(package,buffer);
|
2005-06-24 13:58:21 +02:00
|
|
|
index = MSI_RecordGetInteger(row,10);
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
IShellLinkW_SetIconLocation(sl,Path,index);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(Path);
|
2005-06-24 13:58:21 +02:00
|
|
|
}
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
if (!MSI_RecordIsNull(row,11))
|
|
|
|
IShellLinkW_SetShowCmd(sl,MSI_RecordGetInteger(row,11));
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
if (!MSI_RecordIsNull(row,12))
|
|
|
|
{
|
|
|
|
LPWSTR Path;
|
|
|
|
buffer = MSI_RecordGetString(row,12);
|
|
|
|
Path = resolve_folder(package, buffer, FALSE, FALSE, NULL);
|
|
|
|
IShellLinkW_SetWorkingDirectory(sl,Path);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(Path);
|
2005-06-24 13:58:21 +02:00
|
|
|
}
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
TRACE("Writing shortcut to %s\n",debugstr_w(target_file));
|
|
|
|
IPersistFile_Save(pf,target_file,FALSE);
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(target_file);
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
IPersistFile_Release( pf );
|
|
|
|
IShellLinkW_Release( sl );
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
static UINT ACTION_CreateShortcuts(MSIPACKAGE *package)
|
|
|
|
{
|
|
|
|
UINT rc;
|
|
|
|
HRESULT res;
|
|
|
|
MSIQUERY * view;
|
|
|
|
static const WCHAR Query[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
|
|
|
'`','S','h','o','r','t','c','u','t','`',0};
|
2004-12-22 19:46:17 +01:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
2004-07-06 20:53:11 +02:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
rc = MSI_DatabaseOpenViewW(package->db, Query, &view);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
|
|
|
|
res = CoInitialize( NULL );
|
|
|
|
if (FAILED (res))
|
|
|
|
{
|
|
|
|
ERR("CoInitialize failed\n");
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
2004-07-06 20:53:11 +02:00
|
|
|
}
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-06-24 13:58:21 +02:00
|
|
|
rc = MSI_IterateRecords(view, NULL, ITERATE_CreateShortcuts, package);
|
|
|
|
msiobj_release(&view->hdr);
|
2004-07-06 21:00:23 +02:00
|
|
|
|
|
|
|
CoUninitialize();
|
|
|
|
|
2004-07-06 20:53:11 +02:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-06-22 20:42:19 +02:00
|
|
|
static UINT ITERATE_PublishProduct(MSIRECORD *row, LPVOID param)
|
|
|
|
{
|
|
|
|
MSIPACKAGE* package = (MSIPACKAGE*)param;
|
|
|
|
HANDLE the_file;
|
2005-09-22 12:33:57 +02:00
|
|
|
LPWSTR FilePath;
|
|
|
|
LPCWSTR FileName;
|
2005-06-22 20:42:19 +02:00
|
|
|
CHAR buffer[1024];
|
|
|
|
DWORD sz;
|
|
|
|
UINT rc;
|
|
|
|
|
|
|
|
FileName = MSI_RecordGetString(row,1);
|
|
|
|
if (!FileName)
|
|
|
|
{
|
|
|
|
ERR("Unable to get FileName\n");
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-09-22 12:33:57 +02:00
|
|
|
FilePath = build_icon_path(package,FileName);
|
2005-06-22 20:42:19 +02:00
|
|
|
|
|
|
|
TRACE("Creating icon file at %s\n",debugstr_w(FilePath));
|
|
|
|
|
|
|
|
the_file = CreateFileW(FilePath, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
|
|
|
|
FILE_ATTRIBUTE_NORMAL, NULL);
|
|
|
|
|
|
|
|
if (the_file == INVALID_HANDLE_VALUE)
|
|
|
|
{
|
|
|
|
ERR("Unable to create file %s\n",debugstr_w(FilePath));
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(FilePath);
|
2005-06-22 20:42:19 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
DWORD write;
|
|
|
|
sz = 1024;
|
|
|
|
rc = MSI_RecordReadStream(row,2,buffer,&sz);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
ERR("Failed to get stream\n");
|
|
|
|
CloseHandle(the_file);
|
|
|
|
DeleteFileW(FilePath);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
WriteFile(the_file,buffer,sz,&write,NULL);
|
|
|
|
} while (sz == 1024);
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(FilePath);
|
2005-06-22 20:42:19 +02:00
|
|
|
|
|
|
|
CloseHandle(the_file);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2004-07-06 21:00:23 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 99% of the work done here is only done for
|
|
|
|
* advertised installs. However this is where the
|
|
|
|
* Icon table is processed and written out
|
2004-07-16 21:15:40 +02:00
|
|
|
* so that is what I am going to do here.
|
2004-07-06 21:00:23 +02:00
|
|
|
*/
|
2004-07-10 00:25:34 +02:00
|
|
|
static UINT ACTION_PublishProduct(MSIPACKAGE *package)
|
2004-07-06 21:00:23 +02:00
|
|
|
{
|
|
|
|
UINT rc;
|
2004-07-10 00:25:34 +02:00
|
|
|
MSIQUERY * view;
|
2005-03-01 12:45:19 +01:00
|
|
|
static const WCHAR Query[]=
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
2005-05-20 11:40:42 +02:00
|
|
|
'`','I','c','o','n','`',0};
|
2005-01-17 14:40:39 +01:00
|
|
|
/* for registry stuff */
|
2005-01-25 12:05:37 +01:00
|
|
|
HKEY hkey=0;
|
|
|
|
HKEY hukey=0;
|
2005-06-08 21:16:45 +02:00
|
|
|
static const WCHAR szProductLanguage[] =
|
|
|
|
{'P','r','o','d','u','c','t','L','a','n','g','u','a','g','e',0};
|
|
|
|
static const WCHAR szARPProductIcon[] =
|
|
|
|
{'A','R','P','P','R','O','D','U','C','T','I','C','O','N',0};
|
2005-06-09 17:49:11 +02:00
|
|
|
static const WCHAR szProductVersion[] =
|
|
|
|
{'P','r','o','d','u','c','t','V','e','r','s','i','o','n',0};
|
2005-06-08 21:16:45 +02:00
|
|
|
DWORD langid;
|
2005-01-17 14:40:39 +01:00
|
|
|
LPWSTR buffer;
|
|
|
|
DWORD size;
|
2005-01-25 12:05:37 +01:00
|
|
|
MSIHANDLE hDb, hSumInfo;
|
2004-07-06 21:00:23 +02:00
|
|
|
|
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
|
2005-06-22 20:42:19 +02:00
|
|
|
/* write out icon files */
|
2004-07-06 21:00:23 +02:00
|
|
|
|
2005-06-22 20:42:19 +02:00
|
|
|
rc = MSI_DatabaseOpenViewW(package->db, Query, &view);
|
|
|
|
if (rc == ERROR_SUCCESS)
|
2004-07-06 21:00:23 +02:00
|
|
|
{
|
2005-06-22 20:42:19 +02:00
|
|
|
MSI_IterateRecords(view, NULL, ITERATE_PublishProduct, package);
|
2004-07-10 00:25:34 +02:00
|
|
|
msiobj_release(&view->hdr);
|
2004-07-06 21:00:23 +02:00
|
|
|
}
|
2005-01-17 14:40:39 +01:00
|
|
|
|
2005-01-26 22:09:04 +01:00
|
|
|
/* ok there is a lot more done here but i need to figure out what */
|
2005-06-22 20:42:19 +02:00
|
|
|
|
2005-07-07 22:27:06 +02:00
|
|
|
rc = MSIREG_OpenProductsKey(package->ProductCode,&hkey,TRUE);
|
2005-01-17 14:40:39 +01:00
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
goto end;
|
|
|
|
|
2005-07-07 22:27:06 +02:00
|
|
|
rc = MSIREG_OpenUserProductsKey(package->ProductCode,&hukey,TRUE);
|
2005-01-17 14:40:39 +01:00
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
|
2005-09-15 17:04:08 +02:00
|
|
|
buffer = msi_dup_property( package, INSTALLPROPERTY_PRODUCTNAMEW );
|
2005-09-15 16:58:38 +02:00
|
|
|
msi_reg_set_val_str( hukey, INSTALLPROPERTY_PRODUCTNAMEW, buffer );
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(buffer);
|
2005-06-08 21:16:45 +02:00
|
|
|
|
2005-09-29 12:32:39 +02:00
|
|
|
langid = msi_get_property_int( package, szProductLanguage, 0 );
|
2005-09-15 16:58:38 +02:00
|
|
|
msi_reg_set_val_dword( hkey, INSTALLPROPERTY_LANGUAGEW, langid );
|
2005-06-08 21:16:45 +02:00
|
|
|
|
2005-09-15 17:04:08 +02:00
|
|
|
buffer = msi_dup_property( package, szARPProductIcon );
|
2005-06-08 21:16:45 +02:00
|
|
|
if (buffer)
|
|
|
|
{
|
2005-09-22 12:33:57 +02:00
|
|
|
LPWSTR path = build_icon_path(package,buffer);
|
2005-09-15 16:58:38 +02:00
|
|
|
msi_reg_set_val_str( hukey, INSTALLPROPERTY_PRODUCTICONW, path );
|
2005-09-22 12:33:57 +02:00
|
|
|
msi_free( path );
|
2005-06-08 21:16:45 +02:00
|
|
|
}
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(buffer);
|
2005-06-09 17:49:11 +02:00
|
|
|
|
2005-09-15 17:04:08 +02:00
|
|
|
buffer = msi_dup_property( package, szProductVersion );
|
2005-06-09 17:49:11 +02:00
|
|
|
if (buffer)
|
|
|
|
{
|
|
|
|
DWORD verdword = build_version_dword(buffer);
|
2005-09-15 16:58:38 +02:00
|
|
|
msi_reg_set_val_dword( hkey, INSTALLPROPERTY_VERSIONW, verdword );
|
2005-06-09 17:49:11 +02:00
|
|
|
}
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(buffer);
|
2005-06-08 21:16:45 +02:00
|
|
|
|
2005-01-19 20:07:40 +01:00
|
|
|
FIXME("Need to write more keys to the user registry\n");
|
2005-01-25 12:05:37 +01:00
|
|
|
|
2005-02-18 21:00:34 +01:00
|
|
|
hDb= alloc_msihandle( &package->db->hdr );
|
2005-01-25 12:05:37 +01:00
|
|
|
rc = MsiGetSummaryInformationW(hDb, NULL, 0, &hSumInfo);
|
2005-02-18 21:00:34 +01:00
|
|
|
MsiCloseHandle(hDb);
|
2005-01-25 12:05:37 +01:00
|
|
|
if (rc == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
WCHAR guidbuffer[0x200];
|
|
|
|
size = 0x200;
|
2005-02-18 21:00:34 +01:00
|
|
|
rc = MsiSummaryInfoGetPropertyW(hSumInfo, 9, NULL, NULL, NULL,
|
2005-01-25 12:05:37 +01:00
|
|
|
guidbuffer, &size);
|
|
|
|
if (rc == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
WCHAR squashed[GUID_SIZE];
|
|
|
|
/* for now we only care about the first guid */
|
|
|
|
LPWSTR ptr = strchrW(guidbuffer,';');
|
|
|
|
if (ptr) *ptr = 0;
|
|
|
|
squash_guid(guidbuffer,squashed);
|
2005-09-15 16:58:38 +02:00
|
|
|
msi_reg_set_val_str( hukey, INSTALLPROPERTY_PACKAGECODEW, squashed );
|
2005-01-25 12:05:37 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR("Unable to query Revision_Number... \n");
|
|
|
|
rc = ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
MsiCloseHandle(hSumInfo);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR("Unable to open Summary Information\n");
|
|
|
|
rc = ERROR_SUCCESS;
|
|
|
|
}
|
2005-01-19 20:07:40 +01:00
|
|
|
|
2005-01-17 14:40:39 +01:00
|
|
|
end:
|
|
|
|
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
RegCloseKey(hukey);
|
|
|
|
|
2004-07-06 21:00:23 +02:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-06-23 11:46:31 +02:00
|
|
|
static UINT ITERATE_WriteIniValues(MSIRECORD *row, LPVOID param)
|
2005-01-14 16:59:26 +01:00
|
|
|
{
|
2005-06-23 11:46:31 +02:00
|
|
|
MSIPACKAGE *package = (MSIPACKAGE*)param;
|
|
|
|
LPCWSTR component,section,key,value,identifier,filename,dirproperty;
|
|
|
|
LPWSTR deformated_section, deformated_key, deformated_value;
|
|
|
|
LPWSTR folder, fullname = NULL;
|
|
|
|
MSIRECORD * uirow;
|
2005-08-22 11:15:23 +02:00
|
|
|
INT action;
|
|
|
|
MSICOMPONENT *comp;
|
2005-01-14 16:59:26 +01:00
|
|
|
static const WCHAR szWindowsFolder[] =
|
|
|
|
{'W','i','n','d','o','w','s','F','o','l','d','e','r',0};
|
|
|
|
|
2005-06-23 11:46:31 +02:00
|
|
|
component = MSI_RecordGetString(row, 8);
|
2005-08-22 11:15:23 +02:00
|
|
|
comp = get_loaded_component(package,component);
|
2005-01-14 16:59:26 +01:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
if (!ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_LOCAL))
|
2005-01-14 16:59:26 +01:00
|
|
|
{
|
2005-06-23 11:46:31 +02:00
|
|
|
TRACE("Skipping ini file due to disabled component %s\n",
|
|
|
|
debugstr_w(component));
|
2005-01-14 16:59:26 +01:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
comp->Action = comp->Installed;
|
2005-01-14 16:59:26 +01:00
|
|
|
|
2005-06-23 11:46:31 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2005-01-31 17:23:12 +01:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
comp->Action = INSTALLSTATE_LOCAL;
|
2005-01-31 17:23:12 +01:00
|
|
|
|
2005-06-23 11:46:31 +02:00
|
|
|
identifier = MSI_RecordGetString(row,1);
|
|
|
|
filename = MSI_RecordGetString(row,2);
|
|
|
|
dirproperty = MSI_RecordGetString(row,3);
|
|
|
|
section = MSI_RecordGetString(row,4);
|
|
|
|
key = MSI_RecordGetString(row,5);
|
|
|
|
value = MSI_RecordGetString(row,6);
|
|
|
|
action = MSI_RecordGetInteger(row,7);
|
2005-01-31 17:23:12 +01:00
|
|
|
|
2005-06-23 11:46:31 +02:00
|
|
|
deformat_string(package,section,&deformated_section);
|
|
|
|
deformat_string(package,key,&deformated_key);
|
|
|
|
deformat_string(package,value,&deformated_value);
|
2005-01-14 16:59:26 +01:00
|
|
|
|
2005-06-23 11:46:31 +02:00
|
|
|
if (dirproperty)
|
|
|
|
{
|
|
|
|
folder = resolve_folder(package, dirproperty, FALSE, FALSE, NULL);
|
2005-01-14 16:59:26 +01:00
|
|
|
if (!folder)
|
2005-09-15 17:04:08 +02:00
|
|
|
folder = msi_dup_property( package, dirproperty );
|
2005-06-23 11:46:31 +02:00
|
|
|
}
|
|
|
|
else
|
2005-09-15 17:04:08 +02:00
|
|
|
folder = msi_dup_property( package, szWindowsFolder );
|
2005-06-23 11:46:31 +02:00
|
|
|
|
|
|
|
if (!folder)
|
|
|
|
{
|
|
|
|
ERR("Unable to resolve folder! (%s)\n",debugstr_w(dirproperty));
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2005-01-14 16:59:26 +01:00
|
|
|
|
2005-08-23 12:03:17 +02:00
|
|
|
fullname = build_directory_name(2, folder, filename);
|
2005-01-14 16:59:26 +01:00
|
|
|
|
2005-06-23 11:46:31 +02:00
|
|
|
if (action == 0)
|
|
|
|
{
|
|
|
|
TRACE("Adding value %s to section %s in %s\n",
|
2005-01-14 16:59:26 +01:00
|
|
|
debugstr_w(deformated_key), debugstr_w(deformated_section),
|
|
|
|
debugstr_w(fullname));
|
2005-06-23 11:46:31 +02:00
|
|
|
WritePrivateProfileStringW(deformated_section, deformated_key,
|
|
|
|
deformated_value, fullname);
|
|
|
|
}
|
|
|
|
else if (action == 1)
|
|
|
|
{
|
|
|
|
WCHAR returned[10];
|
|
|
|
GetPrivateProfileStringW(deformated_section, deformated_key, NULL,
|
|
|
|
returned, 10, fullname);
|
|
|
|
if (returned[0] == 0)
|
2005-01-14 16:59:26 +01:00
|
|
|
{
|
2005-06-23 11:46:31 +02:00
|
|
|
TRACE("Adding value %s to section %s in %s\n",
|
2005-01-14 16:59:26 +01:00
|
|
|
debugstr_w(deformated_key), debugstr_w(deformated_section),
|
|
|
|
debugstr_w(fullname));
|
|
|
|
|
2005-06-23 11:46:31 +02:00
|
|
|
WritePrivateProfileStringW(deformated_section, deformated_key,
|
2005-01-14 16:59:26 +01:00
|
|
|
deformated_value, fullname);
|
|
|
|
}
|
2005-06-23 11:46:31 +02:00
|
|
|
}
|
|
|
|
else if (action == 3)
|
|
|
|
FIXME("Append to existing section not yet implemented\n");
|
|
|
|
|
|
|
|
uirow = MSI_CreateRecord(4);
|
|
|
|
MSI_RecordSetStringW(uirow,1,identifier);
|
|
|
|
MSI_RecordSetStringW(uirow,2,deformated_section);
|
|
|
|
MSI_RecordSetStringW(uirow,3,deformated_key);
|
|
|
|
MSI_RecordSetStringW(uirow,4,deformated_value);
|
|
|
|
ui_actiondata(package,szWriteIniValues,uirow);
|
|
|
|
msiobj_release( &uirow->hdr );
|
2005-01-14 16:59:26 +01:00
|
|
|
cleanup:
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(fullname);
|
|
|
|
msi_free(folder);
|
|
|
|
msi_free(deformated_key);
|
|
|
|
msi_free(deformated_value);
|
|
|
|
msi_free(deformated_section);
|
2005-06-23 11:46:31 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ACTION_WriteIniValues(MSIPACKAGE *package)
|
|
|
|
{
|
|
|
|
UINT rc;
|
|
|
|
MSIQUERY * view;
|
|
|
|
static const WCHAR ExecSeqQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
|
|
|
'`','I','n','i','F','i','l','e','`',0};
|
|
|
|
|
|
|
|
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
TRACE("no IniFile table\n");
|
|
|
|
return ERROR_SUCCESS;
|
2005-01-14 16:59:26 +01:00
|
|
|
}
|
2005-06-23 11:46:31 +02:00
|
|
|
|
|
|
|
rc = MSI_IterateRecords(view, NULL, ITERATE_WriteIniValues, package);
|
2005-01-14 16:59:26 +01:00
|
|
|
msiobj_release(&view->hdr);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-06-24 13:33:02 +02:00
|
|
|
static UINT ITERATE_SelfRegModules(MSIRECORD *row, LPVOID param)
|
2005-01-17 14:40:39 +01:00
|
|
|
{
|
2005-06-24 13:33:02 +02:00
|
|
|
MSIPACKAGE *package = (MSIPACKAGE*)param;
|
|
|
|
LPCWSTR filename;
|
|
|
|
LPWSTR FullName;
|
2005-08-23 12:03:17 +02:00
|
|
|
MSIFILE *file;
|
2005-06-24 13:33:02 +02:00
|
|
|
DWORD len;
|
2005-03-01 12:45:19 +01:00
|
|
|
static const WCHAR ExeStr[] =
|
2005-05-18 19:46:12 +02:00
|
|
|
{'r','e','g','s','v','r','3','2','.','e','x','e',' ','\"',0};
|
|
|
|
static const WCHAR close[] = {'\"',0};
|
2005-01-19 20:07:40 +01:00
|
|
|
STARTUPINFOW si;
|
|
|
|
PROCESS_INFORMATION info;
|
|
|
|
BOOL brc;
|
|
|
|
|
|
|
|
memset(&si,0,sizeof(STARTUPINFOW));
|
|
|
|
|
2005-06-24 13:33:02 +02:00
|
|
|
filename = MSI_RecordGetString(row,1);
|
2005-08-23 12:03:17 +02:00
|
|
|
file = get_loaded_file( package, filename );
|
2005-01-17 14:40:39 +01:00
|
|
|
|
2005-08-23 12:03:17 +02:00
|
|
|
if (!file)
|
2005-01-17 14:40:39 +01:00
|
|
|
{
|
2005-06-24 13:33:02 +02:00
|
|
|
ERR("Unable to find file id %s\n",debugstr_w(filename));
|
|
|
|
return ERROR_SUCCESS;
|
2005-01-17 14:40:39 +01:00
|
|
|
}
|
|
|
|
|
2005-08-23 12:03:17 +02:00
|
|
|
len = strlenW(ExeStr) + strlenW( file->TargetPath ) + 2;
|
2005-01-17 14:40:39 +01:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
FullName = msi_alloc(len*sizeof(WCHAR));
|
2005-06-24 13:33:02 +02:00
|
|
|
strcpyW(FullName,ExeStr);
|
2005-08-23 12:03:17 +02:00
|
|
|
strcatW( FullName, file->TargetPath );
|
2005-06-24 13:33:02 +02:00
|
|
|
strcatW(FullName,close);
|
2005-01-17 14:40:39 +01:00
|
|
|
|
2005-06-24 13:33:02 +02:00
|
|
|
TRACE("Registering %s\n",debugstr_w(FullName));
|
|
|
|
brc = CreateProcessW(NULL, FullName, NULL, NULL, FALSE, 0, NULL, c_colon,
|
|
|
|
&si, &info);
|
2005-01-17 14:40:39 +01:00
|
|
|
|
2005-06-24 13:33:02 +02:00
|
|
|
if (brc)
|
|
|
|
msi_dialog_check_messages(info.hProcess);
|
2005-01-17 14:40:39 +01:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(FullName);
|
2005-06-24 13:33:02 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2005-01-17 14:40:39 +01:00
|
|
|
|
2005-06-24 13:33:02 +02:00
|
|
|
static UINT ACTION_SelfRegModules(MSIPACKAGE *package)
|
|
|
|
{
|
|
|
|
UINT rc;
|
|
|
|
MSIQUERY * view;
|
|
|
|
static const WCHAR ExecSeqQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
|
|
|
'`','S','e','l','f','R','e','g','`',0};
|
2005-01-17 14:40:39 +01:00
|
|
|
|
2005-06-24 13:33:02 +02:00
|
|
|
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
TRACE("no SelfReg table\n");
|
|
|
|
return ERROR_SUCCESS;
|
2005-01-17 14:40:39 +01:00
|
|
|
}
|
2005-06-24 13:33:02 +02:00
|
|
|
|
|
|
|
MSI_IterateRecords(view, NULL, ITERATE_SelfRegModules, package);
|
2005-01-17 14:40:39 +01:00
|
|
|
msiobj_release(&view->hdr);
|
2005-06-24 13:33:02 +02:00
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
2005-01-17 14:40:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ACTION_PublishFeatures(MSIPACKAGE *package)
|
|
|
|
{
|
2005-08-22 16:09:17 +02:00
|
|
|
MSIFEATURE *feature;
|
2005-01-17 14:40:39 +01:00
|
|
|
UINT rc;
|
2005-01-25 12:05:37 +01:00
|
|
|
HKEY hkey=0;
|
|
|
|
HKEY hukey=0;
|
|
|
|
|
2005-01-17 14:40:39 +01:00
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
|
2005-07-07 22:27:06 +02:00
|
|
|
rc = MSIREG_OpenFeaturesKey(package->ProductCode,&hkey,TRUE);
|
2005-01-17 14:40:39 +01:00
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
goto end;
|
|
|
|
|
2005-07-07 22:27:06 +02:00
|
|
|
rc = MSIREG_OpenUserFeaturesKey(package->ProductCode,&hukey,TRUE);
|
2005-01-17 14:40:39 +01:00
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
/* here the guids are base 85 encoded */
|
2005-08-22 16:09:17 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
|
2005-01-17 14:40:39 +01:00
|
|
|
{
|
2005-08-19 12:03:11 +02:00
|
|
|
ComponentList *cl;
|
2005-01-17 14:40:39 +01:00
|
|
|
LPWSTR data = NULL;
|
|
|
|
GUID clsid;
|
|
|
|
INT size;
|
2005-05-13 15:56:39 +02:00
|
|
|
BOOL absent = FALSE;
|
2005-01-17 14:40:39 +01:00
|
|
|
|
2005-08-22 16:09:17 +02:00
|
|
|
if (!ACTION_VerifyFeatureForAction( feature, INSTALLSTATE_LOCAL ) &&
|
|
|
|
!ACTION_VerifyFeatureForAction( feature, INSTALLSTATE_SOURCE ) &&
|
|
|
|
!ACTION_VerifyFeatureForAction( feature, INSTALLSTATE_ADVERTISED ))
|
2005-05-13 15:56:39 +02:00
|
|
|
absent = TRUE;
|
2005-02-24 13:47:43 +01:00
|
|
|
|
2005-08-19 12:03:11 +02:00
|
|
|
size = 1;
|
2005-08-22 16:09:17 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( cl, &feature->Components, ComponentList, entry )
|
2005-08-19 12:03:11 +02:00
|
|
|
{
|
|
|
|
size += 21;
|
|
|
|
}
|
2005-09-13 12:37:37 +02:00
|
|
|
if (feature->Feature_Parent)
|
2005-08-22 16:09:17 +02:00
|
|
|
size += strlenW( feature->Feature_Parent )+2;
|
2005-01-17 14:40:39 +01:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
data = msi_alloc(size * sizeof(WCHAR));
|
2005-01-17 14:40:39 +01:00
|
|
|
|
|
|
|
data[0] = 0;
|
2005-08-22 16:09:17 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( cl, &feature->Components, ComponentList, entry )
|
2005-01-17 14:40:39 +01:00
|
|
|
{
|
2005-08-22 11:15:23 +02:00
|
|
|
MSICOMPONENT* component = cl->component;
|
2005-01-17 14:40:39 +01:00
|
|
|
WCHAR buf[21];
|
2005-08-19 12:03:11 +02:00
|
|
|
|
2005-01-17 14:40:39 +01:00
|
|
|
memset(buf,0,sizeof(buf));
|
2005-09-12 14:07:15 +02:00
|
|
|
if (component->ComponentId)
|
2005-05-18 19:46:12 +02:00
|
|
|
{
|
2005-08-19 12:03:11 +02:00
|
|
|
TRACE("From %s\n",debugstr_w(component->ComponentId));
|
|
|
|
CLSIDFromString(component->ComponentId, &clsid);
|
2005-05-18 19:46:12 +02:00
|
|
|
encode_base85_guid(&clsid,buf);
|
|
|
|
TRACE("to %s\n",debugstr_w(buf));
|
|
|
|
strcatW(data,buf);
|
|
|
|
}
|
2005-01-17 14:40:39 +01:00
|
|
|
}
|
2005-09-13 12:37:37 +02:00
|
|
|
if (feature->Feature_Parent)
|
2005-01-17 14:40:39 +01:00
|
|
|
{
|
|
|
|
static const WCHAR sep[] = {'\2',0};
|
|
|
|
strcatW(data,sep);
|
2005-08-22 16:09:17 +02:00
|
|
|
strcatW(data,feature->Feature_Parent);
|
2005-01-17 14:40:39 +01:00
|
|
|
}
|
|
|
|
|
2005-09-15 16:58:38 +02:00
|
|
|
msi_reg_set_val_str( hkey, feature->Feature, data );
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(data);
|
2005-01-17 14:40:39 +01:00
|
|
|
|
2005-09-13 12:37:37 +02:00
|
|
|
size = 0;
|
|
|
|
if (feature->Feature_Parent)
|
|
|
|
size = strlenW(feature->Feature_Parent)*sizeof(WCHAR);
|
2005-05-13 15:56:39 +02:00
|
|
|
if (!absent)
|
|
|
|
{
|
2005-08-22 16:09:17 +02:00
|
|
|
RegSetValueExW(hukey,feature->Feature,0,REG_SZ,
|
|
|
|
(LPBYTE)feature->Feature_Parent,size);
|
2005-05-13 15:56:39 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-09-13 12:37:37 +02:00
|
|
|
size += 2*sizeof(WCHAR);
|
2005-09-20 13:59:14 +02:00
|
|
|
data = msi_alloc(size);
|
2005-05-13 15:56:39 +02:00
|
|
|
data[0] = 0x6;
|
2005-09-13 12:37:37 +02:00
|
|
|
data[1] = 0;
|
|
|
|
if (feature->Feature_Parent)
|
|
|
|
strcpyW( &data[1], feature->Feature_Parent );
|
2005-08-22 16:09:17 +02:00
|
|
|
RegSetValueExW(hukey,feature->Feature,0,REG_SZ,
|
2005-07-06 12:33:30 +02:00
|
|
|
(LPBYTE)data,size);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(data);
|
2005-05-13 15:56:39 +02:00
|
|
|
}
|
2005-01-17 14:40:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
end:
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
RegCloseKey(hukey);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-09-30 12:32:41 +02:00
|
|
|
static UINT msi_make_package_local( MSIPACKAGE *package, HKEY hkey )
|
|
|
|
{
|
|
|
|
static const WCHAR installerPathFmt[] = {
|
|
|
|
'%','s','\\','I','n','s','t','a','l','l','e','r','\\',0};
|
|
|
|
static const WCHAR fmt[] = {
|
|
|
|
'%','s','\\',
|
|
|
|
'I','n','s','t','a','l','l','e','r','\\',
|
|
|
|
'%','x','.','m','s','i',0};
|
|
|
|
static const WCHAR szOriginalDatabase[] =
|
|
|
|
{'O','r','i','g','i','n','a','l','D','a','t','a','b','a','s','e',0};
|
|
|
|
WCHAR windir[MAX_PATH], path[MAX_PATH], packagefile[MAX_PATH];
|
|
|
|
INT num, start;
|
|
|
|
LPWSTR msiFilePath;
|
|
|
|
BOOL r;
|
|
|
|
|
|
|
|
/* copy the package locally */
|
|
|
|
num = GetTickCount() & 0xffff;
|
|
|
|
if (!num)
|
|
|
|
num = 1;
|
|
|
|
start = num;
|
|
|
|
GetWindowsDirectoryW( windir, MAX_PATH );
|
|
|
|
snprintfW( packagefile, MAX_PATH, fmt, windir, num );
|
|
|
|
do
|
|
|
|
{
|
|
|
|
HANDLE handle = CreateFileW(packagefile,GENERIC_WRITE, 0, NULL,
|
|
|
|
CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0 );
|
|
|
|
if (handle != INVALID_HANDLE_VALUE)
|
|
|
|
{
|
|
|
|
CloseHandle(handle);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (GetLastError() != ERROR_FILE_EXISTS &&
|
|
|
|
GetLastError() != ERROR_SHARING_VIOLATION)
|
|
|
|
break;
|
|
|
|
if (!(++num & 0xffff)) num = 1;
|
|
|
|
sprintfW(packagefile,fmt,num);
|
|
|
|
} while (num != start);
|
|
|
|
|
|
|
|
snprintfW( path, MAX_PATH, installerPathFmt, windir );
|
|
|
|
create_full_pathW(path);
|
|
|
|
|
|
|
|
TRACE("Copying to local package %s\n",debugstr_w(packagefile));
|
|
|
|
|
|
|
|
msiFilePath = msi_dup_property( package, szOriginalDatabase );
|
|
|
|
r = CopyFileW( msiFilePath, packagefile, FALSE);
|
|
|
|
msi_free( msiFilePath );
|
|
|
|
|
|
|
|
if (!r)
|
|
|
|
{
|
|
|
|
ERR("Unable to copy package (%s -> %s) (error %ld)\n",
|
|
|
|
debugstr_w(msiFilePath), debugstr_w(packagefile), GetLastError());
|
|
|
|
return ERROR_FUNCTION_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: maybe set this key in ACTION_RegisterProduct instead */
|
|
|
|
msi_reg_set_val_str( hkey, INSTALLPROPERTY_LOCALPACKAGEW, packagefile );
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-01-19 20:07:40 +01:00
|
|
|
static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
|
|
|
|
{
|
2005-01-25 12:05:37 +01:00
|
|
|
HKEY hkey=0;
|
2005-06-17 23:25:41 +02:00
|
|
|
LPWSTR buffer = NULL;
|
2005-01-19 20:07:40 +01:00
|
|
|
UINT rc,i;
|
2005-09-29 12:32:39 +02:00
|
|
|
DWORD size, langid;
|
2005-09-15 16:58:38 +02:00
|
|
|
static const WCHAR szWindowsInstaller[] =
|
2005-01-19 20:07:40 +01:00
|
|
|
{'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0};
|
|
|
|
static const WCHAR szPropKeys[][80] =
|
|
|
|
{
|
|
|
|
{'A','R','P','A','U','T','H','O','R','I','Z','E','D','C','D','F','P','R','E','F','I','X',0},
|
2005-02-22 20:31:45 +01:00
|
|
|
{'A','R','P','C','O','N','T','A','C','T',0},
|
2005-01-19 20:07:40 +01:00
|
|
|
{'A','R','P','C','O','M','M','E','N','T','S',0},
|
|
|
|
{'P','r','o','d','u','c','t','N','a','m','e',0},
|
|
|
|
{'P','r','o','d','u','c','t','V','e','r','s','i','o','n',0},
|
|
|
|
{'A','R','P','H','E','L','P','L','I','N','K',0},
|
|
|
|
{'A','R','P','H','E','L','P','T','E','L','E','P','H','O','N','E',0},
|
|
|
|
{'A','R','P','I','N','S','T','A','L','L','L','O','C','A','T','I','O','N',0},
|
2005-02-25 15:00:09 +01:00
|
|
|
{'S','o','u','r','c','e','D','i','r',0},
|
2005-01-19 20:07:40 +01:00
|
|
|
{'M','a','n','u','f','a','c','t','u','r','e','r',0},
|
|
|
|
{'A','R','P','R','E','A','D','M','E',0},
|
|
|
|
{'A','R','P','S','I','Z','E',0},
|
|
|
|
{'A','R','P','U','R','L','I','N','F','O','A','B','O','U','T',0},
|
|
|
|
{'A','R','P','U','R','L','U','P','D','A','T','E','I','N','F','O',0},
|
|
|
|
{0},
|
|
|
|
};
|
|
|
|
|
|
|
|
static const WCHAR szRegKeys[][80] =
|
|
|
|
{
|
|
|
|
{'A','u','t','h','o','r','i','z','e','d','C','D','F','P','r','e','f','i','x',0},
|
|
|
|
{'C','o','n','t','a','c','t',0},
|
|
|
|
{'C','o','m','m','e','n','t','s',0},
|
|
|
|
{'D','i','s','p','l','a','y','N','a','m','e',0},
|
|
|
|
{'D','i','s','p','l','a','y','V','e','r','s','i','o','n',0},
|
|
|
|
{'H','e','l','p','L','i','n','k',0},
|
|
|
|
{'H','e','l','p','T','e','l','e','p','h','o','n','e',0},
|
|
|
|
{'I','n','s','t','a','l','l','L','o','c','a','t','i','o','n',0},
|
|
|
|
{'I','n','s','t','a','l','l','S','o','u','r','c','e',0},
|
|
|
|
{'P','u','b','l','i','s','h','e','r',0},
|
|
|
|
{'R','e','a','d','m','e',0},
|
|
|
|
{'S','i','z','e',0},
|
|
|
|
{'U','R','L','I','n','f','o','A','b','o','u','t',0},
|
|
|
|
{'U','R','L','U','p','d','a','t','e','I','n','f','o',0},
|
|
|
|
{0},
|
|
|
|
};
|
2005-06-08 21:07:52 +02:00
|
|
|
static const WCHAR szUpgradeCode[] =
|
|
|
|
{'U','p','g','r','a','d','e','C','o','d','e',0};
|
2005-06-17 23:25:41 +02:00
|
|
|
static const WCHAR modpath_fmt[] =
|
|
|
|
{'M','s','i','E','x','e','c','.','e','x','e',' ','/','I','[','P','r','o','d','u','c','t','C','o','d','e',']',0};
|
|
|
|
static const WCHAR szModifyPath[] =
|
|
|
|
{'M','o','d','i','f','y','P','a','t','h',0};
|
|
|
|
static const WCHAR szUninstallString[] =
|
|
|
|
{'U','n','i','n','s','t','a','l','l','S','t','r','i','n','g',0};
|
|
|
|
static const WCHAR szEstimatedSize[] =
|
|
|
|
{'E','s','t','i','m','a','t','e','d','S','i','z','e',0};
|
|
|
|
static const WCHAR szProductLanguage[] =
|
|
|
|
{'P','r','o','d','u','c','t','L','a','n','g','u','a','g','e',0};
|
|
|
|
static const WCHAR szProductVersion[] =
|
|
|
|
{'P','r','o','d','u','c','t','V','e','r','s','i','o','n',0};
|
|
|
|
|
|
|
|
SYSTEMTIME systime;
|
|
|
|
static const WCHAR date_fmt[] = {'%','i','%','i','%','i',0};
|
2005-06-08 21:07:52 +02:00
|
|
|
LPWSTR upgrade_code;
|
2005-01-19 20:07:40 +01:00
|
|
|
|
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
|
2005-07-07 22:27:06 +02:00
|
|
|
rc = MSIREG_OpenUninstallKey(package->ProductCode,&hkey,TRUE);
|
2005-01-19 20:07:40 +01:00
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
/* dump all the info i can grab */
|
|
|
|
FIXME("Flesh out more information \n");
|
|
|
|
|
2005-09-15 16:58:38 +02:00
|
|
|
for( i=0; szPropKeys[i][0]; i++ )
|
2005-01-19 20:07:40 +01:00
|
|
|
{
|
2005-09-15 17:04:08 +02:00
|
|
|
buffer = msi_dup_property( package, szPropKeys[i] );
|
2005-09-15 16:58:38 +02:00
|
|
|
msi_reg_set_val_str( hkey, szRegKeys[i], buffer );
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(buffer);
|
2005-01-19 20:07:40 +01:00
|
|
|
}
|
|
|
|
|
2005-09-15 16:58:38 +02:00
|
|
|
msi_reg_set_val_dword( hkey, szWindowsInstaller, 1 );
|
2005-01-19 20:07:40 +01:00
|
|
|
|
2005-09-30 12:32:41 +02:00
|
|
|
msi_make_package_local( package, hkey );
|
2005-06-08 21:07:52 +02:00
|
|
|
|
2005-06-17 23:25:41 +02:00
|
|
|
/* do ModifyPath and UninstallString */
|
|
|
|
size = deformat_string(package,modpath_fmt,&buffer);
|
2005-07-06 12:33:30 +02:00
|
|
|
RegSetValueExW(hkey,szModifyPath,0,REG_EXPAND_SZ,(LPBYTE)buffer,size);
|
|
|
|
RegSetValueExW(hkey,szUninstallString,0,REG_EXPAND_SZ,(LPBYTE)buffer,size);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(buffer);
|
2005-06-17 23:25:41 +02:00
|
|
|
|
|
|
|
FIXME("Write real Estimated Size when we have it\n");
|
2005-09-15 16:58:38 +02:00
|
|
|
msi_reg_set_val_dword( hkey, szEstimatedSize, 0 );
|
2005-06-17 23:25:41 +02:00
|
|
|
|
|
|
|
GetLocalTime(&systime);
|
|
|
|
size = 9*sizeof(WCHAR);
|
2005-09-20 13:59:14 +02:00
|
|
|
buffer= msi_alloc(size);
|
2005-06-17 23:25:41 +02:00
|
|
|
sprintfW(buffer,date_fmt,systime.wYear,systime.wMonth,systime.wDay);
|
2005-09-15 16:58:38 +02:00
|
|
|
msi_reg_set_val_str( hkey, INSTALLPROPERTY_INSTALLDATEW, buffer );
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(buffer);
|
2005-06-17 23:25:41 +02:00
|
|
|
|
2005-09-29 12:32:39 +02:00
|
|
|
langid = msi_get_property_int( package, szProductLanguage, 0 );
|
|
|
|
msi_reg_set_val_dword( hkey, INSTALLPROPERTY_LANGUAGEW, langid );
|
2005-06-17 23:25:41 +02:00
|
|
|
|
2005-09-15 17:04:08 +02:00
|
|
|
buffer = msi_dup_property( package, szProductVersion );
|
2005-06-17 23:25:41 +02:00
|
|
|
if (buffer)
|
|
|
|
{
|
|
|
|
DWORD verdword = build_version_dword(buffer);
|
2005-09-15 16:58:38 +02:00
|
|
|
|
|
|
|
msi_reg_set_val_dword( hkey, INSTALLPROPERTY_VERSIONW, verdword );
|
|
|
|
msi_reg_set_val_dword( hkey, INSTALLPROPERTY_VERSIONMAJORW, verdword>>24 );
|
|
|
|
msi_reg_set_val_dword( hkey, INSTALLPROPERTY_VERSIONMINORW, (verdword>>16)&0x00FF );
|
2005-06-17 23:25:41 +02:00
|
|
|
}
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(buffer);
|
2005-06-17 23:25:41 +02:00
|
|
|
|
2005-06-08 21:07:52 +02:00
|
|
|
/* Handle Upgrade Codes */
|
2005-09-15 17:04:08 +02:00
|
|
|
upgrade_code = msi_dup_property( package, szUpgradeCode );
|
2005-06-08 21:07:52 +02:00
|
|
|
if (upgrade_code)
|
|
|
|
{
|
|
|
|
HKEY hkey2;
|
|
|
|
WCHAR squashed[33];
|
|
|
|
MSIREG_OpenUpgradeCodesKey(upgrade_code, &hkey2, TRUE);
|
2005-07-07 22:27:06 +02:00
|
|
|
squash_guid(package->ProductCode,squashed);
|
2005-09-15 16:58:38 +02:00
|
|
|
msi_reg_set_val_str( hkey2, squashed, NULL );
|
2005-06-08 21:07:52 +02:00
|
|
|
RegCloseKey(hkey2);
|
|
|
|
MSIREG_OpenUserUpgradeCodesKey(upgrade_code, &hkey2, TRUE);
|
2005-07-07 22:27:06 +02:00
|
|
|
squash_guid(package->ProductCode,squashed);
|
2005-09-15 16:58:38 +02:00
|
|
|
msi_reg_set_val_str( hkey2, squashed, NULL );
|
2005-06-08 21:07:52 +02:00
|
|
|
RegCloseKey(hkey2);
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(upgrade_code);
|
2005-06-08 21:07:52 +02:00
|
|
|
}
|
2005-01-19 20:07:40 +01:00
|
|
|
|
|
|
|
end:
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ACTION_InstallExecute(MSIPACKAGE *package)
|
|
|
|
{
|
2005-05-27 21:24:22 +02:00
|
|
|
UINT rc;
|
|
|
|
|
2005-01-19 20:07:40 +01:00
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
|
2005-05-27 21:24:22 +02:00
|
|
|
rc = execute_script(package,INSTALL_SCRIPT);
|
2005-01-19 20:07:40 +01:00
|
|
|
|
2005-05-27 21:24:22 +02:00
|
|
|
return rc;
|
2005-01-19 20:07:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ACTION_InstallFinalize(MSIPACKAGE *package)
|
|
|
|
{
|
2005-05-27 21:24:22 +02:00
|
|
|
UINT rc;
|
|
|
|
|
2005-01-19 20:07:40 +01:00
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
|
2005-05-27 21:24:22 +02:00
|
|
|
/* turn off scheduleing */
|
|
|
|
package->script->CurrentlyScripting= FALSE;
|
|
|
|
|
2005-01-25 21:17:09 +01:00
|
|
|
/* first do the same as an InstallExecute */
|
2005-05-27 21:24:22 +02:00
|
|
|
rc = ACTION_InstallExecute(package);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
return rc;
|
2005-01-25 21:17:09 +01:00
|
|
|
|
|
|
|
/* then handle Commit Actions */
|
2005-05-27 21:24:22 +02:00
|
|
|
rc = execute_script(package,COMMIT_SCRIPT);
|
2005-01-19 20:07:40 +01:00
|
|
|
|
2005-05-27 21:24:22 +02:00
|
|
|
return rc;
|
2005-01-19 20:07:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ACTION_ForceReboot(MSIPACKAGE *package)
|
|
|
|
{
|
|
|
|
static const WCHAR RunOnce[] = {
|
|
|
|
'S','o','f','t','w','a','r','e','\\',
|
|
|
|
'M','i','c','r','o','s','o','f','t','\\',
|
|
|
|
'W','i','n','d','o','w','s','\\',
|
|
|
|
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
|
2005-02-22 20:31:45 +01:00
|
|
|
'R','u','n','O','n','c','e',0};
|
2005-01-19 20:07:40 +01:00
|
|
|
static const WCHAR InstallRunOnce[] = {
|
|
|
|
'S','o','f','t','w','a','r','e','\\',
|
|
|
|
'M','i','c','r','o','s','o','f','t','\\',
|
|
|
|
'W','i','n','d','o','w','s','\\',
|
|
|
|
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
|
|
|
|
'I','n','s','t','a','l','l','e','r','\\',
|
2005-02-22 20:31:45 +01:00
|
|
|
'R','u','n','O','n','c','e','E','n','t','r','i','e','s',0};
|
2005-01-19 20:07:40 +01:00
|
|
|
|
|
|
|
static const WCHAR msiexec_fmt[] = {
|
2005-03-01 11:41:52 +01:00
|
|
|
'%','s',
|
2005-01-19 20:07:40 +01:00
|
|
|
'\\','M','s','i','E','x','e','c','.','e','x','e',' ','/','@',' ',
|
|
|
|
'\"','%','s','\"',0};
|
|
|
|
static const WCHAR install_fmt[] = {
|
|
|
|
'/','I',' ','\"','%','s','\"',' ',
|
|
|
|
'A','F','T','E','R','R','E','B','O','O','T','=','1',' ',
|
|
|
|
'R','U','N','O','N','C','E','E','N','T','R','Y','=','\"','%','s','\"',0};
|
2005-03-01 11:41:52 +01:00
|
|
|
WCHAR buffer[256], sysdir[MAX_PATH];
|
2005-07-07 22:27:06 +02:00
|
|
|
HKEY hkey;
|
2005-09-15 16:58:38 +02:00
|
|
|
WCHAR squished_pc[100];
|
2005-01-19 20:07:40 +01:00
|
|
|
|
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
|
2005-07-07 22:27:06 +02:00
|
|
|
squash_guid(package->ProductCode,squished_pc);
|
2005-01-19 20:07:40 +01:00
|
|
|
|
2005-03-01 11:41:52 +01:00
|
|
|
GetSystemDirectoryW(sysdir, sizeof(sysdir)/sizeof(sysdir[0]));
|
2005-01-19 20:07:40 +01:00
|
|
|
RegCreateKeyW(HKEY_LOCAL_MACHINE,RunOnce,&hkey);
|
2005-03-01 11:41:52 +01:00
|
|
|
snprintfW(buffer,sizeof(buffer)/sizeof(buffer[0]),msiexec_fmt,sysdir,
|
|
|
|
squished_pc);
|
2005-01-19 20:07:40 +01:00
|
|
|
|
2005-09-15 16:58:38 +02:00
|
|
|
msi_reg_set_val_str( hkey, squished_pc, buffer );
|
2005-01-19 20:07:40 +01:00
|
|
|
RegCloseKey(hkey);
|
|
|
|
|
|
|
|
TRACE("Reboot command %s\n",debugstr_w(buffer));
|
|
|
|
|
|
|
|
RegCreateKeyW(HKEY_LOCAL_MACHINE,InstallRunOnce,&hkey);
|
2005-07-07 22:27:06 +02:00
|
|
|
sprintfW(buffer,install_fmt,package->ProductCode,squished_pc);
|
2005-02-24 13:47:43 +01:00
|
|
|
|
2005-09-15 16:58:38 +02:00
|
|
|
msi_reg_set_val_str( hkey, squished_pc, buffer );
|
2005-01-19 20:07:40 +01:00
|
|
|
RegCloseKey(hkey);
|
|
|
|
|
2005-01-25 12:05:37 +01:00
|
|
|
return ERROR_INSTALL_SUSPEND;
|
2005-01-19 20:07:40 +01:00
|
|
|
}
|
|
|
|
|
2005-01-31 17:23:12 +01:00
|
|
|
UINT ACTION_ResolveSource(MSIPACKAGE* package)
|
|
|
|
{
|
2005-08-15 22:50:06 +02:00
|
|
|
DWORD attrib;
|
|
|
|
UINT rc;
|
2005-01-31 17:23:12 +01:00
|
|
|
/*
|
|
|
|
* we are currently doing what should be done here in the top level Install
|
|
|
|
* however for Adminastrative and uninstalls this step will be needed
|
|
|
|
*/
|
2005-08-15 22:50:06 +02:00
|
|
|
if (!package->PackagePath)
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
|
|
|
|
attrib = GetFileAttributesW(package->PackagePath);
|
|
|
|
if (attrib == INVALID_FILE_ATTRIBUTES)
|
|
|
|
{
|
|
|
|
LPWSTR prompt;
|
|
|
|
LPWSTR msg;
|
|
|
|
DWORD size = 0;
|
|
|
|
|
|
|
|
rc = MsiSourceListGetInfoW(package->ProductCode, NULL,
|
|
|
|
MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT,
|
|
|
|
INSTALLPROPERTY_DISKPROMPTW,NULL,&size);
|
|
|
|
if (rc == ERROR_MORE_DATA)
|
|
|
|
{
|
2005-09-20 13:59:14 +02:00
|
|
|
prompt = msi_alloc(size * sizeof(WCHAR));
|
2005-08-15 22:50:06 +02:00
|
|
|
MsiSourceListGetInfoW(package->ProductCode, NULL,
|
|
|
|
MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT,
|
|
|
|
INSTALLPROPERTY_DISKPROMPTW,prompt,&size);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
prompt = strdupW(package->PackagePath);
|
|
|
|
|
|
|
|
msg = generate_error_string(package,1302,1,prompt);
|
|
|
|
while(attrib == INVALID_FILE_ATTRIBUTES)
|
|
|
|
{
|
|
|
|
rc = MessageBoxW(NULL,msg,NULL,MB_OKCANCEL);
|
|
|
|
if (rc == IDCANCEL)
|
|
|
|
{
|
|
|
|
rc = ERROR_INSTALL_USEREXIT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
attrib = GetFileAttributesW(package->PackagePath);
|
|
|
|
}
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(prompt);
|
2005-08-15 22:50:06 +02:00
|
|
|
rc = ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
|
|
|
|
return rc;
|
2005-01-31 17:23:12 +01:00
|
|
|
}
|
|
|
|
|
2005-02-10 18:09:44 +01:00
|
|
|
static UINT ACTION_RegisterUser(MSIPACKAGE *package)
|
|
|
|
{
|
|
|
|
HKEY hkey=0;
|
|
|
|
LPWSTR buffer;
|
|
|
|
LPWSTR productid;
|
|
|
|
UINT rc,i;
|
|
|
|
|
|
|
|
static const WCHAR szPropKeys[][80] =
|
|
|
|
{
|
2005-03-01 12:45:19 +01:00
|
|
|
{'P','r','o','d','u','c','t','I','D',0},
|
|
|
|
{'U','S','E','R','N','A','M','E',0},
|
|
|
|
{'C','O','M','P','A','N','Y','N','A','M','E',0},
|
|
|
|
{0},
|
2005-02-10 18:09:44 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static const WCHAR szRegKeys[][80] =
|
|
|
|
{
|
2005-03-01 12:45:19 +01:00
|
|
|
{'P','r','o','d','u','c','t','I','D',0},
|
|
|
|
{'R','e','g','O','w','n','e','r',0},
|
|
|
|
{'R','e','g','C','o','m','p','a','n','y',0},
|
|
|
|
{0},
|
2005-02-10 18:09:44 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
if (!package)
|
|
|
|
return ERROR_INVALID_HANDLE;
|
|
|
|
|
2005-09-15 17:04:08 +02:00
|
|
|
productid = msi_dup_property( package, INSTALLPROPERTY_PRODUCTIDW );
|
2005-02-10 18:09:44 +01:00
|
|
|
if (!productid)
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
|
2005-07-07 22:27:06 +02:00
|
|
|
rc = MSIREG_OpenUninstallKey(package->ProductCode,&hkey,TRUE);
|
2005-02-10 18:09:44 +01:00
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
goto end;
|
|
|
|
|
2005-09-16 20:45:19 +02:00
|
|
|
for( i = 0; szPropKeys[i][0]; i++ )
|
2005-02-10 18:09:44 +01:00
|
|
|
{
|
2005-09-15 17:04:08 +02:00
|
|
|
buffer = msi_dup_property( package, szPropKeys[i] );
|
2005-09-15 16:58:38 +02:00
|
|
|
msi_reg_set_val_str( hkey, szRegKeys[i], buffer );
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free( buffer );
|
2005-02-10 18:09:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
end:
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(productid);
|
2005-02-10 18:09:44 +01:00
|
|
|
RegCloseKey(hkey);
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-02-24 13:47:43 +01:00
|
|
|
|
|
|
|
static UINT ACTION_ExecuteAction(MSIPACKAGE *package)
|
|
|
|
{
|
2005-06-24 14:14:52 +02:00
|
|
|
static const WCHAR szUILevel[] = {'U','I','L','e','v','e','l',0};
|
|
|
|
static const WCHAR szTwo[] = {'2',0};
|
2005-02-24 13:47:43 +01:00
|
|
|
UINT rc;
|
2005-06-24 14:14:52 +02:00
|
|
|
LPWSTR level;
|
2005-09-15 17:04:08 +02:00
|
|
|
level = msi_dup_property( package, szUILevel );
|
2005-06-24 14:14:52 +02:00
|
|
|
|
|
|
|
MSI_SetPropertyW(package,szUILevel,szTwo);
|
2005-06-30 22:45:43 +02:00
|
|
|
package->script->InWhatSequence |= SEQUENCE_EXEC;
|
2005-05-13 15:56:39 +02:00
|
|
|
rc = ACTION_ProcessExecSequence(package,FALSE);
|
2005-06-24 14:14:52 +02:00
|
|
|
MSI_SetPropertyW(package,szUILevel,level);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(level);
|
2005-02-24 13:47:43 +01:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-02-25 15:00:09 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Code based off of code located here
|
|
|
|
* http://www.codeproject.com/gdi/fontnamefromfile.asp
|
|
|
|
*
|
|
|
|
* Using string index 4 (full font name) instead of 1 (family name)
|
|
|
|
*/
|
|
|
|
static LPWSTR load_ttfname_from(LPCWSTR filename)
|
|
|
|
{
|
|
|
|
HANDLE handle;
|
|
|
|
LPWSTR ret = NULL;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
typedef struct _tagTT_OFFSET_TABLE{
|
|
|
|
USHORT uMajorVersion;
|
|
|
|
USHORT uMinorVersion;
|
|
|
|
USHORT uNumOfTables;
|
|
|
|
USHORT uSearchRange;
|
|
|
|
USHORT uEntrySelector;
|
|
|
|
USHORT uRangeShift;
|
|
|
|
}TT_OFFSET_TABLE;
|
|
|
|
|
|
|
|
typedef struct _tagTT_TABLE_DIRECTORY{
|
|
|
|
char szTag[4]; /* table name */
|
|
|
|
ULONG uCheckSum; /* Check sum */
|
|
|
|
ULONG uOffset; /* Offset from beginning of file */
|
|
|
|
ULONG uLength; /* length of the table in bytes */
|
|
|
|
}TT_TABLE_DIRECTORY;
|
|
|
|
|
|
|
|
typedef struct _tagTT_NAME_TABLE_HEADER{
|
|
|
|
USHORT uFSelector; /* format selector. Always 0 */
|
|
|
|
USHORT uNRCount; /* Name Records count */
|
|
|
|
USHORT uStorageOffset; /* Offset for strings storage,
|
|
|
|
* from start of the table */
|
|
|
|
}TT_NAME_TABLE_HEADER;
|
|
|
|
|
|
|
|
typedef struct _tagTT_NAME_RECORD{
|
|
|
|
USHORT uPlatformID;
|
|
|
|
USHORT uEncodingID;
|
|
|
|
USHORT uLanguageID;
|
|
|
|
USHORT uNameID;
|
|
|
|
USHORT uStringLength;
|
|
|
|
USHORT uStringOffset; /* from start of storage area */
|
|
|
|
}TT_NAME_RECORD;
|
2005-03-02 13:23:20 +01:00
|
|
|
|
|
|
|
#define SWAPWORD(x) MAKEWORD(HIBYTE(x), LOBYTE(x))
|
|
|
|
#define SWAPLONG(x) MAKELONG(SWAPWORD(HIWORD(x)), SWAPWORD(LOWORD(x)))
|
|
|
|
|
2005-02-25 15:00:09 +01:00
|
|
|
handle = CreateFileW(filename ,GENERIC_READ, 0, NULL, OPEN_EXISTING,
|
|
|
|
FILE_ATTRIBUTE_NORMAL, 0 );
|
|
|
|
if (handle != INVALID_HANDLE_VALUE)
|
|
|
|
{
|
|
|
|
TT_TABLE_DIRECTORY tblDir;
|
|
|
|
BOOL bFound = FALSE;
|
|
|
|
TT_OFFSET_TABLE ttOffsetTable;
|
|
|
|
|
|
|
|
ReadFile(handle,&ttOffsetTable, sizeof(TT_OFFSET_TABLE),NULL,NULL);
|
|
|
|
ttOffsetTable.uNumOfTables = SWAPWORD(ttOffsetTable.uNumOfTables);
|
|
|
|
ttOffsetTable.uMajorVersion = SWAPWORD(ttOffsetTable.uMajorVersion);
|
|
|
|
ttOffsetTable.uMinorVersion = SWAPWORD(ttOffsetTable.uMinorVersion);
|
|
|
|
|
|
|
|
if (ttOffsetTable.uMajorVersion != 1 ||
|
|
|
|
ttOffsetTable.uMinorVersion != 0)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
for (i=0; i< ttOffsetTable.uNumOfTables; i++)
|
|
|
|
{
|
|
|
|
ReadFile(handle,&tblDir, sizeof(TT_TABLE_DIRECTORY),NULL,NULL);
|
|
|
|
if (strncmp(tblDir.szTag,"name",4)==0)
|
|
|
|
{
|
|
|
|
bFound = TRUE;
|
|
|
|
tblDir.uLength = SWAPLONG(tblDir.uLength);
|
|
|
|
tblDir.uOffset = SWAPLONG(tblDir.uOffset);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bFound)
|
|
|
|
{
|
|
|
|
TT_NAME_TABLE_HEADER ttNTHeader;
|
|
|
|
TT_NAME_RECORD ttRecord;
|
|
|
|
|
|
|
|
SetFilePointer(handle, tblDir.uOffset, NULL, FILE_BEGIN);
|
|
|
|
ReadFile(handle,&ttNTHeader, sizeof(TT_NAME_TABLE_HEADER),
|
|
|
|
NULL,NULL);
|
|
|
|
|
|
|
|
ttNTHeader.uNRCount = SWAPWORD(ttNTHeader.uNRCount);
|
|
|
|
ttNTHeader.uStorageOffset = SWAPWORD(ttNTHeader.uStorageOffset);
|
|
|
|
bFound = FALSE;
|
|
|
|
for(i=0; i<ttNTHeader.uNRCount; i++)
|
|
|
|
{
|
|
|
|
ReadFile(handle,&ttRecord, sizeof(TT_NAME_RECORD),NULL,NULL);
|
|
|
|
ttRecord.uNameID = SWAPWORD(ttRecord.uNameID);
|
|
|
|
/* 4 is the Full Font Name */
|
|
|
|
if(ttRecord.uNameID == 4)
|
|
|
|
{
|
|
|
|
int nPos;
|
|
|
|
LPSTR buf;
|
2005-06-07 22:29:51 +02:00
|
|
|
static LPCSTR tt = " (TrueType)";
|
2005-02-25 15:00:09 +01:00
|
|
|
|
|
|
|
ttRecord.uStringLength = SWAPWORD(ttRecord.uStringLength);
|
|
|
|
ttRecord.uStringOffset = SWAPWORD(ttRecord.uStringOffset);
|
|
|
|
nPos = SetFilePointer(handle, 0, NULL, FILE_CURRENT);
|
|
|
|
SetFilePointer(handle, tblDir.uOffset +
|
|
|
|
ttRecord.uStringOffset +
|
|
|
|
ttNTHeader.uStorageOffset,
|
|
|
|
NULL, FILE_BEGIN);
|
2005-09-20 13:59:14 +02:00
|
|
|
buf = msi_alloc( ttRecord.uStringLength + 1 + strlen(tt) );
|
2005-02-25 15:00:09 +01:00
|
|
|
memset(buf, 0, ttRecord.uStringLength + 1 + strlen(tt));
|
|
|
|
ReadFile(handle, buf, ttRecord.uStringLength, NULL, NULL);
|
|
|
|
if (strlen(buf) > 0)
|
|
|
|
{
|
|
|
|
strcat(buf,tt);
|
|
|
|
ret = strdupAtoW(buf);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(buf);
|
2005-02-25 15:00:09 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(buf);
|
2005-02-25 15:00:09 +01:00
|
|
|
SetFilePointer(handle,nPos, NULL, FILE_BEGIN);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CloseHandle(handle);
|
|
|
|
}
|
2005-05-18 11:44:38 +02:00
|
|
|
else
|
|
|
|
ERR("Unable to open font file %s\n", debugstr_w(filename));
|
2005-02-25 15:00:09 +01:00
|
|
|
|
|
|
|
TRACE("Returning fontname %s\n",debugstr_w(ret));
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-06-23 13:04:09 +02:00
|
|
|
static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param)
|
2005-02-25 15:00:09 +01:00
|
|
|
{
|
2005-06-23 13:04:09 +02:00
|
|
|
MSIPACKAGE *package = (MSIPACKAGE*)param;
|
|
|
|
LPWSTR name;
|
2005-08-23 12:03:17 +02:00
|
|
|
LPCWSTR filename;
|
|
|
|
MSIFILE *file;
|
2005-03-01 12:45:19 +01:00
|
|
|
static const WCHAR regfont1[] =
|
|
|
|
{'S','o','f','t','w','a','r','e','\\',
|
|
|
|
'M','i','c','r','o','s','o','f','t','\\',
|
|
|
|
'W','i','n','d','o','w','s',' ','N','T','\\',
|
|
|
|
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
|
|
|
|
'F','o','n','t','s',0};
|
|
|
|
static const WCHAR regfont2[] =
|
|
|
|
{'S','o','f','t','w','a','r','e','\\',
|
|
|
|
'M','i','c','r','o','s','o','f','t','\\',
|
|
|
|
'W','i','n','d','o','w','s','\\',
|
|
|
|
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
|
|
|
|
'F','o','n','t','s',0};
|
2005-02-25 15:00:09 +01:00
|
|
|
HKEY hkey1;
|
|
|
|
HKEY hkey2;
|
|
|
|
|
2005-08-23 12:03:17 +02:00
|
|
|
filename = MSI_RecordGetString( row, 1 );
|
|
|
|
file = get_loaded_file( package, filename );
|
|
|
|
if (!file)
|
2005-05-19 13:15:24 +02:00
|
|
|
{
|
2005-06-23 13:04:09 +02:00
|
|
|
ERR("Unable to load file\n");
|
2005-05-19 13:15:24 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2005-02-25 15:00:09 +01:00
|
|
|
|
2005-06-23 13:04:09 +02:00
|
|
|
/* check to make sure that component is installed */
|
|
|
|
if (!ACTION_VerifyComponentForAction(package,
|
2005-08-23 12:03:17 +02:00
|
|
|
file->Component, INSTALLSTATE_LOCAL))
|
2005-02-25 15:00:09 +01:00
|
|
|
{
|
2005-06-23 13:04:09 +02:00
|
|
|
TRACE("Skipping: Component not scheduled for install\n");
|
2005-05-19 13:15:24 +02:00
|
|
|
return ERROR_SUCCESS;
|
2005-02-25 15:00:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
RegCreateKeyW(HKEY_LOCAL_MACHINE,regfont1,&hkey1);
|
|
|
|
RegCreateKeyW(HKEY_LOCAL_MACHINE,regfont2,&hkey2);
|
|
|
|
|
2005-06-23 13:04:09 +02:00
|
|
|
if (MSI_RecordIsNull(row,2))
|
2005-08-23 12:03:17 +02:00
|
|
|
name = load_ttfname_from( file->TargetPath );
|
2005-06-23 13:04:09 +02:00
|
|
|
else
|
|
|
|
name = load_dynamic_stringW(row,2);
|
2005-02-25 15:00:09 +01:00
|
|
|
|
2005-06-23 13:04:09 +02:00
|
|
|
if (name)
|
|
|
|
{
|
2005-09-15 16:58:38 +02:00
|
|
|
msi_reg_set_val_str( hkey1, name, file->FileName );
|
|
|
|
msi_reg_set_val_str( hkey2, name, file->FileName );
|
2005-06-23 13:04:09 +02:00
|
|
|
}
|
2005-02-25 15:00:09 +01:00
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(name);
|
2005-06-23 13:04:09 +02:00
|
|
|
RegCloseKey(hkey1);
|
|
|
|
RegCloseKey(hkey2);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2005-02-25 15:00:09 +01:00
|
|
|
|
2005-06-23 13:04:09 +02:00
|
|
|
static UINT ACTION_RegisterFonts(MSIPACKAGE *package)
|
|
|
|
{
|
|
|
|
UINT rc;
|
|
|
|
MSIQUERY * view;
|
|
|
|
static const WCHAR ExecSeqQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
|
|
|
'`','F','o','n','t','`',0};
|
2005-02-25 15:00:09 +01:00
|
|
|
|
2005-06-23 13:04:09 +02:00
|
|
|
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
TRACE("MSI_DatabaseOpenViewW failed: %d\n", rc);
|
|
|
|
return ERROR_SUCCESS;
|
2005-02-25 15:00:09 +01:00
|
|
|
}
|
|
|
|
|
2005-06-23 13:04:09 +02:00
|
|
|
MSI_IterateRecords(view, NULL, ITERATE_RegisterFonts, package);
|
|
|
|
msiobj_release(&view->hdr);
|
2005-02-25 15:00:09 +01:00
|
|
|
|
2005-06-23 13:04:09 +02:00
|
|
|
return ERROR_SUCCESS;
|
2005-02-25 15:00:09 +01:00
|
|
|
}
|
|
|
|
|
2005-04-20 14:50:05 +02:00
|
|
|
static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param)
|
|
|
|
{
|
|
|
|
MSIPACKAGE *package = (MSIPACKAGE*)param;
|
2005-06-09 22:30:59 +02:00
|
|
|
LPCWSTR compgroupid=NULL;
|
|
|
|
LPCWSTR feature=NULL;
|
|
|
|
LPCWSTR text = NULL;
|
|
|
|
LPCWSTR qualifier = NULL;
|
|
|
|
LPCWSTR component = NULL;
|
2005-05-26 14:24:28 +02:00
|
|
|
LPWSTR advertise = NULL;
|
|
|
|
LPWSTR output = NULL;
|
2005-04-20 14:50:05 +02:00
|
|
|
HKEY hkey;
|
|
|
|
UINT rc = ERROR_SUCCESS;
|
2005-08-22 11:15:23 +02:00
|
|
|
MSICOMPONENT *comp;
|
2005-04-20 14:50:05 +02:00
|
|
|
DWORD sz = 0;
|
2005-05-13 15:56:39 +02:00
|
|
|
|
2005-06-09 22:30:59 +02:00
|
|
|
component = MSI_RecordGetString(rec,3);
|
2005-08-22 11:15:23 +02:00
|
|
|
comp = get_loaded_component(package,component);
|
|
|
|
|
|
|
|
if (!ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_LOCAL) &&
|
|
|
|
!ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_SOURCE) &&
|
|
|
|
!ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_ADVERTISED))
|
2005-05-13 15:56:39 +02:00
|
|
|
{
|
|
|
|
TRACE("Skipping: Component %s not scheduled for install\n",
|
|
|
|
debugstr_w(component));
|
2005-05-26 14:24:28 +02:00
|
|
|
|
2005-05-13 15:56:39 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2005-04-20 14:50:05 +02:00
|
|
|
|
2005-06-09 22:30:59 +02:00
|
|
|
compgroupid = MSI_RecordGetString(rec,1);
|
2005-04-20 14:50:05 +02:00
|
|
|
|
|
|
|
rc = MSIREG_OpenUserComponentsKey(compgroupid, &hkey, TRUE);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
goto end;
|
|
|
|
|
2005-06-09 22:30:59 +02:00
|
|
|
text = MSI_RecordGetString(rec,4);
|
|
|
|
qualifier = MSI_RecordGetString(rec,2);
|
|
|
|
feature = MSI_RecordGetString(rec,5);
|
2005-04-20 14:50:05 +02:00
|
|
|
|
2005-08-22 11:15:23 +02:00
|
|
|
advertise = create_component_advertise_string(package, comp, feature);
|
2005-05-26 14:24:28 +02:00
|
|
|
|
|
|
|
sz = strlenW(advertise);
|
2005-04-20 14:50:05 +02:00
|
|
|
|
|
|
|
if (text)
|
|
|
|
sz += lstrlenW(text);
|
|
|
|
|
|
|
|
sz+=3;
|
|
|
|
sz *= sizeof(WCHAR);
|
|
|
|
|
2005-09-20 13:59:14 +02:00
|
|
|
output = msi_alloc(sz);
|
2005-04-20 14:50:05 +02:00
|
|
|
memset(output,0,sz);
|
2005-05-26 14:24:28 +02:00
|
|
|
strcpyW(output,advertise);
|
2005-09-22 12:56:26 +02:00
|
|
|
msi_free(advertise);
|
2005-04-20 14:50:05 +02:00
|
|
|
|
|
|
|
if (text)
|
|
|
|
strcatW(output,text);
|
|
|
|
|
2005-09-15 16:58:38 +02:00
|
|
|
msi_reg_set_val_multi_str( hkey, qualifier, output );
|
2005-04-20 14:50:05 +02:00
|
|
|
|
|
|
|
end:
|
|
|
|
RegCloseKey(hkey);
|
2005-09-20 13:59:14 +02:00
|
|
|
msi_free(output);
|
2005-04-20 14:50:05 +02:00
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* At present I am ignorning the advertised components part of this and only
|
|
|
|
* focusing on the qualified component sets
|
|
|
|
*/
|
|
|
|
static UINT ACTION_PublishComponents(MSIPACKAGE *package)
|
|
|
|
{
|
|
|
|
UINT rc;
|
|
|
|
MSIQUERY * view;
|
|
|
|
static const WCHAR ExecSeqQuery[] =
|
|
|
|
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
2005-05-20 11:40:42 +02:00
|
|
|
'`','P','u','b','l','i','s','h',
|
|
|
|
'C','o','m','p','o','n','e','n','t','`',0};
|
2005-04-20 14:50:05 +02:00
|
|
|
|
|
|
|
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
|
|
|
|
if (rc != ERROR_SUCCESS)
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
|
|
|
|
rc = MSI_IterateRecords(view, NULL, ITERATE_PublishComponent, package);
|
|
|
|
msiobj_release(&view->hdr);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
2005-09-23 12:09:18 +02:00
|
|
|
|
2005-09-26 11:56:18 +02:00
|
|
|
static UINT msi_unimplemented_action_stub( MSIPACKAGE *package,
|
|
|
|
LPCSTR action, LPCWSTR table )
|
2005-09-23 12:09:18 +02:00
|
|
|
{
|
2005-09-26 11:56:18 +02:00
|
|
|
static const WCHAR query[] = {
|
|
|
|
'S','E','L','E','C','T',' ','*',' ',
|
|
|
|
'F','R','O','M',' ','`','%','s','`',0 };
|
2005-09-23 12:09:18 +02:00
|
|
|
MSIQUERY *view = NULL;
|
|
|
|
DWORD count = 0;
|
2005-09-26 11:56:18 +02:00
|
|
|
UINT r;
|
2005-09-23 12:09:18 +02:00
|
|
|
|
2005-09-26 11:56:18 +02:00
|
|
|
r = MSI_OpenQuery( package->db, &view, query, table );
|
|
|
|
if (r == ERROR_SUCCESS)
|
2005-09-23 12:09:18 +02:00
|
|
|
{
|
2005-09-26 11:56:18 +02:00
|
|
|
r = MSI_IterateRecords(view, &count, NULL, package);
|
2005-09-23 12:09:18 +02:00
|
|
|
msiobj_release(&view->hdr);
|
|
|
|
}
|
|
|
|
|
2005-09-26 11:56:18 +02:00
|
|
|
if (count)
|
|
|
|
FIXME("%s -> %lu ignored %s table values\n",
|
|
|
|
action, count, debugstr_w(table));
|
|
|
|
|
2005-09-23 12:09:18 +02:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2005-09-23 12:48:17 +02:00
|
|
|
|
2005-09-26 11:56:18 +02:00
|
|
|
static UINT ACTION_RemoveIniValues( MSIPACKAGE *package )
|
2005-09-23 12:48:17 +02:00
|
|
|
{
|
2005-09-26 11:56:18 +02:00
|
|
|
static const WCHAR table[] =
|
|
|
|
{'R','e','m','o','v','e','I','n','i','F','i','l','e',0 };
|
|
|
|
return msi_unimplemented_action_stub( package, "RemoveIniValues", table );
|
|
|
|
}
|
2005-09-23 12:48:17 +02:00
|
|
|
|
2005-09-26 11:56:18 +02:00
|
|
|
static UINT ACTION_MoveFiles( MSIPACKAGE *package )
|
|
|
|
{
|
|
|
|
static const WCHAR table[] = { 'M','o','v','e','F','i','l','e',0 };
|
|
|
|
return msi_unimplemented_action_stub( package, "MoveFiles", table );
|
2005-09-23 12:48:17 +02:00
|
|
|
}
|
2005-09-23 13:06:57 +02:00
|
|
|
|
2005-09-26 11:56:18 +02:00
|
|
|
static UINT ACTION_PatchFiles( MSIPACKAGE *package )
|
2005-09-23 13:06:57 +02:00
|
|
|
{
|
2005-09-26 11:56:18 +02:00
|
|
|
static const WCHAR table[] = { 'P','a','t','c','h',0 };
|
|
|
|
return msi_unimplemented_action_stub( package, "PatchFiles", table );
|
|
|
|
}
|
2005-09-23 13:06:57 +02:00
|
|
|
|
2005-09-26 11:56:18 +02:00
|
|
|
static UINT ACTION_BindImage( MSIPACKAGE *package )
|
|
|
|
{
|
|
|
|
static const WCHAR table[] = { 'B','i','n','d','I','m','a','g','e',0 };
|
|
|
|
return msi_unimplemented_action_stub( package, "BindImage", table );
|
2005-09-23 13:06:57 +02:00
|
|
|
}
|
2005-09-23 19:21:10 +02:00
|
|
|
|
2005-09-26 11:56:18 +02:00
|
|
|
static UINT ACTION_IsolateComponents( MSIPACKAGE *package )
|
2005-09-23 19:21:10 +02:00
|
|
|
{
|
2005-09-26 11:56:18 +02:00
|
|
|
static const WCHAR table[] = {
|
|
|
|
'I','s','o','l','a','t','e','C','o','m','p','o','n','e','n','t',0 };
|
|
|
|
return msi_unimplemented_action_stub( package, "IsolateComponents", table );
|
|
|
|
}
|
2005-09-23 19:21:10 +02:00
|
|
|
|
2005-09-26 11:56:18 +02:00
|
|
|
static UINT ACTION_MigrateFeatureStates( MSIPACKAGE *package )
|
|
|
|
{
|
|
|
|
static const WCHAR table[] = { 'U','p','g','r','a','d','e',0 };
|
|
|
|
return msi_unimplemented_action_stub( package, "MigrateFeatureStates", table );
|
2005-09-23 19:21:10 +02:00
|
|
|
}
|
2005-09-25 17:14:03 +02:00
|
|
|
|
2005-09-26 11:56:18 +02:00
|
|
|
static UINT ACTION_SelfUnregModules( MSIPACKAGE *package )
|
2005-09-25 17:14:03 +02:00
|
|
|
{
|
2005-09-26 11:56:18 +02:00
|
|
|
static const WCHAR table[] = { 'S','e','l','f','R','e','g',0 };
|
|
|
|
return msi_unimplemented_action_stub( package, "SelfUnregModules", table );
|
|
|
|
}
|
2005-09-25 17:14:03 +02:00
|
|
|
|
2005-09-26 11:56:18 +02:00
|
|
|
static UINT ACTION_InstallServices( MSIPACKAGE *package )
|
|
|
|
{
|
|
|
|
static const WCHAR table[] = {
|
|
|
|
'S','e','r','v','i','c','e','I','n','s','t','a','l','l',0 };
|
|
|
|
return msi_unimplemented_action_stub( package, "InstallServices", table );
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ACTION_StartServices( MSIPACKAGE *package )
|
|
|
|
{
|
|
|
|
static const WCHAR table[] = {
|
|
|
|
'S','e','r','v','i','c','e','C','o','n','t','r','o','l',0 };
|
|
|
|
return msi_unimplemented_action_stub( package, "StartServices", table );
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ACTION_StopServices( MSIPACKAGE *package )
|
|
|
|
{
|
|
|
|
static const WCHAR table[] = {
|
|
|
|
'S','e','r','v','i','c','e','C','o','n','t','r','o','l',0 };
|
|
|
|
return msi_unimplemented_action_stub( package, "StopServices", table );
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ACTION_DeleteServices( MSIPACKAGE *package )
|
|
|
|
{
|
|
|
|
static const WCHAR table[] = {
|
|
|
|
'S','e','r','v','i','c','e','C','o','n','t','r','o','l',0 };
|
|
|
|
return msi_unimplemented_action_stub( package, "DeleteServices", table );
|
2005-09-25 17:14:03 +02:00
|
|
|
}
|
2005-09-28 20:10:44 +02:00
|
|
|
|
|
|
|
static UINT ACTION_WriteEnvironmentStrings( MSIPACKAGE *package )
|
|
|
|
{
|
|
|
|
static const WCHAR table[] = {
|
|
|
|
'E','n','v','i','r','o','n','m','e','n','t',0 };
|
|
|
|
return msi_unimplemented_action_stub( package, "WriteEnvironmentStrings", table );
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ACTION_RemoveEnvironmentStrings( MSIPACKAGE *package )
|
|
|
|
{
|
|
|
|
static const WCHAR table[] = {
|
|
|
|
'E','n','v','i','r','o','n','m','e','n','t',0 };
|
|
|
|
return msi_unimplemented_action_stub( package, "RemoveEnvironmentStrings", table );
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ACTION_MsiPublishAssemblies( MSIPACKAGE *package )
|
|
|
|
{
|
|
|
|
static const WCHAR table[] = {
|
|
|
|
'M','s','i','A','s','s','e','m','b','l','y',0 };
|
|
|
|
return msi_unimplemented_action_stub( package, "MsiPublishAssemblies", table );
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ACTION_MsiUnpublishAssemblies( MSIPACKAGE *package )
|
|
|
|
{
|
|
|
|
static const WCHAR table[] = {
|
|
|
|
'M','s','i','A','s','s','e','m','b','l','y',0 };
|
|
|
|
return msi_unimplemented_action_stub( package, "MsiUnpublishAssemblies", table );
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT ACTION_UnregisterFonts( MSIPACKAGE *package )
|
|
|
|
{
|
|
|
|
static const WCHAR table[] = { 'F','o','n','t',0 };
|
|
|
|
return msi_unimplemented_action_stub( package, "UnregisterFonts", table );
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct _actions StandardActions[] = {
|
|
|
|
{ szAllocateRegistrySpace, NULL},
|
|
|
|
{ szAppSearch, ACTION_AppSearch },
|
|
|
|
{ szBindImage, ACTION_BindImage },
|
|
|
|
{ szCCPSearch, NULL},
|
|
|
|
{ szCostFinalize, ACTION_CostFinalize },
|
|
|
|
{ szCostInitialize, ACTION_CostInitialize },
|
|
|
|
{ szCreateFolders, ACTION_CreateFolders },
|
|
|
|
{ szCreateShortcuts, ACTION_CreateShortcuts },
|
|
|
|
{ szDeleteServices, ACTION_DeleteServices },
|
|
|
|
{ szDisableRollback, NULL},
|
|
|
|
{ szDuplicateFiles, ACTION_DuplicateFiles },
|
|
|
|
{ szExecuteAction, ACTION_ExecuteAction },
|
|
|
|
{ szFileCost, ACTION_FileCost },
|
|
|
|
{ szFindRelatedProducts, ACTION_FindRelatedProducts },
|
|
|
|
{ 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, ACTION_IsolateComponents },
|
|
|
|
{ szLaunchConditions, ACTION_LaunchConditions },
|
|
|
|
{ szMigrateFeatureStates, ACTION_MigrateFeatureStates },
|
|
|
|
{ szMoveFiles, ACTION_MoveFiles },
|
|
|
|
{ szMsiPublishAssemblies, ACTION_MsiPublishAssemblies },
|
|
|
|
{ szMsiUnpublishAssemblies, ACTION_MsiUnpublishAssemblies },
|
|
|
|
{ szInstallODBC, NULL},
|
|
|
|
{ szInstallServices, ACTION_InstallServices },
|
|
|
|
{ szPatchFiles, ACTION_PatchFiles },
|
|
|
|
{ szProcessComponents, ACTION_ProcessComponents },
|
|
|
|
{ szPublishComponents, ACTION_PublishComponents },
|
|
|
|
{ szPublishFeatures, ACTION_PublishFeatures },
|
|
|
|
{ szPublishProduct, ACTION_PublishProduct },
|
|
|
|
{ szRegisterClassInfo, ACTION_RegisterClassInfo },
|
|
|
|
{ szRegisterComPlus, NULL},
|
|
|
|
{ szRegisterExtensionInfo, ACTION_RegisterExtensionInfo },
|
|
|
|
{ szRegisterFonts, ACTION_RegisterFonts },
|
|
|
|
{ szRegisterMIMEInfo, ACTION_RegisterMIMEInfo },
|
|
|
|
{ szRegisterProduct, ACTION_RegisterProduct },
|
|
|
|
{ szRegisterProgIdInfo, ACTION_RegisterProgIdInfo },
|
|
|
|
{ szRegisterTypeLibraries, ACTION_RegisterTypeLibraries },
|
|
|
|
{ szRegisterUser, ACTION_RegisterUser},
|
|
|
|
{ szRemoveDuplicateFiles, NULL},
|
|
|
|
{ szRemoveEnvironmentStrings, ACTION_RemoveEnvironmentStrings },
|
|
|
|
{ szRemoveExistingProducts, NULL},
|
|
|
|
{ szRemoveFiles, NULL},
|
|
|
|
{ szRemoveFolders, NULL},
|
|
|
|
{ szRemoveIniValues, ACTION_RemoveIniValues },
|
|
|
|
{ szRemoveODBC, NULL},
|
|
|
|
{ szRemoveRegistryValues, NULL},
|
|
|
|
{ szRemoveShortcuts, NULL},
|
|
|
|
{ szResolveSource, ACTION_ResolveSource},
|
|
|
|
{ szRMCCPSearch, NULL},
|
|
|
|
{ szScheduleReboot, NULL},
|
|
|
|
{ szSelfRegModules, ACTION_SelfRegModules },
|
|
|
|
{ szSelfUnregModules, ACTION_SelfUnregModules },
|
|
|
|
{ szSetODBCFolders, NULL},
|
|
|
|
{ szStartServices, ACTION_StartServices },
|
|
|
|
{ szStopServices, ACTION_StopServices },
|
|
|
|
{ szUnpublishComponents, NULL},
|
|
|
|
{ szUnpublishFeatures, NULL},
|
|
|
|
{ szUnregisterClassInfo, NULL},
|
|
|
|
{ szUnregisterComPlus, NULL},
|
|
|
|
{ szUnregisterExtensionInfo, NULL},
|
|
|
|
{ szUnregisterFonts, ACTION_UnregisterFonts },
|
|
|
|
{ szUnregisterMIMEInfo, NULL},
|
|
|
|
{ szUnregisterProgIdInfo, NULL},
|
|
|
|
{ szUnregisterTypeLibraries, NULL},
|
|
|
|
{ szValidateProductID, NULL},
|
|
|
|
{ szWriteEnvironmentStrings, ACTION_WriteEnvironmentStrings },
|
|
|
|
{ szWriteIniValues, ACTION_WriteIniValues },
|
|
|
|
{ szWriteRegistryValues, ACTION_WriteRegistryValues},
|
|
|
|
{ NULL, NULL},
|
|
|
|
};
|