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