msi: Add a stub implementation of MsiSourceListClearAll.
[wine] / dlls / 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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 SourceLongPath;
82     LPWSTR SourceShortPath;
83
84     LPWSTR ResolvedTarget;
85     LPWSTR ResolvedSource;
86     LPWSTR Property;   /* initially set property */
87     struct tagMSIFOLDER *Parent;
88     INT   State;
89         /* 0 = uninitialized */
90         /* 1 = existing */
91         /* 2 = created remove if empty */
92         /* 3 = created persist if empty */
93     INT   Cost;
94     INT   Space;
95 } MSIFOLDER;
96
97 typedef enum _msi_file_state {
98     msifs_invalid,
99     msifs_missing,
100     msifs_overwrite,
101     msifs_present,
102     msifs_installed,
103     msifs_skipped,
104 } msi_file_state;
105
106 typedef struct tagMSIFILE
107 {
108     struct list entry;
109     LPWSTR File;
110     MSICOMPONENT *Component;
111     LPWSTR FileName;
112     LPWSTR ShortName;
113     LPWSTR LongName;
114     INT FileSize;
115     LPWSTR Version;
116     LPWSTR Language;
117     INT Attributes;
118     INT Sequence;   
119     msi_file_state state;
120     LPWSTR  SourcePath;
121     LPWSTR  TargetPath;
122 } MSIFILE;
123
124 typedef struct tagMSITEMPFILE
125 {
126     struct list entry;
127     LPWSTR File;
128     LPWSTR Path;
129 } MSITEMPFILE;
130
131 typedef struct tagMSIAPPID
132 {
133     struct list entry;
134     LPWSTR AppID; /* Primary key */
135     LPWSTR RemoteServerName;
136     LPWSTR LocalServer;
137     LPWSTR ServiceParameters;
138     LPWSTR DllSurrogate;
139     BOOL ActivateAtStorage;
140     BOOL RunAsInteractiveUser;
141 } MSIAPPID;
142
143 typedef struct tagMSIPROGID MSIPROGID;
144
145 typedef struct tagMSICLASS
146 {
147     struct list entry;
148     LPWSTR clsid;     /* Primary Key */
149     LPWSTR Context;   /* Primary Key */
150     MSICOMPONENT *Component;
151     MSIPROGID *ProgID;
152     LPWSTR ProgIDText;
153     LPWSTR Description;
154     MSIAPPID *AppID;
155     LPWSTR FileTypeMask;
156     LPWSTR IconPath;
157     LPWSTR DefInprocHandler;
158     LPWSTR DefInprocHandler32;
159     LPWSTR Argument;
160     MSIFEATURE *Feature;
161     INT Attributes;
162     /* not in the table, set during installation */
163     BOOL Installed;
164 } MSICLASS;
165
166 typedef struct tagMSIMIME MSIMIME;
167
168 typedef struct tagMSIEXTENSION
169 {
170     struct list entry;
171     LPWSTR Extension;  /* Primary Key */
172     MSICOMPONENT *Component;
173     MSIPROGID *ProgID;
174     LPWSTR ProgIDText;
175     MSIMIME *Mime;
176     MSIFEATURE *Feature;
177     /* not in the table, set during installation */
178     BOOL Installed;
179     struct list verbs;
180 } MSIEXTENSION;
181
182 struct tagMSIPROGID
183 {
184     struct list entry;
185     LPWSTR ProgID;  /* Primary Key */
186     MSIPROGID *Parent;
187     MSICLASS *Class;
188     LPWSTR Description;
189     LPWSTR IconPath;
190     /* not in the table, set during installation */
191     BOOL InstallMe;
192     MSIPROGID *CurVer;
193     MSIPROGID *VersionInd;
194 };
195
196 typedef struct tagMSIVERB
197 {
198     struct list entry;
199     LPWSTR Verb;
200     INT Sequence;
201     LPWSTR Command;
202     LPWSTR Argument;
203 } MSIVERB;
204
205 struct tagMSIMIME
206 {
207     struct list entry;
208     LPWSTR ContentType;  /* Primary Key */
209     MSIEXTENSION *Extension;
210     LPWSTR clsid;
211     MSICLASS *Class;
212     /* not in the table, set during installation */
213     BOOL InstallMe;
214 };
215
216 enum SCRIPTS {
217         INSTALL_SCRIPT = 0,
218         COMMIT_SCRIPT = 1,
219         ROLLBACK_SCRIPT = 2,
220         TOTAL_SCRIPTS = 3
221 };
222
223 #define SEQUENCE_UI       0x1
224 #define SEQUENCE_EXEC     0x2
225 #define SEQUENCE_INSTALL  0x10
226
227 typedef struct tagMSISCRIPT
228 {
229     LPWSTR  *Actions[TOTAL_SCRIPTS];
230     UINT    ActionCount[TOTAL_SCRIPTS];
231     BOOL    ExecuteSequenceRun;
232     BOOL    CurrentlyScripting;
233     UINT    InWhatSequence;
234     LPWSTR  *UniqueActions;
235     UINT    UniqueActionsCount;
236 } MSISCRIPT;
237
238
239 extern UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, BOOL force);
240 extern UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action);
241 extern void ACTION_FinishCustomActions( MSIPACKAGE* package);
242 extern UINT ACTION_CustomAction(MSIPACKAGE *package,const WCHAR *action, BOOL execute);
243
244 /* actions in other modules */
245 extern UINT ACTION_AppSearch(MSIPACKAGE *package);
246 extern UINT ACTION_FindRelatedProducts(MSIPACKAGE *package);
247 extern UINT ACTION_InstallFiles(MSIPACKAGE *package);
248 extern UINT ACTION_RemoveFiles(MSIPACKAGE *package);
249 extern UINT ACTION_DuplicateFiles(MSIPACKAGE *package);
250 extern UINT ACTION_RegisterClassInfo(MSIPACKAGE *package);
251 extern UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package);
252 extern UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package);
253 extern UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package);
254
255
256 /* Helpers */
257 extern DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data );
258 extern LPWSTR msi_dup_record_field(MSIRECORD *row, INT index);
259 extern LPWSTR msi_dup_property(MSIPACKAGE *package, LPCWSTR prop);
260 extern int msi_get_property_int( MSIPACKAGE *package, LPCWSTR prop, int def );
261 extern LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source, 
262                       BOOL set_prop, MSIFOLDER **folder);
263 extern MSICOMPONENT *get_loaded_component( MSIPACKAGE* package, LPCWSTR Component );
264 extern MSIFEATURE *get_loaded_feature( MSIPACKAGE* package, LPCWSTR Feature );
265 extern MSIFILE *get_loaded_file( MSIPACKAGE* package, LPCWSTR file );
266 extern MSIFOLDER *get_loaded_folder( MSIPACKAGE *package, LPCWSTR dir );
267 extern int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path);
268 extern UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action);
269 extern LPWSTR build_icon_path(MSIPACKAGE *, LPCWSTR);
270 extern LPWSTR build_directory_name(DWORD , ...);
271 extern BOOL create_full_pathW(const WCHAR *path);
272 extern BOOL ACTION_VerifyComponentForAction(MSICOMPONENT*, INSTALLSTATE);
273 extern BOOL ACTION_VerifyFeatureForAction(MSIFEATURE*, INSTALLSTATE);
274 extern void reduce_to_longfilename(WCHAR*);
275 extern void reduce_to_shortfilename(WCHAR*);
276 extern LPWSTR create_component_advertise_string(MSIPACKAGE*, MSICOMPONENT*, LPCWSTR);
277 extern void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature);
278 extern UINT register_unique_action(MSIPACKAGE *, LPCWSTR);
279 extern BOOL check_unique_action(MSIPACKAGE *, LPCWSTR);
280 extern WCHAR* generate_error_string(MSIPACKAGE *, UINT, DWORD, ... );
281 extern UINT msi_create_component_directories( MSIPACKAGE *package );
282
283
284 /* control event stuff */
285 extern VOID ControlEvent_FireSubscribedEvent(MSIPACKAGE *package, LPCWSTR event,
286                                       MSIRECORD *data);
287 extern VOID ControlEvent_CleanupSubscriptions(MSIPACKAGE *package);
288 extern VOID ControlEvent_SubscribeToEvent(MSIPACKAGE *package, LPCWSTR event,
289                                    LPCWSTR control, LPCWSTR attribute);
290 extern VOID ControlEvent_UnSubscribeToEvent( MSIPACKAGE *package, LPCWSTR event,
291                                       LPCWSTR control, LPCWSTR attribute );
292
293 /* User Interface messages from the actions */
294 extern void ui_progress(MSIPACKAGE *, int, int, int, int);
295 extern void ui_actiondata(MSIPACKAGE *, LPCWSTR, MSIRECORD *);
296
297
298 /* string consts use a number of places  and defined in helpers.c*/
299 extern const WCHAR cszSourceDir[];
300 extern const WCHAR szProductCode[];
301 extern const WCHAR cszRootDrive[];
302 extern const WCHAR cszbs[];
303
304 #endif /* __MSI_ACTION_H__ */