d2e03e2af7f647982c0900aaead5527bbea76044
[reactos.git] / reactos / lib / msi / action.h
1 /*
2 * Common prototypes for Action handlers
3 *
4 * Copyright 2005 Aric Stewart for CodeWeavers
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
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #ifndef __MSI_ACTION_H__
22 #define __MSI_ACTION_H__
23
24 #include "wine/list.h"
25
26 typedef struct tagMSIFEATURE
27 {
28 struct list entry;
29 LPWSTR Feature;
30 LPWSTR Feature_Parent;
31 LPWSTR Title;
32 LPWSTR Description;
33 INT Display;
34 INT Level;
35 LPWSTR Directory;
36 INT Attributes;
37
38 INSTALLSTATE Installed;
39 INSTALLSTATE ActionRequest;
40 INSTALLSTATE Action;
41
42 struct list Components;
43
44 INT Cost;
45 } MSIFEATURE;
46
47 typedef struct tagMSICOMPONENT
48 {
49 struct list entry;
50 DWORD magic;
51 LPWSTR Component;
52 LPWSTR ComponentId;
53 LPWSTR Directory;
54 INT Attributes;
55 LPWSTR Condition;
56 LPWSTR KeyPath;
57
58 INSTALLSTATE Installed;
59 INSTALLSTATE ActionRequest;
60 INSTALLSTATE Action;
61
62 BOOL Enabled;
63 INT Cost;
64 INT RefCount;
65
66 LPWSTR FullKeypath;
67 LPWSTR AdvertiseString;
68 } MSICOMPONENT;
69
70 typedef struct tagComponentList
71 {
72 struct list entry;
73 MSICOMPONENT *component;
74 } ComponentList;
75
76 typedef struct tagMSIFOLDER
77 {
78 struct list entry;
79 LPWSTR Directory;
80 LPWSTR TargetDefault;
81 LPWSTR SourceDefault;
82
83 LPWSTR ResolvedTarget;
84 LPWSTR ResolvedSource;
85 LPWSTR Property; /* initially set property */
86 struct tagMSIFOLDER *Parent;
87 INT State;
88 /* 0 = uninitialized */
89 /* 1 = existing */
90 /* 2 = created remove if empty */
91 /* 3 = created persist if empty */
92 INT Cost;
93 INT Space;
94 } MSIFOLDER;
95
96 typedef struct tagMSIFILE
97 {
98 struct list entry;
99 LPWSTR File;
100 MSICOMPONENT *Component;
101 LPWSTR FileName;
102 LPWSTR ShortName;
103 INT FileSize;
104 LPWSTR Version;
105 LPWSTR Language;
106 INT Attributes;
107 INT Sequence;
108
109 INT State;
110 /* 0 = uninitialize */
111 /* 1 = not present */
112 /* 2 = present but replace */
113 /* 3 = present do not replace */
114 /* 4 = Installed */
115 /* 5 = Skipped */
116 LPWSTR SourcePath;
117 LPWSTR TargetPath;
118 } MSIFILE;
119
120 typedef struct tagMSITEMPFILE
121 {
122 struct list entry;
123 LPWSTR File;
124 LPWSTR Path;
125 } MSITEMPFILE;
126
127 typedef struct tagMSIAPPID
128 {
129 struct list entry;
130 LPWSTR AppID; /* Primary key */
131 LPWSTR RemoteServerName;
132 LPWSTR LocalServer;
133 LPWSTR ServiceParameters;
134 LPWSTR DllSurrogate;
135 BOOL ActivateAtStorage;
136 BOOL RunAsInteractiveUser;
137 } MSIAPPID;
138
139 typedef struct tagMSIPROGID MSIPROGID;
140
141 typedef struct tagMSICLASS
142 {
143 struct list entry;
144 LPWSTR clsid; /* Primary Key */
145 LPWSTR Context; /* Primary Key */
146 MSICOMPONENT *Component;
147 MSIPROGID *ProgID;
148 LPWSTR ProgIDText;
149 LPWSTR Description;
150 MSIAPPID *AppID;
151 LPWSTR FileTypeMask;
152 LPWSTR IconPath;
153 LPWSTR DefInprocHandler;
154 LPWSTR DefInprocHandler32;
155 LPWSTR Argument;
156 MSIFEATURE *Feature;
157 INT Attributes;
158 /* not in the table, set during installation */
159 BOOL Installed;
160 } MSICLASS;
161
162 typedef struct tagMSIMIME MSIMIME;
163
164 typedef struct tagMSIEXTENSION
165 {
166 struct list entry;
167 LPWSTR Extension; /* Primary Key */
168 MSICOMPONENT *Component;
169 MSIPROGID *ProgID;
170 LPWSTR ProgIDText;
171 MSIMIME *Mime;
172 MSIFEATURE *Feature;
173 /* not in the table, set during installation */
174 BOOL Installed;
175 struct list verbs;
176 } MSIEXTENSION;
177
178 struct tagMSIPROGID
179 {
180 struct list entry;
181 LPWSTR ProgID; /* Primary Key */
182 MSIPROGID *Parent;
183 MSICLASS *Class;
184 LPWSTR Description;
185 LPWSTR IconPath;
186 /* not in the table, set during installation */
187 BOOL InstallMe;
188 MSIPROGID *CurVer;
189 MSIPROGID *VersionInd;
190 };
191
192 typedef struct tagMSIVERB
193 {
194 struct list entry;
195 LPWSTR Verb;
196 INT Sequence;
197 LPWSTR Command;
198 LPWSTR Argument;
199 } MSIVERB;
200
201 struct tagMSIMIME
202 {
203 struct list entry;
204 LPWSTR ContentType; /* Primary Key */
205 MSIEXTENSION *Extension;
206 LPWSTR clsid;
207 MSICLASS *Class;
208 /* not in the table, set during installation */
209 BOOL InstallMe;
210 };
211
212 enum SCRIPTS {
213 INSTALL_SCRIPT = 0,
214 COMMIT_SCRIPT = 1,
215 ROLLBACK_SCRIPT = 2,
216 TOTAL_SCRIPTS = 3
217 };
218
219 #define SEQUENCE_UI 0x1
220 #define SEQUENCE_EXEC 0x2
221 #define SEQUENCE_INSTALL 0x10
222
223 typedef struct tagMSISCRIPT
224 {
225 LPWSTR *Actions[TOTAL_SCRIPTS];
226 UINT ActionCount[TOTAL_SCRIPTS];
227 BOOL ExecuteSequenceRun;
228 BOOL CurrentlyScripting;
229 UINT InWhatSequence;
230 LPWSTR *UniqueActions;
231 UINT UniqueActionsCount;
232 } MSISCRIPT;
233
234
235 extern UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, BOOL force);
236 extern UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action);
237 extern void ACTION_FinishCustomActions( MSIPACKAGE* package);
238 extern UINT ACTION_CustomAction(MSIPACKAGE *package,const WCHAR *action, BOOL execute);
239
240 /* actions in other modules */
241 extern UINT ACTION_AppSearch(MSIPACKAGE *package);
242 extern UINT ACTION_FindRelatedProducts(MSIPACKAGE *package);
243 extern UINT ACTION_InstallFiles(MSIPACKAGE *package);
244 extern UINT ACTION_DuplicateFiles(MSIPACKAGE *package);
245 extern UINT ACTION_RegisterClassInfo(MSIPACKAGE *package);
246 extern UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package);
247 extern UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package);
248 extern UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package);
249
250
251 /* Helpers */
252 extern DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data );
253 extern WCHAR *load_dynamic_stringW(MSIRECORD *row, INT index);
254 extern LPWSTR msi_dup_property(MSIPACKAGE *package, LPCWSTR prop);
255 extern LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
256 BOOL set_prop, MSIFOLDER **folder);
257 extern MSICOMPONENT *get_loaded_component( MSIPACKAGE* package, LPCWSTR Component );
258 extern MSIFEATURE *get_loaded_feature( MSIPACKAGE* package, LPCWSTR Feature );
259 extern MSIFILE *get_loaded_file( MSIPACKAGE* package, LPCWSTR file );
260 extern MSIFOLDER *get_loaded_folder( MSIPACKAGE *package, LPCWSTR dir );
261 extern int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path);
262 extern UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action);
263 extern LPWSTR build_icon_path(MSIPACKAGE *, LPCWSTR);
264 extern DWORD build_version_dword(LPCWSTR);
265 extern LPWSTR build_directory_name(DWORD , ...);
266 extern BOOL create_full_pathW(const WCHAR *path);
267 extern BOOL ACTION_VerifyComponentForAction(MSIPACKAGE*, MSICOMPONENT*, INSTALLSTATE);
268 extern BOOL ACTION_VerifyFeatureForAction(MSIFEATURE*, INSTALLSTATE);
269 extern void reduce_to_longfilename(WCHAR*);
270 extern void reduce_to_shortfilename(WCHAR*);
271 extern LPWSTR create_component_advertise_string(MSIPACKAGE*, MSICOMPONENT*, LPCWSTR);
272 extern void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature);
273 extern UINT register_unique_action(MSIPACKAGE *, LPCWSTR);
274 extern BOOL check_unique_action(MSIPACKAGE *, LPCWSTR);
275 extern WCHAR* generate_error_string(MSIPACKAGE *, UINT, DWORD, ... );
276
277
278 /* control event stuff */
279 extern VOID ControlEvent_FireSubscribedEvent(MSIPACKAGE *package, LPCWSTR event,
280 MSIRECORD *data);
281 extern VOID ControlEvent_CleanupSubscriptions(MSIPACKAGE *package);
282 extern VOID ControlEvent_SubscribeToEvent(MSIPACKAGE *package, LPCWSTR event,
283 LPCWSTR control, LPCWSTR attribute);
284 extern VOID ControlEvent_UnSubscribeToEvent( MSIPACKAGE *package, LPCWSTR event,
285 LPCWSTR control, LPCWSTR attribute );
286
287 /* User Interface messages from the actions */
288 extern void ui_progress(MSIPACKAGE *, int, int, int, int);
289 extern void ui_actiondata(MSIPACKAGE *, LPCWSTR, MSIRECORD *);
290
291
292 /* string consts use a number of places and defined in helpers.c*/
293 extern const WCHAR cszSourceDir[];
294 extern const WCHAR szProductCode[];
295 extern const WCHAR cszRootDrive[];
296 extern const WCHAR cszbs[];
297
298 #endif /* __MSI_ACTION_H__ */