Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Implementation of the Microsoft Installer (msi.dll) |
| 3 | * |
Aric Stewart | c668952 | 2005-06-17 20:56:55 +0000 | [diff] [blame] | 4 | * Copyright 2004,2005 Aric Stewart for CodeWeavers |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2.1 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library; if not, write to the Free Software |
Jonathan Ernst | 360a3f9 | 2006-05-18 14:49:52 +0200 | [diff] [blame] | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 19 | */ |
| 20 | |
| 21 | /* |
Mike McCormack | 6e2bca3 | 2004-07-04 00:25:00 +0000 | [diff] [blame] | 22 | * Pages I need |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 23 | * |
| 24 | http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/installexecutesequence_table.asp |
| 25 | |
| 26 | http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/standard_actions_reference.asp |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 27 | */ |
| 28 | |
| 29 | #include <stdarg.h> |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 30 | |
Francois Gouget | 486d020 | 2004-10-07 03:06:48 +0000 | [diff] [blame] | 31 | #define COBJMACROS |
| 32 | |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 33 | #include "windef.h" |
| 34 | #include "winbase.h" |
| 35 | #include "winerror.h" |
| 36 | #include "winreg.h" |
| 37 | #include "wine/debug.h" |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 38 | #include "msidefs.h" |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 39 | #include "msipriv.h" |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 40 | #include "winuser.h" |
| 41 | #include "shlobj.h" |
| 42 | #include "wine/unicode.h" |
Steven Edwards | 98efef1 | 2005-04-11 16:10:33 +0000 | [diff] [blame] | 43 | #include "winver.h" |
Aric Stewart | 54c67dd | 2005-01-25 20:17:09 +0000 | [diff] [blame] | 44 | #include "action.h" |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 45 | |
Aric Stewart | bd1bbc1 | 2005-01-03 20:00:13 +0000 | [diff] [blame] | 46 | #define REG_PROGRESS_VALUE 13200 |
| 47 | #define COMPONENT_PROGRESS_VALUE 24000 |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 48 | |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 49 | WINE_DEFAULT_DEBUG_CHANNEL(msi); |
| 50 | |
| 51 | /* |
| 52 | * Prototypes |
| 53 | */ |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 54 | static UINT ACTION_ProcessExecSequence(MSIPACKAGE *package, BOOL UIran); |
| 55 | static UINT ACTION_ProcessUISequence(MSIPACKAGE *package); |
Aric Stewart | f8f6440 | 2005-03-24 19:03:45 +0000 | [diff] [blame] | 56 | static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq, BOOL UI); |
Aric Stewart | 90c5739 | 2005-01-31 16:23:12 +0000 | [diff] [blame] | 57 | |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 58 | /* |
| 59 | * consts and values used |
| 60 | */ |
Juan Lang | 014ad3b | 2005-03-01 10:41:52 +0000 | [diff] [blame] | 61 | static const WCHAR c_colon[] = {'C',':','\\',0}; |
Aric Stewart | c668952 | 2005-06-17 20:56:55 +0000 | [diff] [blame] | 62 | |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 63 | static const WCHAR szCreateFolders[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 64 | {'C','r','e','a','t','e','F','o','l','d','e','r','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 65 | static const WCHAR szCostFinalize[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 66 | {'C','o','s','t','F','i','n','a','l','i','z','e',0}; |
Aric Stewart | c668952 | 2005-06-17 20:56:55 +0000 | [diff] [blame] | 67 | const WCHAR szInstallFiles[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 68 | {'I','n','s','t','a','l','l','F','i','l','e','s',0}; |
Aric Stewart | c668952 | 2005-06-17 20:56:55 +0000 | [diff] [blame] | 69 | const WCHAR szDuplicateFiles[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 70 | {'D','u','p','l','i','c','a','t','e','F','i','l','e','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 71 | static const WCHAR szWriteRegistryValues[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 72 | {'W','r','i','t','e','R','e','g','i','s','t','r','y', |
| 73 | 'V','a','l','u','e','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 74 | static const WCHAR szCostInitialize[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 75 | {'C','o','s','t','I','n','i','t','i','a','l','i','z','e',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 76 | static const WCHAR szFileCost[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 77 | {'F','i','l','e','C','o','s','t',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 78 | static const WCHAR szInstallInitialize[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 79 | {'I','n','s','t','a','l','l','I','n','i','t','i','a','l','i','z','e',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 80 | static const WCHAR szInstallValidate[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 81 | {'I','n','s','t','a','l','l','V','a','l','i','d','a','t','e',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 82 | static const WCHAR szLaunchConditions[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 83 | {'L','a','u','n','c','h','C','o','n','d','i','t','i','o','n','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 84 | static const WCHAR szProcessComponents[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 85 | {'P','r','o','c','e','s','s','C','o','m','p','o','n','e','n','t','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 86 | static const WCHAR szRegisterTypeLibraries[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 87 | {'R','e','g','i','s','t','e','r','T','y','p','e', |
| 88 | 'L','i','b','r','a','r','i','e','s',0}; |
Aric Stewart | db982e2 | 2005-06-16 15:51:44 +0000 | [diff] [blame] | 89 | const WCHAR szRegisterClassInfo[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 90 | {'R','e','g','i','s','t','e','r','C','l','a','s','s','I','n','f','o',0}; |
Aric Stewart | db982e2 | 2005-06-16 15:51:44 +0000 | [diff] [blame] | 91 | const WCHAR szRegisterProgIdInfo[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 92 | {'R','e','g','i','s','t','e','r','P','r','o','g','I','d','I','n','f','o',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 93 | static const WCHAR szCreateShortcuts[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 94 | {'C','r','e','a','t','e','S','h','o','r','t','c','u','t','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 95 | static const WCHAR szPublishProduct[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 96 | {'P','u','b','l','i','s','h','P','r','o','d','u','c','t',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 97 | static const WCHAR szWriteIniValues[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 98 | {'W','r','i','t','e','I','n','i','V','a','l','u','e','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 99 | static const WCHAR szSelfRegModules[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 100 | {'S','e','l','f','R','e','g','M','o','d','u','l','e','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 101 | static const WCHAR szPublishFeatures[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 102 | {'P','u','b','l','i','s','h','F','e','a','t','u','r','e','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 103 | static const WCHAR szRegisterProduct[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 104 | {'R','e','g','i','s','t','e','r','P','r','o','d','u','c','t',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 105 | static const WCHAR szInstallExecute[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 106 | {'I','n','s','t','a','l','l','E','x','e','c','u','t','e',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 107 | static const WCHAR szInstallExecuteAgain[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 108 | {'I','n','s','t','a','l','l','E','x','e','c','u','t','e', |
| 109 | 'A','g','a','i','n',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 110 | static const WCHAR szInstallFinalize[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 111 | {'I','n','s','t','a','l','l','F','i','n','a','l','i','z','e',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 112 | static const WCHAR szForceReboot[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 113 | {'F','o','r','c','e','R','e','b','o','o','t',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 114 | static const WCHAR szResolveSource[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 115 | {'R','e','s','o','l','v','e','S','o','u','r','c','e',0}; |
Alexandre Julliard | b79a53e | 2006-06-12 13:39:59 +0200 | [diff] [blame] | 116 | static const WCHAR szAppSearch[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 117 | {'A','p','p','S','e','a','r','c','h',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 118 | static const WCHAR szAllocateRegistrySpace[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 119 | {'A','l','l','o','c','a','t','e','R','e','g','i','s','t','r','y', |
| 120 | 'S','p','a','c','e',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 121 | static const WCHAR szBindImage[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 122 | {'B','i','n','d','I','m','a','g','e',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 123 | static const WCHAR szCCPSearch[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 124 | {'C','C','P','S','e','a','r','c','h',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 125 | static const WCHAR szDeleteServices[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 126 | {'D','e','l','e','t','e','S','e','r','v','i','c','e','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 127 | static const WCHAR szDisableRollback[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 128 | {'D','i','s','a','b','l','e','R','o','l','l','b','a','c','k',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 129 | static const WCHAR szExecuteAction[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 130 | {'E','x','e','c','u','t','e','A','c','t','i','o','n',0}; |
Aric Stewart | db982e2 | 2005-06-16 15:51:44 +0000 | [diff] [blame] | 131 | const WCHAR szFindRelatedProducts[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 132 | {'F','i','n','d','R','e','l','a','t','e','d', |
| 133 | 'P','r','o','d','u','c','t','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 134 | static const WCHAR szInstallAdminPackage[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 135 | {'I','n','s','t','a','l','l','A','d','m','i','n', |
| 136 | 'P','a','c','k','a','g','e',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 137 | static const WCHAR szInstallSFPCatalogFile[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 138 | {'I','n','s','t','a','l','l','S','F','P','C','a','t','a','l','o','g', |
| 139 | 'F','i','l','e',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 140 | static const WCHAR szIsolateComponents[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 141 | {'I','s','o','l','a','t','e','C','o','m','p','o','n','e','n','t','s',0}; |
Aric Stewart | c668952 | 2005-06-17 20:56:55 +0000 | [diff] [blame] | 142 | const WCHAR szMigrateFeatureStates[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 143 | {'M','i','g','r','a','t','e','F','e','a','t','u','r','e', |
| 144 | 'S','t','a','t','e','s',0}; |
Aric Stewart | c668952 | 2005-06-17 20:56:55 +0000 | [diff] [blame] | 145 | const WCHAR szMoveFiles[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 146 | {'M','o','v','e','F','i','l','e','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 147 | static const WCHAR szMsiPublishAssemblies[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 148 | {'M','s','i','P','u','b','l','i','s','h', |
| 149 | 'A','s','s','e','m','b','l','i','e','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 150 | static const WCHAR szMsiUnpublishAssemblies[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 151 | {'M','s','i','U','n','p','u','b','l','i','s','h', |
| 152 | 'A','s','s','e','m','b','l','i','e','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 153 | static const WCHAR szInstallODBC[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 154 | {'I','n','s','t','a','l','l','O','D','B','C',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 155 | static const WCHAR szInstallServices[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 156 | {'I','n','s','t','a','l','l','S','e','r','v','i','c','e','s',0}; |
Aric Stewart | c668952 | 2005-06-17 20:56:55 +0000 | [diff] [blame] | 157 | const WCHAR szPatchFiles[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 158 | {'P','a','t','c','h','F','i','l','e','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 159 | static const WCHAR szPublishComponents[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 160 | {'P','u','b','l','i','s','h','C','o','m','p','o','n','e','n','t','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 161 | static const WCHAR szRegisterComPlus[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 162 | {'R','e','g','i','s','t','e','r','C','o','m','P','l','u','s',0}; |
Aric Stewart | db982e2 | 2005-06-16 15:51:44 +0000 | [diff] [blame] | 163 | const WCHAR szRegisterExtensionInfo[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 164 | {'R','e','g','i','s','t','e','r','E','x','t','e','n','s','i','o','n', |
| 165 | 'I','n','f','o',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 166 | static const WCHAR szRegisterFonts[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 167 | {'R','e','g','i','s','t','e','r','F','o','n','t','s',0}; |
Aric Stewart | db982e2 | 2005-06-16 15:51:44 +0000 | [diff] [blame] | 168 | const WCHAR szRegisterMIMEInfo[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 169 | {'R','e','g','i','s','t','e','r','M','I','M','E','I','n','f','o',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 170 | static const WCHAR szRegisterUser[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 171 | {'R','e','g','i','s','t','e','r','U','s','e','r',0}; |
Aric Stewart | c668952 | 2005-06-17 20:56:55 +0000 | [diff] [blame] | 172 | const WCHAR szRemoveDuplicateFiles[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 173 | {'R','e','m','o','v','e','D','u','p','l','i','c','a','t','e', |
| 174 | 'F','i','l','e','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 175 | static const WCHAR szRemoveEnvironmentStrings[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 176 | {'R','e','m','o','v','e','E','n','v','i','r','o','n','m','e','n','t', |
| 177 | 'S','t','r','i','n','g','s',0}; |
Aric Stewart | c668952 | 2005-06-17 20:56:55 +0000 | [diff] [blame] | 178 | const WCHAR szRemoveExistingProducts[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 179 | {'R','e','m','o','v','e','E','x','i','s','t','i','n','g', |
| 180 | 'P','r','o','d','u','c','t','s',0}; |
Aric Stewart | c668952 | 2005-06-17 20:56:55 +0000 | [diff] [blame] | 181 | const WCHAR szRemoveFiles[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 182 | {'R','e','m','o','v','e','F','i','l','e','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 183 | static const WCHAR szRemoveFolders[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 184 | {'R','e','m','o','v','e','F','o','l','d','e','r','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 185 | static const WCHAR szRemoveIniValues[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 186 | {'R','e','m','o','v','e','I','n','i','V','a','l','u','e','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 187 | static const WCHAR szRemoveODBC[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 188 | {'R','e','m','o','v','e','O','D','B','C',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 189 | static const WCHAR szRemoveRegistryValues[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 190 | {'R','e','m','o','v','e','R','e','g','i','s','t','r','y', |
| 191 | 'V','a','l','u','e','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 192 | static const WCHAR szRemoveShortcuts[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 193 | {'R','e','m','o','v','e','S','h','o','r','t','c','u','t','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 194 | static const WCHAR szRMCCPSearch[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 195 | {'R','M','C','C','P','S','e','a','r','c','h',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 196 | static const WCHAR szScheduleReboot[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 197 | {'S','c','h','e','d','u','l','e','R','e','b','o','o','t',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 198 | static const WCHAR szSelfUnregModules[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 199 | {'S','e','l','f','U','n','r','e','g','M','o','d','u','l','e','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 200 | static const WCHAR szSetODBCFolders[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 201 | {'S','e','t','O','D','B','C','F','o','l','d','e','r','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 202 | static const WCHAR szStartServices[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 203 | {'S','t','a','r','t','S','e','r','v','i','c','e','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 204 | static const WCHAR szStopServices[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 205 | {'S','t','o','p','S','e','r','v','i','c','e','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 206 | static const WCHAR szUnpublishComponents[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 207 | {'U','n','p','u','b','l','i','s','h', |
| 208 | 'C','o','m','p','o','n','e','n','t','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 209 | static const WCHAR szUnpublishFeatures[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 210 | {'U','n','p','u','b','l','i','s','h','F','e','a','t','u','r','e','s',0}; |
Aric Stewart | c668952 | 2005-06-17 20:56:55 +0000 | [diff] [blame] | 211 | const WCHAR szUnregisterClassInfo[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 212 | {'U','n','r','e','g','i','s','t','e','r','C','l','a','s','s', |
| 213 | 'I','n','f','o',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 214 | static const WCHAR szUnregisterComPlus[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 215 | {'U','n','r','e','g','i','s','t','e','r','C','o','m','P','l','u','s',0}; |
Aric Stewart | c668952 | 2005-06-17 20:56:55 +0000 | [diff] [blame] | 216 | const WCHAR szUnregisterExtensionInfo[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 217 | {'U','n','r','e','g','i','s','t','e','r', |
| 218 | 'E','x','t','e','n','s','i','o','n','I','n','f','o',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 219 | static const WCHAR szUnregisterFonts[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 220 | {'U','n','r','e','g','i','s','t','e','r','F','o','n','t','s',0}; |
Aric Stewart | c668952 | 2005-06-17 20:56:55 +0000 | [diff] [blame] | 221 | const WCHAR szUnregisterMIMEInfo[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 222 | {'U','n','r','e','g','i','s','t','e','r','M','I','M','E','I','n','f','o',0}; |
Aric Stewart | c668952 | 2005-06-17 20:56:55 +0000 | [diff] [blame] | 223 | const WCHAR szUnregisterProgIdInfo[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 224 | {'U','n','r','e','g','i','s','t','e','r','P','r','o','g','I','d', |
| 225 | 'I','n','f','o',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 226 | static const WCHAR szUnregisterTypeLibraries[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 227 | {'U','n','r','e','g','i','s','t','e','r','T','y','p','e', |
| 228 | 'L','i','b','r','a','r','i','e','s',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 229 | static const WCHAR szValidateProductID[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 230 | {'V','a','l','i','d','a','t','e','P','r','o','d','u','c','t','I','D',0}; |
Mike McCormack | 9ba8ba3 | 2005-10-30 19:04:26 +0000 | [diff] [blame] | 231 | static const WCHAR szWriteEnvironmentStrings[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 232 | {'W','r','i','t','e','E','n','v','i','r','o','n','m','e','n','t', |
| 233 | 'S','t','r','i','n','g','s',0}; |
Aric Stewart | 90c5739 | 2005-01-31 16:23:12 +0000 | [diff] [blame] | 234 | |
Mike McCormack | 3b95515 | 2005-09-28 18:10:44 +0000 | [diff] [blame] | 235 | /* action handlers */ |
| 236 | typedef UINT (*STANDARDACTIONHANDLER)(MSIPACKAGE*); |
| 237 | |
Aric Stewart | 90c5739 | 2005-01-31 16:23:12 +0000 | [diff] [blame] | 238 | struct _actions { |
| 239 | LPCWSTR action; |
| 240 | STANDARDACTIONHANDLER handler; |
| 241 | }; |
| 242 | |
Mike McCormack | 3b95515 | 2005-09-28 18:10:44 +0000 | [diff] [blame] | 243 | static struct _actions StandardActions[]; |
Aric Stewart | 90c5739 | 2005-01-31 16:23:12 +0000 | [diff] [blame] | 244 | |
Aric Stewart | 2703d71 | 2005-06-20 15:33:10 +0000 | [diff] [blame] | 245 | |
| 246 | /******************************************************** |
| 247 | * helper functions |
| 248 | ********************************************************/ |
| 249 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 250 | static void ui_actionstart(MSIPACKAGE *package, LPCWSTR action) |
Aric Stewart | d2c395a | 2004-07-06 18:48:15 +0000 | [diff] [blame] | 251 | { |
Aric Stewart | d2c395a | 2004-07-06 18:48:15 +0000 | [diff] [blame] | 252 | static const WCHAR Query_t[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 253 | {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 254 | '`','A','c','t','i','o', 'n','T','e','x','t','`',' ', |
| 255 | 'W','H','E','R','E', ' ','`','A','c','t','i','o','n','`',' ','=', |
| 256 | ' ','\'','%','s','\'',0}; |
Robert Shearman | d679bc5 | 2006-01-23 17:30:31 +0100 | [diff] [blame] | 257 | MSIRECORD * row; |
Aric Stewart | d2c395a | 2004-07-06 18:48:15 +0000 | [diff] [blame] | 258 | |
Mike McCormack | 0b352c7 | 2005-06-02 10:29:57 +0000 | [diff] [blame] | 259 | row = MSI_QueryGetRecord( package->db, Query_t, action ); |
| 260 | if (!row) |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 261 | return; |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 262 | MSI_ProcessMessage(package, INSTALLMESSAGE_ACTIONSTART, row); |
| 263 | msiobj_release(&row->hdr); |
Aric Stewart | d2c395a | 2004-07-06 18:48:15 +0000 | [diff] [blame] | 264 | } |
| 265 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 266 | static void ui_actioninfo(MSIPACKAGE *package, LPCWSTR action, BOOL start, |
Aric Stewart | d2c395a | 2004-07-06 18:48:15 +0000 | [diff] [blame] | 267 | UINT rc) |
| 268 | { |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 269 | MSIRECORD * row; |
Aric Stewart | d2c395a | 2004-07-06 18:48:15 +0000 | [diff] [blame] | 270 | static const WCHAR template_s[]= |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 271 | {'A','c','t','i','o','n',' ','s','t','a','r','t',' ','%','s',':',' ', |
| 272 | '%','s', '.',0}; |
Aric Stewart | d2c395a | 2004-07-06 18:48:15 +0000 | [diff] [blame] | 273 | static const WCHAR template_e[]= |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 274 | {'A','c','t','i','o','n',' ','e','n','d','e','d',' ','%','s',':',' ', |
| 275 | '%','s', '.',' ','R','e','t','u','r','n',' ','v','a','l','u','e',' ', |
| 276 | '%','i','.',0}; |
Aric Stewart | d2c395a | 2004-07-06 18:48:15 +0000 | [diff] [blame] | 277 | static const WCHAR format[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 278 | {'H','H','\'',':','\'','m','m','\'',':','\'','s','s',0}; |
Aric Stewart | d2c395a | 2004-07-06 18:48:15 +0000 | [diff] [blame] | 279 | WCHAR message[1024]; |
| 280 | WCHAR timet[0x100]; |
| 281 | |
| 282 | GetTimeFormatW(LOCALE_USER_DEFAULT, 0, NULL, format, timet, 0x100); |
| 283 | if (start) |
| 284 | sprintfW(message,template_s,timet,action); |
| 285 | else |
| 286 | sprintfW(message,template_e,timet,action,rc); |
| 287 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 288 | row = MSI_CreateRecord(1); |
| 289 | MSI_RecordSetStringW(row,1,message); |
Aric Stewart | d2c395a | 2004-07-06 18:48:15 +0000 | [diff] [blame] | 290 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 291 | MSI_ProcessMessage(package, INSTALLMESSAGE_INFO, row); |
| 292 | msiobj_release(&row->hdr); |
Aric Stewart | d2c395a | 2004-07-06 18:48:15 +0000 | [diff] [blame] | 293 | } |
| 294 | |
Mike McCormack | e345222 | 2005-09-28 15:12:32 +0000 | [diff] [blame] | 295 | static UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine ) |
| 296 | { |
| 297 | LPCWSTR ptr,ptr2; |
| 298 | BOOL quote; |
| 299 | DWORD len; |
| 300 | LPWSTR prop = NULL, val = NULL; |
| 301 | |
| 302 | if (!szCommandLine) |
| 303 | return ERROR_SUCCESS; |
| 304 | |
| 305 | ptr = szCommandLine; |
| 306 | |
| 307 | while (*ptr) |
| 308 | { |
| 309 | if (*ptr==' ') |
| 310 | { |
| 311 | ptr++; |
| 312 | continue; |
| 313 | } |
| 314 | |
| 315 | TRACE("Looking at %s\n",debugstr_w(ptr)); |
| 316 | |
| 317 | ptr2 = strchrW(ptr,'='); |
| 318 | if (!ptr2) |
| 319 | { |
| 320 | ERR("command line contains unknown string : %s\n", debugstr_w(ptr)); |
| 321 | break; |
| 322 | } |
| 323 | |
| 324 | quote = FALSE; |
| 325 | |
| 326 | len = ptr2-ptr; |
| 327 | prop = msi_alloc((len+1)*sizeof(WCHAR)); |
| 328 | memcpy(prop,ptr,len*sizeof(WCHAR)); |
| 329 | prop[len]=0; |
| 330 | ptr2++; |
| 331 | |
| 332 | len = 0; |
| 333 | ptr = ptr2; |
| 334 | while (*ptr && (quote || (!quote && *ptr!=' '))) |
| 335 | { |
| 336 | if (*ptr == '"') |
| 337 | quote = !quote; |
| 338 | ptr++; |
| 339 | len++; |
| 340 | } |
| 341 | |
| 342 | if (*ptr2=='"') |
| 343 | { |
| 344 | ptr2++; |
| 345 | len -= 2; |
| 346 | } |
| 347 | val = msi_alloc((len+1)*sizeof(WCHAR)); |
| 348 | memcpy(val,ptr2,len*sizeof(WCHAR)); |
| 349 | val[len] = 0; |
| 350 | |
| 351 | if (lstrlenW(prop) > 0) |
| 352 | { |
| 353 | TRACE("Found commandline property (%s) = (%s)\n", |
| 354 | debugstr_w(prop), debugstr_w(val)); |
| 355 | MSI_SetPropertyW(package,prop,val); |
| 356 | } |
| 357 | msi_free(val); |
| 358 | msi_free(prop); |
| 359 | } |
| 360 | |
| 361 | return ERROR_SUCCESS; |
| 362 | } |
| 363 | |
Mike McCormack | 965a72a | 2005-10-26 12:06:21 +0000 | [diff] [blame] | 364 | |
| 365 | static LPWSTR* msi_split_string( LPCWSTR str, WCHAR sep ) |
| 366 | { |
| 367 | LPWSTR p, *ret = NULL; |
| 368 | UINT count = 0; |
| 369 | |
| 370 | if (!str) |
| 371 | return ret; |
| 372 | |
| 373 | /* count the number of substrings */ |
| 374 | for ( p = (LPWSTR)str, count = 0; p; count++ ) |
| 375 | { |
| 376 | p = strchrW( p, sep ); |
| 377 | if (p) |
| 378 | p++; |
| 379 | } |
| 380 | |
| 381 | /* allocate space for an array of substring pointers and the substrings */ |
| 382 | ret = msi_alloc( (count+1) * sizeof (LPWSTR) + |
| 383 | (lstrlenW(str)+1) * sizeof(WCHAR) ); |
| 384 | if (!ret) |
| 385 | return ret; |
| 386 | |
| 387 | /* copy the string and set the pointers */ |
| 388 | p = (LPWSTR) &ret[count+1]; |
| 389 | lstrcpyW( p, str ); |
| 390 | for( count = 0; (ret[count] = p); count++ ) |
| 391 | { |
| 392 | p = strchrW( p, sep ); |
| 393 | if (p) |
| 394 | *p++ = 0; |
| 395 | } |
| 396 | |
| 397 | return ret; |
| 398 | } |
| 399 | |
| 400 | static UINT msi_apply_substorage_transform( MSIPACKAGE *package, |
| 401 | MSIDATABASE *patch_db, LPCWSTR name ) |
| 402 | { |
| 403 | UINT ret = ERROR_FUNCTION_FAILED; |
| 404 | IStorage *stg = NULL; |
| 405 | HRESULT r; |
| 406 | |
| 407 | TRACE("%p %s\n", package, debugstr_w(name) ); |
| 408 | |
| 409 | if (*name++ != ':') |
| 410 | { |
| 411 | ERR("expected a colon in %s\n", debugstr_w(name)); |
| 412 | return ERROR_FUNCTION_FAILED; |
| 413 | } |
| 414 | |
| 415 | r = IStorage_OpenStorage( patch_db->storage, name, NULL, STGM_SHARE_EXCLUSIVE, NULL, 0, &stg ); |
| 416 | if (SUCCEEDED(r)) |
| 417 | { |
Mike McCormack | f8fef6e | 2005-10-26 13:56:33 +0000 | [diff] [blame] | 418 | ret = msi_table_apply_transform( package->db, stg ); |
Mike McCormack | 965a72a | 2005-10-26 12:06:21 +0000 | [diff] [blame] | 419 | IStorage_Release( stg ); |
| 420 | ret = ERROR_SUCCESS; |
| 421 | } |
| 422 | else |
| 423 | ERR("failed to open substorage %s\n", debugstr_w(name)); |
| 424 | |
| 425 | return ret; |
| 426 | } |
| 427 | |
| 428 | static UINT msi_check_patch_applicable( MSIPACKAGE *package, MSISUMMARYINFO *si ) |
| 429 | { |
| 430 | static const WCHAR szProdID[] = { 'P','r','o','d','u','c','t','I','D',0 }; |
| 431 | LPWSTR guid_list, *guids, product_id; |
| 432 | UINT i, ret = ERROR_FUNCTION_FAILED; |
| 433 | |
| 434 | product_id = msi_dup_property( package, szProdID ); |
| 435 | if (!product_id) |
| 436 | { |
| 437 | /* FIXME: the property ProductID should be written into the DB somewhere */ |
| 438 | ERR("no product ID to check\n"); |
| 439 | return ERROR_SUCCESS; |
| 440 | } |
| 441 | |
| 442 | guid_list = msi_suminfo_dup_string( si, PID_TEMPLATE ); |
| 443 | guids = msi_split_string( guid_list, ';' ); |
| 444 | for ( i = 0; guids[i] && ret != ERROR_SUCCESS; i++ ) |
| 445 | { |
| 446 | if (!lstrcmpW( guids[i], product_id )) |
| 447 | ret = ERROR_SUCCESS; |
| 448 | } |
| 449 | msi_free( guids ); |
| 450 | msi_free( guid_list ); |
| 451 | msi_free( product_id ); |
| 452 | |
| 453 | return ret; |
| 454 | } |
| 455 | |
| 456 | static UINT msi_parse_patch_summary( MSIPACKAGE *package, MSIDATABASE *patch_db ) |
| 457 | { |
| 458 | MSISUMMARYINFO *si; |
| 459 | LPWSTR str, *substorage; |
| 460 | UINT i, r = ERROR_SUCCESS; |
| 461 | |
| 462 | si = MSI_GetSummaryInformationW( patch_db, 0 ); |
| 463 | if (!si) |
| 464 | return ERROR_FUNCTION_FAILED; |
| 465 | |
| 466 | msi_check_patch_applicable( package, si ); |
| 467 | |
| 468 | /* enumerate the substorage */ |
| 469 | str = msi_suminfo_dup_string( si, PID_LASTAUTHOR ); |
| 470 | substorage = msi_split_string( str, ';' ); |
| 471 | for ( i = 0; substorage && substorage[i] && r == ERROR_SUCCESS; i++ ) |
| 472 | r = msi_apply_substorage_transform( package, patch_db, substorage[i] ); |
| 473 | msi_free( substorage ); |
| 474 | msi_free( str ); |
| 475 | |
| 476 | /* FIXME: parse the sources in PID_REVNUMBER and do something with them... */ |
| 477 | |
| 478 | msiobj_release( &si->hdr ); |
| 479 | |
| 480 | return r; |
| 481 | } |
| 482 | |
| 483 | static UINT msi_apply_patch_package( MSIPACKAGE *package, LPCWSTR file ) |
| 484 | { |
| 485 | MSIDATABASE *patch_db = NULL; |
| 486 | UINT r; |
| 487 | |
| 488 | TRACE("%p %s\n", package, debugstr_w( file ) ); |
| 489 | |
| 490 | /* FIXME: |
| 491 | * We probably want to make sure we only open a patch collection here. |
| 492 | * Patch collections (.msp) and databases (.msi) have different GUIDs |
| 493 | * but currently MSI_OpenDatabaseW will accept both. |
| 494 | */ |
| 495 | r = MSI_OpenDatabaseW( file, MSIDBOPEN_READONLY, &patch_db ); |
| 496 | if ( r != ERROR_SUCCESS ) |
| 497 | { |
| 498 | ERR("failed to open patch collection %s\n", debugstr_w( file ) ); |
| 499 | return r; |
| 500 | } |
| 501 | |
| 502 | msi_parse_patch_summary( package, patch_db ); |
| 503 | msiobj_release( &patch_db->hdr ); |
| 504 | |
| 505 | return ERROR_SUCCESS; |
| 506 | } |
| 507 | |
| 508 | /* get the PATCH property, and apply all the patches it specifies */ |
| 509 | static UINT msi_apply_patches( MSIPACKAGE *package ) |
| 510 | { |
| 511 | static const WCHAR szPatch[] = { 'P','A','T','C','H',0 }; |
| 512 | LPWSTR patch_list, *patches; |
| 513 | UINT i, r = ERROR_SUCCESS; |
| 514 | |
| 515 | patch_list = msi_dup_property( package, szPatch ); |
| 516 | |
| 517 | TRACE("patches to be applied: %s\n", debugstr_w( patch_list ) ); |
| 518 | |
| 519 | patches = msi_split_string( patch_list, ';' ); |
| 520 | for( i=0; patches && patches[i] && r == ERROR_SUCCESS; i++ ) |
| 521 | r = msi_apply_patch_package( package, patches[i] ); |
| 522 | |
| 523 | msi_free( patches ); |
| 524 | msi_free( patch_list ); |
| 525 | |
| 526 | return r; |
| 527 | } |
| 528 | |
Mike McCormack | e534e77 | 2006-01-04 14:51:25 +0100 | [diff] [blame] | 529 | static UINT msi_apply_transforms( MSIPACKAGE *package ) |
| 530 | { |
| 531 | static const WCHAR szTransforms[] = { |
| 532 | 'T','R','A','N','S','F','O','R','M','S',0 }; |
| 533 | LPWSTR xform_list, *xforms; |
| 534 | UINT i, r = ERROR_SUCCESS; |
| 535 | |
| 536 | xform_list = msi_dup_property( package, szTransforms ); |
| 537 | xforms = msi_split_string( xform_list, ';' ); |
| 538 | |
| 539 | for( i=0; xforms && xforms[i] && r == ERROR_SUCCESS; i++ ) |
| 540 | { |
| 541 | if (xforms[i][0] == ':') |
| 542 | r = msi_apply_substorage_transform( package, package->db, &xforms[i][1] ); |
| 543 | else |
| 544 | r = MSI_DatabaseApplyTransformW( package->db, xforms[i], 0 ); |
| 545 | } |
| 546 | |
| 547 | msi_free( xforms ); |
| 548 | msi_free( xform_list ); |
| 549 | |
| 550 | return r; |
| 551 | } |
| 552 | |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 553 | /**************************************************** |
| 554 | * TOP level entry points |
| 555 | *****************************************************/ |
| 556 | |
Mike McCormack | 61f24a4 | 2005-09-30 10:32:41 +0000 | [diff] [blame] | 557 | UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, |
| 558 | LPCWSTR szCommandLine ) |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 559 | { |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 560 | UINT rc; |
Aric Stewart | f8f6440 | 2005-03-24 19:03:45 +0000 | [diff] [blame] | 561 | BOOL ui = FALSE; |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 562 | static const WCHAR szUILevel[] = {'U','I','L','e','v','e','l',0}; |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 563 | static const WCHAR szAction[] = {'A','C','T','I','O','N',0}; |
| 564 | static const WCHAR szInstall[] = {'I','N','S','T','A','L','L',0}; |
| 565 | |
| 566 | MSI_SetPropertyW(package, szAction, szInstall); |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 567 | |
Mike McCormack | 3a94011 | 2006-04-19 02:29:03 +0900 | [diff] [blame] | 568 | package->script = msi_alloc_zero(sizeof(MSISCRIPT)); |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 569 | |
Aric Stewart | c980293 | 2005-06-30 20:45:43 +0000 | [diff] [blame] | 570 | package->script->InWhatSequence = SEQUENCE_INSTALL; |
| 571 | |
Aric Stewart | e95136b | 2004-06-29 03:44:01 +0000 | [diff] [blame] | 572 | if (szPackagePath) |
| 573 | { |
Mike McCormack | ba8200b | 2004-12-22 15:25:30 +0000 | [diff] [blame] | 574 | LPWSTR p, check, path; |
Aric Stewart | e95136b | 2004-06-29 03:44:01 +0000 | [diff] [blame] | 575 | |
Mike McCormack | 95dea49 | 2005-03-16 11:31:35 +0000 | [diff] [blame] | 576 | package->PackagePath = strdupW(szPackagePath); |
| 577 | path = strdupW(szPackagePath); |
Mike McCormack | ba8200b | 2004-12-22 15:25:30 +0000 | [diff] [blame] | 578 | p = strrchrW(path,'\\'); |
Aric Stewart | e95136b | 2004-06-29 03:44:01 +0000 | [diff] [blame] | 579 | if (p) |
| 580 | { |
| 581 | p++; |
| 582 | *p=0; |
| 583 | } |
Aric Stewart | c1e5c4a | 2005-02-08 14:26:49 +0000 | [diff] [blame] | 584 | else |
| 585 | { |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 586 | msi_free(path); |
| 587 | path = msi_alloc(MAX_PATH*sizeof(WCHAR)); |
Aric Stewart | c1e5c4a | 2005-02-08 14:26:49 +0000 | [diff] [blame] | 588 | GetCurrentDirectoryW(MAX_PATH,path); |
| 589 | strcatW(path,cszbs); |
| 590 | } |
Aric Stewart | e95136b | 2004-06-29 03:44:01 +0000 | [diff] [blame] | 591 | |
Mike McCormack | 062ad50 | 2005-09-15 15:04:08 +0000 | [diff] [blame] | 592 | check = msi_dup_property( package, cszSourceDir ); |
Aric Stewart | d0c971a | 2004-12-22 18:15:50 +0000 | [diff] [blame] | 593 | if (!check) |
Mike McCormack | ba8200b | 2004-12-22 15:25:30 +0000 | [diff] [blame] | 594 | MSI_SetPropertyW(package, cszSourceDir, path); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 595 | msi_free(check); |
| 596 | msi_free(path); |
Aric Stewart | e95136b | 2004-06-29 03:44:01 +0000 | [diff] [blame] | 597 | } |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 598 | |
Mike McCormack | e345222 | 2005-09-28 15:12:32 +0000 | [diff] [blame] | 599 | msi_parse_command_line( package, szCommandLine ); |
Mike McCormack | 74f0de9 | 2005-09-29 10:32:39 +0000 | [diff] [blame] | 600 | |
Mike McCormack | e534e77 | 2006-01-04 14:51:25 +0100 | [diff] [blame] | 601 | msi_apply_transforms( package ); |
Mike McCormack | 965a72a | 2005-10-26 12:06:21 +0000 | [diff] [blame] | 602 | msi_apply_patches( package ); |
| 603 | |
Mike McCormack | 74f0de9 | 2005-09-29 10:32:39 +0000 | [diff] [blame] | 604 | if ( msi_get_property_int(package, szUILevel, 0) >= INSTALLUILEVEL_REDUCED ) |
Aric Stewart | ed7c4bc | 2004-07-04 00:26:54 +0000 | [diff] [blame] | 605 | { |
Mike McCormack | 74f0de9 | 2005-09-29 10:32:39 +0000 | [diff] [blame] | 606 | package->script->InWhatSequence |= SEQUENCE_UI; |
| 607 | rc = ACTION_ProcessUISequence(package); |
| 608 | ui = TRUE; |
| 609 | if (rc == ERROR_SUCCESS) |
Aric Stewart | ed7c4bc | 2004-07-04 00:26:54 +0000 | [diff] [blame] | 610 | { |
Mike McCormack | 74f0de9 | 2005-09-29 10:32:39 +0000 | [diff] [blame] | 611 | package->script->InWhatSequence |= SEQUENCE_EXEC; |
| 612 | rc = ACTION_ProcessExecSequence(package,TRUE); |
Aric Stewart | ed7c4bc | 2004-07-04 00:26:54 +0000 | [diff] [blame] | 613 | } |
Aric Stewart | ed7c4bc | 2004-07-04 00:26:54 +0000 | [diff] [blame] | 614 | } |
| 615 | else |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 616 | rc = ACTION_ProcessExecSequence(package,FALSE); |
Aric Stewart | 6b16f29 | 2005-01-27 11:12:56 +0000 | [diff] [blame] | 617 | |
| 618 | if (rc == -1) |
| 619 | { |
| 620 | /* install was halted but should be considered a success */ |
| 621 | rc = ERROR_SUCCESS; |
| 622 | } |
Aric Stewart | ed7c4bc | 2004-07-04 00:26:54 +0000 | [diff] [blame] | 623 | |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 624 | package->script->CurrentlyScripting= FALSE; |
| 625 | |
Aric Stewart | 09d35c3 | 2004-12-27 19:00:26 +0000 | [diff] [blame] | 626 | /* process the ending type action */ |
| 627 | if (rc == ERROR_SUCCESS) |
Aric Stewart | f8f6440 | 2005-03-24 19:03:45 +0000 | [diff] [blame] | 628 | ACTION_PerformActionSequence(package,-1,ui); |
Aric Stewart | 6b16f29 | 2005-01-27 11:12:56 +0000 | [diff] [blame] | 629 | else if (rc == ERROR_INSTALL_USEREXIT) |
Aric Stewart | f8f6440 | 2005-03-24 19:03:45 +0000 | [diff] [blame] | 630 | ACTION_PerformActionSequence(package,-2,ui); |
Aric Stewart | 6b16f29 | 2005-01-27 11:12:56 +0000 | [diff] [blame] | 631 | else if (rc == ERROR_INSTALL_SUSPEND) |
Aric Stewart | f8f6440 | 2005-03-24 19:03:45 +0000 | [diff] [blame] | 632 | ACTION_PerformActionSequence(package,-4,ui); |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 633 | else /* failed */ |
| 634 | ACTION_PerformActionSequence(package,-3,ui); |
Aric Stewart | 54c67dd | 2005-01-25 20:17:09 +0000 | [diff] [blame] | 635 | |
| 636 | /* finish up running custom actions */ |
| 637 | ACTION_FinishCustomActions(package); |
Aric Stewart | 09d35c3 | 2004-12-27 19:00:26 +0000 | [diff] [blame] | 638 | |
Aric Stewart | ed7c4bc | 2004-07-04 00:26:54 +0000 | [diff] [blame] | 639 | return rc; |
| 640 | } |
| 641 | |
Aric Stewart | f8f6440 | 2005-03-24 19:03:45 +0000 | [diff] [blame] | 642 | static UINT ACTION_PerformActionSequence(MSIPACKAGE *package, UINT seq, BOOL UI) |
Aric Stewart | 09d35c3 | 2004-12-27 19:00:26 +0000 | [diff] [blame] | 643 | { |
Mike McCormack | 0b352c7 | 2005-06-02 10:29:57 +0000 | [diff] [blame] | 644 | UINT rc = ERROR_SUCCESS; |
Aric Stewart | 09d35c3 | 2004-12-27 19:00:26 +0000 | [diff] [blame] | 645 | MSIRECORD * row = 0; |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 646 | static const WCHAR ExecSeqQuery[] = |
| 647 | {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 648 | '`','I','n','s','t','a','l','l','E','x','e','c','u','t','e', |
| 649 | 'S','e','q','u','e','n','c','e','`',' ', 'W','H','E','R','E',' ', |
| 650 | '`','S','e','q','u','e','n','c','e','`',' ', '=',' ','%','i',0}; |
Aric Stewart | 09d35c3 | 2004-12-27 19:00:26 +0000 | [diff] [blame] | 651 | |
Aric Stewart | f8f6440 | 2005-03-24 19:03:45 +0000 | [diff] [blame] | 652 | static const WCHAR UISeqQuery[] = |
| 653 | {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 654 | '`','I','n','s','t','a','l','l','U','I','S','e','q','u','e','n','c','e', |
| 655 | '`', ' ', 'W','H','E','R','E',' ','`','S','e','q','u','e','n','c','e','`', |
Aric Stewart | f8f6440 | 2005-03-24 19:03:45 +0000 | [diff] [blame] | 656 | ' ', '=',' ','%','i',0}; |
| 657 | |
| 658 | if (UI) |
Mike McCormack | 0b352c7 | 2005-06-02 10:29:57 +0000 | [diff] [blame] | 659 | row = MSI_QueryGetRecord(package->db, UISeqQuery, seq); |
Aric Stewart | f8f6440 | 2005-03-24 19:03:45 +0000 | [diff] [blame] | 660 | else |
Mike McCormack | 0b352c7 | 2005-06-02 10:29:57 +0000 | [diff] [blame] | 661 | row = MSI_QueryGetRecord(package->db, ExecSeqQuery, seq); |
Aric Stewart | 09d35c3 | 2004-12-27 19:00:26 +0000 | [diff] [blame] | 662 | |
Mike McCormack | 0b352c7 | 2005-06-02 10:29:57 +0000 | [diff] [blame] | 663 | if (row) |
Aric Stewart | 09d35c3 | 2004-12-27 19:00:26 +0000 | [diff] [blame] | 664 | { |
Mike McCormack | 20806c7 | 2005-06-07 21:34:05 +0000 | [diff] [blame] | 665 | LPCWSTR action, cond; |
| 666 | |
Aric Stewart | 09d35c3 | 2004-12-27 19:00:26 +0000 | [diff] [blame] | 667 | TRACE("Running the actions\n"); |
| 668 | |
Aric Stewart | 09d35c3 | 2004-12-27 19:00:26 +0000 | [diff] [blame] | 669 | /* check conditions */ |
Mike McCormack | 20806c7 | 2005-06-07 21:34:05 +0000 | [diff] [blame] | 670 | cond = MSI_RecordGetString(row,2); |
| 671 | if (cond) |
Aric Stewart | 09d35c3 | 2004-12-27 19:00:26 +0000 | [diff] [blame] | 672 | { |
Mike McCormack | 20806c7 | 2005-06-07 21:34:05 +0000 | [diff] [blame] | 673 | /* this is a hack to skip errors in the condition code */ |
| 674 | if (MSI_EvaluateConditionW(package, cond) == MSICONDITION_FALSE) |
| 675 | goto end; |
Aric Stewart | 09d35c3 | 2004-12-27 19:00:26 +0000 | [diff] [blame] | 676 | } |
| 677 | |
Mike McCormack | 20806c7 | 2005-06-07 21:34:05 +0000 | [diff] [blame] | 678 | action = MSI_RecordGetString(row,1); |
| 679 | if (!action) |
Aric Stewart | 09d35c3 | 2004-12-27 19:00:26 +0000 | [diff] [blame] | 680 | { |
Mike McCormack | 20806c7 | 2005-06-07 21:34:05 +0000 | [diff] [blame] | 681 | ERR("failed to fetch action\n"); |
| 682 | rc = ERROR_FUNCTION_FAILED; |
Aric Stewart | 09d35c3 | 2004-12-27 19:00:26 +0000 | [diff] [blame] | 683 | goto end; |
| 684 | } |
| 685 | |
Aric Stewart | f8f6440 | 2005-03-24 19:03:45 +0000 | [diff] [blame] | 686 | if (UI) |
Mike McCormack | 20806c7 | 2005-06-07 21:34:05 +0000 | [diff] [blame] | 687 | rc = ACTION_PerformUIAction(package,action); |
Aric Stewart | f8f6440 | 2005-03-24 19:03:45 +0000 | [diff] [blame] | 688 | else |
Mike McCormack | 20806c7 | 2005-06-07 21:34:05 +0000 | [diff] [blame] | 689 | rc = ACTION_PerformAction(package,action,FALSE); |
Aric Stewart | 09d35c3 | 2004-12-27 19:00:26 +0000 | [diff] [blame] | 690 | end: |
Mike McCormack | 0b352c7 | 2005-06-02 10:29:57 +0000 | [diff] [blame] | 691 | msiobj_release(&row->hdr); |
Aric Stewart | 09d35c3 | 2004-12-27 19:00:26 +0000 | [diff] [blame] | 692 | } |
| 693 | else |
| 694 | rc = ERROR_SUCCESS; |
| 695 | |
| 696 | return rc; |
| 697 | } |
Aric Stewart | ed7c4bc | 2004-07-04 00:26:54 +0000 | [diff] [blame] | 698 | |
Aric Stewart | 2703d71 | 2005-06-20 15:33:10 +0000 | [diff] [blame] | 699 | typedef struct { |
| 700 | MSIPACKAGE* package; |
| 701 | BOOL UI; |
| 702 | } iterate_action_param; |
| 703 | |
| 704 | static UINT ITERATE_Actions(MSIRECORD *row, LPVOID param) |
| 705 | { |
| 706 | iterate_action_param *iap= (iterate_action_param*)param; |
| 707 | UINT rc; |
| 708 | LPCWSTR cond, action; |
| 709 | |
| 710 | action = MSI_RecordGetString(row,1); |
| 711 | if (!action) |
| 712 | { |
| 713 | ERR("Error is retrieving action name\n"); |
| 714 | return ERROR_FUNCTION_FAILED; |
| 715 | } |
| 716 | |
| 717 | /* check conditions */ |
| 718 | cond = MSI_RecordGetString(row,2); |
| 719 | if (cond) |
| 720 | { |
| 721 | /* this is a hack to skip errors in the condition code */ |
| 722 | if (MSI_EvaluateConditionW(iap->package, cond) == MSICONDITION_FALSE) |
| 723 | { |
| 724 | TRACE("Skipping action: %s (condition is false)\n", |
| 725 | debugstr_w(action)); |
| 726 | return ERROR_SUCCESS; |
| 727 | } |
| 728 | } |
| 729 | |
| 730 | if (iap->UI) |
| 731 | rc = ACTION_PerformUIAction(iap->package,action); |
| 732 | else |
| 733 | rc = ACTION_PerformAction(iap->package,action,FALSE); |
| 734 | |
Mike McCormack | 4f634a3 | 2005-07-06 15:44:51 +0000 | [diff] [blame] | 735 | msi_dialog_check_messages( NULL ); |
| 736 | |
| 737 | if (iap->package->CurrentInstallState != ERROR_SUCCESS ) |
| 738 | rc = iap->package->CurrentInstallState; |
| 739 | |
Aric Stewart | 2703d71 | 2005-06-20 15:33:10 +0000 | [diff] [blame] | 740 | if (rc == ERROR_FUNCTION_NOT_CALLED) |
| 741 | rc = ERROR_SUCCESS; |
| 742 | |
| 743 | if (rc != ERROR_SUCCESS) |
Mike McCormack | 558abec | 2005-10-27 12:39:28 +0000 | [diff] [blame] | 744 | ERR("Execution halted, action %s returned %i\n", debugstr_w(action), rc); |
Aric Stewart | 2703d71 | 2005-06-20 15:33:10 +0000 | [diff] [blame] | 745 | |
| 746 | return rc; |
| 747 | } |
| 748 | |
Mike McCormack | d34b1c2 | 2005-09-21 10:55:23 +0000 | [diff] [blame] | 749 | UINT MSI_Sequence( MSIPACKAGE *package, LPCWSTR szTable, INT iSequenceMode ) |
| 750 | { |
| 751 | MSIQUERY * view; |
| 752 | UINT r; |
| 753 | static const WCHAR query[] = |
| 754 | {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', |
| 755 | '`','%','s','`', |
| 756 | ' ','W','H','E','R','E',' ', |
| 757 | '`','S','e','q','u','e','n','c','e','`',' ', |
| 758 | '>',' ','0',' ','O','R','D','E','R',' ','B','Y',' ', |
| 759 | '`','S','e','q','u','e','n','c','e','`',0}; |
| 760 | iterate_action_param iap; |
| 761 | |
| 762 | /* |
| 763 | * FIXME: probably should be checking UILevel in the |
| 764 | * ACTION_PerformUIAction/ACTION_PerformAction |
| 765 | * rather than saving the UI level here. Those |
| 766 | * two functions can be merged too. |
| 767 | */ |
| 768 | iap.package = package; |
| 769 | iap.UI = TRUE; |
| 770 | |
| 771 | TRACE("%p %s %i\n", package, debugstr_w(szTable), iSequenceMode ); |
| 772 | |
| 773 | r = MSI_OpenQuery( package->db, &view, query, szTable ); |
| 774 | if (r == ERROR_SUCCESS) |
| 775 | { |
| 776 | r = MSI_IterateRecords( view, NULL, ITERATE_Actions, &iap ); |
| 777 | msiobj_release(&view->hdr); |
| 778 | } |
| 779 | |
| 780 | return r; |
| 781 | } |
| 782 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 783 | static UINT ACTION_ProcessExecSequence(MSIPACKAGE *package, BOOL UIran) |
Aric Stewart | ed7c4bc | 2004-07-04 00:26:54 +0000 | [diff] [blame] | 784 | { |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 785 | MSIQUERY * view; |
Aric Stewart | ed7c4bc | 2004-07-04 00:26:54 +0000 | [diff] [blame] | 786 | UINT rc; |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 787 | static const WCHAR ExecSeqQuery[] = |
| 788 | {'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ', |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 789 | '`','I','n','s','t','a','l','l','E','x','e','c','u','t','e', |
| 790 | 'S','e','q','u','e','n','c','e','`',' ', 'W','H','E','R','E',' ', |
| 791 | '`','S','e','q','u','e','n','c','e','`',' ', '>',' ','%','i',' ', |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 792 | 'O','R','D','E','R',' ', 'B','Y',' ', |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 793 | '`','S','e','q','u','e','n','c','e','`',0 }; |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 794 | MSIRECORD * row = 0; |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 795 | static const WCHAR IVQuery[] = |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 796 | {'S','E','L','E','C','T',' ','`','S','e','q','u','e','n','c','e','`', |
| 797 | ' ', 'F','R','O','M',' ','`','I','n','s','t','a','l','l', |
| 798 | 'E','x','e','c','u','t','e','S','e','q','u','e','n','c','e','`',' ', |
| 799 | 'W','H','E','R','E',' ','`','A','c','t','i','o','n','`',' ','=', |
| 800 | ' ','\'', 'I','n','s','t','a','l','l', |
| 801 | 'V','a','l','i','d','a','t','e','\'', 0}; |
Mike McCormack | 9db0e07 | 2004-12-22 15:05:07 +0000 | [diff] [blame] | 802 | INT seq = 0; |
Aric Stewart | 2703d71 | 2005-06-20 15:33:10 +0000 | [diff] [blame] | 803 | iterate_action_param iap; |
Aric Stewart | ed7c4bc | 2004-07-04 00:26:54 +0000 | [diff] [blame] | 804 | |
Aric Stewart | 2703d71 | 2005-06-20 15:33:10 +0000 | [diff] [blame] | 805 | iap.package = package; |
| 806 | iap.UI = FALSE; |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 807 | |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 808 | if (package->script->ExecuteSequenceRun) |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 809 | { |
| 810 | TRACE("Execute Sequence already Run\n"); |
| 811 | return ERROR_SUCCESS; |
| 812 | } |
| 813 | |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 814 | package->script->ExecuteSequenceRun = TRUE; |
Aric Stewart | 2703d71 | 2005-06-20 15:33:10 +0000 | [diff] [blame] | 815 | |
Mike McCormack | 9db0e07 | 2004-12-22 15:05:07 +0000 | [diff] [blame] | 816 | /* get the sequence number */ |
Aric Stewart | ed7c4bc | 2004-07-04 00:26:54 +0000 | [diff] [blame] | 817 | if (UIran) |
| 818 | { |
Mike McCormack | 0b352c7 | 2005-06-02 10:29:57 +0000 | [diff] [blame] | 819 | row = MSI_QueryGetRecord(package->db, IVQuery); |
| 820 | if( !row ) |
| 821 | return ERROR_FUNCTION_FAILED; |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 822 | seq = MSI_RecordGetInteger(row,1); |
| 823 | msiobj_release(&row->hdr); |
Aric Stewart | ed7c4bc | 2004-07-04 00:26:54 +0000 | [diff] [blame] | 824 | } |
Mike McCormack | 9db0e07 | 2004-12-22 15:05:07 +0000 | [diff] [blame] | 825 | |
Mike McCormack | 0c23885 | 2005-01-21 16:19:11 +0000 | [diff] [blame] | 826 | rc = MSI_OpenQuery(package->db, &view, ExecSeqQuery, seq); |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 827 | if (rc == ERROR_SUCCESS) |
| 828 | { |
Aric Stewart | 2703d71 | 2005-06-20 15:33:10 +0000 | [diff] [blame] | 829 | TRACE("Running the actions\n"); |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 830 | |
Aric Stewart | 2703d71 | 2005-06-20 15:33:10 +0000 | [diff] [blame] | 831 | rc = MSI_IterateRecords(view, NULL, ITERATE_Actions, &iap); |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 832 | msiobj_release(&view->hdr); |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 833 | } |
| 834 | |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 835 | return rc; |
| 836 | } |
| 837 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 838 | static UINT ACTION_ProcessUISequence(MSIPACKAGE *package) |
Aric Stewart | ed7c4bc | 2004-07-04 00:26:54 +0000 | [diff] [blame] | 839 | { |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 840 | MSIQUERY * view; |
Aric Stewart | ed7c4bc | 2004-07-04 00:26:54 +0000 | [diff] [blame] | 841 | UINT rc; |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 842 | static const WCHAR ExecSeqQuery [] = |
| 843 | {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 844 | '`','I','n','s','t','a','l','l', |
| 845 | 'U','I','S','e','q','u','e','n','c','e','`', |
| 846 | ' ','W','H','E','R','E',' ', |
| 847 | '`','S','e','q','u','e','n','c','e','`',' ', |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 848 | '>',' ','0',' ','O','R','D','E','R',' ','B','Y',' ', |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 849 | '`','S','e','q','u','e','n','c','e','`',0}; |
Aric Stewart | 2703d71 | 2005-06-20 15:33:10 +0000 | [diff] [blame] | 850 | iterate_action_param iap; |
| 851 | |
| 852 | iap.package = package; |
| 853 | iap.UI = TRUE; |
| 854 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 855 | rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view); |
Aric Stewart | ed7c4bc | 2004-07-04 00:26:54 +0000 | [diff] [blame] | 856 | |
| 857 | if (rc == ERROR_SUCCESS) |
| 858 | { |
Francois Gouget | 0edbaf7 | 2005-11-10 12:14:56 +0000 | [diff] [blame] | 859 | TRACE("Running the actions\n"); |
Aric Stewart | ed7c4bc | 2004-07-04 00:26:54 +0000 | [diff] [blame] | 860 | |
Aric Stewart | 2703d71 | 2005-06-20 15:33:10 +0000 | [diff] [blame] | 861 | rc = MSI_IterateRecords(view, NULL, ITERATE_Actions, &iap); |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 862 | msiobj_release(&view->hdr); |
Aric Stewart | ed7c4bc | 2004-07-04 00:26:54 +0000 | [diff] [blame] | 863 | } |
| 864 | |
Aric Stewart | ed7c4bc | 2004-07-04 00:26:54 +0000 | [diff] [blame] | 865 | return rc; |
| 866 | } |
| 867 | |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 868 | /******************************************************** |
| 869 | * ACTION helper functions and functions that perform the actions |
| 870 | *******************************************************/ |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 871 | static BOOL ACTION_HandleStandardAction(MSIPACKAGE *package, LPCWSTR action, |
| 872 | UINT* rc, BOOL force ) |
Aric Stewart | 3f31860 | 2005-02-01 18:46:26 +0000 | [diff] [blame] | 873 | { |
| 874 | BOOL ret = FALSE; |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 875 | BOOL run = force; |
Aric Stewart | 3f31860 | 2005-02-01 18:46:26 +0000 | [diff] [blame] | 876 | int i; |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 877 | |
| 878 | if (!run && !package->script->CurrentlyScripting) |
| 879 | run = TRUE; |
| 880 | |
| 881 | if (!run) |
| 882 | { |
| 883 | if (strcmpW(action,szInstallFinalize) == 0 || |
| 884 | strcmpW(action,szInstallExecute) == 0 || |
| 885 | strcmpW(action,szInstallExecuteAgain) == 0) |
| 886 | run = TRUE; |
| 887 | } |
| 888 | |
Aric Stewart | 3f31860 | 2005-02-01 18:46:26 +0000 | [diff] [blame] | 889 | i = 0; |
| 890 | while (StandardActions[i].action != NULL) |
| 891 | { |
| 892 | if (strcmpW(StandardActions[i].action, action)==0) |
| 893 | { |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 894 | if (!run) |
Aric Stewart | d6ecf58 | 2005-02-02 09:29:30 +0000 | [diff] [blame] | 895 | { |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 896 | ui_actioninfo(package, action, TRUE, 0); |
| 897 | *rc = schedule_action(package,INSTALL_SCRIPT,action); |
| 898 | ui_actioninfo(package, action, FALSE, *rc); |
Aric Stewart | d6ecf58 | 2005-02-02 09:29:30 +0000 | [diff] [blame] | 899 | } |
| 900 | else |
| 901 | { |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 902 | ui_actionstart(package, action); |
| 903 | if (StandardActions[i].handler) |
| 904 | { |
| 905 | *rc = StandardActions[i].handler(package); |
| 906 | } |
| 907 | else |
| 908 | { |
Mike McCormack | 54a2891 | 2005-09-06 09:23:18 +0000 | [diff] [blame] | 909 | FIXME("unhandled standard action %s\n",debugstr_w(action)); |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 910 | *rc = ERROR_SUCCESS; |
| 911 | } |
Aric Stewart | d6ecf58 | 2005-02-02 09:29:30 +0000 | [diff] [blame] | 912 | } |
Aric Stewart | 3f31860 | 2005-02-01 18:46:26 +0000 | [diff] [blame] | 913 | ret = TRUE; |
| 914 | break; |
| 915 | } |
| 916 | i++; |
| 917 | } |
| 918 | return ret; |
| 919 | } |
| 920 | |
Mike McCormack | f9acfe6 | 2005-06-07 20:29:51 +0000 | [diff] [blame] | 921 | static BOOL ACTION_HandleCustomAction( MSIPACKAGE* package, LPCWSTR action, |
| 922 | UINT* rc, BOOL force ) |
Aric Stewart | 3f31860 | 2005-02-01 18:46:26 +0000 | [diff] [blame] | 923 | { |
| 924 | BOOL ret=FALSE; |
| 925 | UINT arc; |
| 926 | |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 927 | arc = ACTION_CustomAction(package,action, force); |
Aric Stewart | 3f31860 | 2005-02-01 18:46:26 +0000 | [diff] [blame] | 928 | |
| 929 | if (arc != ERROR_CALL_NOT_IMPLEMENTED) |
| 930 | { |
| 931 | *rc = arc; |
| 932 | ret = TRUE; |
| 933 | } |
| 934 | return ret; |
| 935 | } |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 936 | |
| 937 | /* |
Francois Gouget | da8b3dd | 2005-01-26 21:09:04 +0000 | [diff] [blame] | 938 | * A lot of actions are really important even if they don't do anything |
| 939 | * explicit... Lots of properties are set at the beginning of the installation |
| 940 | * CostFinalize does a bunch of work to translate the directories and such |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 941 | * |
Mike McCormack | 6e2bca3 | 2004-07-04 00:25:00 +0000 | [diff] [blame] | 942 | * But until I get write access to the database that is hard, so I am going to |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 943 | * hack it to see if I can get something to run. |
| 944 | */ |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 945 | UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, BOOL force) |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 946 | { |
Aric Stewart | d2c395a | 2004-07-06 18:48:15 +0000 | [diff] [blame] | 947 | UINT rc = ERROR_SUCCESS; |
Aric Stewart | 3f31860 | 2005-02-01 18:46:26 +0000 | [diff] [blame] | 948 | BOOL handled; |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 949 | |
| 950 | TRACE("Performing action (%s)\n",debugstr_w(action)); |
| 951 | |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 952 | handled = ACTION_HandleStandardAction(package, action, &rc, force); |
Aric Stewart | 7d3e597 | 2004-07-04 00:36:58 +0000 | [diff] [blame] | 953 | |
Aric Stewart | 3f31860 | 2005-02-01 18:46:26 +0000 | [diff] [blame] | 954 | if (!handled) |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 955 | handled = ACTION_HandleCustomAction(package, action, &rc, force); |
Aric Stewart | 3f31860 | 2005-02-01 18:46:26 +0000 | [diff] [blame] | 956 | |
Aric Stewart | 90c5739 | 2005-01-31 16:23:12 +0000 | [diff] [blame] | 957 | if (!handled) |
| 958 | { |
Mike McCormack | 54a2891 | 2005-09-06 09:23:18 +0000 | [diff] [blame] | 959 | FIXME("unhandled msi action %s\n",debugstr_w(action)); |
Aric Stewart | 3f31860 | 2005-02-01 18:46:26 +0000 | [diff] [blame] | 960 | rc = ERROR_FUNCTION_NOT_CALLED; |
| 961 | } |
Aric Stewart | 7d3e597 | 2004-07-04 00:36:58 +0000 | [diff] [blame] | 962 | |
Aric Stewart | 3f31860 | 2005-02-01 18:46:26 +0000 | [diff] [blame] | 963 | return rc; |
| 964 | } |
| 965 | |
| 966 | UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action) |
| 967 | { |
| 968 | UINT rc = ERROR_SUCCESS; |
| 969 | BOOL handled = FALSE; |
| 970 | |
| 971 | TRACE("Performing action (%s)\n",debugstr_w(action)); |
| 972 | |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 973 | handled = ACTION_HandleStandardAction(package, action, &rc,TRUE); |
Aric Stewart | 3f31860 | 2005-02-01 18:46:26 +0000 | [diff] [blame] | 974 | |
| 975 | if (!handled) |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 976 | handled = ACTION_HandleCustomAction(package, action, &rc, FALSE); |
Aric Stewart | 3f31860 | 2005-02-01 18:46:26 +0000 | [diff] [blame] | 977 | |
Mike McCormack | 4f634a3 | 2005-07-06 15:44:51 +0000 | [diff] [blame] | 978 | if( !handled && ACTION_DialogBox(package,action) == ERROR_SUCCESS ) |
| 979 | handled = TRUE; |
Mike McCormack | 34d4a02 | 2005-02-09 13:24:31 +0000 | [diff] [blame] | 980 | |
Aric Stewart | 3f31860 | 2005-02-01 18:46:26 +0000 | [diff] [blame] | 981 | if (!handled) |
| 982 | { |
Mike McCormack | 54a2891 | 2005-09-06 09:23:18 +0000 | [diff] [blame] | 983 | FIXME("unhandled msi action %s\n",debugstr_w(action)); |
Aric Stewart | 3f31860 | 2005-02-01 18:46:26 +0000 | [diff] [blame] | 984 | rc = ERROR_FUNCTION_NOT_CALLED; |
Aric Stewart | 90c5739 | 2005-01-31 16:23:12 +0000 | [diff] [blame] | 985 | } |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 986 | |
Aric Stewart | d2c395a | 2004-07-06 18:48:15 +0000 | [diff] [blame] | 987 | return rc; |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 988 | } |
| 989 | |
Aric Stewart | 2274ff1 | 2005-06-21 20:03:46 +0000 | [diff] [blame] | 990 | |
| 991 | /* |
| 992 | * Actual Action Handlers |
| 993 | */ |
| 994 | |
| 995 | static UINT ITERATE_CreateFolders(MSIRECORD *row, LPVOID param) |
| 996 | { |
| 997 | MSIPACKAGE *package = (MSIPACKAGE*)param; |
| 998 | LPCWSTR dir; |
| 999 | LPWSTR full_path; |
| 1000 | MSIRECORD *uirow; |
| 1001 | MSIFOLDER *folder; |
| 1002 | |
| 1003 | dir = MSI_RecordGetString(row,1); |
| 1004 | if (!dir) |
| 1005 | { |
Francois Gouget | 0edbaf7 | 2005-11-10 12:14:56 +0000 | [diff] [blame] | 1006 | ERR("Unable to get folder id\n"); |
Aric Stewart | 2274ff1 | 2005-06-21 20:03:46 +0000 | [diff] [blame] | 1007 | return ERROR_SUCCESS; |
| 1008 | } |
| 1009 | |
| 1010 | full_path = resolve_folder(package,dir,FALSE,FALSE,&folder); |
| 1011 | if (!full_path) |
| 1012 | { |
| 1013 | ERR("Unable to resolve folder id %s\n",debugstr_w(dir)); |
| 1014 | return ERROR_SUCCESS; |
| 1015 | } |
| 1016 | |
| 1017 | TRACE("Folder is %s\n",debugstr_w(full_path)); |
| 1018 | |
| 1019 | /* UI stuff */ |
| 1020 | uirow = MSI_CreateRecord(1); |
| 1021 | MSI_RecordSetStringW(uirow,1,full_path); |
| 1022 | ui_actiondata(package,szCreateFolders,uirow); |
| 1023 | msiobj_release( &uirow->hdr ); |
| 1024 | |
| 1025 | if (folder->State == 0) |
| 1026 | create_full_pathW(full_path); |
| 1027 | |
| 1028 | folder->State = 3; |
| 1029 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 1030 | msi_free(full_path); |
Aric Stewart | 2274ff1 | 2005-06-21 20:03:46 +0000 | [diff] [blame] | 1031 | return ERROR_SUCCESS; |
| 1032 | } |
| 1033 | |
Mike McCormack | 03b4dbb | 2005-10-28 09:39:29 +0000 | [diff] [blame] | 1034 | /* FIXME: probably should merge this with the above function */ |
| 1035 | static UINT msi_create_directory( MSIPACKAGE* package, LPCWSTR dir ) |
| 1036 | { |
| 1037 | UINT rc = ERROR_SUCCESS; |
| 1038 | MSIFOLDER *folder; |
| 1039 | LPWSTR install_path; |
| 1040 | |
| 1041 | install_path = resolve_folder(package, dir, FALSE, FALSE, &folder); |
| 1042 | if (!install_path) |
| 1043 | return ERROR_FUNCTION_FAILED; |
| 1044 | |
| 1045 | /* create the path */ |
| 1046 | if (folder->State == 0) |
| 1047 | { |
| 1048 | create_full_pathW(install_path); |
| 1049 | folder->State = 2; |
| 1050 | } |
| 1051 | msi_free(install_path); |
| 1052 | |
| 1053 | return rc; |
| 1054 | } |
Aric Stewart | 2274ff1 | 2005-06-21 20:03:46 +0000 | [diff] [blame] | 1055 | |
Mike McCormack | 9c84585 | 2005-10-29 11:29:17 +0000 | [diff] [blame] | 1056 | UINT msi_create_component_directories( MSIPACKAGE *package ) |
| 1057 | { |
| 1058 | MSICOMPONENT *comp; |
| 1059 | |
| 1060 | /* create all the folders required by the components are going to install */ |
| 1061 | LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry ) |
| 1062 | { |
Mike McCormack | d693f46 | 2005-10-29 11:36:48 +0000 | [diff] [blame] | 1063 | if (!ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL)) |
Mike McCormack | 9c84585 | 2005-10-29 11:29:17 +0000 | [diff] [blame] | 1064 | continue; |
| 1065 | msi_create_directory( package, comp->Directory ); |
| 1066 | } |
| 1067 | |
| 1068 | return ERROR_SUCCESS; |
| 1069 | } |
| 1070 | |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1071 | /* |
| 1072 | * Also we cannot enable/disable components either, so for now I am just going |
Mike McCormack | 6e2bca3 | 2004-07-04 00:25:00 +0000 | [diff] [blame] | 1073 | * to do all the directories for all the components. |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1074 | */ |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1075 | static UINT ACTION_CreateFolders(MSIPACKAGE *package) |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1076 | { |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 1077 | static const WCHAR ExecSeqQuery[] = |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 1078 | {'S','E','L','E','C','T',' ', |
| 1079 | '`','D','i','r','e','c','t','o','r','y','_','`', |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 1080 | ' ','F','R','O','M',' ', |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 1081 | '`','C','r','e','a','t','e','F','o','l','d','e','r','`',0 }; |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1082 | UINT rc; |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1083 | MSIQUERY *view; |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1084 | |
Mike McCormack | 03b4dbb | 2005-10-28 09:39:29 +0000 | [diff] [blame] | 1085 | /* create all the empty folders specified in the CreateFolder table */ |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1086 | rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view ); |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1087 | if (rc != ERROR_SUCCESS) |
Aric Stewart | 84837d9 | 2004-07-20 01:22:37 +0000 | [diff] [blame] | 1088 | return ERROR_SUCCESS; |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1089 | |
Aric Stewart | 2274ff1 | 2005-06-21 20:03:46 +0000 | [diff] [blame] | 1090 | rc = MSI_IterateRecords(view, NULL, ITERATE_CreateFolders, package); |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1091 | msiobj_release(&view->hdr); |
Mike McCormack | 03b4dbb | 2005-10-28 09:39:29 +0000 | [diff] [blame] | 1092 | |
Mike McCormack | 9c84585 | 2005-10-29 11:29:17 +0000 | [diff] [blame] | 1093 | msi_create_component_directories( package ); |
Mike McCormack | 03b4dbb | 2005-10-28 09:39:29 +0000 | [diff] [blame] | 1094 | |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1095 | return rc; |
| 1096 | } |
| 1097 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1098 | static MSICOMPONENT* load_component( MSIRECORD * row ) |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1099 | { |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1100 | MSICOMPONENT *comp; |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1101 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 1102 | comp = msi_alloc_zero( sizeof(MSICOMPONENT) ); |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1103 | if (!comp) |
| 1104 | return comp; |
| 1105 | |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1106 | /* fill in the data */ |
Mike McCormack | 51c6618 | 2005-10-27 12:36:12 +0000 | [diff] [blame] | 1107 | comp->Component = msi_dup_record_field( row, 1 ); |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1108 | |
Mike McCormack | efcc1ec | 2005-09-12 12:07:15 +0000 | [diff] [blame] | 1109 | TRACE("Loading Component %s\n", debugstr_w(comp->Component)); |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1110 | |
Mike McCormack | 51c6618 | 2005-10-27 12:36:12 +0000 | [diff] [blame] | 1111 | comp->ComponentId = msi_dup_record_field( row, 2 ); |
| 1112 | comp->Directory = msi_dup_record_field( row, 3 ); |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1113 | comp->Attributes = MSI_RecordGetInteger(row,4); |
Mike McCormack | 51c6618 | 2005-10-27 12:36:12 +0000 | [diff] [blame] | 1114 | comp->Condition = msi_dup_record_field( row, 5 ); |
| 1115 | comp->KeyPath = msi_dup_record_field( row, 6 ); |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1116 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1117 | comp->Installed = INSTALLSTATE_ABSENT; |
| 1118 | comp->Action = INSTALLSTATE_UNKNOWN; |
| 1119 | comp->ActionRequest = INSTALLSTATE_UNKNOWN; |
Aric Stewart | fbdd709 | 2004-12-27 19:06:22 +0000 | [diff] [blame] | 1120 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1121 | comp->Enabled = TRUE; |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1122 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1123 | return comp; |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1124 | } |
| 1125 | |
Aric Stewart | 0459824 | 2005-06-23 16:43:24 +0000 | [diff] [blame] | 1126 | typedef struct { |
| 1127 | MSIPACKAGE *package; |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1128 | MSIFEATURE *feature; |
Aric Stewart | 0459824 | 2005-06-23 16:43:24 +0000 | [diff] [blame] | 1129 | } _ilfs; |
| 1130 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1131 | static UINT add_feature_component( MSIFEATURE *feature, MSICOMPONENT *comp ) |
Mike McCormack | 3f2d5d7 | 2005-08-19 10:03:11 +0000 | [diff] [blame] | 1132 | { |
| 1133 | ComponentList *cl; |
| 1134 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 1135 | cl = msi_alloc( sizeof (*cl) ); |
Mike McCormack | 3f2d5d7 | 2005-08-19 10:03:11 +0000 | [diff] [blame] | 1136 | if ( !cl ) |
| 1137 | return ERROR_NOT_ENOUGH_MEMORY; |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1138 | cl->component = comp; |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1139 | list_add_tail( &feature->Components, &cl->entry ); |
Mike McCormack | 3f2d5d7 | 2005-08-19 10:03:11 +0000 | [diff] [blame] | 1140 | |
| 1141 | return ERROR_SUCCESS; |
| 1142 | } |
| 1143 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1144 | static UINT iterate_component_check( MSIRECORD *row, LPVOID param ) |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1145 | { |
Aric Stewart | 0459824 | 2005-06-23 16:43:24 +0000 | [diff] [blame] | 1146 | _ilfs* ilfs= (_ilfs*)param; |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1147 | MSIPACKAGE *package = ilfs->package; |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1148 | MSIFEATURE *feature = ilfs->feature; |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1149 | MSICOMPONENT *comp; |
Aric Stewart | 0459824 | 2005-06-23 16:43:24 +0000 | [diff] [blame] | 1150 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1151 | comp = load_component( row ); |
| 1152 | if (!comp) |
| 1153 | return ERROR_FUNCTION_FAILED; |
Aric Stewart | 0459824 | 2005-06-23 16:43:24 +0000 | [diff] [blame] | 1154 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1155 | list_add_tail( &package->components, &comp->entry ); |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1156 | add_feature_component( feature, comp ); |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1157 | |
| 1158 | TRACE("Loaded new component %p\n", comp); |
Aric Stewart | 0459824 | 2005-06-23 16:43:24 +0000 | [diff] [blame] | 1159 | |
| 1160 | return ERROR_SUCCESS; |
| 1161 | } |
| 1162 | |
| 1163 | static UINT iterate_load_featurecomponents(MSIRECORD *row, LPVOID param) |
| 1164 | { |
| 1165 | _ilfs* ilfs= (_ilfs*)param; |
| 1166 | LPCWSTR component; |
| 1167 | DWORD rc; |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1168 | MSICOMPONENT *comp; |
Aric Stewart | 0459824 | 2005-06-23 16:43:24 +0000 | [diff] [blame] | 1169 | MSIQUERY * view; |
| 1170 | static const WCHAR Query[] = |
| 1171 | {'S','E','L','E','C','T',' ','*',' ','F','R', 'O','M',' ', |
| 1172 | '`','C','o','m','p','o','n','e','n','t','`',' ', |
| 1173 | 'W','H','E','R','E',' ', |
| 1174 | '`','C','o','m','p','o','n','e','n','t','`',' ', |
| 1175 | '=','\'','%','s','\'',0}; |
| 1176 | |
| 1177 | component = MSI_RecordGetString(row,1); |
| 1178 | |
| 1179 | /* check to see if the component is already loaded */ |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1180 | comp = get_loaded_component( ilfs->package, component ); |
| 1181 | if (comp) |
Aric Stewart | 0459824 | 2005-06-23 16:43:24 +0000 | [diff] [blame] | 1182 | { |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1183 | TRACE("Component %s already loaded\n", debugstr_w(component) ); |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1184 | add_feature_component( ilfs->feature, comp ); |
Aric Stewart | 0459824 | 2005-06-23 16:43:24 +0000 | [diff] [blame] | 1185 | return ERROR_SUCCESS; |
| 1186 | } |
| 1187 | |
| 1188 | rc = MSI_OpenQuery(ilfs->package->db, &view, Query, component); |
| 1189 | if (rc != ERROR_SUCCESS) |
| 1190 | return ERROR_SUCCESS; |
| 1191 | |
Aric Stewart | 0459824 | 2005-06-23 16:43:24 +0000 | [diff] [blame] | 1192 | rc = MSI_IterateRecords(view, NULL, iterate_component_check, ilfs); |
| 1193 | msiobj_release( &view->hdr ); |
| 1194 | |
| 1195 | return ERROR_SUCCESS; |
| 1196 | } |
| 1197 | |
| 1198 | static UINT load_feature(MSIRECORD * row, LPVOID param) |
| 1199 | { |
| 1200 | MSIPACKAGE* package = (MSIPACKAGE*)param; |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1201 | MSIFEATURE* feature; |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 1202 | static const WCHAR Query1[] = |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 1203 | {'S','E','L','E','C','T',' ', |
| 1204 | '`','C','o','m','p','o','n','e','n','t','_','`', |
| 1205 | ' ','F','R','O','M',' ','`','F','e','a','t','u','r','e', |
| 1206 | 'C','o','m','p','o','n','e','n','t','s','`',' ', |
| 1207 | 'W','H','E','R','E',' ', |
| 1208 | '`','F','e', 'a','t','u','r','e','_','`',' ','=','\'','%','s','\'',0}; |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1209 | MSIQUERY * view; |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1210 | UINT rc; |
Aric Stewart | 0459824 | 2005-06-23 16:43:24 +0000 | [diff] [blame] | 1211 | _ilfs ilfs; |
| 1212 | |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1213 | /* fill in the data */ |
| 1214 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 1215 | feature = msi_alloc_zero( sizeof (MSIFEATURE) ); |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1216 | if (!feature) |
| 1217 | return ERROR_NOT_ENOUGH_MEMORY; |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1218 | |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1219 | list_init( &feature->Components ); |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1220 | |
Mike McCormack | 51c6618 | 2005-10-27 12:36:12 +0000 | [diff] [blame] | 1221 | feature->Feature = msi_dup_record_field( row, 1 ); |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1222 | |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1223 | TRACE("Loading feature %s\n",debugstr_w(feature->Feature)); |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1224 | |
Mike McCormack | 51c6618 | 2005-10-27 12:36:12 +0000 | [diff] [blame] | 1225 | feature->Feature_Parent = msi_dup_record_field( row, 2 ); |
| 1226 | feature->Title = msi_dup_record_field( row, 3 ); |
| 1227 | feature->Description = msi_dup_record_field( row, 4 ); |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1228 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1229 | if (!MSI_RecordIsNull(row,5)) |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1230 | feature->Display = MSI_RecordGetInteger(row,5); |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1231 | |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1232 | feature->Level= MSI_RecordGetInteger(row,6); |
Mike McCormack | 51c6618 | 2005-10-27 12:36:12 +0000 | [diff] [blame] | 1233 | feature->Directory = msi_dup_record_field( row, 7 ); |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1234 | feature->Attributes = MSI_RecordGetInteger(row,8); |
Aric Stewart | fbdd709 | 2004-12-27 19:06:22 +0000 | [diff] [blame] | 1235 | |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1236 | feature->Installed = INSTALLSTATE_ABSENT; |
| 1237 | feature->Action = INSTALLSTATE_UNKNOWN; |
| 1238 | feature->ActionRequest = INSTALLSTATE_UNKNOWN; |
| 1239 | |
| 1240 | list_add_tail( &package->features, &feature->entry ); |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1241 | |
| 1242 | /* load feature components */ |
| 1243 | |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1244 | rc = MSI_OpenQuery( package->db, &view, Query1, feature->Feature ); |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1245 | if (rc != ERROR_SUCCESS) |
Aric Stewart | 0459824 | 2005-06-23 16:43:24 +0000 | [diff] [blame] | 1246 | return ERROR_SUCCESS; |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1247 | |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1248 | ilfs.package = package; |
| 1249 | ilfs.feature = feature; |
| 1250 | |
Aric Stewart | 0459824 | 2005-06-23 16:43:24 +0000 | [diff] [blame] | 1251 | MSI_IterateRecords(view, NULL, iterate_load_featurecomponents , &ilfs); |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1252 | msiobj_release(&view->hdr); |
Aric Stewart | 0459824 | 2005-06-23 16:43:24 +0000 | [diff] [blame] | 1253 | |
| 1254 | return ERROR_SUCCESS; |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1255 | } |
| 1256 | |
Mike McCormack | c1513be | 2006-03-21 19:40:36 +0900 | [diff] [blame] | 1257 | static LPWSTR folder_split_path(LPWSTR p, WCHAR ch) |
| 1258 | { |
| 1259 | if (!p) |
| 1260 | return p; |
| 1261 | p = strchrW(p, ch); |
| 1262 | if (!p) |
| 1263 | return p; |
| 1264 | *p = 0; |
| 1265 | return p+1; |
| 1266 | } |
| 1267 | |
Aric Stewart | 0459824 | 2005-06-23 16:43:24 +0000 | [diff] [blame] | 1268 | static UINT load_file(MSIRECORD *row, LPVOID param) |
Aric Stewart | c5a1443 | 2005-05-18 17:46:12 +0000 | [diff] [blame] | 1269 | { |
Aric Stewart | 0459824 | 2005-06-23 16:43:24 +0000 | [diff] [blame] | 1270 | MSIPACKAGE* package = (MSIPACKAGE*)param; |
Aric Stewart | 09b0aba | 2005-06-09 20:30:59 +0000 | [diff] [blame] | 1271 | LPCWSTR component; |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 1272 | MSIFILE *file; |
Aric Stewart | c5a1443 | 2005-05-18 17:46:12 +0000 | [diff] [blame] | 1273 | |
| 1274 | /* fill in the data */ |
| 1275 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 1276 | file = msi_alloc_zero( sizeof (MSIFILE) ); |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 1277 | if (!file) |
| 1278 | return ERROR_NOT_ENOUGH_MEMORY; |
Aric Stewart | c5a1443 | 2005-05-18 17:46:12 +0000 | [diff] [blame] | 1279 | |
Mike McCormack | 51c6618 | 2005-10-27 12:36:12 +0000 | [diff] [blame] | 1280 | file->File = msi_dup_record_field( row, 1 ); |
Aric Stewart | c5a1443 | 2005-05-18 17:46:12 +0000 | [diff] [blame] | 1281 | |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 1282 | component = MSI_RecordGetString( row, 2 ); |
| 1283 | file->Component = get_loaded_component( package, component ); |
Aric Stewart | 09b0aba | 2005-06-09 20:30:59 +0000 | [diff] [blame] | 1284 | |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 1285 | if (!file->Component) |
Aric Stewart | 09b0aba | 2005-06-09 20:30:59 +0000 | [diff] [blame] | 1286 | ERR("Unfound Component %s\n",debugstr_w(component)); |
Aric Stewart | c5a1443 | 2005-05-18 17:46:12 +0000 | [diff] [blame] | 1287 | |
Mike McCormack | 51c6618 | 2005-10-27 12:36:12 +0000 | [diff] [blame] | 1288 | file->FileName = msi_dup_record_field( row, 3 ); |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 1289 | reduce_to_longfilename( file->FileName ); |
Aric Stewart | c5a1443 | 2005-05-18 17:46:12 +0000 | [diff] [blame] | 1290 | |
Mike McCormack | 51c6618 | 2005-10-27 12:36:12 +0000 | [diff] [blame] | 1291 | file->ShortName = msi_dup_record_field( row, 3 ); |
Mike McCormack | c1513be | 2006-03-21 19:40:36 +0900 | [diff] [blame] | 1292 | file->LongName = strdupW( folder_split_path(file->ShortName, '|')); |
Aric Stewart | c5a1443 | 2005-05-18 17:46:12 +0000 | [diff] [blame] | 1293 | |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 1294 | file->FileSize = MSI_RecordGetInteger( row, 4 ); |
Mike McCormack | 51c6618 | 2005-10-27 12:36:12 +0000 | [diff] [blame] | 1295 | file->Version = msi_dup_record_field( row, 5 ); |
| 1296 | file->Language = msi_dup_record_field( row, 6 ); |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 1297 | file->Attributes = MSI_RecordGetInteger( row, 7 ); |
| 1298 | file->Sequence = MSI_RecordGetInteger( row, 8 ); |
Aric Stewart | c5a1443 | 2005-05-18 17:46:12 +0000 | [diff] [blame] | 1299 | |
Mike McCormack | dded8fb | 2005-11-02 10:56:42 +0000 | [diff] [blame] | 1300 | file->state = msifs_invalid; |
Aric Stewart | c5a1443 | 2005-05-18 17:46:12 +0000 | [diff] [blame] | 1301 | |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 1302 | TRACE("File Loaded (%s)\n",debugstr_w(file->File)); |
| 1303 | |
| 1304 | list_add_tail( &package->files, &file->entry ); |
Aric Stewart | c5a1443 | 2005-05-18 17:46:12 +0000 | [diff] [blame] | 1305 | |
| 1306 | return ERROR_SUCCESS; |
| 1307 | } |
| 1308 | |
| 1309 | static UINT load_all_files(MSIPACKAGE *package) |
| 1310 | { |
| 1311 | MSIQUERY * view; |
Aric Stewart | c5a1443 | 2005-05-18 17:46:12 +0000 | [diff] [blame] | 1312 | UINT rc; |
| 1313 | static const WCHAR Query[] = |
| 1314 | {'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ', |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 1315 | '`','F','i','l','e','`',' ', 'O','R','D','E','R',' ','B','Y',' ', |
| 1316 | '`','S','e','q','u','e','n','c','e','`', 0}; |
Aric Stewart | c5a1443 | 2005-05-18 17:46:12 +0000 | [diff] [blame] | 1317 | |
Mike McCormack | 9a9195d | 2006-07-19 17:01:07 +0900 | [diff] [blame] | 1318 | if (!list_empty(&package->files)) |
| 1319 | return ERROR_SUCCESS; |
| 1320 | |
Aric Stewart | c5a1443 | 2005-05-18 17:46:12 +0000 | [diff] [blame] | 1321 | rc = MSI_DatabaseOpenViewW(package->db, Query, &view); |
| 1322 | if (rc != ERROR_SUCCESS) |
| 1323 | return ERROR_SUCCESS; |
Aric Stewart | c5a1443 | 2005-05-18 17:46:12 +0000 | [diff] [blame] | 1324 | |
Aric Stewart | 0459824 | 2005-06-23 16:43:24 +0000 | [diff] [blame] | 1325 | rc = MSI_IterateRecords(view, NULL, load_file, package); |
Aric Stewart | c5a1443 | 2005-05-18 17:46:12 +0000 | [diff] [blame] | 1326 | msiobj_release(&view->hdr); |
| 1327 | |
| 1328 | return ERROR_SUCCESS; |
| 1329 | } |
| 1330 | |
| 1331 | |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1332 | /* |
Mike McCormack | 9a9195d | 2006-07-19 17:01:07 +0900 | [diff] [blame] | 1333 | * I am not doing any of the costing functionality yet. |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1334 | * Mostly looking at doing the Component and Feature loading |
| 1335 | * |
Francois Gouget | da8b3dd | 2005-01-26 21:09:04 +0000 | [diff] [blame] | 1336 | * The native MSI does A LOT of modification to tables here. Mostly adding |
Mike McCormack | 9a9195d | 2006-07-19 17:01:07 +0900 | [diff] [blame] | 1337 | * a lot of temporary columns to the Feature and Component tables. |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1338 | * |
Francois Gouget | da8b3dd | 2005-01-26 21:09:04 +0000 | [diff] [blame] | 1339 | * note: Native msi also tracks the short filename. But I am only going to |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1340 | * track the long ones. Also looking at this directory table |
| 1341 | * it appears that the directory table does not get the parents |
Mike McCormack | 9a9195d | 2006-07-19 17:01:07 +0900 | [diff] [blame] | 1342 | * resolved base on property only based on their entries in the |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1343 | * directory table. |
| 1344 | */ |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1345 | static UINT ACTION_CostInitialize(MSIPACKAGE *package) |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1346 | { |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1347 | MSIQUERY * view; |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1348 | UINT rc; |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 1349 | static const WCHAR Query_all[] = |
| 1350 | {'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ', |
James Hawkins | 2396e2a | 2006-07-18 11:40:44 -0700 | [diff] [blame] | 1351 | '`','F','e','a','t','u','r','e','`',' ','O','R','D','E','R', |
| 1352 | ' ','B','Y',' ','`','D','i','s','p','l','a','y','`',0}; |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 1353 | static const WCHAR szCosting[] = |
| 1354 | {'C','o','s','t','i','n','g','C','o','m','p','l','e','t','e',0 }; |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1355 | static const WCHAR szZero[] = { '0', 0 }; |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1356 | |
Mike McCormack | 9293f86 | 2005-10-30 19:16:45 +0000 | [diff] [blame] | 1357 | if ( 1 == msi_get_property_int( package, szCosting, 0 ) ) |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 1358 | return ERROR_SUCCESS; |
Mike McCormack | 9a9195d | 2006-07-19 17:01:07 +0900 | [diff] [blame] | 1359 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1360 | MSI_SetPropertyW(package, szCosting, szZero); |
Juan Lang | 014ad3b | 2005-03-01 10:41:52 +0000 | [diff] [blame] | 1361 | MSI_SetPropertyW(package, cszRootDrive , c_colon); |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1362 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1363 | rc = MSI_DatabaseOpenViewW(package->db,Query_all,&view); |
| 1364 | if (rc != ERROR_SUCCESS) |
| 1365 | return rc; |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1366 | |
Mike McCormack | 9a9195d | 2006-07-19 17:01:07 +0900 | [diff] [blame] | 1367 | if (list_empty(&package->features)) |
| 1368 | { |
| 1369 | rc = MSI_IterateRecords(view, NULL, load_feature, package); |
| 1370 | msiobj_release(&view->hdr); |
| 1371 | } |
Aric Stewart | ec688fb | 2004-07-04 00:35:52 +0000 | [diff] [blame] | 1372 | |
Aric Stewart | c5a1443 | 2005-05-18 17:46:12 +0000 | [diff] [blame] | 1373 | load_all_files(package); |
Aric Stewart | ec688fb | 2004-07-04 00:35:52 +0000 | [diff] [blame] | 1374 | |
Aric Stewart | ec688fb | 2004-07-04 00:35:52 +0000 | [diff] [blame] | 1375 | return ERROR_SUCCESS; |
| 1376 | } |
| 1377 | |
Mike McCormack | f9acfe6 | 2005-06-07 20:29:51 +0000 | [diff] [blame] | 1378 | static UINT execute_script(MSIPACKAGE *package, UINT script ) |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 1379 | { |
| 1380 | int i; |
| 1381 | UINT rc = ERROR_SUCCESS; |
| 1382 | |
| 1383 | TRACE("Executing Script %i\n",script); |
| 1384 | |
Mike McCormack | aa81e4f | 2006-01-10 12:09:19 +0100 | [diff] [blame] | 1385 | if (!package->script) |
| 1386 | { |
| 1387 | ERR("no script!\n"); |
| 1388 | return ERROR_FUNCTION_FAILED; |
| 1389 | } |
| 1390 | |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 1391 | for (i = 0; i < package->script->ActionCount[script]; i++) |
| 1392 | { |
| 1393 | LPWSTR action; |
| 1394 | action = package->script->Actions[script][i]; |
| 1395 | ui_actionstart(package, action); |
| 1396 | TRACE("Executing Action (%s)\n",debugstr_w(action)); |
| 1397 | rc = ACTION_PerformAction(package, action, TRUE); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 1398 | msi_free(package->script->Actions[script][i]); |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 1399 | if (rc != ERROR_SUCCESS) |
| 1400 | break; |
| 1401 | } |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 1402 | msi_free(package->script->Actions[script]); |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 1403 | |
| 1404 | package->script->ActionCount[script] = 0; |
| 1405 | package->script->Actions[script] = NULL; |
| 1406 | return rc; |
| 1407 | } |
| 1408 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1409 | static UINT ACTION_FileCost(MSIPACKAGE *package) |
Aric Stewart | ec688fb | 2004-07-04 00:35:52 +0000 | [diff] [blame] | 1410 | { |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1411 | return ERROR_SUCCESS; |
| 1412 | } |
| 1413 | |
Mike McCormack | 979511f | 2005-08-23 18:15:44 +0000 | [diff] [blame] | 1414 | static MSIFOLDER *load_folder( MSIPACKAGE *package, LPCWSTR dir ) |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1415 | { |
Mike McCormack | ba8200b | 2004-12-22 15:25:30 +0000 | [diff] [blame] | 1416 | static const WCHAR Query[] = |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 1417 | {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 1418 | '`','D','i','r','e','c', 't','o','r','y','`',' ', |
| 1419 | 'W','H','E','R','E',' ', '`', 'D','i','r','e','c','t', 'o','r','y','`', |
| 1420 | ' ','=',' ','\'','%','s','\'', |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 1421 | 0}; |
Mike McCormack | c1513be | 2006-03-21 19:40:36 +0900 | [diff] [blame] | 1422 | static const WCHAR szDot[] = { '.',0 }; |
James Hawkins | a1910e1 | 2006-06-20 15:46:41 -0700 | [diff] [blame] | 1423 | static WCHAR szEmpty[] = { 0 }; |
Mike McCormack | c1513be | 2006-03-21 19:40:36 +0900 | [diff] [blame] | 1424 | LPWSTR p, tgt_short, tgt_long, src_short, src_long; |
Aric Stewart | 09b0aba | 2005-06-09 20:30:59 +0000 | [diff] [blame] | 1425 | LPCWSTR parent; |
Mike McCormack | c1513be | 2006-03-21 19:40:36 +0900 | [diff] [blame] | 1426 | MSIRECORD *row; |
Mike McCormack | 979511f | 2005-08-23 18:15:44 +0000 | [diff] [blame] | 1427 | MSIFOLDER *folder; |
Aric Stewart | e95136b | 2004-06-29 03:44:01 +0000 | [diff] [blame] | 1428 | |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1429 | TRACE("Looking for dir %s\n",debugstr_w(dir)); |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1430 | |
Mike McCormack | 979511f | 2005-08-23 18:15:44 +0000 | [diff] [blame] | 1431 | folder = get_loaded_folder( package, dir ); |
| 1432 | if (folder) |
| 1433 | return folder; |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1434 | |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1435 | TRACE("Working to load %s\n",debugstr_w(dir)); |
| 1436 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 1437 | folder = msi_alloc_zero( sizeof (MSIFOLDER) ); |
Mike McCormack | 979511f | 2005-08-23 18:15:44 +0000 | [diff] [blame] | 1438 | if (!folder) |
| 1439 | return NULL; |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1440 | |
Mike McCormack | 979511f | 2005-08-23 18:15:44 +0000 | [diff] [blame] | 1441 | folder->Directory = strdupW(dir); |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1442 | |
Mike McCormack | 0b352c7 | 2005-06-02 10:29:57 +0000 | [diff] [blame] | 1443 | row = MSI_QueryGetRecord(package->db, Query, dir); |
| 1444 | if (!row) |
Mike McCormack | 979511f | 2005-08-23 18:15:44 +0000 | [diff] [blame] | 1445 | return NULL; |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1446 | |
Mike McCormack | c1513be | 2006-03-21 19:40:36 +0900 | [diff] [blame] | 1447 | p = msi_dup_record_field(row, 3); |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1448 | |
| 1449 | /* split src and target dir */ |
Mike McCormack | c1513be | 2006-03-21 19:40:36 +0900 | [diff] [blame] | 1450 | tgt_short = p; |
| 1451 | src_short = folder_split_path( p, ':' ); |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1452 | |
Francois Gouget | e739ba9 | 2006-05-12 00:06:31 +0200 | [diff] [blame] | 1453 | /* split the long and short paths */ |
Mike McCormack | c1513be | 2006-03-21 19:40:36 +0900 | [diff] [blame] | 1454 | tgt_long = folder_split_path( tgt_short, '|' ); |
| 1455 | src_long = folder_split_path( src_short, '|' ); |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1456 | |
James Hawkins | a1910e1 | 2006-06-20 15:46:41 -0700 | [diff] [blame] | 1457 | /* check for no-op dirs */ |
Mike McCormack | c1513be | 2006-03-21 19:40:36 +0900 | [diff] [blame] | 1458 | if (!lstrcmpW(szDot, tgt_short)) |
James Hawkins | a1910e1 | 2006-06-20 15:46:41 -0700 | [diff] [blame] | 1459 | tgt_short = szEmpty; |
| 1460 | if (!lstrcmpW(szDot, src_short)) |
| 1461 | src_short = szEmpty; |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1462 | |
Mike McCormack | c1513be | 2006-03-21 19:40:36 +0900 | [diff] [blame] | 1463 | if (!tgt_long) |
| 1464 | tgt_long = tgt_short; |
Labrousse Jean | d0862c3 | 2006-05-21 17:27:29 +0200 | [diff] [blame] | 1465 | |
| 1466 | if (!src_short) { |
| 1467 | src_short = tgt_short; |
| 1468 | src_long = tgt_long; |
| 1469 | } |
| 1470 | |
Mike McCormack | c1513be | 2006-03-21 19:40:36 +0900 | [diff] [blame] | 1471 | if (!src_long) |
| 1472 | src_long = src_short; |
Mike McCormack | ba8200b | 2004-12-22 15:25:30 +0000 | [diff] [blame] | 1473 | |
Mike McCormack | c1513be | 2006-03-21 19:40:36 +0900 | [diff] [blame] | 1474 | /* FIXME: use the target short path too */ |
| 1475 | folder->TargetDefault = strdupW(tgt_long); |
Labrousse Jean | d0862c3 | 2006-05-21 17:27:29 +0200 | [diff] [blame] | 1476 | folder->SourceShortPath = strdupW(src_short); |
Mike McCormack | c1513be | 2006-03-21 19:40:36 +0900 | [diff] [blame] | 1477 | folder->SourceLongPath = strdupW(src_long); |
| 1478 | msi_free(p); |
| 1479 | |
| 1480 | TRACE("TargetDefault = %s\n",debugstr_w( folder->TargetDefault )); |
| 1481 | TRACE("SourceLong = %s\n", debugstr_w( folder->SourceLongPath )); |
| 1482 | TRACE("SourceShort = %s\n", debugstr_w( folder->SourceShortPath )); |
| 1483 | |
| 1484 | parent = MSI_RecordGetString(row, 2); |
Mike McCormack | ba8200b | 2004-12-22 15:25:30 +0000 | [diff] [blame] | 1485 | if (parent) |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1486 | { |
Mike McCormack | 979511f | 2005-08-23 18:15:44 +0000 | [diff] [blame] | 1487 | folder->Parent = load_folder( package, parent ); |
| 1488 | if ( folder->Parent ) |
| 1489 | TRACE("loaded parent %p %s\n", folder->Parent, |
| 1490 | debugstr_w(folder->Parent->Directory)); |
| 1491 | else |
| 1492 | ERR("failed to load parent folder %s\n", debugstr_w(parent)); |
Aric Stewart | bdb2955 | 2004-07-04 00:32:48 +0000 | [diff] [blame] | 1493 | } |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1494 | |
Mike McCormack | 062ad50 | 2005-09-15 15:04:08 +0000 | [diff] [blame] | 1495 | folder->Property = msi_dup_property( package, dir ); |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1496 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1497 | msiobj_release(&row->hdr); |
Mike McCormack | 979511f | 2005-08-23 18:15:44 +0000 | [diff] [blame] | 1498 | |
| 1499 | list_add_tail( &package->folders, &folder->entry ); |
| 1500 | |
| 1501 | TRACE("%s returning %p\n",debugstr_w(dir),folder); |
| 1502 | |
| 1503 | return folder; |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1504 | } |
| 1505 | |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1506 | /* scan for and update current install states */ |
Mike McCormack | f9acfe6 | 2005-06-07 20:29:51 +0000 | [diff] [blame] | 1507 | static void ACTION_UpdateInstallStates(MSIPACKAGE *package) |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1508 | { |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1509 | MSICOMPONENT *comp; |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1510 | MSIFEATURE *feature; |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1511 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1512 | LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry ) |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1513 | { |
| 1514 | INSTALLSTATE res; |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1515 | res = MsiGetComponentPathW( package->ProductCode, |
| 1516 | comp->ComponentId, NULL, NULL); |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1517 | if (res < 0) |
| 1518 | res = INSTALLSTATE_ABSENT; |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1519 | comp->Installed = res; |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1520 | } |
| 1521 | |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1522 | LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1523 | { |
Mike McCormack | 3f2d5d7 | 2005-08-19 10:03:11 +0000 | [diff] [blame] | 1524 | ComponentList *cl; |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1525 | INSTALLSTATE res = -10; |
Mike McCormack | 3f2d5d7 | 2005-08-19 10:03:11 +0000 | [diff] [blame] | 1526 | |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1527 | LIST_FOR_EACH_ENTRY( cl, &feature->Components, ComponentList, entry ) |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1528 | { |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1529 | comp= cl->component; |
Mike McCormack | 3f2d5d7 | 2005-08-19 10:03:11 +0000 | [diff] [blame] | 1530 | |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1531 | if (res == -10) |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1532 | res = comp->Installed; |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1533 | else |
| 1534 | { |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1535 | if (res == comp->Installed) |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1536 | continue; |
| 1537 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1538 | if (res != comp->Installed) |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1539 | res = INSTALLSTATE_INCOMPLETE; |
| 1540 | } |
| 1541 | } |
Mike McCormack | 8aa1a91 | 2005-08-25 19:19:10 +0000 | [diff] [blame] | 1542 | feature->Installed = res; |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1543 | } |
| 1544 | } |
| 1545 | |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1546 | static BOOL process_state_property (MSIPACKAGE* package, LPCWSTR property, |
| 1547 | INSTALLSTATE state) |
Aric Stewart | ae1aa32 | 2004-12-27 19:02:59 +0000 | [diff] [blame] | 1548 | { |
Aric Stewart | ae1aa32 | 2004-12-27 19:02:59 +0000 | [diff] [blame] | 1549 | static const WCHAR all[]={'A','L','L',0}; |
Mike McCormack | 72faac0 | 2005-09-08 11:03:35 +0000 | [diff] [blame] | 1550 | LPWSTR override; |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1551 | MSIFEATURE *feature; |
Aric Stewart | ae1aa32 | 2004-12-27 19:02:59 +0000 | [diff] [blame] | 1552 | |
Mike McCormack | 062ad50 | 2005-09-15 15:04:08 +0000 | [diff] [blame] | 1553 | override = msi_dup_property( package, property ); |
Mike McCormack | 72faac0 | 2005-09-08 11:03:35 +0000 | [diff] [blame] | 1554 | if (!override) |
| 1555 | return FALSE; |
| 1556 | |
| 1557 | LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) |
Aric Stewart | ae1aa32 | 2004-12-27 19:02:59 +0000 | [diff] [blame] | 1558 | { |
Mike McCormack | 72faac0 | 2005-09-08 11:03:35 +0000 | [diff] [blame] | 1559 | if (strcmpiW(override,all)==0) |
Aric Stewart | fbdd709 | 2004-12-27 19:06:22 +0000 | [diff] [blame] | 1560 | { |
Mike McCormack | 72faac0 | 2005-09-08 11:03:35 +0000 | [diff] [blame] | 1561 | feature->ActionRequest= state; |
| 1562 | feature->Action = state; |
| 1563 | } |
| 1564 | else |
| 1565 | { |
| 1566 | LPWSTR ptr = override; |
| 1567 | LPWSTR ptr2 = strchrW(override,','); |
Aric Stewart | d900b53 | 2004-12-27 19:12:35 +0000 | [diff] [blame] | 1568 | |
Mike McCormack | 72faac0 | 2005-09-08 11:03:35 +0000 | [diff] [blame] | 1569 | while (ptr) |
| 1570 | { |
| 1571 | if ((ptr2 && strncmpW(ptr,feature->Feature, ptr2-ptr)==0) |
| 1572 | || (!ptr2 && strcmpW(ptr,feature->Feature)==0)) |
Aric Stewart | d900b53 | 2004-12-27 19:12:35 +0000 | [diff] [blame] | 1573 | { |
Mike McCormack | 72faac0 | 2005-09-08 11:03:35 +0000 | [diff] [blame] | 1574 | feature->ActionRequest= state; |
| 1575 | feature->Action = state; |
| 1576 | break; |
Aric Stewart | d900b53 | 2004-12-27 19:12:35 +0000 | [diff] [blame] | 1577 | } |
Mike McCormack | 72faac0 | 2005-09-08 11:03:35 +0000 | [diff] [blame] | 1578 | if (ptr2) |
| 1579 | { |
| 1580 | ptr=ptr2+1; |
| 1581 | ptr2 = strchrW(ptr,','); |
| 1582 | } |
| 1583 | else |
| 1584 | break; |
Aric Stewart | d900b53 | 2004-12-27 19:12:35 +0000 | [diff] [blame] | 1585 | } |
Aric Stewart | fbdd709 | 2004-12-27 19:06:22 +0000 | [diff] [blame] | 1586 | } |
Aric Stewart | fbdd709 | 2004-12-27 19:06:22 +0000 | [diff] [blame] | 1587 | } |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 1588 | msi_free(override); |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1589 | |
Mike McCormack | 72faac0 | 2005-09-08 11:03:35 +0000 | [diff] [blame] | 1590 | return TRUE; |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1591 | } |
| 1592 | |
James Hawkins | 7bcac31 | 2006-07-19 11:17:16 -0700 | [diff] [blame^] | 1593 | UINT MSI_SetFeatureStates(MSIPACKAGE *package) |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1594 | { |
Mike McCormack | 74f0de9 | 2005-09-29 10:32:39 +0000 | [diff] [blame] | 1595 | int install_level; |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 1596 | static const WCHAR szlevel[] = |
| 1597 | {'I','N','S','T','A','L','L','L','E','V','E','L',0}; |
| 1598 | static const WCHAR szAddLocal[] = |
| 1599 | {'A','D','D','L','O','C','A','L',0}; |
| 1600 | static const WCHAR szRemove[] = |
| 1601 | {'R','E','M','O','V','E',0}; |
Aric Stewart | d5655f9 | 2005-11-02 14:21:17 +0000 | [diff] [blame] | 1602 | static const WCHAR szReinstall[] = |
| 1603 | {'R','E','I','N','S','T','A','L','L',0}; |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1604 | BOOL override = FALSE; |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1605 | MSICOMPONENT* component; |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1606 | MSIFEATURE *feature; |
| 1607 | |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1608 | |
| 1609 | /* I do not know if this is where it should happen.. but */ |
| 1610 | |
| 1611 | TRACE("Checking Install Level\n"); |
| 1612 | |
Mike McCormack | 74f0de9 | 2005-09-29 10:32:39 +0000 | [diff] [blame] | 1613 | install_level = msi_get_property_int( package, szlevel, 1 ); |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1614 | |
| 1615 | /* ok hereis the _real_ rub |
Francois Gouget | fbb3343 | 2005-03-02 13:53:50 +0000 | [diff] [blame] | 1616 | * all these activation/deactivation things happen in order and things |
| 1617 | * later on the list override things earlier on the list. |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1618 | * 1) INSTALLLEVEL processing |
| 1619 | * 2) ADDLOCAL |
| 1620 | * 3) REMOVE |
| 1621 | * 4) ADDSOURCE |
| 1622 | * 5) ADDDEFAULT |
| 1623 | * 6) REINSTALL |
| 1624 | * 7) COMPADDLOCAL |
| 1625 | * 8) COMPADDSOURCE |
| 1626 | * 9) FILEADDLOCAL |
| 1627 | * 10) FILEADDSOURCE |
| 1628 | * 11) FILEADDDEFAULT |
Francois Gouget | fbb3343 | 2005-03-02 13:53:50 +0000 | [diff] [blame] | 1629 | * I have confirmed that if ADDLOCAL is stated then the INSTALLLEVEL is |
| 1630 | * ignored for all the features. seems strange, especially since it is not |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1631 | * documented anywhere, but it is how it works. |
| 1632 | * |
Francois Gouget | fbb3343 | 2005-03-02 13:53:50 +0000 | [diff] [blame] | 1633 | * I am still ignoring a lot of these. But that is ok for now, ADDLOCAL and |
| 1634 | * REMOVE are the big ones, since we don't handle administrative installs |
| 1635 | * yet anyway. |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1636 | */ |
| 1637 | override |= process_state_property(package,szAddLocal,INSTALLSTATE_LOCAL); |
| 1638 | override |= process_state_property(package,szRemove,INSTALLSTATE_ABSENT); |
Aric Stewart | d5655f9 | 2005-11-02 14:21:17 +0000 | [diff] [blame] | 1639 | override |= process_state_property(package,szReinstall,INSTALLSTATE_LOCAL); |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1640 | |
| 1641 | if (!override) |
Aric Stewart | fbdd709 | 2004-12-27 19:06:22 +0000 | [diff] [blame] | 1642 | { |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1643 | LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) |
Aric Stewart | fbdd709 | 2004-12-27 19:06:22 +0000 | [diff] [blame] | 1644 | { |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1645 | BOOL feature_state = ((feature->Level > 0) && |
| 1646 | (feature->Level <= install_level)); |
Aric Stewart | ae1aa32 | 2004-12-27 19:02:59 +0000 | [diff] [blame] | 1647 | |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1648 | if ((feature_state) && (feature->Action == INSTALLSTATE_UNKNOWN)) |
Aric Stewart | fbdd709 | 2004-12-27 19:06:22 +0000 | [diff] [blame] | 1649 | { |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1650 | if (feature->Attributes & msidbFeatureAttributesFavorSource) |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 1651 | { |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1652 | feature->ActionRequest = INSTALLSTATE_SOURCE; |
| 1653 | feature->Action = INSTALLSTATE_SOURCE; |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 1654 | } |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1655 | else if (feature->Attributes & msidbFeatureAttributesFavorAdvertise) |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 1656 | { |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1657 | feature->ActionRequest = INSTALLSTATE_ADVERTISED; |
| 1658 | feature->Action = INSTALLSTATE_ADVERTISED; |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 1659 | } |
| 1660 | else |
| 1661 | { |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1662 | feature->ActionRequest = INSTALLSTATE_LOCAL; |
| 1663 | feature->Action = INSTALLSTATE_LOCAL; |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 1664 | } |
Aric Stewart | fbdd709 | 2004-12-27 19:06:22 +0000 | [diff] [blame] | 1665 | } |
Aric Stewart | ae1aa32 | 2004-12-27 19:02:59 +0000 | [diff] [blame] | 1666 | } |
Aric Stewart | fbdd709 | 2004-12-27 19:06:22 +0000 | [diff] [blame] | 1667 | } |
Aric Stewart | 6999a04 | 2005-06-08 19:20:02 +0000 | [diff] [blame] | 1668 | else |
| 1669 | { |
| 1670 | /* set the Preselected Property */ |
| 1671 | static const WCHAR szPreselected[] = {'P','r','e','s','e','l','e','c','t','e','d',0}; |
| 1672 | static const WCHAR szOne[] = { '1', 0 }; |
| 1673 | |
| 1674 | MSI_SetPropertyW(package,szPreselected,szOne); |
| 1675 | } |
Aric Stewart | ae1aa32 | 2004-12-27 19:02:59 +0000 | [diff] [blame] | 1676 | |
Aric Stewart | fbdd709 | 2004-12-27 19:06:22 +0000 | [diff] [blame] | 1677 | /* |
| 1678 | * now we want to enable or disable components base on feature |
| 1679 | */ |
| 1680 | |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1681 | LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) |
Aric Stewart | fbdd709 | 2004-12-27 19:06:22 +0000 | [diff] [blame] | 1682 | { |
Mike McCormack | 3f2d5d7 | 2005-08-19 10:03:11 +0000 | [diff] [blame] | 1683 | ComponentList *cl; |
| 1684 | |
Aric Stewart | fbdd709 | 2004-12-27 19:06:22 +0000 | [diff] [blame] | 1685 | TRACE("Examining Feature %s (Installed %i, Action %i, Request %i)\n", |
| 1686 | debugstr_w(feature->Feature), feature->Installed, feature->Action, |
| 1687 | feature->ActionRequest); |
| 1688 | |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1689 | LIST_FOR_EACH_ENTRY( cl, &feature->Components, ComponentList, entry ) |
Aric Stewart | ae1aa32 | 2004-12-27 19:02:59 +0000 | [diff] [blame] | 1690 | { |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1691 | component = cl->component; |
Aric Stewart | fbdd709 | 2004-12-27 19:06:22 +0000 | [diff] [blame] | 1692 | |
| 1693 | if (!component->Enabled) |
| 1694 | { |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1695 | component->Action = INSTALLSTATE_UNKNOWN; |
| 1696 | component->ActionRequest = INSTALLSTATE_UNKNOWN; |
Aric Stewart | fbdd709 | 2004-12-27 19:06:22 +0000 | [diff] [blame] | 1697 | } |
| 1698 | else |
| 1699 | { |
| 1700 | if (feature->Action == INSTALLSTATE_LOCAL) |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1701 | { |
Aric Stewart | fbdd709 | 2004-12-27 19:06:22 +0000 | [diff] [blame] | 1702 | component->Action = INSTALLSTATE_LOCAL; |
Aric Stewart | fbdd709 | 2004-12-27 19:06:22 +0000 | [diff] [blame] | 1703 | component->ActionRequest = INSTALLSTATE_LOCAL; |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1704 | } |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 1705 | else if (feature->ActionRequest == INSTALLSTATE_SOURCE) |
| 1706 | { |
| 1707 | if ((component->Action == INSTALLSTATE_UNKNOWN) || |
| 1708 | (component->Action == INSTALLSTATE_ABSENT) || |
| 1709 | (component->Action == INSTALLSTATE_ADVERTISED)) |
| 1710 | |
| 1711 | { |
| 1712 | component->Action = INSTALLSTATE_SOURCE; |
| 1713 | component->ActionRequest = INSTALLSTATE_SOURCE; |
| 1714 | } |
| 1715 | } |
| 1716 | else if (feature->ActionRequest == INSTALLSTATE_ADVERTISED) |
| 1717 | { |
| 1718 | if ((component->Action == INSTALLSTATE_UNKNOWN) || |
| 1719 | (component->Action == INSTALLSTATE_ABSENT)) |
| 1720 | |
| 1721 | { |
| 1722 | component->Action = INSTALLSTATE_ADVERTISED; |
| 1723 | component->ActionRequest = INSTALLSTATE_ADVERTISED; |
| 1724 | } |
| 1725 | } |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1726 | else if (feature->ActionRequest == INSTALLSTATE_ABSENT) |
| 1727 | { |
| 1728 | if (component->Action == INSTALLSTATE_UNKNOWN) |
| 1729 | { |
| 1730 | component->Action = INSTALLSTATE_ABSENT; |
| 1731 | component->ActionRequest = INSTALLSTATE_ABSENT; |
| 1732 | } |
| 1733 | } |
Aric Stewart | fbdd709 | 2004-12-27 19:06:22 +0000 | [diff] [blame] | 1734 | } |
Aric Stewart | ae1aa32 | 2004-12-27 19:02:59 +0000 | [diff] [blame] | 1735 | } |
| 1736 | } |
Aric Stewart | fbdd709 | 2004-12-27 19:06:22 +0000 | [diff] [blame] | 1737 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1738 | LIST_FOR_EACH_ENTRY( component, &package->components, MSICOMPONENT, entry ) |
Aric Stewart | fbdd709 | 2004-12-27 19:06:22 +0000 | [diff] [blame] | 1739 | { |
Aric Stewart | fbdd709 | 2004-12-27 19:06:22 +0000 | [diff] [blame] | 1740 | TRACE("Result: Component %s (Installed %i, Action %i, Request %i)\n", |
| 1741 | debugstr_w(component->Component), component->Installed, |
| 1742 | component->Action, component->ActionRequest); |
| 1743 | } |
| 1744 | |
| 1745 | |
Aric Stewart | ae1aa32 | 2004-12-27 19:02:59 +0000 | [diff] [blame] | 1746 | return ERROR_SUCCESS; |
| 1747 | } |
| 1748 | |
Aric Stewart | 443ad4d | 2005-06-21 20:50:12 +0000 | [diff] [blame] | 1749 | static UINT ITERATE_CostFinalizeDirectories(MSIRECORD *row, LPVOID param) |
| 1750 | { |
| 1751 | MSIPACKAGE *package = (MSIPACKAGE*)param; |
| 1752 | LPCWSTR name; |
| 1753 | LPWSTR path; |
| 1754 | |
| 1755 | name = MSI_RecordGetString(row,1); |
| 1756 | |
| 1757 | /* This helper function now does ALL the work */ |
| 1758 | TRACE("Dir %s ...\n",debugstr_w(name)); |
| 1759 | load_folder(package,name); |
| 1760 | path = resolve_folder(package,name,FALSE,TRUE,NULL); |
| 1761 | TRACE("resolves to %s\n",debugstr_w(path)); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 1762 | msi_free(path); |
Aric Stewart | 443ad4d | 2005-06-21 20:50:12 +0000 | [diff] [blame] | 1763 | |
| 1764 | return ERROR_SUCCESS; |
| 1765 | } |
| 1766 | |
| 1767 | static UINT ITERATE_CostFinalizeConditions(MSIRECORD *row, LPVOID param) |
| 1768 | { |
| 1769 | MSIPACKAGE *package = (MSIPACKAGE*)param; |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1770 | LPCWSTR name; |
| 1771 | MSIFEATURE *feature; |
Aric Stewart | 443ad4d | 2005-06-21 20:50:12 +0000 | [diff] [blame] | 1772 | |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1773 | name = MSI_RecordGetString( row, 1 ); |
Aric Stewart | 443ad4d | 2005-06-21 20:50:12 +0000 | [diff] [blame] | 1774 | |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1775 | feature = get_loaded_feature( package, name ); |
| 1776 | if (!feature) |
| 1777 | ERR("FAILED to find loaded feature %s\n",debugstr_w(name)); |
Aric Stewart | 443ad4d | 2005-06-21 20:50:12 +0000 | [diff] [blame] | 1778 | else |
| 1779 | { |
| 1780 | LPCWSTR Condition; |
| 1781 | Condition = MSI_RecordGetString(row,3); |
| 1782 | |
Aric Stewart | 0713f09 | 2005-06-24 11:51:29 +0000 | [diff] [blame] | 1783 | if (MSI_EvaluateConditionW(package,Condition) == MSICONDITION_TRUE) |
Aric Stewart | 443ad4d | 2005-06-21 20:50:12 +0000 | [diff] [blame] | 1784 | { |
| 1785 | int level = MSI_RecordGetInteger(row,2); |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 1786 | TRACE("Reseting feature %s to level %i\n", debugstr_w(name), level); |
| 1787 | feature->Level = level; |
Aric Stewart | 443ad4d | 2005-06-21 20:50:12 +0000 | [diff] [blame] | 1788 | } |
| 1789 | } |
| 1790 | return ERROR_SUCCESS; |
| 1791 | } |
| 1792 | |
| 1793 | |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1794 | /* |
Francois Gouget | da8b3dd | 2005-01-26 21:09:04 +0000 | [diff] [blame] | 1795 | * A lot is done in this function aside from just the costing. |
Mike McCormack | 6e2bca3 | 2004-07-04 00:25:00 +0000 | [diff] [blame] | 1796 | * The costing needs to be implemented at some point but for now I am going |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1797 | * to focus on the directory building |
| 1798 | * |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1799 | */ |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1800 | static UINT ACTION_CostFinalize(MSIPACKAGE *package) |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1801 | { |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 1802 | static const WCHAR ExecSeqQuery[] = |
| 1803 | {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 1804 | '`','D','i','r','e','c','t','o','r','y','`',0}; |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 1805 | static const WCHAR ConditionQuery[] = |
| 1806 | {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 1807 | '`','C','o','n','d','i','t','i','o','n','`',0}; |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 1808 | static const WCHAR szCosting[] = |
| 1809 | {'C','o','s','t','i','n','g','C','o','m','p','l','e','t','e',0 }; |
| 1810 | static const WCHAR szlevel[] = |
| 1811 | {'I','N','S','T','A','L','L','L','E','V','E','L',0}; |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1812 | static const WCHAR szOne[] = { '1', 0 }; |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1813 | MSICOMPONENT *comp; |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 1814 | MSIFILE *file; |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1815 | UINT rc; |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1816 | MSIQUERY * view; |
Aric Stewart | 8cc14a9 | 2004-12-27 18:56:30 +0000 | [diff] [blame] | 1817 | LPWSTR level; |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 1818 | |
Mike McCormack | 9293f86 | 2005-10-30 19:16:45 +0000 | [diff] [blame] | 1819 | if ( 1 == msi_get_property_int( package, szCosting, 0 ) ) |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 1820 | return ERROR_SUCCESS; |
Mike McCormack | 9293f86 | 2005-10-30 19:16:45 +0000 | [diff] [blame] | 1821 | |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1822 | TRACE("Building Directory properties\n"); |
| 1823 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1824 | rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view); |
Aric Stewart | 84837d9 | 2004-07-20 01:22:37 +0000 | [diff] [blame] | 1825 | if (rc == ERROR_SUCCESS) |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1826 | { |
Aric Stewart | 443ad4d | 2005-06-21 20:50:12 +0000 | [diff] [blame] | 1827 | rc = MSI_IterateRecords(view, NULL, ITERATE_CostFinalizeDirectories, |
| 1828 | package); |
Aric Stewart | 84837d9 | 2004-07-20 01:22:37 +0000 | [diff] [blame] | 1829 | msiobj_release(&view->hdr); |
| 1830 | } |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1831 | |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 1832 | TRACE("File calculations\n"); |
Aric Stewart | ec688fb | 2004-07-04 00:35:52 +0000 | [diff] [blame] | 1833 | |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 1834 | LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry ) |
Aric Stewart | ec688fb | 2004-07-04 00:35:52 +0000 | [diff] [blame] | 1835 | { |
Mike McCormack | f11c8b0 | 2005-09-09 14:48:51 +0000 | [diff] [blame] | 1836 | MSICOMPONENT* comp = file->Component; |
| 1837 | LPWSTR p; |
Aric Stewart | ec688fb | 2004-07-04 00:35:52 +0000 | [diff] [blame] | 1838 | |
Mike McCormack | f11c8b0 | 2005-09-09 14:48:51 +0000 | [diff] [blame] | 1839 | if (!comp) |
| 1840 | continue; |
Aric Stewart | ec688fb | 2004-07-04 00:35:52 +0000 | [diff] [blame] | 1841 | |
Mike McCormack | f11c8b0 | 2005-09-09 14:48:51 +0000 | [diff] [blame] | 1842 | /* calculate target */ |
| 1843 | p = resolve_folder(package, comp->Directory, FALSE, FALSE, NULL); |
| 1844 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 1845 | msi_free(file->TargetPath); |
Mike McCormack | f11c8b0 | 2005-09-09 14:48:51 +0000 | [diff] [blame] | 1846 | |
| 1847 | TRACE("file %s is named %s\n", |
| 1848 | debugstr_w(file->File),debugstr_w(file->FileName)); |
| 1849 | |
| 1850 | file->TargetPath = build_directory_name(2, p, file->FileName); |
| 1851 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 1852 | msi_free(p); |
Mike McCormack | f11c8b0 | 2005-09-09 14:48:51 +0000 | [diff] [blame] | 1853 | |
| 1854 | TRACE("file %s resolves to %s\n", |
| 1855 | debugstr_w(file->File),debugstr_w(file->TargetPath)); |
| 1856 | |
| 1857 | if (GetFileAttributesW(file->TargetPath) == INVALID_FILE_ATTRIBUTES) |
Aric Stewart | ec688fb | 2004-07-04 00:35:52 +0000 | [diff] [blame] | 1858 | { |
Mike McCormack | dded8fb | 2005-11-02 10:56:42 +0000 | [diff] [blame] | 1859 | file->state = msifs_missing; |
Mike McCormack | f11c8b0 | 2005-09-09 14:48:51 +0000 | [diff] [blame] | 1860 | comp->Cost += file->FileSize; |
| 1861 | continue; |
| 1862 | } |
Mike McCormack | ba8200b | 2004-12-22 15:25:30 +0000 | [diff] [blame] | 1863 | |
Mike McCormack | f11c8b0 | 2005-09-09 14:48:51 +0000 | [diff] [blame] | 1864 | if (file->Version) |
| 1865 | { |
| 1866 | DWORD handle; |
| 1867 | DWORD versize; |
| 1868 | UINT sz; |
| 1869 | LPVOID version; |
Ivan Leo Puoti | 5b22e4d | 2005-11-03 11:35:11 +0000 | [diff] [blame] | 1870 | static WCHAR name[] = {'\\',0}; |
Mike McCormack | f11c8b0 | 2005-09-09 14:48:51 +0000 | [diff] [blame] | 1871 | static const WCHAR name_fmt[] = |
| 1872 | {'%','u','.','%','u','.','%','u','.','%','u',0}; |
| 1873 | WCHAR filever[0x100]; |
| 1874 | VS_FIXEDFILEINFO *lpVer; |
Aric Stewart | fa384f6 | 2004-12-22 18:46:17 +0000 | [diff] [blame] | 1875 | |
Francois Gouget | 0edbaf7 | 2005-11-10 12:14:56 +0000 | [diff] [blame] | 1876 | TRACE("Version comparison..\n"); |
Mike McCormack | f11c8b0 | 2005-09-09 14:48:51 +0000 | [diff] [blame] | 1877 | versize = GetFileVersionInfoSizeW(file->TargetPath,&handle); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 1878 | version = msi_alloc(versize); |
Mike McCormack | f11c8b0 | 2005-09-09 14:48:51 +0000 | [diff] [blame] | 1879 | GetFileVersionInfoW(file->TargetPath, 0, versize, version); |
Aric Stewart | fa384f6 | 2004-12-22 18:46:17 +0000 | [diff] [blame] | 1880 | |
Mike McCormack | f11c8b0 | 2005-09-09 14:48:51 +0000 | [diff] [blame] | 1881 | VerQueryValueW(version, name, (LPVOID*)&lpVer, &sz); |
Aric Stewart | fa384f6 | 2004-12-22 18:46:17 +0000 | [diff] [blame] | 1882 | |
Mike McCormack | f11c8b0 | 2005-09-09 14:48:51 +0000 | [diff] [blame] | 1883 | sprintfW(filever,name_fmt, |
| 1884 | HIWORD(lpVer->dwFileVersionMS), |
| 1885 | LOWORD(lpVer->dwFileVersionMS), |
| 1886 | HIWORD(lpVer->dwFileVersionLS), |
| 1887 | LOWORD(lpVer->dwFileVersionLS)); |
Aric Stewart | ec688fb | 2004-07-04 00:35:52 +0000 | [diff] [blame] | 1888 | |
Mike McCormack | f11c8b0 | 2005-09-09 14:48:51 +0000 | [diff] [blame] | 1889 | TRACE("new %s old %s\n", debugstr_w(file->Version), |
| 1890 | debugstr_w(filever)); |
| 1891 | if (strcmpiW(filever,file->Version)<0) |
Aric Stewart | ec688fb | 2004-07-04 00:35:52 +0000 | [diff] [blame] | 1892 | { |
Mike McCormack | dded8fb | 2005-11-02 10:56:42 +0000 | [diff] [blame] | 1893 | file->state = msifs_overwrite; |
| 1894 | /* FIXME: cost should be diff in size */ |
Aric Stewart | ec688fb | 2004-07-04 00:35:52 +0000 | [diff] [blame] | 1895 | comp->Cost += file->FileSize; |
| 1896 | } |
| 1897 | else |
Mike McCormack | dded8fb | 2005-11-02 10:56:42 +0000 | [diff] [blame] | 1898 | file->state = msifs_present; |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 1899 | msi_free(version); |
Mike McCormack | f11c8b0 | 2005-09-09 14:48:51 +0000 | [diff] [blame] | 1900 | } |
| 1901 | else |
Mike McCormack | dded8fb | 2005-11-02 10:56:42 +0000 | [diff] [blame] | 1902 | file->state = msifs_present; |
Aric Stewart | ec688fb | 2004-07-04 00:35:52 +0000 | [diff] [blame] | 1903 | } |
| 1904 | |
Aric Stewart | 7d3e597 | 2004-07-04 00:36:58 +0000 | [diff] [blame] | 1905 | TRACE("Evaluating Condition Table\n"); |
Aric Stewart | 2e9b5f7 | 2004-07-04 00:31:17 +0000 | [diff] [blame] | 1906 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1907 | rc = MSI_DatabaseOpenViewW(package->db, ConditionQuery, &view); |
Aric Stewart | 84837d9 | 2004-07-20 01:22:37 +0000 | [diff] [blame] | 1908 | if (rc == ERROR_SUCCESS) |
| 1909 | { |
Aric Stewart | 443ad4d | 2005-06-21 20:50:12 +0000 | [diff] [blame] | 1910 | rc = MSI_IterateRecords(view, NULL, ITERATE_CostFinalizeConditions, |
| 1911 | package); |
Mike McCormack | ac6a413 | 2005-01-04 20:36:12 +0000 | [diff] [blame] | 1912 | msiobj_release(&view->hdr); |
Aric Stewart | 84837d9 | 2004-07-20 01:22:37 +0000 | [diff] [blame] | 1913 | } |
Aric Stewart | 7d3e597 | 2004-07-04 00:36:58 +0000 | [diff] [blame] | 1914 | |
| 1915 | TRACE("Enabling or Disabling Components\n"); |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1916 | LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry ) |
Aric Stewart | 7d3e597 | 2004-07-04 00:36:58 +0000 | [diff] [blame] | 1917 | { |
Mike McCormack | 298cdae | 2005-09-06 11:39:01 +0000 | [diff] [blame] | 1918 | if (comp->Condition) |
Aric Stewart | 7d3e597 | 2004-07-04 00:36:58 +0000 | [diff] [blame] | 1919 | { |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1920 | if (MSI_EvaluateConditionW(package, |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1921 | comp->Condition) == MSICONDITION_FALSE) |
Aric Stewart | 7d3e597 | 2004-07-04 00:36:58 +0000 | [diff] [blame] | 1922 | { |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 1923 | TRACE("Disabling component %s\n", debugstr_w(comp->Component)); |
| 1924 | comp->Enabled = FALSE; |
Aric Stewart | 7d3e597 | 2004-07-04 00:36:58 +0000 | [diff] [blame] | 1925 | } |
| 1926 | } |
| 1927 | } |
| 1928 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1929 | MSI_SetPropertyW(package,szCosting,szOne); |
Aric Stewart | 8cc14a9 | 2004-12-27 18:56:30 +0000 | [diff] [blame] | 1930 | /* set default run level if not set */ |
Mike McCormack | 062ad50 | 2005-09-15 15:04:08 +0000 | [diff] [blame] | 1931 | level = msi_dup_property( package, szlevel ); |
Aric Stewart | 8cc14a9 | 2004-12-27 18:56:30 +0000 | [diff] [blame] | 1932 | if (!level) |
| 1933 | MSI_SetPropertyW(package,szlevel, szOne); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 1934 | msi_free(level); |
Aric Stewart | ae1aa32 | 2004-12-27 19:02:59 +0000 | [diff] [blame] | 1935 | |
Aric Stewart | 78a04e3 | 2005-02-22 15:47:00 +0000 | [diff] [blame] | 1936 | ACTION_UpdateInstallStates(package); |
Aric Stewart | ae1aa32 | 2004-12-27 19:02:59 +0000 | [diff] [blame] | 1937 | |
James Hawkins | 7c7f0bb | 2006-07-19 11:15:37 -0700 | [diff] [blame] | 1938 | return MSI_SetFeatureStates(package); |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1939 | } |
| 1940 | |
Francois Gouget | da8b3dd | 2005-01-26 21:09:04 +0000 | [diff] [blame] | 1941 | /* OK this value is "interpreted" and then formatted based on the |
Aric Stewart | 6e160f1 | 2004-06-29 04:07:22 +0000 | [diff] [blame] | 1942 | first few characters */ |
Aric Stewart | 09b0aba | 2005-06-09 20:30:59 +0000 | [diff] [blame] | 1943 | static LPSTR parse_value(MSIPACKAGE *package, LPCWSTR value, DWORD *type, |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1944 | DWORD *size) |
| 1945 | { |
| 1946 | LPSTR data = NULL; |
Aric Stewart | 6e160f1 | 2004-06-29 04:07:22 +0000 | [diff] [blame] | 1947 | if (value[0]=='#' && value[1]!='#' && value[1]!='%') |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 1948 | { |
Aric Stewart | 6e160f1 | 2004-06-29 04:07:22 +0000 | [diff] [blame] | 1949 | if (value[1]=='x') |
| 1950 | { |
| 1951 | LPWSTR ptr; |
| 1952 | CHAR byte[5]; |
Aric Stewart | 6186b2b | 2005-05-16 21:37:35 +0000 | [diff] [blame] | 1953 | LPWSTR deformated = NULL; |
Aric Stewart | 6e160f1 | 2004-06-29 04:07:22 +0000 | [diff] [blame] | 1954 | int count; |
| 1955 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 1956 | deformat_string(package, &value[2], &deformated); |
Aric Stewart | 6e160f1 | 2004-06-29 04:07:22 +0000 | [diff] [blame] | 1957 | |
| 1958 | /* binary value type */ |
Aric Stewart | 6186b2b | 2005-05-16 21:37:35 +0000 | [diff] [blame] | 1959 | ptr = deformated; |
| 1960 | *type = REG_BINARY; |
| 1961 | if (strlenW(ptr)%2) |
| 1962 | *size = (strlenW(ptr)/2)+1; |
| 1963 | else |
| 1964 | *size = strlenW(ptr)/2; |
| 1965 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 1966 | data = msi_alloc(*size); |
Aric Stewart | 6186b2b | 2005-05-16 21:37:35 +0000 | [diff] [blame] | 1967 | |
Aric Stewart | 6e160f1 | 2004-06-29 04:07:22 +0000 | [diff] [blame] | 1968 | byte[0] = '0'; |
| 1969 | byte[1] = 'x'; |
| 1970 | byte[4] = 0; |
| 1971 | count = 0; |
Aric Stewart | 6186b2b | 2005-05-16 21:37:35 +0000 | [diff] [blame] | 1972 | /* if uneven pad with a zero in front */ |
| 1973 | if (strlenW(ptr)%2) |
| 1974 | { |
| 1975 | byte[2]= '0'; |
| 1976 | byte[3]= *ptr; |
| 1977 | ptr++; |
| 1978 | data[count] = (BYTE)strtol(byte,NULL,0); |
| 1979 | count ++; |
| 1980 | TRACE("Uneven byte count\n"); |
| 1981 | } |
Aric Stewart | 6e160f1 | 2004-06-29 04:07:22 +0000 | [diff] [blame] | 1982 | while (*ptr) |
| 1983 | { |
| 1984 | byte[2]= *ptr; |
| 1985 | ptr++; |
| 1986 | byte[3]= *ptr; |
| 1987 | ptr++; |
| 1988 | data[count] = (BYTE)strtol(byte,NULL,0); |
| 1989 | count ++; |
| 1990 | } |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 1991 | msi_free(deformated); |
Aric Stewart | 6e160f1 | 2004-06-29 04:07:22 +0000 | [diff] [blame] | 1992 | |
| 1993 | TRACE("Data %li bytes(%i)\n",*size,count); |
| 1994 | } |
| 1995 | else |
| 1996 | { |
| 1997 | LPWSTR deformated; |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 1998 | LPWSTR p; |
| 1999 | DWORD d = 0; |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 2000 | deformat_string(package, &value[1], &deformated); |
Aric Stewart | 6e160f1 | 2004-06-29 04:07:22 +0000 | [diff] [blame] | 2001 | |
| 2002 | *type=REG_DWORD; |
| 2003 | *size = sizeof(DWORD); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2004 | data = msi_alloc(*size); |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2005 | p = deformated; |
| 2006 | if (*p == '-') |
| 2007 | p++; |
| 2008 | while (*p) |
| 2009 | { |
| 2010 | if ( (*p < '0') || (*p > '9') ) |
| 2011 | break; |
| 2012 | d *= 10; |
| 2013 | d += (*p - '0'); |
| 2014 | p++; |
| 2015 | } |
| 2016 | if (deformated[0] == '-') |
| 2017 | d = -d; |
| 2018 | *(LPDWORD)data = d; |
| 2019 | TRACE("DWORD %li\n",*(LPDWORD)data); |
Aric Stewart | 6e160f1 | 2004-06-29 04:07:22 +0000 | [diff] [blame] | 2020 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2021 | msi_free(deformated); |
Aric Stewart | 6e160f1 | 2004-06-29 04:07:22 +0000 | [diff] [blame] | 2022 | } |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 2023 | } |
| 2024 | else |
| 2025 | { |
Aric Stewart | 54c67dd | 2005-01-25 20:17:09 +0000 | [diff] [blame] | 2026 | static const WCHAR szMulti[] = {'[','~',']',0}; |
Aric Stewart | 09b0aba | 2005-06-09 20:30:59 +0000 | [diff] [blame] | 2027 | LPCWSTR ptr; |
Aric Stewart | 6e160f1 | 2004-06-29 04:07:22 +0000 | [diff] [blame] | 2028 | *type=REG_SZ; |
| 2029 | |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 2030 | if (value[0]=='#') |
Aric Stewart | 6e160f1 | 2004-06-29 04:07:22 +0000 | [diff] [blame] | 2031 | { |
| 2032 | if (value[1]=='%') |
| 2033 | { |
| 2034 | ptr = &value[2]; |
| 2035 | *type=REG_EXPAND_SZ; |
| 2036 | } |
| 2037 | else |
| 2038 | ptr = &value[1]; |
| 2039 | } |
| 2040 | else |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 2041 | ptr=value; |
| 2042 | |
Aric Stewart | 54c67dd | 2005-01-25 20:17:09 +0000 | [diff] [blame] | 2043 | if (strstrW(value,szMulti)) |
| 2044 | *type = REG_MULTI_SZ; |
| 2045 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 2046 | *size = deformat_string(package, ptr,(LPWSTR*)&data); |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 2047 | } |
| 2048 | return data; |
| 2049 | } |
| 2050 | |
Aric Stewart | 92ef78e | 2005-06-21 20:21:18 +0000 | [diff] [blame] | 2051 | static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param) |
| 2052 | { |
| 2053 | MSIPACKAGE *package = (MSIPACKAGE*)param; |
| 2054 | static const WCHAR szHCR[] = |
| 2055 | {'H','K','E','Y','_','C','L','A','S','S','E','S','_', |
| 2056 | 'R','O','O','T','\\',0}; |
| 2057 | static const WCHAR szHCU[] = |
| 2058 | {'H','K','E','Y','_','C','U','R','R','E','N','T','_', |
| 2059 | 'U','S','E','R','\\',0}; |
| 2060 | static const WCHAR szHLM[] = |
| 2061 | {'H','K','E','Y','_','L','O','C','A','L','_', |
| 2062 | 'M','A','C','H','I','N','E','\\',0}; |
| 2063 | static const WCHAR szHU[] = |
| 2064 | {'H','K','E','Y','_','U','S','E','R','S','\\',0}; |
| 2065 | |
| 2066 | LPSTR value_data = NULL; |
| 2067 | HKEY root_key, hkey; |
| 2068 | DWORD type,size; |
| 2069 | LPWSTR deformated; |
| 2070 | LPCWSTR szRoot, component, name, key, value; |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2071 | MSICOMPONENT *comp; |
Aric Stewart | 92ef78e | 2005-06-21 20:21:18 +0000 | [diff] [blame] | 2072 | MSIRECORD * uirow; |
| 2073 | LPWSTR uikey; |
| 2074 | INT root; |
| 2075 | BOOL check_first = FALSE; |
| 2076 | UINT rc; |
| 2077 | |
| 2078 | ui_progress(package,2,0,0,0); |
| 2079 | |
| 2080 | value = NULL; |
| 2081 | key = NULL; |
| 2082 | uikey = NULL; |
| 2083 | name = NULL; |
| 2084 | |
| 2085 | component = MSI_RecordGetString(row, 6); |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2086 | comp = get_loaded_component(package,component); |
Johan Dahlin | 0946c42 | 2005-08-24 10:57:27 +0000 | [diff] [blame] | 2087 | if (!comp) |
| 2088 | return ERROR_SUCCESS; |
Aric Stewart | 92ef78e | 2005-06-21 20:21:18 +0000 | [diff] [blame] | 2089 | |
Mike McCormack | d693f46 | 2005-10-29 11:36:48 +0000 | [diff] [blame] | 2090 | if (!ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL)) |
Aric Stewart | 92ef78e | 2005-06-21 20:21:18 +0000 | [diff] [blame] | 2091 | { |
| 2092 | TRACE("Skipping write due to disabled component %s\n", |
| 2093 | debugstr_w(component)); |
| 2094 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2095 | comp->Action = comp->Installed; |
Aric Stewart | 92ef78e | 2005-06-21 20:21:18 +0000 | [diff] [blame] | 2096 | |
| 2097 | return ERROR_SUCCESS; |
| 2098 | } |
| 2099 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2100 | comp->Action = INSTALLSTATE_LOCAL; |
Aric Stewart | 92ef78e | 2005-06-21 20:21:18 +0000 | [diff] [blame] | 2101 | |
| 2102 | name = MSI_RecordGetString(row, 4); |
| 2103 | if( MSI_RecordIsNull(row,5) && name ) |
| 2104 | { |
| 2105 | /* null values can have special meanings */ |
| 2106 | if (name[0]=='-' && name[1] == 0) |
| 2107 | return ERROR_SUCCESS; |
| 2108 | else if ((name[0]=='+' && name[1] == 0) || |
| 2109 | (name[0] == '*' && name[1] == 0)) |
| 2110 | name = NULL; |
| 2111 | check_first = TRUE; |
| 2112 | } |
| 2113 | |
| 2114 | root = MSI_RecordGetInteger(row,2); |
| 2115 | key = MSI_RecordGetString(row, 3); |
| 2116 | |
| 2117 | /* get the root key */ |
| 2118 | switch (root) |
| 2119 | { |
Aric Stewart | 0713f09 | 2005-06-24 11:51:29 +0000 | [diff] [blame] | 2120 | case -1: |
| 2121 | { |
| 2122 | static const WCHAR szALLUSER[] = {'A','L','L','U','S','E','R','S',0}; |
Mike McCormack | 062ad50 | 2005-09-15 15:04:08 +0000 | [diff] [blame] | 2123 | LPWSTR all_users = msi_dup_property( package, szALLUSER ); |
Aric Stewart | 0713f09 | 2005-06-24 11:51:29 +0000 | [diff] [blame] | 2124 | if (all_users && all_users[0] == '1') |
| 2125 | { |
| 2126 | root_key = HKEY_LOCAL_MACHINE; |
| 2127 | szRoot = szHLM; |
| 2128 | } |
| 2129 | else |
| 2130 | { |
| 2131 | root_key = HKEY_CURRENT_USER; |
| 2132 | szRoot = szHCU; |
| 2133 | } |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2134 | msi_free(all_users); |
Aric Stewart | 0713f09 | 2005-06-24 11:51:29 +0000 | [diff] [blame] | 2135 | } |
| 2136 | break; |
Aric Stewart | 92ef78e | 2005-06-21 20:21:18 +0000 | [diff] [blame] | 2137 | case 0: root_key = HKEY_CLASSES_ROOT; |
| 2138 | szRoot = szHCR; |
| 2139 | break; |
| 2140 | case 1: root_key = HKEY_CURRENT_USER; |
| 2141 | szRoot = szHCU; |
| 2142 | break; |
| 2143 | case 2: root_key = HKEY_LOCAL_MACHINE; |
| 2144 | szRoot = szHLM; |
| 2145 | break; |
| 2146 | case 3: root_key = HKEY_USERS; |
| 2147 | szRoot = szHU; |
| 2148 | break; |
| 2149 | default: |
| 2150 | ERR("Unknown root %i\n",root); |
| 2151 | root_key=NULL; |
| 2152 | szRoot = NULL; |
| 2153 | break; |
| 2154 | } |
| 2155 | if (!root_key) |
| 2156 | return ERROR_SUCCESS; |
| 2157 | |
| 2158 | deformat_string(package, key , &deformated); |
| 2159 | size = strlenW(deformated) + strlenW(szRoot) + 1; |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2160 | uikey = msi_alloc(size*sizeof(WCHAR)); |
Aric Stewart | 92ef78e | 2005-06-21 20:21:18 +0000 | [diff] [blame] | 2161 | strcpyW(uikey,szRoot); |
| 2162 | strcatW(uikey,deformated); |
| 2163 | |
| 2164 | if (RegCreateKeyW( root_key, deformated, &hkey)) |
| 2165 | { |
| 2166 | ERR("Could not create key %s\n",debugstr_w(deformated)); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2167 | msi_free(deformated); |
| 2168 | msi_free(uikey); |
Aric Stewart | 92ef78e | 2005-06-21 20:21:18 +0000 | [diff] [blame] | 2169 | return ERROR_SUCCESS; |
| 2170 | } |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2171 | msi_free(deformated); |
Aric Stewart | 92ef78e | 2005-06-21 20:21:18 +0000 | [diff] [blame] | 2172 | |
| 2173 | value = MSI_RecordGetString(row,5); |
| 2174 | if (value) |
| 2175 | value_data = parse_value(package, value, &type, &size); |
| 2176 | else |
| 2177 | { |
| 2178 | static const WCHAR szEmpty[] = {0}; |
| 2179 | value_data = (LPSTR)strdupW(szEmpty); |
| 2180 | size = 0; |
| 2181 | type = REG_SZ; |
| 2182 | } |
| 2183 | |
| 2184 | deformat_string(package, name, &deformated); |
| 2185 | |
| 2186 | /* get the double nulls to terminate SZ_MULTI */ |
| 2187 | if (type == REG_MULTI_SZ) |
| 2188 | size +=sizeof(WCHAR); |
| 2189 | |
| 2190 | if (!check_first) |
| 2191 | { |
| 2192 | TRACE("Setting value %s of %s\n",debugstr_w(deformated), |
| 2193 | debugstr_w(uikey)); |
Mike McCormack | 16466af | 2005-07-06 10:33:30 +0000 | [diff] [blame] | 2194 | RegSetValueExW(hkey, deformated, 0, type, (LPBYTE)value_data, size); |
Aric Stewart | 92ef78e | 2005-06-21 20:21:18 +0000 | [diff] [blame] | 2195 | } |
| 2196 | else |
| 2197 | { |
| 2198 | DWORD sz = 0; |
| 2199 | rc = RegQueryValueExW(hkey, deformated, NULL, NULL, NULL, &sz); |
| 2200 | if (rc == ERROR_SUCCESS || rc == ERROR_MORE_DATA) |
| 2201 | { |
| 2202 | TRACE("value %s of %s checked already exists\n", |
| 2203 | debugstr_w(deformated), debugstr_w(uikey)); |
| 2204 | } |
| 2205 | else |
| 2206 | { |
| 2207 | TRACE("Checked and setting value %s of %s\n", |
| 2208 | debugstr_w(deformated), debugstr_w(uikey)); |
| 2209 | if (deformated || size) |
Mike McCormack | 16466af | 2005-07-06 10:33:30 +0000 | [diff] [blame] | 2210 | RegSetValueExW(hkey, deformated, 0, type, (LPBYTE) value_data, size); |
Aric Stewart | 92ef78e | 2005-06-21 20:21:18 +0000 | [diff] [blame] | 2211 | } |
| 2212 | } |
| 2213 | RegCloseKey(hkey); |
| 2214 | |
| 2215 | uirow = MSI_CreateRecord(3); |
| 2216 | MSI_RecordSetStringW(uirow,2,deformated); |
| 2217 | MSI_RecordSetStringW(uirow,1,uikey); |
| 2218 | |
| 2219 | if (type == REG_SZ) |
| 2220 | MSI_RecordSetStringW(uirow,3,(LPWSTR)value_data); |
| 2221 | else |
| 2222 | MSI_RecordSetStringW(uirow,3,value); |
| 2223 | |
| 2224 | ui_actiondata(package,szWriteRegistryValues,uirow); |
| 2225 | msiobj_release( &uirow->hdr ); |
| 2226 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2227 | msi_free(value_data); |
| 2228 | msi_free(deformated); |
| 2229 | msi_free(uikey); |
Aric Stewart | 92ef78e | 2005-06-21 20:21:18 +0000 | [diff] [blame] | 2230 | |
| 2231 | return ERROR_SUCCESS; |
| 2232 | } |
| 2233 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 2234 | static UINT ACTION_WriteRegistryValues(MSIPACKAGE *package) |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 2235 | { |
| 2236 | UINT rc; |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 2237 | MSIQUERY * view; |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 2238 | static const WCHAR ExecSeqQuery[] = |
| 2239 | {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 2240 | '`','R','e','g','i','s','t','r','y','`',0 }; |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 2241 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 2242 | rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view); |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 2243 | if (rc != ERROR_SUCCESS) |
Aric Stewart | 84837d9 | 2004-07-20 01:22:37 +0000 | [diff] [blame] | 2244 | return ERROR_SUCCESS; |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 2245 | |
Aric Stewart | d2c395a | 2004-07-06 18:48:15 +0000 | [diff] [blame] | 2246 | /* increment progress bar each time action data is sent */ |
Aric Stewart | bd1bbc1 | 2005-01-03 20:00:13 +0000 | [diff] [blame] | 2247 | ui_progress(package,1,REG_PROGRESS_VALUE,1,0); |
Aric Stewart | d2c395a | 2004-07-06 18:48:15 +0000 | [diff] [blame] | 2248 | |
Aric Stewart | 92ef78e | 2005-06-21 20:21:18 +0000 | [diff] [blame] | 2249 | rc = MSI_IterateRecords(view, NULL, ITERATE_WriteRegistryValues, package); |
Aric Stewart | d2c395a | 2004-07-06 18:48:15 +0000 | [diff] [blame] | 2250 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 2251 | msiobj_release(&view->hdr); |
Aric Stewart | 401bd3f | 2004-06-28 20:34:35 +0000 | [diff] [blame] | 2252 | return rc; |
| 2253 | } |
| 2254 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 2255 | static UINT ACTION_InstallInitialize(MSIPACKAGE *package) |
Aric Stewart | 7d3e597 | 2004-07-04 00:36:58 +0000 | [diff] [blame] | 2256 | { |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 2257 | package->script->CurrentlyScripting = TRUE; |
| 2258 | |
Aric Stewart | 7d3e597 | 2004-07-04 00:36:58 +0000 | [diff] [blame] | 2259 | return ERROR_SUCCESS; |
| 2260 | } |
| 2261 | |
Aric Stewart | ae1aa32 | 2004-12-27 19:02:59 +0000 | [diff] [blame] | 2262 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 2263 | static UINT ACTION_InstallValidate(MSIPACKAGE *package) |
Aric Stewart | 7d3e597 | 2004-07-04 00:36:58 +0000 | [diff] [blame] | 2264 | { |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2265 | MSICOMPONENT *comp; |
Aric Stewart | 7d3e597 | 2004-07-04 00:36:58 +0000 | [diff] [blame] | 2266 | DWORD progress = 0; |
Aric Stewart | bd1bbc1 | 2005-01-03 20:00:13 +0000 | [diff] [blame] | 2267 | DWORD total = 0; |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 2268 | static const WCHAR q1[]= |
| 2269 | {'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ', |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 2270 | '`','R','e','g','i','s','t','r','y','`',0}; |
Aric Stewart | 7d3e597 | 2004-07-04 00:36:58 +0000 | [diff] [blame] | 2271 | UINT rc; |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 2272 | MSIQUERY * view; |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 2273 | MSIFEATURE *feature; |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 2274 | MSIFILE *file; |
Aric Stewart | 7d3e597 | 2004-07-04 00:36:58 +0000 | [diff] [blame] | 2275 | |
Mike McCormack | f3f12ab | 2005-09-21 10:20:03 +0000 | [diff] [blame] | 2276 | TRACE("InstallValidate\n"); |
Aric Stewart | 7d3e597 | 2004-07-04 00:36:58 +0000 | [diff] [blame] | 2277 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 2278 | rc = MSI_DatabaseOpenViewW(package->db, q1, &view); |
Mike McCormack | f3f12ab | 2005-09-21 10:20:03 +0000 | [diff] [blame] | 2279 | if (rc == ERROR_SUCCESS) |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 2280 | { |
Mike McCormack | f3f12ab | 2005-09-21 10:20:03 +0000 | [diff] [blame] | 2281 | MSI_IterateRecords( view, &progress, NULL, package ); |
| 2282 | msiobj_release( &view->hdr ); |
| 2283 | total += progress * REG_PROGRESS_VALUE; |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 2284 | } |
Aric Stewart | 7d3e597 | 2004-07-04 00:36:58 +0000 | [diff] [blame] | 2285 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2286 | LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry ) |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2287 | total += COMPONENT_PROGRESS_VALUE; |
Mike McCormack | f3f12ab | 2005-09-21 10:20:03 +0000 | [diff] [blame] | 2288 | |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 2289 | LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry ) |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 2290 | total += file->FileSize; |
Mike McCormack | f3f12ab | 2005-09-21 10:20:03 +0000 | [diff] [blame] | 2291 | |
Aric Stewart | bd1bbc1 | 2005-01-03 20:00:13 +0000 | [diff] [blame] | 2292 | ui_progress(package,0,total,0,0); |
Aric Stewart | 7d3e597 | 2004-07-04 00:36:58 +0000 | [diff] [blame] | 2293 | |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 2294 | LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 2295 | { |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 2296 | TRACE("Feature: %s; Installed: %i; Action %i; Request %i\n", |
| 2297 | debugstr_w(feature->Feature), feature->Installed, feature->Action, |
| 2298 | feature->ActionRequest); |
| 2299 | } |
| 2300 | |
Aric Stewart | 7d3e597 | 2004-07-04 00:36:58 +0000 | [diff] [blame] | 2301 | return ERROR_SUCCESS; |
| 2302 | } |
| 2303 | |
Aric Stewart | c79f4e2 | 2005-06-22 18:03:08 +0000 | [diff] [blame] | 2304 | static UINT ITERATE_LaunchConditions(MSIRECORD *row, LPVOID param) |
| 2305 | { |
| 2306 | MSIPACKAGE* package = (MSIPACKAGE*)param; |
| 2307 | LPCWSTR cond = NULL; |
| 2308 | LPCWSTR message = NULL; |
| 2309 | static const WCHAR title[]= |
| 2310 | {'I','n','s','t','a','l','l',' ','F','a', 'i','l','e','d',0}; |
| 2311 | |
| 2312 | cond = MSI_RecordGetString(row,1); |
| 2313 | |
| 2314 | if (MSI_EvaluateConditionW(package,cond) != MSICONDITION_TRUE) |
| 2315 | { |
| 2316 | LPWSTR deformated; |
| 2317 | message = MSI_RecordGetString(row,2); |
| 2318 | deformat_string(package,message,&deformated); |
| 2319 | MessageBoxW(NULL,deformated,title,MB_OK); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2320 | msi_free(deformated); |
Aric Stewart | c79f4e2 | 2005-06-22 18:03:08 +0000 | [diff] [blame] | 2321 | return ERROR_FUNCTION_FAILED; |
| 2322 | } |
| 2323 | |
| 2324 | return ERROR_SUCCESS; |
| 2325 | } |
| 2326 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 2327 | static UINT ACTION_LaunchConditions(MSIPACKAGE *package) |
Aric Stewart | 5b936ca | 2004-07-06 18:47:09 +0000 | [diff] [blame] | 2328 | { |
| 2329 | UINT rc; |
Mike McCormack | f3c8b83 | 2004-07-19 19:35:05 +0000 | [diff] [blame] | 2330 | MSIQUERY * view = NULL; |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 2331 | static const WCHAR ExecSeqQuery[] = |
| 2332 | {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 2333 | '`','L','a','u','n','c','h','C','o','n','d','i','t','i','o','n','`',0}; |
Aric Stewart | 7d3e597 | 2004-07-04 00:36:58 +0000 | [diff] [blame] | 2334 | |
Aric Stewart | 5b936ca | 2004-07-06 18:47:09 +0000 | [diff] [blame] | 2335 | TRACE("Checking launch conditions\n"); |
Aric Stewart | 7d3e597 | 2004-07-04 00:36:58 +0000 | [diff] [blame] | 2336 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 2337 | rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view); |
Aric Stewart | 5b936ca | 2004-07-06 18:47:09 +0000 | [diff] [blame] | 2338 | if (rc != ERROR_SUCCESS) |
Aric Stewart | 84837d9 | 2004-07-20 01:22:37 +0000 | [diff] [blame] | 2339 | return ERROR_SUCCESS; |
Aric Stewart | 5b936ca | 2004-07-06 18:47:09 +0000 | [diff] [blame] | 2340 | |
Aric Stewart | c79f4e2 | 2005-06-22 18:03:08 +0000 | [diff] [blame] | 2341 | rc = MSI_IterateRecords(view, NULL, ITERATE_LaunchConditions, package); |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 2342 | msiobj_release(&view->hdr); |
Aric Stewart | c79f4e2 | 2005-06-22 18:03:08 +0000 | [diff] [blame] | 2343 | |
Aric Stewart | 5b936ca | 2004-07-06 18:47:09 +0000 | [diff] [blame] | 2344 | return rc; |
| 2345 | } |
Aric Stewart | 7d3e597 | 2004-07-04 00:36:58 +0000 | [diff] [blame] | 2346 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2347 | static LPWSTR resolve_keypath( MSIPACKAGE* package, MSICOMPONENT *cmp ) |
Aric Stewart | b942e18 | 2004-07-06 18:50:02 +0000 | [diff] [blame] | 2348 | { |
Aric Stewart | b942e18 | 2004-07-06 18:50:02 +0000 | [diff] [blame] | 2349 | |
Mike McCormack | efcc1ec | 2005-09-12 12:07:15 +0000 | [diff] [blame] | 2350 | if (!cmp->KeyPath) |
| 2351 | return resolve_folder(package,cmp->Directory,FALSE,FALSE,NULL); |
| 2352 | |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2353 | if (cmp->Attributes & msidbComponentAttributesRegistryKeyPath) |
Aric Stewart | b942e18 | 2004-07-06 18:50:02 +0000 | [diff] [blame] | 2354 | { |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 2355 | MSIRECORD * row = 0; |
Mike McCormack | 0b352c7 | 2005-06-02 10:29:57 +0000 | [diff] [blame] | 2356 | UINT root,len; |
Aric Stewart | 09b0aba | 2005-06-09 20:30:59 +0000 | [diff] [blame] | 2357 | LPWSTR deformated,buffer,deformated_name; |
| 2358 | LPCWSTR key,name; |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 2359 | static const WCHAR ExecSeqQuery[] = |
| 2360 | {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 2361 | '`','R','e','g','i','s','t','r','y','`',' ', |
| 2362 | 'W','H','E','R','E',' ', '`','R','e','g','i','s','t','r','y','`', |
| 2363 | ' ','=',' ' ,'\'','%','s','\'',0 }; |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2364 | static const WCHAR fmt[]={'%','0','2','i',':','\\','%','s','\\',0}; |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 2365 | static const WCHAR fmt2[]= |
| 2366 | {'%','0','2','i',':','\\','%','s','\\','%','s',0}; |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 2367 | |
Mike McCormack | 0b352c7 | 2005-06-02 10:29:57 +0000 | [diff] [blame] | 2368 | row = MSI_QueryGetRecord(package->db, ExecSeqQuery,cmp->KeyPath); |
| 2369 | if (!row) |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 2370 | return NULL; |
| 2371 | |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 2372 | root = MSI_RecordGetInteger(row,2); |
Aric Stewart | 09b0aba | 2005-06-09 20:30:59 +0000 | [diff] [blame] | 2373 | key = MSI_RecordGetString(row, 3); |
| 2374 | name = MSI_RecordGetString(row, 4); |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 2375 | deformat_string(package, key , &deformated); |
| 2376 | deformat_string(package, name, &deformated_name); |
| 2377 | |
Ulrich Czekalla | e15e517 | 2005-03-08 16:44:51 +0000 | [diff] [blame] | 2378 | len = strlenW(deformated) + 6; |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 2379 | if (deformated_name) |
| 2380 | len+=strlenW(deformated_name); |
| 2381 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2382 | buffer = msi_alloc( len *sizeof(WCHAR)); |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 2383 | |
| 2384 | if (deformated_name) |
| 2385 | sprintfW(buffer,fmt2,root,deformated,deformated_name); |
| 2386 | else |
| 2387 | sprintfW(buffer,fmt,root,deformated); |
| 2388 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2389 | msi_free(deformated); |
| 2390 | msi_free(deformated_name); |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 2391 | msiobj_release(&row->hdr); |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 2392 | |
| 2393 | return buffer; |
| 2394 | } |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2395 | else if (cmp->Attributes & msidbComponentAttributesODBCDataSource) |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 2396 | { |
| 2397 | FIXME("UNIMPLEMENTED keypath as ODBC Source\n"); |
Aric Stewart | fa384f6 | 2004-12-22 18:46:17 +0000 | [diff] [blame] | 2398 | return NULL; |
Aric Stewart | b942e18 | 2004-07-06 18:50:02 +0000 | [diff] [blame] | 2399 | } |
| 2400 | else |
| 2401 | { |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 2402 | MSIFILE *file = get_loaded_file( package, cmp->KeyPath ); |
Aric Stewart | fcb20c5 | 2004-07-06 18:51:16 +0000 | [diff] [blame] | 2403 | |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 2404 | if (file) |
| 2405 | return strdupW( file->TargetPath ); |
Aric Stewart | b942e18 | 2004-07-06 18:50:02 +0000 | [diff] [blame] | 2406 | } |
Aric Stewart | fa384f6 | 2004-12-22 18:46:17 +0000 | [diff] [blame] | 2407 | return NULL; |
Aric Stewart | b942e18 | 2004-07-06 18:50:02 +0000 | [diff] [blame] | 2408 | } |
| 2409 | |
Stefan Huehner | ac6f562 | 2005-06-20 14:18:03 +0000 | [diff] [blame] | 2410 | static HKEY openSharedDLLsKey(void) |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2411 | { |
| 2412 | HKEY hkey=0; |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 2413 | static const WCHAR path[] = |
| 2414 | {'S','o','f','t','w','a','r','e','\\', |
| 2415 | 'M','i','c','r','o','s','o','f','t','\\', |
| 2416 | 'W','i','n','d','o','w','s','\\', |
| 2417 | 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', |
| 2418 | 'S','h','a','r','e','d','D','L','L','s',0}; |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2419 | |
| 2420 | RegCreateKeyW(HKEY_LOCAL_MACHINE,path,&hkey); |
| 2421 | return hkey; |
| 2422 | } |
| 2423 | |
| 2424 | static UINT ACTION_GetSharedDLLsCount(LPCWSTR dll) |
| 2425 | { |
| 2426 | HKEY hkey; |
| 2427 | DWORD count=0; |
| 2428 | DWORD type; |
| 2429 | DWORD sz = sizeof(count); |
| 2430 | DWORD rc; |
| 2431 | |
| 2432 | hkey = openSharedDLLsKey(); |
| 2433 | rc = RegQueryValueExW(hkey, dll, NULL, &type, (LPBYTE)&count, &sz); |
| 2434 | if (rc != ERROR_SUCCESS) |
| 2435 | count = 0; |
| 2436 | RegCloseKey(hkey); |
| 2437 | return count; |
| 2438 | } |
| 2439 | |
| 2440 | static UINT ACTION_WriteSharedDLLsCount(LPCWSTR path, UINT count) |
| 2441 | { |
| 2442 | HKEY hkey; |
| 2443 | |
| 2444 | hkey = openSharedDLLsKey(); |
| 2445 | if (count > 0) |
Mike McCormack | 4db02cd | 2005-09-15 14:58:38 +0000 | [diff] [blame] | 2446 | msi_reg_set_val_dword( hkey, path, count ); |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2447 | else |
| 2448 | RegDeleteValueW(hkey,path); |
| 2449 | RegCloseKey(hkey); |
| 2450 | return count; |
| 2451 | } |
| 2452 | |
| 2453 | /* |
| 2454 | * Return TRUE if the count should be written out and FALSE if not |
| 2455 | */ |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2456 | static void ACTION_RefCountComponent( MSIPACKAGE* package, MSICOMPONENT *comp ) |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2457 | { |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 2458 | MSIFEATURE *feature; |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2459 | INT count = 0; |
| 2460 | BOOL write = FALSE; |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2461 | |
| 2462 | /* only refcount DLLs */ |
Mike McCormack | efcc1ec | 2005-09-12 12:07:15 +0000 | [diff] [blame] | 2463 | if (comp->KeyPath == NULL || |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2464 | comp->Attributes & msidbComponentAttributesRegistryKeyPath || |
| 2465 | comp->Attributes & msidbComponentAttributesODBCDataSource) |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2466 | write = FALSE; |
| 2467 | else |
| 2468 | { |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2469 | count = ACTION_GetSharedDLLsCount( comp->FullKeypath); |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2470 | write = (count > 0); |
| 2471 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2472 | if (comp->Attributes & msidbComponentAttributesSharedDllRefCount) |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2473 | write = TRUE; |
| 2474 | } |
| 2475 | |
| 2476 | /* increment counts */ |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 2477 | LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2478 | { |
Mike McCormack | 3f2d5d7 | 2005-08-19 10:03:11 +0000 | [diff] [blame] | 2479 | ComponentList *cl; |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2480 | |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 2481 | if (!ACTION_VerifyFeatureForAction( feature, INSTALLSTATE_LOCAL )) |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2482 | continue; |
| 2483 | |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 2484 | LIST_FOR_EACH_ENTRY( cl, &feature->Components, ComponentList, entry ) |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2485 | { |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2486 | if ( cl->component == comp ) |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2487 | count++; |
| 2488 | } |
| 2489 | } |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 2490 | |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2491 | /* decrement counts */ |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 2492 | LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2493 | { |
Mike McCormack | 3f2d5d7 | 2005-08-19 10:03:11 +0000 | [diff] [blame] | 2494 | ComponentList *cl; |
| 2495 | |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 2496 | if (!ACTION_VerifyFeatureForAction( feature, INSTALLSTATE_ABSENT )) |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2497 | continue; |
| 2498 | |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 2499 | LIST_FOR_EACH_ENTRY( cl, &feature->Components, ComponentList, entry ) |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2500 | { |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2501 | if ( cl->component == comp ) |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2502 | count--; |
| 2503 | } |
| 2504 | } |
| 2505 | |
| 2506 | /* ref count all the files in the component */ |
| 2507 | if (write) |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 2508 | { |
| 2509 | MSIFILE *file; |
| 2510 | |
| 2511 | LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry ) |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2512 | { |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 2513 | if (file->Component == comp) |
| 2514 | ACTION_WriteSharedDLLsCount( file->TargetPath, count ); |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2515 | } |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 2516 | } |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2517 | |
| 2518 | /* add a count for permenent */ |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2519 | if (comp->Attributes & msidbComponentAttributesPermanent) |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2520 | count ++; |
| 2521 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2522 | comp->RefCount = count; |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2523 | |
| 2524 | if (write) |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2525 | ACTION_WriteSharedDLLsCount( comp->FullKeypath, comp->RefCount ); |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2526 | } |
| 2527 | |
Aric Stewart | 2cf222f | 2004-07-06 19:00:23 +0000 | [diff] [blame] | 2528 | /* |
| 2529 | * Ok further analysis makes me think that this work is |
| 2530 | * actually done in the PublishComponents and PublishFeatures |
Mike McCormack | 3ece246 | 2004-07-09 19:33:25 +0000 | [diff] [blame] | 2531 | * step, and not here. It appears like the keypath and all that is |
| 2532 | * resolved in this step, however actually written in the Publish steps. |
Alexandre Julliard | 77b1276 | 2004-07-09 19:43:29 +0000 | [diff] [blame] | 2533 | * But we will leave it here for now because it is unclear |
Aric Stewart | 2cf222f | 2004-07-06 19:00:23 +0000 | [diff] [blame] | 2534 | */ |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 2535 | static UINT ACTION_ProcessComponents(MSIPACKAGE *package) |
Aric Stewart | b942e18 | 2004-07-06 18:50:02 +0000 | [diff] [blame] | 2536 | { |
Aric Stewart | 68b0749 | 2005-01-25 11:05:37 +0000 | [diff] [blame] | 2537 | WCHAR squished_pc[GUID_SIZE]; |
| 2538 | WCHAR squished_cc[GUID_SIZE]; |
Aric Stewart | b942e18 | 2004-07-06 18:50:02 +0000 | [diff] [blame] | 2539 | UINT rc; |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2540 | MSICOMPONENT *comp; |
Aric Stewart | 68b0749 | 2005-01-25 11:05:37 +0000 | [diff] [blame] | 2541 | HKEY hkey=0,hkey2=0; |
Aric Stewart | b942e18 | 2004-07-06 18:50:02 +0000 | [diff] [blame] | 2542 | |
Aric Stewart | b942e18 | 2004-07-06 18:50:02 +0000 | [diff] [blame] | 2543 | /* writes the Component and Features values to the registry */ |
Aric Stewart | b942e18 | 2004-07-06 18:50:02 +0000 | [diff] [blame] | 2544 | |
Aric Stewart | 68b0749 | 2005-01-25 11:05:37 +0000 | [diff] [blame] | 2545 | rc = MSIREG_OpenComponents(&hkey); |
Aric Stewart | b942e18 | 2004-07-06 18:50:02 +0000 | [diff] [blame] | 2546 | if (rc != ERROR_SUCCESS) |
Mike McCormack | fe8cd38 | 2006-03-09 14:21:37 +0900 | [diff] [blame] | 2547 | return rc; |
| 2548 | |
Aric Stewart | adaef11 | 2005-07-07 20:27:06 +0000 | [diff] [blame] | 2549 | squash_guid(package->ProductCode,squished_pc); |
Aric Stewart | bd1bbc1 | 2005-01-03 20:00:13 +0000 | [diff] [blame] | 2550 | ui_progress(package,1,COMPONENT_PROGRESS_VALUE,1,0); |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2551 | |
| 2552 | LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry ) |
Aric Stewart | b942e18 | 2004-07-06 18:50:02 +0000 | [diff] [blame] | 2553 | { |
Mike McCormack | fe8cd38 | 2006-03-09 14:21:37 +0900 | [diff] [blame] | 2554 | MSIRECORD * uirow; |
| 2555 | |
Aric Stewart | bd1bbc1 | 2005-01-03 20:00:13 +0000 | [diff] [blame] | 2556 | ui_progress(package,2,0,0,0); |
Mike McCormack | fe8cd38 | 2006-03-09 14:21:37 +0900 | [diff] [blame] | 2557 | if (!comp->ComponentId) |
| 2558 | continue; |
Aric Stewart | b942e18 | 2004-07-06 18:50:02 +0000 | [diff] [blame] | 2559 | |
Mike McCormack | fe8cd38 | 2006-03-09 14:21:37 +0900 | [diff] [blame] | 2560 | squash_guid(comp->ComponentId,squished_cc); |
Aric Stewart | b942e18 | 2004-07-06 18:50:02 +0000 | [diff] [blame] | 2561 | |
Mike McCormack | fe8cd38 | 2006-03-09 14:21:37 +0900 | [diff] [blame] | 2562 | msi_free(comp->FullKeypath); |
| 2563 | comp->FullKeypath = resolve_keypath( package, comp ); |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2564 | |
Mike McCormack | fe8cd38 | 2006-03-09 14:21:37 +0900 | [diff] [blame] | 2565 | /* do the refcounting */ |
| 2566 | ACTION_RefCountComponent( package, comp ); |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2567 | |
Mike McCormack | fe8cd38 | 2006-03-09 14:21:37 +0900 | [diff] [blame] | 2568 | TRACE("Component %s (%s), Keypath=%s, RefCount=%i\n", |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2569 | debugstr_w(comp->Component), |
Aric Stewart | c5a1443 | 2005-05-18 17:46:12 +0000 | [diff] [blame] | 2570 | debugstr_w(squished_cc), |
Mike McCormack | fe8cd38 | 2006-03-09 14:21:37 +0900 | [diff] [blame] | 2571 | debugstr_w(comp->FullKeypath), |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2572 | comp->RefCount); |
Mike McCormack | fe8cd38 | 2006-03-09 14:21:37 +0900 | [diff] [blame] | 2573 | /* |
| 2574 | * Write the keypath out if the component is to be registered |
| 2575 | * and delete the key if the component is to be deregistered |
| 2576 | */ |
| 2577 | if (ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL)) |
| 2578 | { |
| 2579 | rc = RegCreateKeyW(hkey,squished_cc,&hkey2); |
| 2580 | if (rc != ERROR_SUCCESS) |
| 2581 | continue; |
| 2582 | |
| 2583 | if (!comp->FullKeypath) |
| 2584 | continue; |
| 2585 | |
| 2586 | msi_reg_set_val_str( hkey2, squished_pc, comp->FullKeypath ); |
| 2587 | |
| 2588 | if (comp->Attributes & msidbComponentAttributesPermanent) |
Aric Stewart | fa384f6 | 2004-12-22 18:46:17 +0000 | [diff] [blame] | 2589 | { |
Mike McCormack | fe8cd38 | 2006-03-09 14:21:37 +0900 | [diff] [blame] | 2590 | static const WCHAR szPermKey[] = |
| 2591 | { '0','0','0','0','0','0','0','0','0','0','0','0', |
| 2592 | '0','0','0','0','0','0','0','0','0','0','0','0', |
| 2593 | '0','0','0','0','0','0','0','0',0 }; |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 2594 | |
Mike McCormack | fe8cd38 | 2006-03-09 14:21:37 +0900 | [diff] [blame] | 2595 | msi_reg_set_val_str( hkey2, szPermKey, comp->FullKeypath ); |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2596 | } |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 2597 | |
Mike McCormack | fe8cd38 | 2006-03-09 14:21:37 +0900 | [diff] [blame] | 2598 | RegCloseKey(hkey2); |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 2599 | |
Mike McCormack | fe8cd38 | 2006-03-09 14:21:37 +0900 | [diff] [blame] | 2600 | /* UI stuff */ |
| 2601 | uirow = MSI_CreateRecord(3); |
| 2602 | MSI_RecordSetStringW(uirow,1,package->ProductCode); |
| 2603 | MSI_RecordSetStringW(uirow,2,comp->ComponentId); |
| 2604 | MSI_RecordSetStringW(uirow,3,comp->FullKeypath); |
| 2605 | ui_actiondata(package,szProcessComponents,uirow); |
| 2606 | msiobj_release( &uirow->hdr ); |
| 2607 | } |
| 2608 | else if (ACTION_VerifyComponentForAction( comp, INSTALLSTATE_ABSENT)) |
| 2609 | { |
| 2610 | DWORD res; |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 2611 | |
Mike McCormack | fe8cd38 | 2006-03-09 14:21:37 +0900 | [diff] [blame] | 2612 | rc = RegOpenKeyW(hkey,squished_cc,&hkey2); |
| 2613 | if (rc != ERROR_SUCCESS) |
| 2614 | continue; |
| 2615 | |
| 2616 | RegDeleteValueW(hkey2,squished_pc); |
| 2617 | |
| 2618 | /* if the key is empty delete it */ |
| 2619 | res = RegEnumKeyExW(hkey2,0,NULL,0,0,NULL,0,NULL); |
| 2620 | RegCloseKey(hkey2); |
| 2621 | if (res == ERROR_NO_MORE_ITEMS) |
| 2622 | RegDeleteKeyW(hkey,squished_cc); |
| 2623 | |
| 2624 | /* UI stuff */ |
| 2625 | uirow = MSI_CreateRecord(2); |
| 2626 | MSI_RecordSetStringW(uirow,1,package->ProductCode); |
| 2627 | MSI_RecordSetStringW(uirow,2,comp->ComponentId); |
| 2628 | ui_actiondata(package,szProcessComponents,uirow); |
| 2629 | msiobj_release( &uirow->hdr ); |
Aric Stewart | b942e18 | 2004-07-06 18:50:02 +0000 | [diff] [blame] | 2630 | } |
| 2631 | } |
Aric Stewart | b942e18 | 2004-07-06 18:50:02 +0000 | [diff] [blame] | 2632 | RegCloseKey(hkey); |
| 2633 | return rc; |
| 2634 | } |
| 2635 | |
Aric Stewart | 6e82173 | 2005-03-30 10:19:08 +0000 | [diff] [blame] | 2636 | typedef struct { |
| 2637 | CLSID clsid; |
| 2638 | LPWSTR source; |
| 2639 | |
| 2640 | LPWSTR path; |
| 2641 | ITypeLib *ptLib; |
| 2642 | } typelib_struct; |
| 2643 | |
Mike McCormack | f9acfe6 | 2005-06-07 20:29:51 +0000 | [diff] [blame] | 2644 | static BOOL CALLBACK Typelib_EnumResNameProc( HMODULE hModule, LPCWSTR lpszType, |
Aric Stewart | 6e82173 | 2005-03-30 10:19:08 +0000 | [diff] [blame] | 2645 | LPWSTR lpszName, LONG_PTR lParam) |
| 2646 | { |
| 2647 | TLIBATTR *attr; |
| 2648 | typelib_struct *tl_struct = (typelib_struct*) lParam; |
| 2649 | static const WCHAR fmt[] = {'%','s','\\','%','i',0}; |
| 2650 | int sz; |
| 2651 | HRESULT res; |
| 2652 | |
| 2653 | if (!IS_INTRESOURCE(lpszName)) |
| 2654 | { |
| 2655 | ERR("Not Int Resource Name %s\n",debugstr_w(lpszName)); |
| 2656 | return TRUE; |
| 2657 | } |
| 2658 | |
| 2659 | sz = strlenW(tl_struct->source)+4; |
| 2660 | sz *= sizeof(WCHAR); |
| 2661 | |
Mike McCormack | 2acf800 | 2006-05-25 11:41:39 +0900 | [diff] [blame] | 2662 | if ((INT_PTR)lpszName == 1) |
Aric Stewart | ca8c4e4 | 2005-06-02 15:13:57 +0000 | [diff] [blame] | 2663 | tl_struct->path = strdupW(tl_struct->source); |
| 2664 | else |
| 2665 | { |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2666 | tl_struct->path = msi_alloc(sz); |
Aric Stewart | ca8c4e4 | 2005-06-02 15:13:57 +0000 | [diff] [blame] | 2667 | sprintfW(tl_struct->path,fmt,tl_struct->source, lpszName); |
| 2668 | } |
Aric Stewart | 6e82173 | 2005-03-30 10:19:08 +0000 | [diff] [blame] | 2669 | |
| 2670 | TRACE("trying %s\n", debugstr_w(tl_struct->path)); |
| 2671 | res = LoadTypeLib(tl_struct->path,&tl_struct->ptLib); |
| 2672 | if (!SUCCEEDED(res)) |
| 2673 | { |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2674 | msi_free(tl_struct->path); |
Aric Stewart | 6e82173 | 2005-03-30 10:19:08 +0000 | [diff] [blame] | 2675 | tl_struct->path = NULL; |
| 2676 | |
| 2677 | return TRUE; |
| 2678 | } |
| 2679 | |
| 2680 | ITypeLib_GetLibAttr(tl_struct->ptLib, &attr); |
| 2681 | if (IsEqualGUID(&(tl_struct->clsid),&(attr->guid))) |
| 2682 | { |
| 2683 | ITypeLib_ReleaseTLibAttr(tl_struct->ptLib, attr); |
| 2684 | return FALSE; |
| 2685 | } |
| 2686 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2687 | msi_free(tl_struct->path); |
Aric Stewart | 6e82173 | 2005-03-30 10:19:08 +0000 | [diff] [blame] | 2688 | tl_struct->path = NULL; |
| 2689 | |
| 2690 | ITypeLib_ReleaseTLibAttr(tl_struct->ptLib, attr); |
| 2691 | ITypeLib_Release(tl_struct->ptLib); |
| 2692 | |
| 2693 | return TRUE; |
| 2694 | } |
| 2695 | |
Aric Stewart | 234dc4b | 2005-06-22 18:27:34 +0000 | [diff] [blame] | 2696 | static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param) |
| 2697 | { |
| 2698 | MSIPACKAGE* package = (MSIPACKAGE*)param; |
| 2699 | LPCWSTR component; |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2700 | MSICOMPONENT *comp; |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 2701 | MSIFILE *file; |
Aric Stewart | 234dc4b | 2005-06-22 18:27:34 +0000 | [diff] [blame] | 2702 | typelib_struct tl_struct; |
| 2703 | HMODULE module; |
| 2704 | static const WCHAR szTYPELIB[] = {'T','Y','P','E','L','I','B',0}; |
| 2705 | |
| 2706 | component = MSI_RecordGetString(row,3); |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2707 | comp = get_loaded_component(package,component); |
| 2708 | if (!comp) |
Aric Stewart | 234dc4b | 2005-06-22 18:27:34 +0000 | [diff] [blame] | 2709 | return ERROR_SUCCESS; |
| 2710 | |
Mike McCormack | d693f46 | 2005-10-29 11:36:48 +0000 | [diff] [blame] | 2711 | if (!ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL)) |
Aric Stewart | 234dc4b | 2005-06-22 18:27:34 +0000 | [diff] [blame] | 2712 | { |
| 2713 | TRACE("Skipping typelib reg due to disabled component\n"); |
| 2714 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2715 | comp->Action = comp->Installed; |
Aric Stewart | 234dc4b | 2005-06-22 18:27:34 +0000 | [diff] [blame] | 2716 | |
| 2717 | return ERROR_SUCCESS; |
| 2718 | } |
| 2719 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2720 | comp->Action = INSTALLSTATE_LOCAL; |
Aric Stewart | 234dc4b | 2005-06-22 18:27:34 +0000 | [diff] [blame] | 2721 | |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 2722 | file = get_loaded_file( package, comp->KeyPath ); |
| 2723 | if (!file) |
Aric Stewart | 234dc4b | 2005-06-22 18:27:34 +0000 | [diff] [blame] | 2724 | return ERROR_SUCCESS; |
| 2725 | |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 2726 | module = LoadLibraryExW( file->TargetPath, NULL, LOAD_LIBRARY_AS_DATAFILE ); |
Mike McCormack | 51c6618 | 2005-10-27 12:36:12 +0000 | [diff] [blame] | 2727 | if (module) |
Aric Stewart | 234dc4b | 2005-06-22 18:27:34 +0000 | [diff] [blame] | 2728 | { |
Mike McCormack | 51c6618 | 2005-10-27 12:36:12 +0000 | [diff] [blame] | 2729 | LPCWSTR guid; |
| 2730 | guid = MSI_RecordGetString(row,1); |
| 2731 | CLSIDFromString((LPWSTR)guid, &tl_struct.clsid); |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 2732 | tl_struct.source = strdupW( file->TargetPath ); |
Aric Stewart | 234dc4b | 2005-06-22 18:27:34 +0000 | [diff] [blame] | 2733 | tl_struct.path = NULL; |
| 2734 | |
| 2735 | EnumResourceNamesW(module, szTYPELIB, Typelib_EnumResNameProc, |
| 2736 | (LONG_PTR)&tl_struct); |
| 2737 | |
Mike McCormack | 51c6618 | 2005-10-27 12:36:12 +0000 | [diff] [blame] | 2738 | if (tl_struct.path) |
Aric Stewart | 234dc4b | 2005-06-22 18:27:34 +0000 | [diff] [blame] | 2739 | { |
| 2740 | LPWSTR help = NULL; |
| 2741 | LPCWSTR helpid; |
| 2742 | HRESULT res; |
| 2743 | |
| 2744 | helpid = MSI_RecordGetString(row,6); |
| 2745 | |
| 2746 | if (helpid) |
| 2747 | help = resolve_folder(package,helpid,FALSE,FALSE,NULL); |
| 2748 | res = RegisterTypeLib(tl_struct.ptLib,tl_struct.path,help); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2749 | msi_free(help); |
Aric Stewart | 234dc4b | 2005-06-22 18:27:34 +0000 | [diff] [blame] | 2750 | |
| 2751 | if (!SUCCEEDED(res)) |
| 2752 | ERR("Failed to register type library %s\n", |
| 2753 | debugstr_w(tl_struct.path)); |
| 2754 | else |
| 2755 | { |
| 2756 | ui_actiondata(package,szRegisterTypeLibraries,row); |
| 2757 | |
| 2758 | TRACE("Registered %s\n", debugstr_w(tl_struct.path)); |
| 2759 | } |
| 2760 | |
| 2761 | ITypeLib_Release(tl_struct.ptLib); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2762 | msi_free(tl_struct.path); |
Aric Stewart | 234dc4b | 2005-06-22 18:27:34 +0000 | [diff] [blame] | 2763 | } |
| 2764 | else |
| 2765 | ERR("Failed to load type library %s\n", |
| 2766 | debugstr_w(tl_struct.source)); |
| 2767 | |
| 2768 | FreeLibrary(module); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2769 | msi_free(tl_struct.source); |
Aric Stewart | 234dc4b | 2005-06-22 18:27:34 +0000 | [diff] [blame] | 2770 | } |
| 2771 | else |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 2772 | ERR("Could not load file! %s\n", debugstr_w(file->TargetPath)); |
Aric Stewart | 234dc4b | 2005-06-22 18:27:34 +0000 | [diff] [blame] | 2773 | |
| 2774 | return ERROR_SUCCESS; |
| 2775 | } |
| 2776 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 2777 | static UINT ACTION_RegisterTypeLibraries(MSIPACKAGE *package) |
Aric Stewart | fcb20c5 | 2004-07-06 18:51:16 +0000 | [diff] [blame] | 2778 | { |
| 2779 | /* |
Mike McCormack | c90c781 | 2004-07-09 22:58:27 +0000 | [diff] [blame] | 2780 | * OK this is a bit confusing.. I am given a _Component key and I believe |
Aric Stewart | fcb20c5 | 2004-07-06 18:51:16 +0000 | [diff] [blame] | 2781 | * that the file that is being registered as a type library is the "key file |
Mike McCormack | c90c781 | 2004-07-09 22:58:27 +0000 | [diff] [blame] | 2782 | * of that component" which I interpret to mean "The file in the KeyPath of |
| 2783 | * that component". |
Aric Stewart | fcb20c5 | 2004-07-06 18:51:16 +0000 | [diff] [blame] | 2784 | */ |
| 2785 | UINT rc; |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 2786 | MSIQUERY * view; |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 2787 | static const WCHAR Query[] = |
| 2788 | {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 2789 | '`','T','y','p','e','L','i','b','`',0}; |
Aric Stewart | fcb20c5 | 2004-07-06 18:51:16 +0000 | [diff] [blame] | 2790 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 2791 | rc = MSI_DatabaseOpenViewW(package->db, Query, &view); |
Aric Stewart | fcb20c5 | 2004-07-06 18:51:16 +0000 | [diff] [blame] | 2792 | if (rc != ERROR_SUCCESS) |
Aric Stewart | 84837d9 | 2004-07-20 01:22:37 +0000 | [diff] [blame] | 2793 | return ERROR_SUCCESS; |
Aric Stewart | fcb20c5 | 2004-07-06 18:51:16 +0000 | [diff] [blame] | 2794 | |
Aric Stewart | 234dc4b | 2005-06-22 18:27:34 +0000 | [diff] [blame] | 2795 | rc = MSI_IterateRecords(view, NULL, ITERATE_RegisterTypeLibraries, package); |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 2796 | msiobj_release(&view->hdr); |
Aric Stewart | fcb20c5 | 2004-07-06 18:51:16 +0000 | [diff] [blame] | 2797 | return rc; |
Aric Stewart | fcb20c5 | 2004-07-06 18:51:16 +0000 | [diff] [blame] | 2798 | } |
| 2799 | |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2800 | static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param) |
Aric Stewart | 2cf222f | 2004-07-06 19:00:23 +0000 | [diff] [blame] | 2801 | { |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2802 | MSIPACKAGE *package = (MSIPACKAGE*)param; |
Mike McCormack | 477bce3 | 2006-01-16 20:38:28 +0100 | [diff] [blame] | 2803 | LPWSTR target_file, target_folder, filename; |
Robert Shearman | 4ac8567 | 2006-02-22 16:31:00 +0000 | [diff] [blame] | 2804 | LPCWSTR buffer, extension; |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2805 | MSICOMPONENT *comp; |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2806 | static const WCHAR szlnk[]={'.','l','n','k',0}; |
Mike McCormack | 20c5746 | 2006-05-24 17:41:04 +0900 | [diff] [blame] | 2807 | IShellLinkW *sl = NULL; |
| 2808 | IPersistFile *pf = NULL; |
Aric Stewart | 2cf222f | 2004-07-06 19:00:23 +0000 | [diff] [blame] | 2809 | HRESULT res; |
| 2810 | |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2811 | buffer = MSI_RecordGetString(row,4); |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2812 | comp = get_loaded_component(package,buffer); |
| 2813 | if (!comp) |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2814 | return ERROR_SUCCESS; |
| 2815 | |
Mike McCormack | d693f46 | 2005-10-29 11:36:48 +0000 | [diff] [blame] | 2816 | if (!ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL )) |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2817 | { |
| 2818 | TRACE("Skipping shortcut creation due to disabled component\n"); |
| 2819 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2820 | comp->Action = comp->Installed; |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2821 | |
| 2822 | return ERROR_SUCCESS; |
| 2823 | } |
| 2824 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 2825 | comp->Action = INSTALLSTATE_LOCAL; |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2826 | |
| 2827 | ui_actiondata(package,szCreateShortcuts,row); |
| 2828 | |
| 2829 | res = CoCreateInstance( &CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, |
| 2830 | &IID_IShellLinkW, (LPVOID *) &sl ); |
| 2831 | |
Mike McCormack | 20c5746 | 2006-05-24 17:41:04 +0900 | [diff] [blame] | 2832 | if (FAILED( res )) |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2833 | { |
Mike McCormack | 20c5746 | 2006-05-24 17:41:04 +0900 | [diff] [blame] | 2834 | ERR("CLSID_ShellLink not available\n"); |
| 2835 | goto err; |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2836 | } |
| 2837 | |
| 2838 | res = IShellLinkW_QueryInterface( sl, &IID_IPersistFile,(LPVOID*) &pf ); |
Mike McCormack | 20c5746 | 2006-05-24 17:41:04 +0900 | [diff] [blame] | 2839 | if (FAILED( res )) |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2840 | { |
Mike McCormack | 20c5746 | 2006-05-24 17:41:04 +0900 | [diff] [blame] | 2841 | ERR("QueryInterface(IID_IPersistFile) failed\n"); |
| 2842 | goto err; |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2843 | } |
| 2844 | |
| 2845 | buffer = MSI_RecordGetString(row,2); |
| 2846 | target_folder = resolve_folder(package, buffer,FALSE,FALSE,NULL); |
| 2847 | |
| 2848 | /* may be needed because of a bug somehwere else */ |
| 2849 | create_full_pathW(target_folder); |
| 2850 | |
Mike McCormack | 477bce3 | 2006-01-16 20:38:28 +0100 | [diff] [blame] | 2851 | filename = msi_dup_record_field( row, 3 ); |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2852 | reduce_to_longfilename(filename); |
Robert Shearman | 4ac8567 | 2006-02-22 16:31:00 +0000 | [diff] [blame] | 2853 | |
| 2854 | extension = strchrW(filename,'.'); |
| 2855 | if (!extension || strcmpiW(extension,szlnk)) |
| 2856 | { |
| 2857 | int len = strlenW(filename); |
| 2858 | filename = msi_realloc(filename, len * sizeof(WCHAR) + sizeof(szlnk)); |
| 2859 | memcpy(filename + len, szlnk, sizeof(szlnk)); |
| 2860 | } |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2861 | target_file = build_directory_name(2, target_folder, filename); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2862 | msi_free(target_folder); |
Mike McCormack | 477bce3 | 2006-01-16 20:38:28 +0100 | [diff] [blame] | 2863 | msi_free(filename); |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2864 | |
| 2865 | buffer = MSI_RecordGetString(row,5); |
| 2866 | if (strchrW(buffer,'[')) |
| 2867 | { |
| 2868 | LPWSTR deformated; |
| 2869 | deformat_string(package,buffer,&deformated); |
| 2870 | IShellLinkW_SetPath(sl,deformated); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2871 | msi_free(deformated); |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2872 | } |
| 2873 | else |
| 2874 | { |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2875 | FIXME("poorly handled shortcut format, advertised shortcut\n"); |
Mike McCormack | 566c69e | 2005-09-22 10:49:17 +0000 | [diff] [blame] | 2876 | IShellLinkW_SetPath(sl,comp->FullKeypath); |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2877 | } |
| 2878 | |
| 2879 | if (!MSI_RecordIsNull(row,6)) |
| 2880 | { |
| 2881 | LPWSTR deformated; |
| 2882 | buffer = MSI_RecordGetString(row,6); |
| 2883 | deformat_string(package,buffer,&deformated); |
| 2884 | IShellLinkW_SetArguments(sl,deformated); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2885 | msi_free(deformated); |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2886 | } |
| 2887 | |
| 2888 | if (!MSI_RecordIsNull(row,7)) |
| 2889 | { |
| 2890 | buffer = MSI_RecordGetString(row,7); |
| 2891 | IShellLinkW_SetDescription(sl,buffer); |
| 2892 | } |
| 2893 | |
| 2894 | if (!MSI_RecordIsNull(row,8)) |
| 2895 | IShellLinkW_SetHotkey(sl,MSI_RecordGetInteger(row,8)); |
| 2896 | |
| 2897 | if (!MSI_RecordIsNull(row,9)) |
| 2898 | { |
Mike McCormack | 75658d7 | 2005-09-22 10:33:57 +0000 | [diff] [blame] | 2899 | LPWSTR Path; |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2900 | INT index; |
| 2901 | |
| 2902 | buffer = MSI_RecordGetString(row,9); |
| 2903 | |
Mike McCormack | 75658d7 | 2005-09-22 10:33:57 +0000 | [diff] [blame] | 2904 | Path = build_icon_path(package,buffer); |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2905 | index = MSI_RecordGetInteger(row,10); |
| 2906 | |
| 2907 | IShellLinkW_SetIconLocation(sl,Path,index); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2908 | msi_free(Path); |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2909 | } |
| 2910 | |
| 2911 | if (!MSI_RecordIsNull(row,11)) |
| 2912 | IShellLinkW_SetShowCmd(sl,MSI_RecordGetInteger(row,11)); |
| 2913 | |
| 2914 | if (!MSI_RecordIsNull(row,12)) |
| 2915 | { |
| 2916 | LPWSTR Path; |
| 2917 | buffer = MSI_RecordGetString(row,12); |
| 2918 | Path = resolve_folder(package, buffer, FALSE, FALSE, NULL); |
| 2919 | IShellLinkW_SetWorkingDirectory(sl,Path); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2920 | msi_free(Path); |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2921 | } |
| 2922 | |
| 2923 | TRACE("Writing shortcut to %s\n",debugstr_w(target_file)); |
| 2924 | IPersistFile_Save(pf,target_file,FALSE); |
| 2925 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2926 | msi_free(target_file); |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2927 | |
Mike McCormack | 20c5746 | 2006-05-24 17:41:04 +0900 | [diff] [blame] | 2928 | err: |
| 2929 | if (pf) |
| 2930 | IPersistFile_Release( pf ); |
| 2931 | if (sl) |
| 2932 | IShellLinkW_Release( sl ); |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2933 | |
| 2934 | return ERROR_SUCCESS; |
| 2935 | } |
| 2936 | |
| 2937 | static UINT ACTION_CreateShortcuts(MSIPACKAGE *package) |
| 2938 | { |
| 2939 | UINT rc; |
| 2940 | HRESULT res; |
| 2941 | MSIQUERY * view; |
| 2942 | static const WCHAR Query[] = |
| 2943 | {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', |
| 2944 | '`','S','h','o','r','t','c','u','t','`',0}; |
| 2945 | |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2946 | rc = MSI_DatabaseOpenViewW(package->db, Query, &view); |
| 2947 | if (rc != ERROR_SUCCESS) |
| 2948 | return ERROR_SUCCESS; |
| 2949 | |
Aric Stewart | 2cf222f | 2004-07-06 19:00:23 +0000 | [diff] [blame] | 2950 | res = CoInitialize( NULL ); |
| 2951 | if (FAILED (res)) |
| 2952 | { |
| 2953 | ERR("CoInitialize failed\n"); |
| 2954 | return ERROR_FUNCTION_FAILED; |
| 2955 | } |
| 2956 | |
Aric Stewart | 9adacf6 | 2005-06-24 11:58:21 +0000 | [diff] [blame] | 2957 | rc = MSI_IterateRecords(view, NULL, ITERATE_CreateShortcuts, package); |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 2958 | msiobj_release(&view->hdr); |
Aric Stewart | 2cf222f | 2004-07-06 19:00:23 +0000 | [diff] [blame] | 2959 | |
Aric Stewart | 2cf222f | 2004-07-06 19:00:23 +0000 | [diff] [blame] | 2960 | CoUninitialize(); |
| 2961 | |
| 2962 | return rc; |
| 2963 | } |
| 2964 | |
Aric Stewart | 916ef94 | 2005-06-22 18:42:19 +0000 | [diff] [blame] | 2965 | static UINT ITERATE_PublishProduct(MSIRECORD *row, LPVOID param) |
| 2966 | { |
| 2967 | MSIPACKAGE* package = (MSIPACKAGE*)param; |
| 2968 | HANDLE the_file; |
Mike McCormack | 75658d7 | 2005-09-22 10:33:57 +0000 | [diff] [blame] | 2969 | LPWSTR FilePath; |
| 2970 | LPCWSTR FileName; |
Aric Stewart | 916ef94 | 2005-06-22 18:42:19 +0000 | [diff] [blame] | 2971 | CHAR buffer[1024]; |
| 2972 | DWORD sz; |
| 2973 | UINT rc; |
Robert Shearman | d2e48e0 | 2006-01-23 17:29:50 +0100 | [diff] [blame] | 2974 | MSIRECORD *uirow; |
Aric Stewart | 916ef94 | 2005-06-22 18:42:19 +0000 | [diff] [blame] | 2975 | |
| 2976 | FileName = MSI_RecordGetString(row,1); |
| 2977 | if (!FileName) |
| 2978 | { |
| 2979 | ERR("Unable to get FileName\n"); |
| 2980 | return ERROR_SUCCESS; |
| 2981 | } |
| 2982 | |
Mike McCormack | 75658d7 | 2005-09-22 10:33:57 +0000 | [diff] [blame] | 2983 | FilePath = build_icon_path(package,FileName); |
Aric Stewart | 916ef94 | 2005-06-22 18:42:19 +0000 | [diff] [blame] | 2984 | |
| 2985 | TRACE("Creating icon file at %s\n",debugstr_w(FilePath)); |
| 2986 | |
| 2987 | the_file = CreateFileW(FilePath, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, |
| 2988 | FILE_ATTRIBUTE_NORMAL, NULL); |
| 2989 | |
| 2990 | if (the_file == INVALID_HANDLE_VALUE) |
| 2991 | { |
| 2992 | ERR("Unable to create file %s\n",debugstr_w(FilePath)); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 2993 | msi_free(FilePath); |
Aric Stewart | 916ef94 | 2005-06-22 18:42:19 +0000 | [diff] [blame] | 2994 | return ERROR_SUCCESS; |
| 2995 | } |
| 2996 | |
| 2997 | do |
| 2998 | { |
| 2999 | DWORD write; |
| 3000 | sz = 1024; |
| 3001 | rc = MSI_RecordReadStream(row,2,buffer,&sz); |
| 3002 | if (rc != ERROR_SUCCESS) |
| 3003 | { |
| 3004 | ERR("Failed to get stream\n"); |
| 3005 | CloseHandle(the_file); |
| 3006 | DeleteFileW(FilePath); |
| 3007 | break; |
| 3008 | } |
| 3009 | WriteFile(the_file,buffer,sz,&write,NULL); |
| 3010 | } while (sz == 1024); |
| 3011 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 3012 | msi_free(FilePath); |
Aric Stewart | 916ef94 | 2005-06-22 18:42:19 +0000 | [diff] [blame] | 3013 | |
| 3014 | CloseHandle(the_file); |
Robert Shearman | d2e48e0 | 2006-01-23 17:29:50 +0100 | [diff] [blame] | 3015 | |
| 3016 | uirow = MSI_CreateRecord(1); |
| 3017 | MSI_RecordSetStringW(uirow,1,FileName); |
| 3018 | ui_actiondata(package,szPublishProduct,uirow); |
| 3019 | msiobj_release( &uirow->hdr ); |
| 3020 | |
Aric Stewart | 916ef94 | 2005-06-22 18:42:19 +0000 | [diff] [blame] | 3021 | return ERROR_SUCCESS; |
| 3022 | } |
Aric Stewart | 2cf222f | 2004-07-06 19:00:23 +0000 | [diff] [blame] | 3023 | |
| 3024 | /* |
| 3025 | * 99% of the work done here is only done for |
| 3026 | * advertised installs. However this is where the |
| 3027 | * Icon table is processed and written out |
Francois Gouget | 817c520 | 2004-07-16 19:15:40 +0000 | [diff] [blame] | 3028 | * so that is what I am going to do here. |
Aric Stewart | 2cf222f | 2004-07-06 19:00:23 +0000 | [diff] [blame] | 3029 | */ |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 3030 | static UINT ACTION_PublishProduct(MSIPACKAGE *package) |
Aric Stewart | 2cf222f | 2004-07-06 19:00:23 +0000 | [diff] [blame] | 3031 | { |
| 3032 | UINT rc; |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 3033 | MSIQUERY * view; |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 3034 | static const WCHAR Query[]= |
| 3035 | {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 3036 | '`','I','c','o','n','`',0}; |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3037 | /* for registry stuff */ |
Aric Stewart | 68b0749 | 2005-01-25 11:05:37 +0000 | [diff] [blame] | 3038 | HKEY hkey=0; |
| 3039 | HKEY hukey=0; |
Aric Stewart | 6957e4a | 2005-06-08 19:16:45 +0000 | [diff] [blame] | 3040 | static const WCHAR szProductLanguage[] = |
| 3041 | {'P','r','o','d','u','c','t','L','a','n','g','u','a','g','e',0}; |
Aric Stewart | 6957e4a | 2005-06-08 19:16:45 +0000 | [diff] [blame] | 3042 | static const WCHAR szARPProductIcon[] = |
| 3043 | {'A','R','P','P','R','O','D','U','C','T','I','C','O','N',0}; |
Aric Stewart | c28bb54 | 2005-06-09 15:49:11 +0000 | [diff] [blame] | 3044 | static const WCHAR szProductVersion[] = |
| 3045 | {'P','r','o','d','u','c','t','V','e','r','s','i','o','n',0}; |
Aric Stewart | 6957e4a | 2005-06-08 19:16:45 +0000 | [diff] [blame] | 3046 | DWORD langid; |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3047 | LPWSTR buffer; |
| 3048 | DWORD size; |
Aric Stewart | 68b0749 | 2005-01-25 11:05:37 +0000 | [diff] [blame] | 3049 | MSIHANDLE hDb, hSumInfo; |
Aric Stewart | 2cf222f | 2004-07-06 19:00:23 +0000 | [diff] [blame] | 3050 | |
Aric Stewart | 916ef94 | 2005-06-22 18:42:19 +0000 | [diff] [blame] | 3051 | /* write out icon files */ |
| 3052 | |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 3053 | rc = MSI_DatabaseOpenViewW(package->db, Query, &view); |
Aric Stewart | 916ef94 | 2005-06-22 18:42:19 +0000 | [diff] [blame] | 3054 | if (rc == ERROR_SUCCESS) |
Aric Stewart | 2cf222f | 2004-07-06 19:00:23 +0000 | [diff] [blame] | 3055 | { |
Aric Stewart | 916ef94 | 2005-06-22 18:42:19 +0000 | [diff] [blame] | 3056 | MSI_IterateRecords(view, NULL, ITERATE_PublishProduct, package); |
Alexandre Julliard | a7a6f5f | 2004-07-09 22:25:34 +0000 | [diff] [blame] | 3057 | msiobj_release(&view->hdr); |
Aric Stewart | 2cf222f | 2004-07-06 19:00:23 +0000 | [diff] [blame] | 3058 | } |
| 3059 | |
Francois Gouget | da8b3dd | 2005-01-26 21:09:04 +0000 | [diff] [blame] | 3060 | /* ok there is a lot more done here but i need to figure out what */ |
Aric Stewart | 916ef94 | 2005-06-22 18:42:19 +0000 | [diff] [blame] | 3061 | |
Aric Stewart | adaef11 | 2005-07-07 20:27:06 +0000 | [diff] [blame] | 3062 | rc = MSIREG_OpenProductsKey(package->ProductCode,&hkey,TRUE); |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3063 | if (rc != ERROR_SUCCESS) |
| 3064 | goto end; |
| 3065 | |
Aric Stewart | adaef11 | 2005-07-07 20:27:06 +0000 | [diff] [blame] | 3066 | rc = MSIREG_OpenUserProductsKey(package->ProductCode,&hukey,TRUE); |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3067 | if (rc != ERROR_SUCCESS) |
| 3068 | goto end; |
| 3069 | |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3070 | |
Mike McCormack | 062ad50 | 2005-09-15 15:04:08 +0000 | [diff] [blame] | 3071 | buffer = msi_dup_property( package, INSTALLPROPERTY_PRODUCTNAMEW ); |
Mike McCormack | 4db02cd | 2005-09-15 14:58:38 +0000 | [diff] [blame] | 3072 | msi_reg_set_val_str( hukey, INSTALLPROPERTY_PRODUCTNAMEW, buffer ); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 3073 | msi_free(buffer); |
Aric Stewart | 6957e4a | 2005-06-08 19:16:45 +0000 | [diff] [blame] | 3074 | |
Mike McCormack | 74f0de9 | 2005-09-29 10:32:39 +0000 | [diff] [blame] | 3075 | langid = msi_get_property_int( package, szProductLanguage, 0 ); |
Mike McCormack | 4db02cd | 2005-09-15 14:58:38 +0000 | [diff] [blame] | 3076 | msi_reg_set_val_dword( hkey, INSTALLPROPERTY_LANGUAGEW, langid ); |
Aric Stewart | 6957e4a | 2005-06-08 19:16:45 +0000 | [diff] [blame] | 3077 | |
Mike McCormack | 062ad50 | 2005-09-15 15:04:08 +0000 | [diff] [blame] | 3078 | buffer = msi_dup_property( package, szARPProductIcon ); |
Aric Stewart | 6957e4a | 2005-06-08 19:16:45 +0000 | [diff] [blame] | 3079 | if (buffer) |
| 3080 | { |
Mike McCormack | 75658d7 | 2005-09-22 10:33:57 +0000 | [diff] [blame] | 3081 | LPWSTR path = build_icon_path(package,buffer); |
Mike McCormack | 4db02cd | 2005-09-15 14:58:38 +0000 | [diff] [blame] | 3082 | msi_reg_set_val_str( hukey, INSTALLPROPERTY_PRODUCTICONW, path ); |
Mike McCormack | 75658d7 | 2005-09-22 10:33:57 +0000 | [diff] [blame] | 3083 | msi_free( path ); |
Aric Stewart | 6957e4a | 2005-06-08 19:16:45 +0000 | [diff] [blame] | 3084 | } |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 3085 | msi_free(buffer); |
Aric Stewart | c28bb54 | 2005-06-09 15:49:11 +0000 | [diff] [blame] | 3086 | |
Mike McCormack | 062ad50 | 2005-09-15 15:04:08 +0000 | [diff] [blame] | 3087 | buffer = msi_dup_property( package, szProductVersion ); |
Aric Stewart | c28bb54 | 2005-06-09 15:49:11 +0000 | [diff] [blame] | 3088 | if (buffer) |
| 3089 | { |
Mike McCormack | 230af9d | 2006-07-14 15:19:08 +0900 | [diff] [blame] | 3090 | DWORD verdword = msi_version_str_to_dword(buffer); |
Mike McCormack | 4db02cd | 2005-09-15 14:58:38 +0000 | [diff] [blame] | 3091 | msi_reg_set_val_dword( hkey, INSTALLPROPERTY_VERSIONW, verdword ); |
Aric Stewart | c28bb54 | 2005-06-09 15:49:11 +0000 | [diff] [blame] | 3092 | } |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 3093 | msi_free(buffer); |
Aric Stewart | 6957e4a | 2005-06-08 19:16:45 +0000 | [diff] [blame] | 3094 | |
Mike McCormack | b7270b8 | 2005-12-31 13:18:11 +0100 | [diff] [blame] | 3095 | /* FIXME: Need to write more keys to the user registry */ |
Aric Stewart | 68b0749 | 2005-01-25 11:05:37 +0000 | [diff] [blame] | 3096 | |
Aric Stewart | 7e7b8cf | 2005-02-18 20:00:34 +0000 | [diff] [blame] | 3097 | hDb= alloc_msihandle( &package->db->hdr ); |
Aric Stewart | 68b0749 | 2005-01-25 11:05:37 +0000 | [diff] [blame] | 3098 | rc = MsiGetSummaryInformationW(hDb, NULL, 0, &hSumInfo); |
Aric Stewart | 7e7b8cf | 2005-02-18 20:00:34 +0000 | [diff] [blame] | 3099 | MsiCloseHandle(hDb); |
Aric Stewart | 68b0749 | 2005-01-25 11:05:37 +0000 | [diff] [blame] | 3100 | if (rc == ERROR_SUCCESS) |
| 3101 | { |
| 3102 | WCHAR guidbuffer[0x200]; |
| 3103 | size = 0x200; |
Aric Stewart | 7e7b8cf | 2005-02-18 20:00:34 +0000 | [diff] [blame] | 3104 | rc = MsiSummaryInfoGetPropertyW(hSumInfo, 9, NULL, NULL, NULL, |
Aric Stewart | 68b0749 | 2005-01-25 11:05:37 +0000 | [diff] [blame] | 3105 | guidbuffer, &size); |
| 3106 | if (rc == ERROR_SUCCESS) |
| 3107 | { |
| 3108 | WCHAR squashed[GUID_SIZE]; |
| 3109 | /* for now we only care about the first guid */ |
| 3110 | LPWSTR ptr = strchrW(guidbuffer,';'); |
| 3111 | if (ptr) *ptr = 0; |
| 3112 | squash_guid(guidbuffer,squashed); |
Mike McCormack | 4db02cd | 2005-09-15 14:58:38 +0000 | [diff] [blame] | 3113 | msi_reg_set_val_str( hukey, INSTALLPROPERTY_PACKAGECODEW, squashed ); |
Aric Stewart | 68b0749 | 2005-01-25 11:05:37 +0000 | [diff] [blame] | 3114 | } |
| 3115 | else |
| 3116 | { |
Francois Gouget | 0edbaf7 | 2005-11-10 12:14:56 +0000 | [diff] [blame] | 3117 | ERR("Unable to query Revision_Number...\n"); |
Aric Stewart | 68b0749 | 2005-01-25 11:05:37 +0000 | [diff] [blame] | 3118 | rc = ERROR_SUCCESS; |
| 3119 | } |
| 3120 | MsiCloseHandle(hSumInfo); |
| 3121 | } |
| 3122 | else |
| 3123 | { |
| 3124 | ERR("Unable to open Summary Information\n"); |
| 3125 | rc = ERROR_SUCCESS; |
| 3126 | } |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3127 | |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3128 | end: |
| 3129 | |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3130 | RegCloseKey(hkey); |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3131 | RegCloseKey(hukey); |
| 3132 | |
Aric Stewart | 2cf222f | 2004-07-06 19:00:23 +0000 | [diff] [blame] | 3133 | return rc; |
Aric Stewart | 2cf222f | 2004-07-06 19:00:23 +0000 | [diff] [blame] | 3134 | } |
| 3135 | |
Aric Stewart | aded32f | 2005-06-23 09:46:31 +0000 | [diff] [blame] | 3136 | static UINT ITERATE_WriteIniValues(MSIRECORD *row, LPVOID param) |
| 3137 | { |
| 3138 | MSIPACKAGE *package = (MSIPACKAGE*)param; |
| 3139 | LPCWSTR component,section,key,value,identifier,filename,dirproperty; |
| 3140 | LPWSTR deformated_section, deformated_key, deformated_value; |
| 3141 | LPWSTR folder, fullname = NULL; |
| 3142 | MSIRECORD * uirow; |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 3143 | INT action; |
| 3144 | MSICOMPONENT *comp; |
Aric Stewart | aded32f | 2005-06-23 09:46:31 +0000 | [diff] [blame] | 3145 | static const WCHAR szWindowsFolder[] = |
| 3146 | {'W','i','n','d','o','w','s','F','o','l','d','e','r',0}; |
| 3147 | |
| 3148 | component = MSI_RecordGetString(row, 8); |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 3149 | comp = get_loaded_component(package,component); |
Aric Stewart | aded32f | 2005-06-23 09:46:31 +0000 | [diff] [blame] | 3150 | |
Mike McCormack | d693f46 | 2005-10-29 11:36:48 +0000 | [diff] [blame] | 3151 | if (!ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL)) |
Aric Stewart | aded32f | 2005-06-23 09:46:31 +0000 | [diff] [blame] | 3152 | { |
| 3153 | TRACE("Skipping ini file due to disabled component %s\n", |
| 3154 | debugstr_w(component)); |
| 3155 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 3156 | comp->Action = comp->Installed; |
Aric Stewart | aded32f | 2005-06-23 09:46:31 +0000 | [diff] [blame] | 3157 | |
| 3158 | return ERROR_SUCCESS; |
| 3159 | } |
| 3160 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 3161 | comp->Action = INSTALLSTATE_LOCAL; |
Aric Stewart | aded32f | 2005-06-23 09:46:31 +0000 | [diff] [blame] | 3162 | |
| 3163 | identifier = MSI_RecordGetString(row,1); |
| 3164 | filename = MSI_RecordGetString(row,2); |
| 3165 | dirproperty = MSI_RecordGetString(row,3); |
| 3166 | section = MSI_RecordGetString(row,4); |
| 3167 | key = MSI_RecordGetString(row,5); |
| 3168 | value = MSI_RecordGetString(row,6); |
| 3169 | action = MSI_RecordGetInteger(row,7); |
| 3170 | |
| 3171 | deformat_string(package,section,&deformated_section); |
| 3172 | deformat_string(package,key,&deformated_key); |
| 3173 | deformat_string(package,value,&deformated_value); |
| 3174 | |
| 3175 | if (dirproperty) |
| 3176 | { |
| 3177 | folder = resolve_folder(package, dirproperty, FALSE, FALSE, NULL); |
| 3178 | if (!folder) |
Mike McCormack | 062ad50 | 2005-09-15 15:04:08 +0000 | [diff] [blame] | 3179 | folder = msi_dup_property( package, dirproperty ); |
Aric Stewart | aded32f | 2005-06-23 09:46:31 +0000 | [diff] [blame] | 3180 | } |
| 3181 | else |
Mike McCormack | 062ad50 | 2005-09-15 15:04:08 +0000 | [diff] [blame] | 3182 | folder = msi_dup_property( package, szWindowsFolder ); |
Aric Stewart | aded32f | 2005-06-23 09:46:31 +0000 | [diff] [blame] | 3183 | |
| 3184 | if (!folder) |
| 3185 | { |
| 3186 | ERR("Unable to resolve folder! (%s)\n",debugstr_w(dirproperty)); |
| 3187 | goto cleanup; |
| 3188 | } |
| 3189 | |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 3190 | fullname = build_directory_name(2, folder, filename); |
Aric Stewart | aded32f | 2005-06-23 09:46:31 +0000 | [diff] [blame] | 3191 | |
| 3192 | if (action == 0) |
| 3193 | { |
| 3194 | TRACE("Adding value %s to section %s in %s\n", |
| 3195 | debugstr_w(deformated_key), debugstr_w(deformated_section), |
| 3196 | debugstr_w(fullname)); |
| 3197 | WritePrivateProfileStringW(deformated_section, deformated_key, |
| 3198 | deformated_value, fullname); |
| 3199 | } |
| 3200 | else if (action == 1) |
| 3201 | { |
| 3202 | WCHAR returned[10]; |
| 3203 | GetPrivateProfileStringW(deformated_section, deformated_key, NULL, |
| 3204 | returned, 10, fullname); |
| 3205 | if (returned[0] == 0) |
| 3206 | { |
| 3207 | TRACE("Adding value %s to section %s in %s\n", |
| 3208 | debugstr_w(deformated_key), debugstr_w(deformated_section), |
| 3209 | debugstr_w(fullname)); |
| 3210 | |
| 3211 | WritePrivateProfileStringW(deformated_section, deformated_key, |
| 3212 | deformated_value, fullname); |
| 3213 | } |
| 3214 | } |
| 3215 | else if (action == 3) |
| 3216 | FIXME("Append to existing section not yet implemented\n"); |
| 3217 | |
| 3218 | uirow = MSI_CreateRecord(4); |
| 3219 | MSI_RecordSetStringW(uirow,1,identifier); |
| 3220 | MSI_RecordSetStringW(uirow,2,deformated_section); |
| 3221 | MSI_RecordSetStringW(uirow,3,deformated_key); |
| 3222 | MSI_RecordSetStringW(uirow,4,deformated_value); |
| 3223 | ui_actiondata(package,szWriteIniValues,uirow); |
| 3224 | msiobj_release( &uirow->hdr ); |
| 3225 | cleanup: |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 3226 | msi_free(fullname); |
| 3227 | msi_free(folder); |
| 3228 | msi_free(deformated_key); |
| 3229 | msi_free(deformated_value); |
| 3230 | msi_free(deformated_section); |
Aric Stewart | aded32f | 2005-06-23 09:46:31 +0000 | [diff] [blame] | 3231 | return ERROR_SUCCESS; |
| 3232 | } |
| 3233 | |
Aric Stewart | 516a9c7 | 2005-01-14 15:59:26 +0000 | [diff] [blame] | 3234 | static UINT ACTION_WriteIniValues(MSIPACKAGE *package) |
| 3235 | { |
| 3236 | UINT rc; |
| 3237 | MSIQUERY * view; |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 3238 | static const WCHAR ExecSeqQuery[] = |
| 3239 | {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 3240 | '`','I','n','i','F','i','l','e','`',0}; |
Aric Stewart | 516a9c7 | 2005-01-14 15:59:26 +0000 | [diff] [blame] | 3241 | |
| 3242 | rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view); |
| 3243 | if (rc != ERROR_SUCCESS) |
| 3244 | { |
| 3245 | TRACE("no IniFile table\n"); |
| 3246 | return ERROR_SUCCESS; |
| 3247 | } |
| 3248 | |
Aric Stewart | aded32f | 2005-06-23 09:46:31 +0000 | [diff] [blame] | 3249 | rc = MSI_IterateRecords(view, NULL, ITERATE_WriteIniValues, package); |
Aric Stewart | 516a9c7 | 2005-01-14 15:59:26 +0000 | [diff] [blame] | 3250 | msiobj_release(&view->hdr); |
| 3251 | return rc; |
| 3252 | } |
| 3253 | |
Aric Stewart | 854bfc4 | 2005-06-24 11:33:02 +0000 | [diff] [blame] | 3254 | static UINT ITERATE_SelfRegModules(MSIRECORD *row, LPVOID param) |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3255 | { |
Aric Stewart | 854bfc4 | 2005-06-24 11:33:02 +0000 | [diff] [blame] | 3256 | MSIPACKAGE *package = (MSIPACKAGE*)param; |
| 3257 | LPCWSTR filename; |
| 3258 | LPWSTR FullName; |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 3259 | MSIFILE *file; |
Aric Stewart | 854bfc4 | 2005-06-24 11:33:02 +0000 | [diff] [blame] | 3260 | DWORD len; |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 3261 | static const WCHAR ExeStr[] = |
Aric Stewart | c5a1443 | 2005-05-18 17:46:12 +0000 | [diff] [blame] | 3262 | {'r','e','g','s','v','r','3','2','.','e','x','e',' ','\"',0}; |
| 3263 | static const WCHAR close[] = {'\"',0}; |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3264 | STARTUPINFOW si; |
| 3265 | PROCESS_INFORMATION info; |
| 3266 | BOOL brc; |
Robert Shearman | d2e48e0 | 2006-01-23 17:29:50 +0100 | [diff] [blame] | 3267 | MSIRECORD *uirow; |
| 3268 | LPWSTR uipath, p; |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3269 | |
| 3270 | memset(&si,0,sizeof(STARTUPINFOW)); |
| 3271 | |
Aric Stewart | 854bfc4 | 2005-06-24 11:33:02 +0000 | [diff] [blame] | 3272 | filename = MSI_RecordGetString(row,1); |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 3273 | file = get_loaded_file( package, filename ); |
Aric Stewart | 854bfc4 | 2005-06-24 11:33:02 +0000 | [diff] [blame] | 3274 | |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 3275 | if (!file) |
Aric Stewart | 854bfc4 | 2005-06-24 11:33:02 +0000 | [diff] [blame] | 3276 | { |
| 3277 | ERR("Unable to find file id %s\n",debugstr_w(filename)); |
| 3278 | return ERROR_SUCCESS; |
| 3279 | } |
| 3280 | |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 3281 | len = strlenW(ExeStr) + strlenW( file->TargetPath ) + 2; |
Aric Stewart | 854bfc4 | 2005-06-24 11:33:02 +0000 | [diff] [blame] | 3282 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 3283 | FullName = msi_alloc(len*sizeof(WCHAR)); |
Aric Stewart | 854bfc4 | 2005-06-24 11:33:02 +0000 | [diff] [blame] | 3284 | strcpyW(FullName,ExeStr); |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 3285 | strcatW( FullName, file->TargetPath ); |
Aric Stewart | 854bfc4 | 2005-06-24 11:33:02 +0000 | [diff] [blame] | 3286 | strcatW(FullName,close); |
| 3287 | |
| 3288 | TRACE("Registering %s\n",debugstr_w(FullName)); |
| 3289 | brc = CreateProcessW(NULL, FullName, NULL, NULL, FALSE, 0, NULL, c_colon, |
| 3290 | &si, &info); |
| 3291 | |
| 3292 | if (brc) |
| 3293 | msi_dialog_check_messages(info.hProcess); |
| 3294 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 3295 | msi_free(FullName); |
Robert Shearman | d2e48e0 | 2006-01-23 17:29:50 +0100 | [diff] [blame] | 3296 | |
| 3297 | /* the UI chunk */ |
| 3298 | uirow = MSI_CreateRecord( 2 ); |
| 3299 | uipath = strdupW( file->TargetPath ); |
| 3300 | p = strrchrW(uipath,'\\'); |
| 3301 | if (p) |
| 3302 | p[1]=0; |
| 3303 | MSI_RecordSetStringW( uirow, 1, &p[2] ); |
| 3304 | MSI_RecordSetStringW( uirow, 2, uipath); |
| 3305 | ui_actiondata( package, szSelfRegModules, uirow); |
| 3306 | msiobj_release( &uirow->hdr ); |
| 3307 | msi_free( uipath ); |
| 3308 | /* FIXME: call ui_progress? */ |
| 3309 | |
Aric Stewart | 854bfc4 | 2005-06-24 11:33:02 +0000 | [diff] [blame] | 3310 | return ERROR_SUCCESS; |
| 3311 | } |
| 3312 | |
| 3313 | static UINT ACTION_SelfRegModules(MSIPACKAGE *package) |
| 3314 | { |
| 3315 | UINT rc; |
| 3316 | MSIQUERY * view; |
| 3317 | static const WCHAR ExecSeqQuery[] = |
| 3318 | {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', |
| 3319 | '`','S','e','l','f','R','e','g','`',0}; |
| 3320 | |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3321 | rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view); |
| 3322 | if (rc != ERROR_SUCCESS) |
| 3323 | { |
| 3324 | TRACE("no SelfReg table\n"); |
| 3325 | return ERROR_SUCCESS; |
| 3326 | } |
| 3327 | |
Aric Stewart | 854bfc4 | 2005-06-24 11:33:02 +0000 | [diff] [blame] | 3328 | MSI_IterateRecords(view, NULL, ITERATE_SelfRegModules, package); |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3329 | msiobj_release(&view->hdr); |
Aric Stewart | 854bfc4 | 2005-06-24 11:33:02 +0000 | [diff] [blame] | 3330 | |
| 3331 | return ERROR_SUCCESS; |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3332 | } |
| 3333 | |
| 3334 | static UINT ACTION_PublishFeatures(MSIPACKAGE *package) |
| 3335 | { |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 3336 | MSIFEATURE *feature; |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3337 | UINT rc; |
Aric Stewart | 68b0749 | 2005-01-25 11:05:37 +0000 | [diff] [blame] | 3338 | HKEY hkey=0; |
| 3339 | HKEY hukey=0; |
Aric Stewart | 68b0749 | 2005-01-25 11:05:37 +0000 | [diff] [blame] | 3340 | |
Aric Stewart | adaef11 | 2005-07-07 20:27:06 +0000 | [diff] [blame] | 3341 | rc = MSIREG_OpenFeaturesKey(package->ProductCode,&hkey,TRUE); |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3342 | if (rc != ERROR_SUCCESS) |
| 3343 | goto end; |
| 3344 | |
Aric Stewart | adaef11 | 2005-07-07 20:27:06 +0000 | [diff] [blame] | 3345 | rc = MSIREG_OpenUserFeaturesKey(package->ProductCode,&hukey,TRUE); |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3346 | if (rc != ERROR_SUCCESS) |
| 3347 | goto end; |
| 3348 | |
| 3349 | /* here the guids are base 85 encoded */ |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 3350 | LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3351 | { |
Mike McCormack | 3f2d5d7 | 2005-08-19 10:03:11 +0000 | [diff] [blame] | 3352 | ComponentList *cl; |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3353 | LPWSTR data = NULL; |
| 3354 | GUID clsid; |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3355 | INT size; |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 3356 | BOOL absent = FALSE; |
Robert Shearman | d2e48e0 | 2006-01-23 17:29:50 +0100 | [diff] [blame] | 3357 | MSIRECORD *uirow; |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3358 | |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 3359 | if (!ACTION_VerifyFeatureForAction( feature, INSTALLSTATE_LOCAL ) && |
| 3360 | !ACTION_VerifyFeatureForAction( feature, INSTALLSTATE_SOURCE ) && |
| 3361 | !ACTION_VerifyFeatureForAction( feature, INSTALLSTATE_ADVERTISED )) |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 3362 | absent = TRUE; |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 3363 | |
Mike McCormack | 3f2d5d7 | 2005-08-19 10:03:11 +0000 | [diff] [blame] | 3364 | size = 1; |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 3365 | LIST_FOR_EACH_ENTRY( cl, &feature->Components, ComponentList, entry ) |
Mike McCormack | 3f2d5d7 | 2005-08-19 10:03:11 +0000 | [diff] [blame] | 3366 | { |
| 3367 | size += 21; |
| 3368 | } |
Mike McCormack | 79ca56c | 2005-09-13 10:37:37 +0000 | [diff] [blame] | 3369 | if (feature->Feature_Parent) |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 3370 | size += strlenW( feature->Feature_Parent )+2; |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3371 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 3372 | data = msi_alloc(size * sizeof(WCHAR)); |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3373 | |
| 3374 | data[0] = 0; |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 3375 | LIST_FOR_EACH_ENTRY( cl, &feature->Components, ComponentList, entry ) |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3376 | { |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 3377 | MSICOMPONENT* component = cl->component; |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3378 | WCHAR buf[21]; |
Mike McCormack | 3f2d5d7 | 2005-08-19 10:03:11 +0000 | [diff] [blame] | 3379 | |
Mike McCormack | 3a94011 | 2006-04-19 02:29:03 +0900 | [diff] [blame] | 3380 | buf[0] = 0; |
Mike McCormack | efcc1ec | 2005-09-12 12:07:15 +0000 | [diff] [blame] | 3381 | if (component->ComponentId) |
Aric Stewart | c5a1443 | 2005-05-18 17:46:12 +0000 | [diff] [blame] | 3382 | { |
Mike McCormack | 3f2d5d7 | 2005-08-19 10:03:11 +0000 | [diff] [blame] | 3383 | TRACE("From %s\n",debugstr_w(component->ComponentId)); |
| 3384 | CLSIDFromString(component->ComponentId, &clsid); |
Aric Stewart | c5a1443 | 2005-05-18 17:46:12 +0000 | [diff] [blame] | 3385 | encode_base85_guid(&clsid,buf); |
| 3386 | TRACE("to %s\n",debugstr_w(buf)); |
| 3387 | strcatW(data,buf); |
| 3388 | } |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3389 | } |
Mike McCormack | 79ca56c | 2005-09-13 10:37:37 +0000 | [diff] [blame] | 3390 | if (feature->Feature_Parent) |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3391 | { |
| 3392 | static const WCHAR sep[] = {'\2',0}; |
| 3393 | strcatW(data,sep); |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 3394 | strcatW(data,feature->Feature_Parent); |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3395 | } |
| 3396 | |
Mike McCormack | 4db02cd | 2005-09-15 14:58:38 +0000 | [diff] [blame] | 3397 | msi_reg_set_val_str( hkey, feature->Feature, data ); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 3398 | msi_free(data); |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3399 | |
Mike McCormack | 79ca56c | 2005-09-13 10:37:37 +0000 | [diff] [blame] | 3400 | size = 0; |
| 3401 | if (feature->Feature_Parent) |
| 3402 | size = strlenW(feature->Feature_Parent)*sizeof(WCHAR); |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 3403 | if (!absent) |
| 3404 | { |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 3405 | RegSetValueExW(hukey,feature->Feature,0,REG_SZ, |
| 3406 | (LPBYTE)feature->Feature_Parent,size); |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 3407 | } |
| 3408 | else |
| 3409 | { |
Mike McCormack | 79ca56c | 2005-09-13 10:37:37 +0000 | [diff] [blame] | 3410 | size += 2*sizeof(WCHAR); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 3411 | data = msi_alloc(size); |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 3412 | data[0] = 0x6; |
Mike McCormack | 79ca56c | 2005-09-13 10:37:37 +0000 | [diff] [blame] | 3413 | data[1] = 0; |
| 3414 | if (feature->Feature_Parent) |
| 3415 | strcpyW( &data[1], feature->Feature_Parent ); |
Mike McCormack | 1da2858 | 2005-08-22 14:09:17 +0000 | [diff] [blame] | 3416 | RegSetValueExW(hukey,feature->Feature,0,REG_SZ, |
Mike McCormack | 16466af | 2005-07-06 10:33:30 +0000 | [diff] [blame] | 3417 | (LPBYTE)data,size); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 3418 | msi_free(data); |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 3419 | } |
Robert Shearman | d2e48e0 | 2006-01-23 17:29:50 +0100 | [diff] [blame] | 3420 | |
| 3421 | /* the UI chunk */ |
| 3422 | uirow = MSI_CreateRecord( 1 ); |
| 3423 | MSI_RecordSetStringW( uirow, 1, feature->Feature ); |
| 3424 | ui_actiondata( package, szPublishFeatures, uirow); |
| 3425 | msiobj_release( &uirow->hdr ); |
| 3426 | /* FIXME: call ui_progress? */ |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3427 | } |
| 3428 | |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3429 | end: |
Aric Stewart | 6269f00 | 2005-01-17 13:40:39 +0000 | [diff] [blame] | 3430 | RegCloseKey(hkey); |
| 3431 | RegCloseKey(hukey); |
| 3432 | return rc; |
| 3433 | } |
| 3434 | |
Mike McCormack | 61f24a4 | 2005-09-30 10:32:41 +0000 | [diff] [blame] | 3435 | static UINT msi_make_package_local( MSIPACKAGE *package, HKEY hkey ) |
| 3436 | { |
| 3437 | static const WCHAR installerPathFmt[] = { |
| 3438 | '%','s','\\','I','n','s','t','a','l','l','e','r','\\',0}; |
| 3439 | static const WCHAR fmt[] = { |
| 3440 | '%','s','\\', |
| 3441 | 'I','n','s','t','a','l','l','e','r','\\', |
| 3442 | '%','x','.','m','s','i',0}; |
| 3443 | static const WCHAR szOriginalDatabase[] = |
| 3444 | {'O','r','i','g','i','n','a','l','D','a','t','a','b','a','s','e',0}; |
| 3445 | WCHAR windir[MAX_PATH], path[MAX_PATH], packagefile[MAX_PATH]; |
| 3446 | INT num, start; |
| 3447 | LPWSTR msiFilePath; |
| 3448 | BOOL r; |
| 3449 | |
| 3450 | /* copy the package locally */ |
| 3451 | num = GetTickCount() & 0xffff; |
| 3452 | if (!num) |
| 3453 | num = 1; |
| 3454 | start = num; |
| 3455 | GetWindowsDirectoryW( windir, MAX_PATH ); |
| 3456 | snprintfW( packagefile, MAX_PATH, fmt, windir, num ); |
| 3457 | do |
| 3458 | { |
| 3459 | HANDLE handle = CreateFileW(packagefile,GENERIC_WRITE, 0, NULL, |
| 3460 | CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0 ); |
| 3461 | if (handle != INVALID_HANDLE_VALUE) |
| 3462 | { |
| 3463 | CloseHandle(handle); |
| 3464 | break; |
| 3465 | } |
| 3466 | if (GetLastError() != ERROR_FILE_EXISTS && |
| 3467 | GetLastError() != ERROR_SHARING_VIOLATION) |
| 3468 | break; |
| 3469 | if (!(++num & 0xffff)) num = 1; |
| 3470 | sprintfW(packagefile,fmt,num); |
| 3471 | } while (num != start); |
| 3472 | |
| 3473 | snprintfW( path, MAX_PATH, installerPathFmt, windir ); |
| 3474 | create_full_pathW(path); |
| 3475 | |
| 3476 | TRACE("Copying to local package %s\n",debugstr_w(packagefile)); |
| 3477 | |
| 3478 | msiFilePath = msi_dup_property( package, szOriginalDatabase ); |
| 3479 | r = CopyFileW( msiFilePath, packagefile, FALSE); |
| 3480 | msi_free( msiFilePath ); |
| 3481 | |
| 3482 | if (!r) |
| 3483 | { |
| 3484 | ERR("Unable to copy package (%s -> %s) (error %ld)\n", |
| 3485 | debugstr_w(msiFilePath), debugstr_w(packagefile), GetLastError()); |
| 3486 | return ERROR_FUNCTION_FAILED; |
| 3487 | } |
| 3488 | |
| 3489 | /* FIXME: maybe set this key in ACTION_RegisterProduct instead */ |
| 3490 | msi_reg_set_val_str( hkey, INSTALLPROPERTY_LOCALPACKAGEW, packagefile ); |
| 3491 | return ERROR_SUCCESS; |
| 3492 | } |
| 3493 | |
Mike McCormack | ba293ee | 2005-10-27 12:08:16 +0000 | [diff] [blame] | 3494 | static UINT msi_write_uninstall_property_vals( MSIPACKAGE *package, HKEY hkey ) |
| 3495 | { |
| 3496 | LPWSTR prop, val, key; |
| 3497 | static const LPCSTR propval[] = { |
| 3498 | "ARPAUTHORIZEDCDFPREFIX", "AuthorizedCDFPrefix", |
| 3499 | "ARPCONTACT", "Contact", |
| 3500 | "ARPCOMMENTS", "Comments", |
| 3501 | "ProductName", "DisplayName", |
| 3502 | "ProductVersion", "DisplayVersion", |
| 3503 | "ARPHELPLINK", "HelpLink", |
| 3504 | "ARPHELPTELEPHONE", "HelpTelephone", |
| 3505 | "ARPINSTALLLOCATION", "InstallLocation", |
| 3506 | "SourceDir", "InstallSource", |
| 3507 | "Manufacturer", "Publisher", |
| 3508 | "ARPREADME", "Readme", |
| 3509 | "ARPSIZE", "Size", |
| 3510 | "ARPURLINFOABOUT", "URLInfoAbout", |
| 3511 | "ARPURLUPDATEINFO", "URLUpdateInfo", |
| 3512 | NULL, |
| 3513 | }; |
| 3514 | const LPCSTR *p = propval; |
| 3515 | |
| 3516 | while( *p ) |
| 3517 | { |
| 3518 | prop = strdupAtoW( *p++ ); |
| 3519 | key = strdupAtoW( *p++ ); |
| 3520 | val = msi_dup_property( package, prop ); |
| 3521 | msi_reg_set_val_str( hkey, key, val ); |
| 3522 | msi_free(val); |
| 3523 | msi_free(key); |
| 3524 | msi_free(prop); |
| 3525 | } |
| 3526 | return ERROR_SUCCESS; |
| 3527 | } |
| 3528 | |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3529 | static UINT ACTION_RegisterProduct(MSIPACKAGE *package) |
| 3530 | { |
Aric Stewart | 68b0749 | 2005-01-25 11:05:37 +0000 | [diff] [blame] | 3531 | HKEY hkey=0; |
Aric Stewart | e9db87b | 2005-06-17 21:25:41 +0000 | [diff] [blame] | 3532 | LPWSTR buffer = NULL; |
Mike McCormack | ba293ee | 2005-10-27 12:08:16 +0000 | [diff] [blame] | 3533 | UINT rc; |
Mike McCormack | 74f0de9 | 2005-09-29 10:32:39 +0000 | [diff] [blame] | 3534 | DWORD size, langid; |
Mike McCormack | 4db02cd | 2005-09-15 14:58:38 +0000 | [diff] [blame] | 3535 | static const WCHAR szWindowsInstaller[] = |
Mike McCormack | ba293ee | 2005-10-27 12:08:16 +0000 | [diff] [blame] | 3536 | {'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0}; |
Aric Stewart | 36a0150 | 2005-06-08 19:07:52 +0000 | [diff] [blame] | 3537 | static const WCHAR szUpgradeCode[] = |
| 3538 | {'U','p','g','r','a','d','e','C','o','d','e',0}; |
Aric Stewart | e9db87b | 2005-06-17 21:25:41 +0000 | [diff] [blame] | 3539 | static const WCHAR modpath_fmt[] = |
Mike McCormack | ba293ee | 2005-10-27 12:08:16 +0000 | [diff] [blame] | 3540 | {'M','s','i','E','x','e','c','.','e','x','e',' ', |
| 3541 | '/','I','[','P','r','o','d','u','c','t','C','o','d','e',']',0}; |
Aric Stewart | e9db87b | 2005-06-17 21:25:41 +0000 | [diff] [blame] | 3542 | static const WCHAR szModifyPath[] = |
| 3543 | {'M','o','d','i','f','y','P','a','t','h',0}; |
| 3544 | static const WCHAR szUninstallString[] = |
| 3545 | {'U','n','i','n','s','t','a','l','l','S','t','r','i','n','g',0}; |
| 3546 | static const WCHAR szEstimatedSize[] = |
| 3547 | {'E','s','t','i','m','a','t','e','d','S','i','z','e',0}; |
Aric Stewart | e9db87b | 2005-06-17 21:25:41 +0000 | [diff] [blame] | 3548 | static const WCHAR szProductLanguage[] = |
| 3549 | {'P','r','o','d','u','c','t','L','a','n','g','u','a','g','e',0}; |
| 3550 | static const WCHAR szProductVersion[] = |
| 3551 | {'P','r','o','d','u','c','t','V','e','r','s','i','o','n',0}; |
Aric Stewart | e9db87b | 2005-06-17 21:25:41 +0000 | [diff] [blame] | 3552 | |
| 3553 | SYSTEMTIME systime; |
| 3554 | static const WCHAR date_fmt[] = {'%','i','%','i','%','i',0}; |
Aric Stewart | 36a0150 | 2005-06-08 19:07:52 +0000 | [diff] [blame] | 3555 | LPWSTR upgrade_code; |
Mike McCormack | ba293ee | 2005-10-27 12:08:16 +0000 | [diff] [blame] | 3556 | WCHAR szDate[9]; |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3557 | |
Aric Stewart | adaef11 | 2005-07-07 20:27:06 +0000 | [diff] [blame] | 3558 | rc = MSIREG_OpenUninstallKey(package->ProductCode,&hkey,TRUE); |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3559 | if (rc != ERROR_SUCCESS) |
Mike McCormack | ba293ee | 2005-10-27 12:08:16 +0000 | [diff] [blame] | 3560 | return rc; |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3561 | |
| 3562 | /* dump all the info i can grab */ |
Mike McCormack | b7270b8 | 2005-12-31 13:18:11 +0100 | [diff] [blame] | 3563 | /* FIXME: Flesh out more information */ |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3564 | |
Mike McCormack | ba293ee | 2005-10-27 12:08:16 +0000 | [diff] [blame] | 3565 | msi_write_uninstall_property_vals( package, hkey ); |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3566 | |
Mike McCormack | 4db02cd | 2005-09-15 14:58:38 +0000 | [diff] [blame] | 3567 | msi_reg_set_val_dword( hkey, szWindowsInstaller, 1 ); |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3568 | |
Mike McCormack | 61f24a4 | 2005-09-30 10:32:41 +0000 | [diff] [blame] | 3569 | msi_make_package_local( package, hkey ); |
Aric Stewart | 36a0150 | 2005-06-08 19:07:52 +0000 | [diff] [blame] | 3570 | |
Aric Stewart | e9db87b | 2005-06-17 21:25:41 +0000 | [diff] [blame] | 3571 | /* do ModifyPath and UninstallString */ |
| 3572 | size = deformat_string(package,modpath_fmt,&buffer); |
Mike McCormack | 16466af | 2005-07-06 10:33:30 +0000 | [diff] [blame] | 3573 | RegSetValueExW(hkey,szModifyPath,0,REG_EXPAND_SZ,(LPBYTE)buffer,size); |
| 3574 | RegSetValueExW(hkey,szUninstallString,0,REG_EXPAND_SZ,(LPBYTE)buffer,size); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 3575 | msi_free(buffer); |
Aric Stewart | e9db87b | 2005-06-17 21:25:41 +0000 | [diff] [blame] | 3576 | |
Mike McCormack | b7270b8 | 2005-12-31 13:18:11 +0100 | [diff] [blame] | 3577 | /* FIXME: Write real Estimated Size when we have it */ |
Mike McCormack | 4db02cd | 2005-09-15 14:58:38 +0000 | [diff] [blame] | 3578 | msi_reg_set_val_dword( hkey, szEstimatedSize, 0 ); |
Aric Stewart | e9db87b | 2005-06-17 21:25:41 +0000 | [diff] [blame] | 3579 | |
| 3580 | GetLocalTime(&systime); |
Mike McCormack | ba293ee | 2005-10-27 12:08:16 +0000 | [diff] [blame] | 3581 | sprintfW(szDate,date_fmt,systime.wYear,systime.wMonth,systime.wDay); |
| 3582 | msi_reg_set_val_str( hkey, INSTALLPROPERTY_INSTALLDATEW, szDate ); |
Aric Stewart | e9db87b | 2005-06-17 21:25:41 +0000 | [diff] [blame] | 3583 | |
Mike McCormack | 74f0de9 | 2005-09-29 10:32:39 +0000 | [diff] [blame] | 3584 | langid = msi_get_property_int( package, szProductLanguage, 0 ); |
| 3585 | msi_reg_set_val_dword( hkey, INSTALLPROPERTY_LANGUAGEW, langid ); |
Aric Stewart | e9db87b | 2005-06-17 21:25:41 +0000 | [diff] [blame] | 3586 | |
Mike McCormack | 062ad50 | 2005-09-15 15:04:08 +0000 | [diff] [blame] | 3587 | buffer = msi_dup_property( package, szProductVersion ); |
Aric Stewart | e9db87b | 2005-06-17 21:25:41 +0000 | [diff] [blame] | 3588 | if (buffer) |
| 3589 | { |
Mike McCormack | 230af9d | 2006-07-14 15:19:08 +0900 | [diff] [blame] | 3590 | DWORD verdword = msi_version_str_to_dword(buffer); |
Mike McCormack | 4db02cd | 2005-09-15 14:58:38 +0000 | [diff] [blame] | 3591 | |
| 3592 | msi_reg_set_val_dword( hkey, INSTALLPROPERTY_VERSIONW, verdword ); |
| 3593 | msi_reg_set_val_dword( hkey, INSTALLPROPERTY_VERSIONMAJORW, verdword>>24 ); |
| 3594 | msi_reg_set_val_dword( hkey, INSTALLPROPERTY_VERSIONMINORW, (verdword>>16)&0x00FF ); |
Aric Stewart | e9db87b | 2005-06-17 21:25:41 +0000 | [diff] [blame] | 3595 | } |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 3596 | msi_free(buffer); |
Aric Stewart | e9db87b | 2005-06-17 21:25:41 +0000 | [diff] [blame] | 3597 | |
Aric Stewart | 36a0150 | 2005-06-08 19:07:52 +0000 | [diff] [blame] | 3598 | /* Handle Upgrade Codes */ |
Mike McCormack | 062ad50 | 2005-09-15 15:04:08 +0000 | [diff] [blame] | 3599 | upgrade_code = msi_dup_property( package, szUpgradeCode ); |
Aric Stewart | 36a0150 | 2005-06-08 19:07:52 +0000 | [diff] [blame] | 3600 | if (upgrade_code) |
| 3601 | { |
| 3602 | HKEY hkey2; |
| 3603 | WCHAR squashed[33]; |
| 3604 | MSIREG_OpenUpgradeCodesKey(upgrade_code, &hkey2, TRUE); |
Aric Stewart | adaef11 | 2005-07-07 20:27:06 +0000 | [diff] [blame] | 3605 | squash_guid(package->ProductCode,squashed); |
Mike McCormack | 4db02cd | 2005-09-15 14:58:38 +0000 | [diff] [blame] | 3606 | msi_reg_set_val_str( hkey2, squashed, NULL ); |
Aric Stewart | 36a0150 | 2005-06-08 19:07:52 +0000 | [diff] [blame] | 3607 | RegCloseKey(hkey2); |
| 3608 | MSIREG_OpenUserUpgradeCodesKey(upgrade_code, &hkey2, TRUE); |
Aric Stewart | adaef11 | 2005-07-07 20:27:06 +0000 | [diff] [blame] | 3609 | squash_guid(package->ProductCode,squashed); |
Mike McCormack | 4db02cd | 2005-09-15 14:58:38 +0000 | [diff] [blame] | 3610 | msi_reg_set_val_str( hkey2, squashed, NULL ); |
Aric Stewart | 36a0150 | 2005-06-08 19:07:52 +0000 | [diff] [blame] | 3611 | RegCloseKey(hkey2); |
| 3612 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 3613 | msi_free(upgrade_code); |
Aric Stewart | 36a0150 | 2005-06-08 19:07:52 +0000 | [diff] [blame] | 3614 | } |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3615 | |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3616 | RegCloseKey(hkey); |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3617 | |
Robert Shearman | d2e48e0 | 2006-01-23 17:29:50 +0100 | [diff] [blame] | 3618 | /* FIXME: call ui_actiondata */ |
| 3619 | |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3620 | return ERROR_SUCCESS; |
| 3621 | } |
| 3622 | |
| 3623 | static UINT ACTION_InstallExecute(MSIPACKAGE *package) |
| 3624 | { |
Mike McCormack | a977b2c | 2005-11-03 09:56:29 +0000 | [diff] [blame] | 3625 | return execute_script(package,INSTALL_SCRIPT); |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3626 | } |
| 3627 | |
| 3628 | static UINT ACTION_InstallFinalize(MSIPACKAGE *package) |
| 3629 | { |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 3630 | UINT rc; |
| 3631 | |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 3632 | /* turn off scheduleing */ |
| 3633 | package->script->CurrentlyScripting= FALSE; |
| 3634 | |
Aric Stewart | 54c67dd | 2005-01-25 20:17:09 +0000 | [diff] [blame] | 3635 | /* first do the same as an InstallExecute */ |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 3636 | rc = ACTION_InstallExecute(package); |
| 3637 | if (rc != ERROR_SUCCESS) |
| 3638 | return rc; |
Aric Stewart | 54c67dd | 2005-01-25 20:17:09 +0000 | [diff] [blame] | 3639 | |
| 3640 | /* then handle Commit Actions */ |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 3641 | rc = execute_script(package,COMMIT_SCRIPT); |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3642 | |
Aric Stewart | 9cd707d | 2005-05-27 19:24:22 +0000 | [diff] [blame] | 3643 | return rc; |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3644 | } |
| 3645 | |
| 3646 | static UINT ACTION_ForceReboot(MSIPACKAGE *package) |
| 3647 | { |
| 3648 | static const WCHAR RunOnce[] = { |
| 3649 | 'S','o','f','t','w','a','r','e','\\', |
| 3650 | 'M','i','c','r','o','s','o','f','t','\\', |
| 3651 | 'W','i','n','d','o','w','s','\\', |
| 3652 | 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', |
Mike McCormack | 09b8264 | 2005-02-22 19:31:45 +0000 | [diff] [blame] | 3653 | 'R','u','n','O','n','c','e',0}; |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3654 | static const WCHAR InstallRunOnce[] = { |
| 3655 | 'S','o','f','t','w','a','r','e','\\', |
| 3656 | 'M','i','c','r','o','s','o','f','t','\\', |
| 3657 | 'W','i','n','d','o','w','s','\\', |
| 3658 | 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', |
| 3659 | 'I','n','s','t','a','l','l','e','r','\\', |
Mike McCormack | 09b8264 | 2005-02-22 19:31:45 +0000 | [diff] [blame] | 3660 | 'R','u','n','O','n','c','e','E','n','t','r','i','e','s',0}; |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3661 | |
| 3662 | static const WCHAR msiexec_fmt[] = { |
Juan Lang | 014ad3b | 2005-03-01 10:41:52 +0000 | [diff] [blame] | 3663 | '%','s', |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3664 | '\\','M','s','i','E','x','e','c','.','e','x','e',' ','/','@',' ', |
| 3665 | '\"','%','s','\"',0}; |
| 3666 | static const WCHAR install_fmt[] = { |
| 3667 | '/','I',' ','\"','%','s','\"',' ', |
| 3668 | 'A','F','T','E','R','R','E','B','O','O','T','=','1',' ', |
| 3669 | 'R','U','N','O','N','C','E','E','N','T','R','Y','=','\"','%','s','\"',0}; |
Juan Lang | 014ad3b | 2005-03-01 10:41:52 +0000 | [diff] [blame] | 3670 | WCHAR buffer[256], sysdir[MAX_PATH]; |
Aric Stewart | adaef11 | 2005-07-07 20:27:06 +0000 | [diff] [blame] | 3671 | HKEY hkey; |
Mike McCormack | 4db02cd | 2005-09-15 14:58:38 +0000 | [diff] [blame] | 3672 | WCHAR squished_pc[100]; |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3673 | |
Aric Stewart | adaef11 | 2005-07-07 20:27:06 +0000 | [diff] [blame] | 3674 | squash_guid(package->ProductCode,squished_pc); |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3675 | |
Juan Lang | 014ad3b | 2005-03-01 10:41:52 +0000 | [diff] [blame] | 3676 | GetSystemDirectoryW(sysdir, sizeof(sysdir)/sizeof(sysdir[0])); |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3677 | RegCreateKeyW(HKEY_LOCAL_MACHINE,RunOnce,&hkey); |
Juan Lang | 014ad3b | 2005-03-01 10:41:52 +0000 | [diff] [blame] | 3678 | snprintfW(buffer,sizeof(buffer)/sizeof(buffer[0]),msiexec_fmt,sysdir, |
| 3679 | squished_pc); |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3680 | |
Mike McCormack | 4db02cd | 2005-09-15 14:58:38 +0000 | [diff] [blame] | 3681 | msi_reg_set_val_str( hkey, squished_pc, buffer ); |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3682 | RegCloseKey(hkey); |
| 3683 | |
| 3684 | TRACE("Reboot command %s\n",debugstr_w(buffer)); |
| 3685 | |
| 3686 | RegCreateKeyW(HKEY_LOCAL_MACHINE,InstallRunOnce,&hkey); |
Aric Stewart | adaef11 | 2005-07-07 20:27:06 +0000 | [diff] [blame] | 3687 | sprintfW(buffer,install_fmt,package->ProductCode,squished_pc); |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 3688 | |
Mike McCormack | 4db02cd | 2005-09-15 14:58:38 +0000 | [diff] [blame] | 3689 | msi_reg_set_val_str( hkey, squished_pc, buffer ); |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3690 | RegCloseKey(hkey); |
| 3691 | |
Aric Stewart | 68b0749 | 2005-01-25 11:05:37 +0000 | [diff] [blame] | 3692 | return ERROR_INSTALL_SUSPEND; |
Aric Stewart | 2cae30b | 2005-01-19 19:07:40 +0000 | [diff] [blame] | 3693 | } |
| 3694 | |
Aric Stewart | 90c5739 | 2005-01-31 16:23:12 +0000 | [diff] [blame] | 3695 | UINT ACTION_ResolveSource(MSIPACKAGE* package) |
| 3696 | { |
Aric Stewart | 94d6818 | 2005-08-15 20:50:06 +0000 | [diff] [blame] | 3697 | DWORD attrib; |
| 3698 | UINT rc; |
Aric Stewart | 90c5739 | 2005-01-31 16:23:12 +0000 | [diff] [blame] | 3699 | /* |
| 3700 | * we are currently doing what should be done here in the top level Install |
| 3701 | * however for Adminastrative and uninstalls this step will be needed |
| 3702 | */ |
Aric Stewart | 94d6818 | 2005-08-15 20:50:06 +0000 | [diff] [blame] | 3703 | if (!package->PackagePath) |
| 3704 | return ERROR_SUCCESS; |
| 3705 | |
| 3706 | attrib = GetFileAttributesW(package->PackagePath); |
| 3707 | if (attrib == INVALID_FILE_ATTRIBUTES) |
| 3708 | { |
| 3709 | LPWSTR prompt; |
| 3710 | LPWSTR msg; |
| 3711 | DWORD size = 0; |
| 3712 | |
| 3713 | rc = MsiSourceListGetInfoW(package->ProductCode, NULL, |
| 3714 | MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT, |
| 3715 | INSTALLPROPERTY_DISKPROMPTW,NULL,&size); |
| 3716 | if (rc == ERROR_MORE_DATA) |
| 3717 | { |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 3718 | prompt = msi_alloc(size * sizeof(WCHAR)); |
Aric Stewart | 94d6818 | 2005-08-15 20:50:06 +0000 | [diff] [blame] | 3719 | MsiSourceListGetInfoW(package->ProductCode, NULL, |
| 3720 | MSIINSTALLCONTEXT_USERMANAGED, MSICODE_PRODUCT, |
| 3721 | INSTALLPROPERTY_DISKPROMPTW,prompt,&size); |
| 3722 | } |
| 3723 | else |
| 3724 | prompt = strdupW(package->PackagePath); |
| 3725 | |
| 3726 | msg = generate_error_string(package,1302,1,prompt); |
| 3727 | while(attrib == INVALID_FILE_ATTRIBUTES) |
| 3728 | { |
| 3729 | rc = MessageBoxW(NULL,msg,NULL,MB_OKCANCEL); |
| 3730 | if (rc == IDCANCEL) |
| 3731 | { |
| 3732 | rc = ERROR_INSTALL_USEREXIT; |
| 3733 | break; |
| 3734 | } |
| 3735 | attrib = GetFileAttributesW(package->PackagePath); |
| 3736 | } |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 3737 | msi_free(prompt); |
Aric Stewart | 94d6818 | 2005-08-15 20:50:06 +0000 | [diff] [blame] | 3738 | rc = ERROR_SUCCESS; |
| 3739 | } |
| 3740 | else |
| 3741 | return ERROR_SUCCESS; |
| 3742 | |
| 3743 | return rc; |
Aric Stewart | 90c5739 | 2005-01-31 16:23:12 +0000 | [diff] [blame] | 3744 | } |
| 3745 | |
Aric Stewart | c7e88e0 | 2005-02-10 17:09:44 +0000 | [diff] [blame] | 3746 | static UINT ACTION_RegisterUser(MSIPACKAGE *package) |
| 3747 | { |
Aric Stewart | c7e88e0 | 2005-02-10 17:09:44 +0000 | [diff] [blame] | 3748 | HKEY hkey=0; |
| 3749 | LPWSTR buffer; |
Aric Stewart | c7e88e0 | 2005-02-10 17:09:44 +0000 | [diff] [blame] | 3750 | LPWSTR productid; |
| 3751 | UINT rc,i; |
Aric Stewart | c7e88e0 | 2005-02-10 17:09:44 +0000 | [diff] [blame] | 3752 | |
| 3753 | static const WCHAR szPropKeys[][80] = |
| 3754 | { |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 3755 | {'P','r','o','d','u','c','t','I','D',0}, |
| 3756 | {'U','S','E','R','N','A','M','E',0}, |
| 3757 | {'C','O','M','P','A','N','Y','N','A','M','E',0}, |
| 3758 | {0}, |
Aric Stewart | c7e88e0 | 2005-02-10 17:09:44 +0000 | [diff] [blame] | 3759 | }; |
| 3760 | |
| 3761 | static const WCHAR szRegKeys[][80] = |
| 3762 | { |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 3763 | {'P','r','o','d','u','c','t','I','D',0}, |
| 3764 | {'R','e','g','O','w','n','e','r',0}, |
| 3765 | {'R','e','g','C','o','m','p','a','n','y',0}, |
| 3766 | {0}, |
Aric Stewart | c7e88e0 | 2005-02-10 17:09:44 +0000 | [diff] [blame] | 3767 | }; |
| 3768 | |
Mike McCormack | 062ad50 | 2005-09-15 15:04:08 +0000 | [diff] [blame] | 3769 | productid = msi_dup_property( package, INSTALLPROPERTY_PRODUCTIDW ); |
Aric Stewart | c7e88e0 | 2005-02-10 17:09:44 +0000 | [diff] [blame] | 3770 | if (!productid) |
| 3771 | return ERROR_SUCCESS; |
| 3772 | |
Aric Stewart | adaef11 | 2005-07-07 20:27:06 +0000 | [diff] [blame] | 3773 | rc = MSIREG_OpenUninstallKey(package->ProductCode,&hkey,TRUE); |
Aric Stewart | c7e88e0 | 2005-02-10 17:09:44 +0000 | [diff] [blame] | 3774 | if (rc != ERROR_SUCCESS) |
| 3775 | goto end; |
| 3776 | |
Mike McCormack | 67189f9 | 2005-09-16 18:45:19 +0000 | [diff] [blame] | 3777 | for( i = 0; szPropKeys[i][0]; i++ ) |
Aric Stewart | c7e88e0 | 2005-02-10 17:09:44 +0000 | [diff] [blame] | 3778 | { |
Mike McCormack | 062ad50 | 2005-09-15 15:04:08 +0000 | [diff] [blame] | 3779 | buffer = msi_dup_property( package, szPropKeys[i] ); |
Mike McCormack | 4db02cd | 2005-09-15 14:58:38 +0000 | [diff] [blame] | 3780 | msi_reg_set_val_str( hkey, szRegKeys[i], buffer ); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 3781 | msi_free( buffer ); |
Aric Stewart | c7e88e0 | 2005-02-10 17:09:44 +0000 | [diff] [blame] | 3782 | } |
| 3783 | |
| 3784 | end: |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 3785 | msi_free(productid); |
Aric Stewart | c7e88e0 | 2005-02-10 17:09:44 +0000 | [diff] [blame] | 3786 | RegCloseKey(hkey); |
| 3787 | |
Robert Shearman | d2e48e0 | 2006-01-23 17:29:50 +0100 | [diff] [blame] | 3788 | /* FIXME: call ui_actiondata */ |
| 3789 | |
Aric Stewart | c7e88e0 | 2005-02-10 17:09:44 +0000 | [diff] [blame] | 3790 | return ERROR_SUCCESS; |
| 3791 | } |
| 3792 | |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 3793 | |
| 3794 | static UINT ACTION_ExecuteAction(MSIPACKAGE *package) |
| 3795 | { |
| 3796 | UINT rc; |
Aric Stewart | 25f1e75 | 2005-06-24 12:14:52 +0000 | [diff] [blame] | 3797 | |
Aric Stewart | c980293 | 2005-06-30 20:45:43 +0000 | [diff] [blame] | 3798 | package->script->InWhatSequence |= SEQUENCE_EXEC; |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 3799 | rc = ACTION_ProcessExecSequence(package,FALSE); |
Aric Stewart | b6bc6aa | 2005-02-24 12:47:43 +0000 | [diff] [blame] | 3800 | return rc; |
| 3801 | } |
| 3802 | |
Aric Stewart | 0af2487 | 2005-02-25 14:00:09 +0000 | [diff] [blame] | 3803 | |
| 3804 | /* |
| 3805 | * Code based off of code located here |
| 3806 | * http://www.codeproject.com/gdi/fontnamefromfile.asp |
| 3807 | * |
| 3808 | * Using string index 4 (full font name) instead of 1 (family name) |
| 3809 | */ |
| 3810 | static LPWSTR load_ttfname_from(LPCWSTR filename) |
| 3811 | { |
| 3812 | HANDLE handle; |
| 3813 | LPWSTR ret = NULL; |
| 3814 | int i; |
| 3815 | |
| 3816 | typedef struct _tagTT_OFFSET_TABLE{ |
| 3817 | USHORT uMajorVersion; |
| 3818 | USHORT uMinorVersion; |
| 3819 | USHORT uNumOfTables; |
| 3820 | USHORT uSearchRange; |
| 3821 | USHORT uEntrySelector; |
| 3822 | USHORT uRangeShift; |
| 3823 | }TT_OFFSET_TABLE; |
| 3824 | |
| 3825 | typedef struct _tagTT_TABLE_DIRECTORY{ |
| 3826 | char szTag[4]; /* table name */ |
| 3827 | ULONG uCheckSum; /* Check sum */ |
| 3828 | ULONG uOffset; /* Offset from beginning of file */ |
| 3829 | ULONG uLength; /* length of the table in bytes */ |
| 3830 | }TT_TABLE_DIRECTORY; |
| 3831 | |
| 3832 | typedef struct _tagTT_NAME_TABLE_HEADER{ |
| 3833 | USHORT uFSelector; /* format selector. Always 0 */ |
| 3834 | USHORT uNRCount; /* Name Records count */ |
| 3835 | USHORT uStorageOffset; /* Offset for strings storage, |
| 3836 | * from start of the table */ |
| 3837 | }TT_NAME_TABLE_HEADER; |
| 3838 | |
| 3839 | typedef struct _tagTT_NAME_RECORD{ |
| 3840 | USHORT uPlatformID; |
| 3841 | USHORT uEncodingID; |
| 3842 | USHORT uLanguageID; |
| 3843 | USHORT uNameID; |
| 3844 | USHORT uStringLength; |
| 3845 | USHORT uStringOffset; /* from start of storage area */ |
| 3846 | }TT_NAME_RECORD; |
Alexandre Julliard | d0ee9f9 | 2005-03-02 12:23:20 +0000 | [diff] [blame] | 3847 | |
| 3848 | #define SWAPWORD(x) MAKEWORD(HIBYTE(x), LOBYTE(x)) |
| 3849 | #define SWAPLONG(x) MAKELONG(SWAPWORD(HIWORD(x)), SWAPWORD(LOWORD(x))) |
| 3850 | |
Aric Stewart | 0af2487 | 2005-02-25 14:00:09 +0000 | [diff] [blame] | 3851 | handle = CreateFileW(filename ,GENERIC_READ, 0, NULL, OPEN_EXISTING, |
| 3852 | FILE_ATTRIBUTE_NORMAL, 0 ); |
| 3853 | if (handle != INVALID_HANDLE_VALUE) |
| 3854 | { |
| 3855 | TT_TABLE_DIRECTORY tblDir; |
| 3856 | BOOL bFound = FALSE; |
| 3857 | TT_OFFSET_TABLE ttOffsetTable; |
Thomas Weidenmueller | 561f2f0 | 2005-10-29 10:29:08 +0000 | [diff] [blame] | 3858 | DWORD dwRead; |
Aric Stewart | 0af2487 | 2005-02-25 14:00:09 +0000 | [diff] [blame] | 3859 | |
Thomas Weidenmueller | 561f2f0 | 2005-10-29 10:29:08 +0000 | [diff] [blame] | 3860 | ReadFile(handle,&ttOffsetTable, sizeof(TT_OFFSET_TABLE),&dwRead,NULL); |
Aric Stewart | 0af2487 | 2005-02-25 14:00:09 +0000 | [diff] [blame] | 3861 | ttOffsetTable.uNumOfTables = SWAPWORD(ttOffsetTable.uNumOfTables); |
| 3862 | ttOffsetTable.uMajorVersion = SWAPWORD(ttOffsetTable.uMajorVersion); |
| 3863 | ttOffsetTable.uMinorVersion = SWAPWORD(ttOffsetTable.uMinorVersion); |
| 3864 | |
| 3865 | if (ttOffsetTable.uMajorVersion != 1 || |
| 3866 | ttOffsetTable.uMinorVersion != 0) |
| 3867 | return NULL; |
| 3868 | |
| 3869 | for (i=0; i< ttOffsetTable.uNumOfTables; i++) |
| 3870 | { |
Thomas Weidenmueller | 561f2f0 | 2005-10-29 10:29:08 +0000 | [diff] [blame] | 3871 | ReadFile(handle,&tblDir, sizeof(TT_TABLE_DIRECTORY),&dwRead,NULL); |
Aric Stewart | 0af2487 | 2005-02-25 14:00:09 +0000 | [diff] [blame] | 3872 | if (strncmp(tblDir.szTag,"name",4)==0) |
| 3873 | { |
| 3874 | bFound = TRUE; |
| 3875 | tblDir.uLength = SWAPLONG(tblDir.uLength); |
| 3876 | tblDir.uOffset = SWAPLONG(tblDir.uOffset); |
| 3877 | break; |
| 3878 | } |
| 3879 | } |
| 3880 | |
| 3881 | if (bFound) |
| 3882 | { |
| 3883 | TT_NAME_TABLE_HEADER ttNTHeader; |
| 3884 | TT_NAME_RECORD ttRecord; |
| 3885 | |
| 3886 | SetFilePointer(handle, tblDir.uOffset, NULL, FILE_BEGIN); |
| 3887 | ReadFile(handle,&ttNTHeader, sizeof(TT_NAME_TABLE_HEADER), |
Thomas Weidenmueller | 561f2f0 | 2005-10-29 10:29:08 +0000 | [diff] [blame] | 3888 | &dwRead,NULL); |
Aric Stewart | 0af2487 | 2005-02-25 14:00:09 +0000 | [diff] [blame] | 3889 | |
| 3890 | ttNTHeader.uNRCount = SWAPWORD(ttNTHeader.uNRCount); |
| 3891 | ttNTHeader.uStorageOffset = SWAPWORD(ttNTHeader.uStorageOffset); |
| 3892 | bFound = FALSE; |
| 3893 | for(i=0; i<ttNTHeader.uNRCount; i++) |
| 3894 | { |
Thomas Weidenmueller | 561f2f0 | 2005-10-29 10:29:08 +0000 | [diff] [blame] | 3895 | ReadFile(handle,&ttRecord, sizeof(TT_NAME_RECORD),&dwRead,NULL); |
Aric Stewart | 0af2487 | 2005-02-25 14:00:09 +0000 | [diff] [blame] | 3896 | ttRecord.uNameID = SWAPWORD(ttRecord.uNameID); |
| 3897 | /* 4 is the Full Font Name */ |
| 3898 | if(ttRecord.uNameID == 4) |
| 3899 | { |
| 3900 | int nPos; |
| 3901 | LPSTR buf; |
Mike McCormack | f9acfe6 | 2005-06-07 20:29:51 +0000 | [diff] [blame] | 3902 | static LPCSTR tt = " (TrueType)"; |
Aric Stewart | 0af2487 | 2005-02-25 14:00:09 +0000 | [diff] [blame] | 3903 | |
| 3904 | ttRecord.uStringLength = SWAPWORD(ttRecord.uStringLength); |
| 3905 | ttRecord.uStringOffset = SWAPWORD(ttRecord.uStringOffset); |
| 3906 | nPos = SetFilePointer(handle, 0, NULL, FILE_CURRENT); |
| 3907 | SetFilePointer(handle, tblDir.uOffset + |
| 3908 | ttRecord.uStringOffset + |
| 3909 | ttNTHeader.uStorageOffset, |
| 3910 | NULL, FILE_BEGIN); |
Mike McCormack | 3a94011 | 2006-04-19 02:29:03 +0900 | [diff] [blame] | 3911 | buf = msi_alloc_zero( ttRecord.uStringLength + 1 + strlen(tt) ); |
Thomas Weidenmueller | 561f2f0 | 2005-10-29 10:29:08 +0000 | [diff] [blame] | 3912 | ReadFile(handle, buf, ttRecord.uStringLength, &dwRead, NULL); |
Aric Stewart | 0af2487 | 2005-02-25 14:00:09 +0000 | [diff] [blame] | 3913 | if (strlen(buf) > 0) |
| 3914 | { |
| 3915 | strcat(buf,tt); |
| 3916 | ret = strdupAtoW(buf); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 3917 | msi_free(buf); |
Aric Stewart | 0af2487 | 2005-02-25 14:00:09 +0000 | [diff] [blame] | 3918 | break; |
| 3919 | } |
| 3920 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 3921 | msi_free(buf); |
Aric Stewart | 0af2487 | 2005-02-25 14:00:09 +0000 | [diff] [blame] | 3922 | SetFilePointer(handle,nPos, NULL, FILE_BEGIN); |
| 3923 | } |
| 3924 | } |
| 3925 | } |
| 3926 | CloseHandle(handle); |
| 3927 | } |
Aric Stewart | 8a6a9a6 | 2005-05-18 09:44:38 +0000 | [diff] [blame] | 3928 | else |
| 3929 | ERR("Unable to open font file %s\n", debugstr_w(filename)); |
Aric Stewart | 0af2487 | 2005-02-25 14:00:09 +0000 | [diff] [blame] | 3930 | |
| 3931 | TRACE("Returning fontname %s\n",debugstr_w(ret)); |
| 3932 | return ret; |
| 3933 | } |
| 3934 | |
Aric Stewart | a9b5052 | 2005-06-23 11:04:09 +0000 | [diff] [blame] | 3935 | static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param) |
Aric Stewart | 0af2487 | 2005-02-25 14:00:09 +0000 | [diff] [blame] | 3936 | { |
Aric Stewart | a9b5052 | 2005-06-23 11:04:09 +0000 | [diff] [blame] | 3937 | MSIPACKAGE *package = (MSIPACKAGE*)param; |
| 3938 | LPWSTR name; |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 3939 | LPCWSTR filename; |
| 3940 | MSIFILE *file; |
Aric Stewart | 8e233e9 | 2005-03-01 11:45:19 +0000 | [diff] [blame] | 3941 | static const WCHAR regfont1[] = |
| 3942 | {'S','o','f','t','w','a','r','e','\\', |
| 3943 | 'M','i','c','r','o','s','o','f','t','\\', |
| 3944 | 'W','i','n','d','o','w','s',' ','N','T','\\', |
| 3945 | 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', |
| 3946 | 'F','o','n','t','s',0}; |
| 3947 | static const WCHAR regfont2[] = |
| 3948 | {'S','o','f','t','w','a','r','e','\\', |
| 3949 | 'M','i','c','r','o','s','o','f','t','\\', |
| 3950 | 'W','i','n','d','o','w','s','\\', |
| 3951 | 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', |
| 3952 | 'F','o','n','t','s',0}; |
Aric Stewart | 0af2487 | 2005-02-25 14:00:09 +0000 | [diff] [blame] | 3953 | HKEY hkey1; |
| 3954 | HKEY hkey2; |
Robert Shearman | d2e48e0 | 2006-01-23 17:29:50 +0100 | [diff] [blame] | 3955 | MSIRECORD *uirow; |
| 3956 | LPWSTR uipath, p; |
Aric Stewart | 0af2487 | 2005-02-25 14:00:09 +0000 | [diff] [blame] | 3957 | |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 3958 | filename = MSI_RecordGetString( row, 1 ); |
| 3959 | file = get_loaded_file( package, filename ); |
| 3960 | if (!file) |
Aric Stewart | a9b5052 | 2005-06-23 11:04:09 +0000 | [diff] [blame] | 3961 | { |
| 3962 | ERR("Unable to load file\n"); |
| 3963 | return ERROR_SUCCESS; |
| 3964 | } |
| 3965 | |
| 3966 | /* check to make sure that component is installed */ |
Mike McCormack | d693f46 | 2005-10-29 11:36:48 +0000 | [diff] [blame] | 3967 | if (!ACTION_VerifyComponentForAction( file->Component, INSTALLSTATE_LOCAL)) |
Aric Stewart | a9b5052 | 2005-06-23 11:04:09 +0000 | [diff] [blame] | 3968 | { |
| 3969 | TRACE("Skipping: Component not scheduled for install\n"); |
| 3970 | return ERROR_SUCCESS; |
| 3971 | } |
| 3972 | |
| 3973 | RegCreateKeyW(HKEY_LOCAL_MACHINE,regfont1,&hkey1); |
| 3974 | RegCreateKeyW(HKEY_LOCAL_MACHINE,regfont2,&hkey2); |
| 3975 | |
| 3976 | if (MSI_RecordIsNull(row,2)) |
Mike McCormack | e18f8ab | 2005-08-23 10:03:17 +0000 | [diff] [blame] | 3977 | name = load_ttfname_from( file->TargetPath ); |
Aric Stewart | a9b5052 | 2005-06-23 11:04:09 +0000 | [diff] [blame] | 3978 | else |
Mike McCormack | 51c6618 | 2005-10-27 12:36:12 +0000 | [diff] [blame] | 3979 | name = msi_dup_record_field(row,2); |
Aric Stewart | a9b5052 | 2005-06-23 11:04:09 +0000 | [diff] [blame] | 3980 | |
| 3981 | if (name) |
| 3982 | { |
Mike McCormack | 4db02cd | 2005-09-15 14:58:38 +0000 | [diff] [blame] | 3983 | msi_reg_set_val_str( hkey1, name, file->FileName ); |
| 3984 | msi_reg_set_val_str( hkey2, name, file->FileName ); |
Aric Stewart | a9b5052 | 2005-06-23 11:04:09 +0000 | [diff] [blame] | 3985 | } |
| 3986 | |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 3987 | msi_free(name); |
Aric Stewart | a9b5052 | 2005-06-23 11:04:09 +0000 | [diff] [blame] | 3988 | RegCloseKey(hkey1); |
| 3989 | RegCloseKey(hkey2); |
Robert Shearman | d2e48e0 | 2006-01-23 17:29:50 +0100 | [diff] [blame] | 3990 | |
| 3991 | /* the UI chunk */ |
| 3992 | uirow = MSI_CreateRecord( 1 ); |
| 3993 | uipath = strdupW( file->TargetPath ); |
| 3994 | p = strrchrW(uipath,'\\'); |
| 3995 | if (p) p++; |
| 3996 | else p = uipath; |
| 3997 | MSI_RecordSetStringW( uirow, 1, p ); |
| 3998 | ui_actiondata( package, szRegisterFonts, uirow); |
| 3999 | msiobj_release( &uirow->hdr ); |
| 4000 | msi_free( uipath ); |
| 4001 | /* FIXME: call ui_progress? */ |
| 4002 | |
Aric Stewart | a9b5052 | 2005-06-23 11:04:09 +0000 | [diff] [blame] | 4003 | return ERROR_SUCCESS; |
| 4004 | } |
| 4005 | |
| 4006 | static UINT ACTION_RegisterFonts(MSIPACKAGE *package) |
| 4007 | { |
| 4008 | UINT rc; |
| 4009 | MSIQUERY * view; |
| 4010 | static const WCHAR ExecSeqQuery[] = |
| 4011 | {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', |
| 4012 | '`','F','o','n','t','`',0}; |
Juan Lang | 88adb53 | 2005-05-19 11:15:24 +0000 | [diff] [blame] | 4013 | |
Aric Stewart | 0af2487 | 2005-02-25 14:00:09 +0000 | [diff] [blame] | 4014 | rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view); |
| 4015 | if (rc != ERROR_SUCCESS) |
Juan Lang | 88adb53 | 2005-05-19 11:15:24 +0000 | [diff] [blame] | 4016 | { |
| 4017 | TRACE("MSI_DatabaseOpenViewW failed: %d\n", rc); |
| 4018 | return ERROR_SUCCESS; |
| 4019 | } |
Aric Stewart | 0af2487 | 2005-02-25 14:00:09 +0000 | [diff] [blame] | 4020 | |
Aric Stewart | a9b5052 | 2005-06-23 11:04:09 +0000 | [diff] [blame] | 4021 | MSI_IterateRecords(view, NULL, ITERATE_RegisterFonts, package); |
Aric Stewart | 0af2487 | 2005-02-25 14:00:09 +0000 | [diff] [blame] | 4022 | msiobj_release(&view->hdr); |
| 4023 | |
Aric Stewart | a9b5052 | 2005-06-23 11:04:09 +0000 | [diff] [blame] | 4024 | return ERROR_SUCCESS; |
Aric Stewart | 0af2487 | 2005-02-25 14:00:09 +0000 | [diff] [blame] | 4025 | } |
| 4026 | |
Aric Stewart | 072c5e5 | 2005-04-20 12:50:05 +0000 | [diff] [blame] | 4027 | static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param) |
| 4028 | { |
| 4029 | MSIPACKAGE *package = (MSIPACKAGE*)param; |
Aric Stewart | 09b0aba | 2005-06-09 20:30:59 +0000 | [diff] [blame] | 4030 | LPCWSTR compgroupid=NULL; |
| 4031 | LPCWSTR feature=NULL; |
| 4032 | LPCWSTR text = NULL; |
| 4033 | LPCWSTR qualifier = NULL; |
| 4034 | LPCWSTR component = NULL; |
Aric Stewart | 6f43c18 | 2005-05-26 12:24:28 +0000 | [diff] [blame] | 4035 | LPWSTR advertise = NULL; |
| 4036 | LPWSTR output = NULL; |
Aric Stewart | 072c5e5 | 2005-04-20 12:50:05 +0000 | [diff] [blame] | 4037 | HKEY hkey; |
| 4038 | UINT rc = ERROR_SUCCESS; |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 4039 | MSICOMPONENT *comp; |
Aric Stewart | 072c5e5 | 2005-04-20 12:50:05 +0000 | [diff] [blame] | 4040 | DWORD sz = 0; |
Robert Shearman | d2e48e0 | 2006-01-23 17:29:50 +0100 | [diff] [blame] | 4041 | MSIRECORD *uirow; |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 4042 | |
Aric Stewart | 09b0aba | 2005-06-09 20:30:59 +0000 | [diff] [blame] | 4043 | component = MSI_RecordGetString(rec,3); |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 4044 | comp = get_loaded_component(package,component); |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 4045 | |
Mike McCormack | d693f46 | 2005-10-29 11:36:48 +0000 | [diff] [blame] | 4046 | if (!ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL ) && |
| 4047 | !ACTION_VerifyComponentForAction( comp, INSTALLSTATE_SOURCE ) && |
| 4048 | !ACTION_VerifyComponentForAction( comp, INSTALLSTATE_ADVERTISED )) |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 4049 | { |
| 4050 | TRACE("Skipping: Component %s not scheduled for install\n", |
| 4051 | debugstr_w(component)); |
Aric Stewart | 6f43c18 | 2005-05-26 12:24:28 +0000 | [diff] [blame] | 4052 | |
Aric Stewart | b39d8fc | 2005-05-13 13:56:39 +0000 | [diff] [blame] | 4053 | return ERROR_SUCCESS; |
| 4054 | } |
Aric Stewart | 072c5e5 | 2005-04-20 12:50:05 +0000 | [diff] [blame] | 4055 | |
Aric Stewart | 09b0aba | 2005-06-09 20:30:59 +0000 | [diff] [blame] | 4056 | compgroupid = MSI_RecordGetString(rec,1); |
Robert Shearman | d2e48e0 | 2006-01-23 17:29:50 +0100 | [diff] [blame] | 4057 | qualifier = MSI_RecordGetString(rec,2); |
Aric Stewart | 072c5e5 | 2005-04-20 12:50:05 +0000 | [diff] [blame] | 4058 | |
| 4059 | rc = MSIREG_OpenUserComponentsKey(compgroupid, &hkey, TRUE); |
| 4060 | if (rc != ERROR_SUCCESS) |
| 4061 | goto end; |
| 4062 | |
Aric Stewart | 09b0aba | 2005-06-09 20:30:59 +0000 | [diff] [blame] | 4063 | text = MSI_RecordGetString(rec,4); |
Aric Stewart | 09b0aba | 2005-06-09 20:30:59 +0000 | [diff] [blame] | 4064 | feature = MSI_RecordGetString(rec,5); |
Aric Stewart | 072c5e5 | 2005-04-20 12:50:05 +0000 | [diff] [blame] | 4065 | |
Mike McCormack | 38d67a4 | 2005-08-22 09:15:23 +0000 | [diff] [blame] | 4066 | advertise = create_component_advertise_string(package, comp, feature); |
Aric Stewart | 072c5e5 | 2005-04-20 12:50:05 +0000 | [diff] [blame] | 4067 | |
Aric Stewart | 6f43c18 | 2005-05-26 12:24:28 +0000 | [diff] [blame] | 4068 | sz = strlenW(advertise); |
| 4069 | |
Aric Stewart | 072c5e5 | 2005-04-20 12:50:05 +0000 | [diff] [blame] | 4070 | if (text) |
| 4071 | sz += lstrlenW(text); |
Aric Stewart | 072c5e5 | 2005-04-20 12:50:05 +0000 | [diff] [blame] | 4072 | |
| 4073 | sz+=3; |
| 4074 | sz *= sizeof(WCHAR); |
| 4075 | |
Mike McCormack | 3a94011 | 2006-04-19 02:29:03 +0900 | [diff] [blame] | 4076 | output = msi_alloc_zero(sz); |
Aric Stewart | 6f43c18 | 2005-05-26 12:24:28 +0000 | [diff] [blame] | 4077 | strcpyW(output,advertise); |
Mike McCormack | 470f23d | 2005-09-22 10:56:26 +0000 | [diff] [blame] | 4078 | msi_free(advertise); |
Aric Stewart | 072c5e5 | 2005-04-20 12:50:05 +0000 | [diff] [blame] | 4079 | |
| 4080 | if (text) |
| 4081 | strcatW(output,text); |
| 4082 | |
Mike McCormack | 4db02cd | 2005-09-15 14:58:38 +0000 | [diff] [blame] | 4083 | msi_reg_set_val_multi_str( hkey, qualifier, output ); |
Aric Stewart | 072c5e5 | 2005-04-20 12:50:05 +0000 | [diff] [blame] | 4084 | |
| 4085 | end: |
| 4086 | RegCloseKey(hkey); |
Mike McCormack | ee034ba | 2005-09-20 11:59:14 +0000 | [diff] [blame] | 4087 | msi_free(output); |
Robert Shearman | d2e48e0 | 2006-01-23 17:29:50 +0100 | [diff] [blame] | 4088 | |
| 4089 | /* the UI chunk */ |
| 4090 | uirow = MSI_CreateRecord( 2 ); |
| 4091 | MSI_RecordSetStringW( uirow, 1, compgroupid ); |
| 4092 | MSI_RecordSetStringW( uirow, 2, qualifier); |
| 4093 | ui_actiondata( package, szPublishComponents, uirow); |
| 4094 | msiobj_release( &uirow->hdr ); |
| 4095 | /* FIXME: call ui_progress? */ |
| 4096 | |
Aric Stewart | 072c5e5 | 2005-04-20 12:50:05 +0000 | [diff] [blame] | 4097 | return rc; |
| 4098 | } |
| 4099 | |
| 4100 | /* |
| 4101 | * At present I am ignorning the advertised components part of this and only |
| 4102 | * focusing on the qualified component sets |
| 4103 | */ |
| 4104 | static UINT ACTION_PublishComponents(MSIPACKAGE *package) |
| 4105 | { |
| 4106 | UINT rc; |
| 4107 | MSIQUERY * view; |
| 4108 | static const WCHAR ExecSeqQuery[] = |
| 4109 | {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', |
Aric Stewart | 98e3808 | 2005-05-20 09:40:42 +0000 | [diff] [blame] | 4110 | '`','P','u','b','l','i','s','h', |
| 4111 | 'C','o','m','p','o','n','e','n','t','`',0}; |
Aric Stewart | 072c5e5 | 2005-04-20 12:50:05 +0000 | [diff] [blame] | 4112 | |
| 4113 | rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view); |
| 4114 | if (rc != ERROR_SUCCESS) |
| 4115 | return ERROR_SUCCESS; |
| 4116 | |
| 4117 | rc = MSI_IterateRecords(view, NULL, ITERATE_PublishComponent, package); |
| 4118 | msiobj_release(&view->hdr); |
| 4119 | |
| 4120 | return rc; |
| 4121 | } |
Mike McCormack | 202166c | 2005-09-23 10:09:18 +0000 | [diff] [blame] | 4122 | |
Mike McCormack | 2586a09 | 2005-09-26 09:56:18 +0000 | [diff] [blame] | 4123 | static UINT msi_unimplemented_action_stub( MSIPACKAGE *package, |
| 4124 | LPCSTR action, LPCWSTR table ) |
Mike McCormack | 567f031 | 2005-09-23 11:06:57 +0000 | [diff] [blame] | 4125 | { |
| 4126 | static const WCHAR query[] = { |
Mike McCormack | 2586a09 | 2005-09-26 09:56:18 +0000 | [diff] [blame] | 4127 | 'S','E','L','E','C','T',' ','*',' ', |
| 4128 | 'F','R','O','M',' ','`','%','s','`',0 }; |
Mike McCormack | 567f031 | 2005-09-23 11:06:57 +0000 | [diff] [blame] | 4129 | MSIQUERY *view = NULL; |
| 4130 | DWORD count = 0; |
Mike McCormack | 2586a09 | 2005-09-26 09:56:18 +0000 | [diff] [blame] | 4131 | UINT r; |
Mike McCormack | 567f031 | 2005-09-23 11:06:57 +0000 | [diff] [blame] | 4132 | |
Mike McCormack | 2586a09 | 2005-09-26 09:56:18 +0000 | [diff] [blame] | 4133 | r = MSI_OpenQuery( package->db, &view, query, table ); |
| 4134 | if (r == ERROR_SUCCESS) |
Mike McCormack | 567f031 | 2005-09-23 11:06:57 +0000 | [diff] [blame] | 4135 | { |
Mike McCormack | 2586a09 | 2005-09-26 09:56:18 +0000 | [diff] [blame] | 4136 | r = MSI_IterateRecords(view, &count, NULL, package); |
Mike McCormack | 567f031 | 2005-09-23 11:06:57 +0000 | [diff] [blame] | 4137 | msiobj_release(&view->hdr); |
| 4138 | } |
| 4139 | |
Mike McCormack | 2586a09 | 2005-09-26 09:56:18 +0000 | [diff] [blame] | 4140 | if (count) |
| 4141 | FIXME("%s -> %lu ignored %s table values\n", |
| 4142 | action, count, debugstr_w(table)); |
| 4143 | |
Mike McCormack | 567f031 | 2005-09-23 11:06:57 +0000 | [diff] [blame] | 4144 | return ERROR_SUCCESS; |
| 4145 | } |
Mike McCormack | 94fbe09 | 2005-09-23 17:21:10 +0000 | [diff] [blame] | 4146 | |
Mike McCormack | 5594270 | 2005-10-30 19:23:28 +0000 | [diff] [blame] | 4147 | static UINT ACTION_AllocateRegistrySpace( MSIPACKAGE *package ) |
| 4148 | { |
| 4149 | TRACE("%p\n", package); |
| 4150 | return ERROR_SUCCESS; |
| 4151 | } |
| 4152 | |
Mike McCormack | 2586a09 | 2005-09-26 09:56:18 +0000 | [diff] [blame] | 4153 | static UINT ACTION_RemoveIniValues( MSIPACKAGE *package ) |
Mike McCormack | 94fbe09 | 2005-09-23 17:21:10 +0000 | [diff] [blame] | 4154 | { |
Mike McCormack | 2586a09 | 2005-09-26 09:56:18 +0000 | [diff] [blame] | 4155 | static const WCHAR table[] = |
| 4156 | {'R','e','m','o','v','e','I','n','i','F','i','l','e',0 }; |
| 4157 | return msi_unimplemented_action_stub( package, "RemoveIniValues", table ); |
Mike McCormack | 94fbe09 | 2005-09-23 17:21:10 +0000 | [diff] [blame] | 4158 | } |
Mike McCormack | b9a3a7a | 2005-09-25 15:14:03 +0000 | [diff] [blame] | 4159 | |
Mike McCormack | 2586a09 | 2005-09-26 09:56:18 +0000 | [diff] [blame] | 4160 | static UINT ACTION_MoveFiles( MSIPACKAGE *package ) |
Mike McCormack | b9a3a7a | 2005-09-25 15:14:03 +0000 | [diff] [blame] | 4161 | { |
Mike McCormack | 2586a09 | 2005-09-26 09:56:18 +0000 | [diff] [blame] | 4162 | static const WCHAR table[] = { 'M','o','v','e','F','i','l','e',0 }; |
| 4163 | return msi_unimplemented_action_stub( package, "MoveFiles", table ); |
| 4164 | } |
| 4165 | |
| 4166 | static UINT ACTION_PatchFiles( MSIPACKAGE *package ) |
| 4167 | { |
| 4168 | static const WCHAR table[] = { 'P','a','t','c','h',0 }; |
| 4169 | return msi_unimplemented_action_stub( package, "PatchFiles", table ); |
| 4170 | } |
| 4171 | |
| 4172 | static UINT ACTION_BindImage( MSIPACKAGE *package ) |
| 4173 | { |
| 4174 | static const WCHAR table[] = { 'B','i','n','d','I','m','a','g','e',0 }; |
| 4175 | return msi_unimplemented_action_stub( package, "BindImage", table ); |
| 4176 | } |
| 4177 | |
| 4178 | static UINT ACTION_IsolateComponents( MSIPACKAGE *package ) |
| 4179 | { |
| 4180 | static const WCHAR table[] = { |
Mike McCormack | b9a3a7a | 2005-09-25 15:14:03 +0000 | [diff] [blame] | 4181 | 'I','s','o','l','a','t','e','C','o','m','p','o','n','e','n','t',0 }; |
Mike McCormack | 2586a09 | 2005-09-26 09:56:18 +0000 | [diff] [blame] | 4182 | return msi_unimplemented_action_stub( package, "IsolateComponents", table ); |
| 4183 | } |
Mike McCormack | b9a3a7a | 2005-09-25 15:14:03 +0000 | [diff] [blame] | 4184 | |
Mike McCormack | 2586a09 | 2005-09-26 09:56:18 +0000 | [diff] [blame] | 4185 | static UINT ACTION_MigrateFeatureStates( MSIPACKAGE *package ) |
| 4186 | { |
| 4187 | static const WCHAR table[] = { 'U','p','g','r','a','d','e',0 }; |
| 4188 | return msi_unimplemented_action_stub( package, "MigrateFeatureStates", table ); |
| 4189 | } |
| 4190 | |
| 4191 | static UINT ACTION_SelfUnregModules( MSIPACKAGE *package ) |
| 4192 | { |
| 4193 | static const WCHAR table[] = { 'S','e','l','f','R','e','g',0 }; |
| 4194 | return msi_unimplemented_action_stub( package, "SelfUnregModules", table ); |
| 4195 | } |
| 4196 | |
| 4197 | static UINT ACTION_InstallServices( MSIPACKAGE *package ) |
| 4198 | { |
| 4199 | static const WCHAR table[] = { |
| 4200 | 'S','e','r','v','i','c','e','I','n','s','t','a','l','l',0 }; |
| 4201 | return msi_unimplemented_action_stub( package, "InstallServices", table ); |
| 4202 | } |
| 4203 | |
| 4204 | static UINT ACTION_StartServices( MSIPACKAGE *package ) |
| 4205 | { |
| 4206 | static const WCHAR table[] = { |
| 4207 | 'S','e','r','v','i','c','e','C','o','n','t','r','o','l',0 }; |
| 4208 | return msi_unimplemented_action_stub( package, "StartServices", table ); |
| 4209 | } |
| 4210 | |
| 4211 | static UINT ACTION_StopServices( MSIPACKAGE *package ) |
| 4212 | { |
| 4213 | static const WCHAR table[] = { |
| 4214 | 'S','e','r','v','i','c','e','C','o','n','t','r','o','l',0 }; |
| 4215 | return msi_unimplemented_action_stub( package, "StopServices", table ); |
| 4216 | } |
| 4217 | |
| 4218 | static UINT ACTION_DeleteServices( MSIPACKAGE *package ) |
| 4219 | { |
| 4220 | static const WCHAR table[] = { |
| 4221 | 'S','e','r','v','i','c','e','C','o','n','t','r','o','l',0 }; |
| 4222 | return msi_unimplemented_action_stub( package, "DeleteServices", table ); |
Mike McCormack | b9a3a7a | 2005-09-25 15:14:03 +0000 | [diff] [blame] | 4223 | } |
Mike McCormack | 3b95515 | 2005-09-28 18:10:44 +0000 | [diff] [blame] | 4224 | |
| 4225 | static UINT ACTION_WriteEnvironmentStrings( MSIPACKAGE *package ) |
| 4226 | { |
| 4227 | static const WCHAR table[] = { |
| 4228 | 'E','n','v','i','r','o','n','m','e','n','t',0 }; |
| 4229 | return msi_unimplemented_action_stub( package, "WriteEnvironmentStrings", table ); |
| 4230 | } |
| 4231 | |
| 4232 | static UINT ACTION_RemoveEnvironmentStrings( MSIPACKAGE *package ) |
| 4233 | { |
| 4234 | static const WCHAR table[] = { |
| 4235 | 'E','n','v','i','r','o','n','m','e','n','t',0 }; |
| 4236 | return msi_unimplemented_action_stub( package, "RemoveEnvironmentStrings", table ); |
| 4237 | } |
| 4238 | |
| 4239 | static UINT ACTION_MsiPublishAssemblies( MSIPACKAGE *package ) |
| 4240 | { |
| 4241 | static const WCHAR table[] = { |
| 4242 | 'M','s','i','A','s','s','e','m','b','l','y',0 }; |
| 4243 | return msi_unimplemented_action_stub( package, "MsiPublishAssemblies", table ); |
| 4244 | } |
| 4245 | |
| 4246 | static UINT ACTION_MsiUnpublishAssemblies( MSIPACKAGE *package ) |
| 4247 | { |
| 4248 | static const WCHAR table[] = { |
| 4249 | 'M','s','i','A','s','s','e','m','b','l','y',0 }; |
| 4250 | return msi_unimplemented_action_stub( package, "MsiUnpublishAssemblies", table ); |
| 4251 | } |
| 4252 | |
| 4253 | static UINT ACTION_UnregisterFonts( MSIPACKAGE *package ) |
| 4254 | { |
| 4255 | static const WCHAR table[] = { 'F','o','n','t',0 }; |
| 4256 | return msi_unimplemented_action_stub( package, "UnregisterFonts", table ); |
| 4257 | } |
| 4258 | |
Mike McCormack | f24a9e2 | 2005-12-31 13:14:23 +0100 | [diff] [blame] | 4259 | static UINT ACTION_CCPSearch( MSIPACKAGE *package ) |
| 4260 | { |
| 4261 | static const WCHAR table[] = { 'C','C','P','S','e','a','r','c','h',0 }; |
| 4262 | return msi_unimplemented_action_stub( package, "CCPSearch", table ); |
| 4263 | } |
| 4264 | |
| 4265 | static UINT ACTION_RMCCPSearch( MSIPACKAGE *package ) |
| 4266 | { |
| 4267 | static const WCHAR table[] = { 'C','C','P','S','e','a','r','c','h',0 }; |
| 4268 | return msi_unimplemented_action_stub( package, "RMCCPSearch", table ); |
| 4269 | } |
| 4270 | |
Mike McCormack | 8860366 | 2006-03-22 23:01:56 +0900 | [diff] [blame] | 4271 | static UINT ACTION_RegisterComPlus( MSIPACKAGE *package ) |
| 4272 | { |
| 4273 | static const WCHAR table[] = { 'C','o','m','p','l','u','s',0 }; |
| 4274 | return msi_unimplemented_action_stub( package, "RegisterComPlus", table ); |
| 4275 | } |
| 4276 | |
| 4277 | static UINT ACTION_UnregisterComPlus( MSIPACKAGE *package ) |
| 4278 | { |
| 4279 | static const WCHAR table[] = { 'C','o','m','p','l','u','s',0 }; |
| 4280 | return msi_unimplemented_action_stub( package, "UnregisterComPlus", table ); |
| 4281 | } |
| 4282 | |
Mike McCormack | 3b95515 | 2005-09-28 18:10:44 +0000 | [diff] [blame] | 4283 | static struct _actions StandardActions[] = { |
Mike McCormack | 5594270 | 2005-10-30 19:23:28 +0000 | [diff] [blame] | 4284 | { szAllocateRegistrySpace, ACTION_AllocateRegistrySpace }, |
Mike McCormack | 3b95515 | 2005-09-28 18:10:44 +0000 | [diff] [blame] | 4285 | { szAppSearch, ACTION_AppSearch }, |
| 4286 | { szBindImage, ACTION_BindImage }, |
Mike McCormack | f24a9e2 | 2005-12-31 13:14:23 +0100 | [diff] [blame] | 4287 | { szCCPSearch, ACTION_CCPSearch}, |
Mike McCormack | 3b95515 | 2005-09-28 18:10:44 +0000 | [diff] [blame] | 4288 | { szCostFinalize, ACTION_CostFinalize }, |
| 4289 | { szCostInitialize, ACTION_CostInitialize }, |
| 4290 | { szCreateFolders, ACTION_CreateFolders }, |
| 4291 | { szCreateShortcuts, ACTION_CreateShortcuts }, |
| 4292 | { szDeleteServices, ACTION_DeleteServices }, |
| 4293 | { szDisableRollback, NULL}, |
| 4294 | { szDuplicateFiles, ACTION_DuplicateFiles }, |
| 4295 | { szExecuteAction, ACTION_ExecuteAction }, |
| 4296 | { szFileCost, ACTION_FileCost }, |
| 4297 | { szFindRelatedProducts, ACTION_FindRelatedProducts }, |
| 4298 | { szForceReboot, ACTION_ForceReboot }, |
| 4299 | { szInstallAdminPackage, NULL}, |
| 4300 | { szInstallExecute, ACTION_InstallExecute }, |
| 4301 | { szInstallExecuteAgain, ACTION_InstallExecute }, |
| 4302 | { szInstallFiles, ACTION_InstallFiles}, |
| 4303 | { szInstallFinalize, ACTION_InstallFinalize }, |
| 4304 | { szInstallInitialize, ACTION_InstallInitialize }, |
| 4305 | { szInstallSFPCatalogFile, NULL}, |
| 4306 | { szInstallValidate, ACTION_InstallValidate }, |
| 4307 | { szIsolateComponents, ACTION_IsolateComponents }, |
| 4308 | { szLaunchConditions, ACTION_LaunchConditions }, |
| 4309 | { szMigrateFeatureStates, ACTION_MigrateFeatureStates }, |
| 4310 | { szMoveFiles, ACTION_MoveFiles }, |
| 4311 | { szMsiPublishAssemblies, ACTION_MsiPublishAssemblies }, |
| 4312 | { szMsiUnpublishAssemblies, ACTION_MsiUnpublishAssemblies }, |
| 4313 | { szInstallODBC, NULL}, |
| 4314 | { szInstallServices, ACTION_InstallServices }, |
| 4315 | { szPatchFiles, ACTION_PatchFiles }, |
| 4316 | { szProcessComponents, ACTION_ProcessComponents }, |
| 4317 | { szPublishComponents, ACTION_PublishComponents }, |
| 4318 | { szPublishFeatures, ACTION_PublishFeatures }, |
| 4319 | { szPublishProduct, ACTION_PublishProduct }, |
| 4320 | { szRegisterClassInfo, ACTION_RegisterClassInfo }, |
Mike McCormack | 8860366 | 2006-03-22 23:01:56 +0900 | [diff] [blame] | 4321 | { szRegisterComPlus, ACTION_RegisterComPlus}, |
Mike McCormack | 3b95515 | 2005-09-28 18:10:44 +0000 | [diff] [blame] | 4322 | { szRegisterExtensionInfo, ACTION_RegisterExtensionInfo }, |
| 4323 | { szRegisterFonts, ACTION_RegisterFonts }, |
| 4324 | { szRegisterMIMEInfo, ACTION_RegisterMIMEInfo }, |
| 4325 | { szRegisterProduct, ACTION_RegisterProduct }, |
| 4326 | { szRegisterProgIdInfo, ACTION_RegisterProgIdInfo }, |
| 4327 | { szRegisterTypeLibraries, ACTION_RegisterTypeLibraries }, |
| 4328 | { szRegisterUser, ACTION_RegisterUser}, |
| 4329 | { szRemoveDuplicateFiles, NULL}, |
| 4330 | { szRemoveEnvironmentStrings, ACTION_RemoveEnvironmentStrings }, |
| 4331 | { szRemoveExistingProducts, NULL}, |
Mike McCormack | fd4a200 | 2005-11-02 11:42:56 +0000 | [diff] [blame] | 4332 | { szRemoveFiles, ACTION_RemoveFiles}, |
Mike McCormack | 3b95515 | 2005-09-28 18:10:44 +0000 | [diff] [blame] | 4333 | { szRemoveFolders, NULL}, |
| 4334 | { szRemoveIniValues, ACTION_RemoveIniValues }, |
| 4335 | { szRemoveODBC, NULL}, |
| 4336 | { szRemoveRegistryValues, NULL}, |
| 4337 | { szRemoveShortcuts, NULL}, |
| 4338 | { szResolveSource, ACTION_ResolveSource}, |
Mike McCormack | f24a9e2 | 2005-12-31 13:14:23 +0100 | [diff] [blame] | 4339 | { szRMCCPSearch, ACTION_RMCCPSearch}, |
Mike McCormack | 3b95515 | 2005-09-28 18:10:44 +0000 | [diff] [blame] | 4340 | { szScheduleReboot, NULL}, |
| 4341 | { szSelfRegModules, ACTION_SelfRegModules }, |
| 4342 | { szSelfUnregModules, ACTION_SelfUnregModules }, |
| 4343 | { szSetODBCFolders, NULL}, |
| 4344 | { szStartServices, ACTION_StartServices }, |
| 4345 | { szStopServices, ACTION_StopServices }, |
| 4346 | { szUnpublishComponents, NULL}, |
| 4347 | { szUnpublishFeatures, NULL}, |
| 4348 | { szUnregisterClassInfo, NULL}, |
Mike McCormack | 8860366 | 2006-03-22 23:01:56 +0900 | [diff] [blame] | 4349 | { szUnregisterComPlus, ACTION_UnregisterComPlus}, |
Mike McCormack | 3b95515 | 2005-09-28 18:10:44 +0000 | [diff] [blame] | 4350 | { szUnregisterExtensionInfo, NULL}, |
| 4351 | { szUnregisterFonts, ACTION_UnregisterFonts }, |
| 4352 | { szUnregisterMIMEInfo, NULL}, |
| 4353 | { szUnregisterProgIdInfo, NULL}, |
| 4354 | { szUnregisterTypeLibraries, NULL}, |
| 4355 | { szValidateProductID, NULL}, |
| 4356 | { szWriteEnvironmentStrings, ACTION_WriteEnvironmentStrings }, |
| 4357 | { szWriteIniValues, ACTION_WriteIniValues }, |
| 4358 | { szWriteRegistryValues, ACTION_WriteRegistryValues}, |
| 4359 | { NULL, NULL}, |
| 4360 | }; |