Break out all the file related actions and helper functions into
[wine/multimedia.git] / dlls / msi / action.h
blob9c472a53f157ca1dac8b7305cf98dfaf8a58c38e
1 /*
2 * Common prototypes for Action handlers
4 * Copyright 2005 Aric Stewart for CodeWeavers
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.
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.
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
21 #define IDENTIFIER_SIZE 96
23 typedef struct tagMSIFEATURE
25 WCHAR Feature[IDENTIFIER_SIZE];
26 WCHAR Feature_Parent[IDENTIFIER_SIZE];
27 WCHAR Title[0x100];
28 WCHAR Description[0x100];
29 INT Display;
30 INT Level;
31 WCHAR Directory[IDENTIFIER_SIZE];
32 INT Attributes;
34 INSTALLSTATE Installed;
35 INSTALLSTATE ActionRequest;
36 INSTALLSTATE Action;
38 INT ComponentCount;
39 INT Components[1024]; /* yes hardcoded limit.... I am bad */
40 INT Cost;
41 } MSIFEATURE;
43 typedef struct tagMSICOMPONENT
45 WCHAR Component[IDENTIFIER_SIZE];
46 WCHAR ComponentId[IDENTIFIER_SIZE];
47 WCHAR Directory[IDENTIFIER_SIZE];
48 INT Attributes;
49 WCHAR Condition[0x100];
50 WCHAR KeyPath[IDENTIFIER_SIZE];
52 INSTALLSTATE Installed;
53 INSTALLSTATE ActionRequest;
54 INSTALLSTATE Action;
56 BOOL Enabled;
57 INT Cost;
58 INT RefCount;
60 LPWSTR FullKeypath;
61 LPWSTR AdvertiseString;
62 } MSICOMPONENT;
64 typedef struct tagMSIFOLDER
66 LPWSTR Directory;
67 LPWSTR TargetDefault;
68 LPWSTR SourceDefault;
70 LPWSTR ResolvedTarget;
71 LPWSTR ResolvedSource;
72 LPWSTR Property; /* initially set property */
73 INT ParentIndex;
74 INT State;
75 /* 0 = uninitialized */
76 /* 1 = existing */
77 /* 2 = created remove if empty */
78 /* 3 = created persist if empty */
79 INT Cost;
80 INT Space;
81 }MSIFOLDER;
83 typedef struct tagMSIFILE
85 LPWSTR File;
86 INT ComponentIndex;
87 LPWSTR FileName;
88 LPWSTR ShortName;
89 INT FileSize;
90 LPWSTR Version;
91 LPWSTR Language;
92 INT Attributes;
93 INT Sequence;
95 INT State;
96 /* 0 = uninitialize */
97 /* 1 = not present */
98 /* 2 = present but replace */
99 /* 3 = present do not replace */
100 /* 4 = Installed */
101 LPWSTR SourcePath;
102 LPWSTR TargetPath;
103 BOOL Temporary;
104 }MSIFILE;
106 typedef struct tagMSICLASS
108 WCHAR CLSID[IDENTIFIER_SIZE]; /* Primary Key */
109 WCHAR Context[IDENTIFIER_SIZE]; /* Primary Key */
110 INT ComponentIndex; /* Primary Key */
111 INT ProgIDIndex;
112 LPWSTR ProgIDText;
113 LPWSTR Description;
114 INT AppIDIndex;
115 LPWSTR FileTypeMask;
116 LPWSTR IconPath;
117 LPWSTR DefInprocHandler;
118 LPWSTR DefInprocHandler32;
119 LPWSTR Argument;
120 INT FeatureIndex;
121 INT Attributes;
122 /* not in the table, set during installation */
123 BOOL Installed;
124 } MSICLASS;
126 typedef struct tagMSIEXTENSION
128 WCHAR Extension[256]; /* Primary Key */
129 INT ComponentIndex; /* Primary Key */
130 INT ProgIDIndex;
131 LPWSTR ProgIDText;
132 INT MIMEIndex;
133 INT FeatureIndex;
134 /* not in the table, set during installation */
135 BOOL Installed;
136 INT VerbCount;
137 INT Verbs[100]; /* yes hard coded limit, but realistically 100 verbs??? */
138 } MSIEXTENSION;
140 typedef struct tagMSIPROGID
142 LPWSTR ProgID; /* Primary Key */
143 INT ParentIndex;
144 INT ClassIndex;
145 LPWSTR Description;
146 LPWSTR IconPath;
147 /* not in the table, set during installation */
148 BOOL InstallMe;
149 INT CurVerIndex;
150 INT VersionIndIndex;
151 } MSIPROGID;
153 typedef struct tagMSIVERB
155 INT ExtensionIndex;
156 LPWSTR Verb;
157 INT Sequence;
158 LPWSTR Command;
159 LPWSTR Argument;
160 } MSIVERB;
162 typedef struct tagMSIMIME
164 LPWSTR ContentType; /* Primary Key */
165 INT ExtensionIndex;
166 WCHAR CLSID[IDENTIFIER_SIZE];
167 INT ClassIndex;
168 /* not in the table, set during installation */
169 BOOL InstallMe;
170 } MSIMIME;
172 typedef struct tagMSIAPPID
174 WCHAR AppID[IDENTIFIER_SIZE]; /* Primary key */
175 LPWSTR RemoteServerName;
176 LPWSTR LocalServer;
177 LPWSTR ServiceParameters;
178 LPWSTR DllSurrogate;
179 BOOL ActivateAtStorage;
180 BOOL RunAsInteractiveUser;
181 } MSIAPPID;
183 enum SCRIPTS {
184 INSTALL_SCRIPT = 0,
185 COMMIT_SCRIPT = 1,
186 ROLLBACK_SCRIPT = 2,
187 TOTAL_SCRIPTS = 3
190 typedef struct tagMSISCRIPT
192 LPWSTR *Actions[TOTAL_SCRIPTS];
193 UINT ActionCount[TOTAL_SCRIPTS];
194 BOOL ExecuteSequenceRun;
195 BOOL FindRelatedProductsRun;
196 BOOL CurrentlyScripting;
197 }MSISCRIPT;
200 UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, BOOL force);
201 UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action);
202 void ACTION_FinishCustomActions( MSIPACKAGE* package);
203 UINT ACTION_CustomAction(MSIPACKAGE *package,const WCHAR *action, BOOL execute);
205 /* actions in other modules */
206 UINT ACTION_AppSearch(MSIPACKAGE *package);
207 UINT ACTION_FindRelatedProducts(MSIPACKAGE *package);
208 UINT ACTION_InstallFiles(MSIPACKAGE *package);
209 UINT ACTION_DuplicateFiles(MSIPACKAGE *package);
210 UINT ACTION_RegisterClassInfo(MSIPACKAGE *package);
211 UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package);
212 UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package);
213 UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package);
216 /* Helpers */
217 DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data );
218 WCHAR *load_dynamic_stringW(MSIRECORD *row, INT index);
219 LPWSTR load_dynamic_property(MSIPACKAGE *package, LPCWSTR prop, UINT* rc);
220 LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
221 BOOL set_prop, MSIFOLDER **folder);
222 int get_loaded_component(MSIPACKAGE* package, LPCWSTR Component );
223 int get_loaded_feature(MSIPACKAGE* package, LPCWSTR Feature );
224 int get_loaded_file(MSIPACKAGE* package, LPCWSTR file);
225 int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path);
226 UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action);
227 UINT build_icon_path(MSIPACKAGE *, LPCWSTR, LPWSTR *);
228 DWORD build_version_dword(LPCWSTR);
229 LPWSTR build_directory_name(DWORD , ...);
230 BOOL create_full_pathW(const WCHAR *path);
231 BOOL ACTION_VerifyComponentForAction(MSIPACKAGE*, INT, INSTALLSTATE);
232 BOOL ACTION_VerifyFeatureForAction(MSIPACKAGE*, INT, INSTALLSTATE);
233 void reduce_to_longfilename(WCHAR*);
234 void reduce_to_shortfilename(WCHAR*);
235 LPWSTR create_component_advertise_string(MSIPACKAGE*, MSICOMPONENT*, LPCWSTR);
236 void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature);
239 /* control event stuff */
240 VOID ControlEvent_FireSubscribedEvent(MSIPACKAGE *package, LPCWSTR event,
241 MSIRECORD *data);
242 VOID ControlEvent_CleanupSubscriptions(MSIPACKAGE *package);
243 VOID ControlEvent_SubscribeToEvent(MSIPACKAGE *package, LPCWSTR event,
244 LPCWSTR control, LPCWSTR attribute);
245 VOID ControlEvent_UnSubscribeToEvent( MSIPACKAGE *package, LPCWSTR event,
246 LPCWSTR control, LPCWSTR attribute );
248 /* User Interface messages from the actions */
249 void ui_progress(MSIPACKAGE *, int, int, int, int);
250 void ui_actiondata(MSIPACKAGE *, LPCWSTR, MSIRECORD *);
253 /* string consts use a number of places and defined in helpers.c*/
254 extern const WCHAR cszSourceDir[];
255 extern const WCHAR szProductCode[];
256 extern const WCHAR cszRootDrive[];
257 extern const WCHAR cszbs[];