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