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