Authors: Aric Stewart <aric@codeweavers.com>, Mike McCormack <mike@codeweavers.com>
[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 #define IDENTIFIER_SIZE 96
22
23 typedef struct tagMSIFEATURE
24 {
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;
33     
34     INSTALLSTATE Installed;
35     INSTALLSTATE ActionRequest;
36     INSTALLSTATE Action;
37
38     INT ComponentCount;
39     INT Components[1024]; /* yes hardcoded limit.... I am bad */
40     INT Cost;
41 } MSIFEATURE;
42
43 typedef struct tagMSICOMPONENT
44 {
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];
51
52     INSTALLSTATE Installed;
53     INSTALLSTATE ActionRequest;
54     INSTALLSTATE Action;
55
56     BOOL Enabled;
57     INT  Cost;
58     INT  RefCount;
59
60     LPWSTR FullKeypath;
61     LPWSTR AdvertiseString;
62 } MSICOMPONENT;
63
64 typedef struct tagMSIFOLDER
65 {
66     LPWSTR Directory;
67     LPWSTR TargetDefault;
68     LPWSTR SourceDefault;
69
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;
82
83 typedef struct tagMSIFILE
84 {
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;   
94
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;
105
106 typedef struct tagMSICLASS
107 {
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 instalation */
123     BOOL Installed;
124 } MSICLASS;
125
126 typedef struct tagMSIEXTENSION
127 {
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 instalation */
135     BOOL Installed;
136     INT VerbCount;
137     INT Verbs[100]; /* yes hard coded limit, but relisticly 100 verbs??? */
138 } MSIEXTENSION;
139
140 typedef struct tagMSIPROGID
141 {
142     LPWSTR ProgID;  /* Primary Key */
143     INT ParentIndex;
144     INT ClassIndex;
145     LPWSTR Description;
146     LPWSTR IconPath;
147     /* not in the table, set during instalation */
148     BOOL InstallMe;
149     INT CurVerIndex;
150 } MSIPROGID;
151
152 typedef struct tagMSIVERB
153 {
154     INT ExtensionIndex;
155     LPWSTR Verb;
156     INT Sequence;
157     LPWSTR Command;
158     LPWSTR Argument;
159 } MSIVERB;
160
161 typedef struct tagMSIMIME
162 {
163     LPWSTR ContentType;  /* Primary Key */
164     INT ExtensionIndex;
165     WCHAR CLSID[IDENTIFIER_SIZE];
166     INT ClassIndex;
167     /* not in the table, set during instalation */
168     BOOL InstallMe;
169 } MSIMIME;
170
171 typedef struct tagMSIAPPID
172 {
173     WCHAR AppID[IDENTIFIER_SIZE]; /* Primary key */
174     LPWSTR RemoteServerName;
175     LPWSTR LocalServer;
176     LPWSTR ServiceParameters;
177     LPWSTR DllSurrogate;
178     BOOL ActivateAtStorage;
179     BOOL RunAsInteractiveUser;
180 } MSIAPPID;
181
182
183 UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action);
184 UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action);
185 void ACTION_FinishCustomActions( MSIPACKAGE* package);
186 UINT ACTION_CustomAction(MSIPACKAGE *package,const WCHAR *action, BOOL execute);
187 void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature);
188 UINT ACTION_AppSearch(MSIPACKAGE *package);
189
190 DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data );
191 WCHAR *load_dynamic_stringW(MSIRECORD *row, INT index);
192 LPWSTR load_dynamic_property(MSIPACKAGE *package, LPCWSTR prop, UINT* rc);
193 LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source, 
194                       BOOL set_prop, MSIFOLDER **folder);
195 int get_loaded_component(MSIPACKAGE* package, LPCWSTR Component );
196 int get_loaded_feature(MSIPACKAGE* package, LPCWSTR Feature );
197 int get_loaded_file(MSIPACKAGE* package, LPCWSTR file);
198 int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path);
199
200 /* control event stuff */
201 VOID ControlEvent_FireSubscribedEvent(MSIPACKAGE *package, LPCWSTR event,
202                                       MSIRECORD *data);
203 VOID ControlEvent_CleanupSubscriptions(MSIPACKAGE *package);