action.h 8.49 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/*
 * Common prototypes for Action handlers
 *
 * Copyright 2005 Aric Stewart for CodeWeavers
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

21 22 23
#ifndef __MSI_ACTION_H__
#define __MSI_ACTION_H__

24 25
#include "wine/list.h"

26 27
typedef struct tagMSIFEATURE
{
28
    struct list entry;
29 30
    LPWSTR Feature;
    LPWSTR Feature_Parent;
31 32
    LPWSTR Title;
    LPWSTR Description;
33 34
    INT Display;
    INT Level;
35
    LPWSTR Directory;
36 37 38 39 40 41
    INT Attributes;
    
    INSTALLSTATE Installed;
    INSTALLSTATE ActionRequest;
    INSTALLSTATE Action;

42
    struct list Components;
43
    
44 45 46 47 48
    INT Cost;
} MSIFEATURE;

typedef struct tagMSICOMPONENT
{
49 50
    struct list entry;
    DWORD magic;
51 52 53
    LPWSTR Component;
    LPWSTR ComponentId;
    LPWSTR Directory;
54
    INT Attributes;
55
    LPWSTR Condition;
56
    LPWSTR KeyPath;
57 58 59 60 61 62 63

    INSTALLSTATE Installed;
    INSTALLSTATE ActionRequest;
    INSTALLSTATE Action;

    BOOL Enabled;
    INT  Cost;
64 65 66
    INT  RefCount;

    LPWSTR FullKeypath;
67
    LPWSTR AdvertiseString;
68 69
} MSICOMPONENT;

70 71 72
typedef struct tagComponentList
{
    struct list entry;
73
    MSICOMPONENT *component;
74 75
} ComponentList;

76 77
typedef struct tagMSIFOLDER
{
78
    struct list entry;
79 80 81 82 83 84 85
    LPWSTR Directory;
    LPWSTR TargetDefault;
    LPWSTR SourceDefault;

    LPWSTR ResolvedTarget;
    LPWSTR ResolvedSource;
    LPWSTR Property;   /* initially set property */
86
    struct tagMSIFOLDER *Parent;
87 88 89 90 91 92 93
    INT   State;
        /* 0 = uninitialized */
        /* 1 = existing */
        /* 2 = created remove if empty */
        /* 3 = created persist if empty */
    INT   Cost;
    INT   Space;
94
} MSIFOLDER;
95

96 97 98 99 100 101 102 103 104
typedef enum _msi_file_state {
    msifs_invalid,
    msifs_missing,
    msifs_overwrite,
    msifs_present,
    msifs_installed,
    msifs_skipped,
} msi_file_state;

105 106
typedef struct tagMSIFILE
{
107
    struct list entry;
108
    LPWSTR File;
109
    MSICOMPONENT *Component;
110
    LPWSTR FileName;
111
    LPWSTR ShortName;
112 113 114 115 116
    INT FileSize;
    LPWSTR Version;
    LPWSTR Language;
    INT Attributes;
    INT Sequence;   
117
    msi_file_state state;
118 119
    LPWSTR  SourcePath;
    LPWSTR  TargetPath;
120 121
} MSIFILE;

122 123 124 125 126 127 128
typedef struct tagMSITEMPFILE
{
    struct list entry;
    LPWSTR File;
    LPWSTR Path;
} MSITEMPFILE;

129 130 131
typedef struct tagMSIAPPID
{
    struct list entry;
132
    LPWSTR AppID; /* Primary key */
133 134 135 136 137 138 139
    LPWSTR RemoteServerName;
    LPWSTR LocalServer;
    LPWSTR ServiceParameters;
    LPWSTR DllSurrogate;
    BOOL ActivateAtStorage;
    BOOL RunAsInteractiveUser;
} MSIAPPID;
140

141 142
typedef struct tagMSIPROGID MSIPROGID;

143 144
typedef struct tagMSICLASS
{
145
    struct list entry;
146 147
    LPWSTR clsid;     /* Primary Key */
    LPWSTR Context;   /* Primary Key */
148
    MSICOMPONENT *Component;
149
    MSIPROGID *ProgID;
150 151
    LPWSTR ProgIDText;
    LPWSTR Description;
152
    MSIAPPID *AppID;
153 154 155 156 157
    LPWSTR FileTypeMask;
    LPWSTR IconPath;
    LPWSTR DefInprocHandler;
    LPWSTR DefInprocHandler32;
    LPWSTR Argument;
158
    MSIFEATURE *Feature;
159
    INT Attributes;
160
    /* not in the table, set during installation */
161 162 163
    BOOL Installed;
} MSICLASS;

164 165
typedef struct tagMSIMIME MSIMIME;

166 167
typedef struct tagMSIEXTENSION
{
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 179
} MSIEXTENSION;

180
struct tagMSIPROGID
181
{
182
    struct list entry;
183
    LPWSTR ProgID;  /* Primary Key */
184
    MSIPROGID *Parent;
185
    MSICLASS *Class;
186 187
    LPWSTR Description;
    LPWSTR IconPath;
188
    /* not in the table, set during installation */
189
    BOOL InstallMe;
190 191 192
    MSIPROGID *CurVer;
    MSIPROGID *VersionInd;
};
193 194 195

typedef struct tagMSIVERB
{
196
    struct list entry;
197 198 199 200 201 202
    LPWSTR Verb;
    INT Sequence;
    LPWSTR Command;
    LPWSTR Argument;
} MSIVERB;

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 215 216 217 218 219 220
enum SCRIPTS {
        INSTALL_SCRIPT = 0,
        COMMIT_SCRIPT = 1,
        ROLLBACK_SCRIPT = 2,
        TOTAL_SCRIPTS = 3
};

221 222 223 224
#define SEQUENCE_UI       0x1
#define SEQUENCE_EXEC     0x2
#define SEQUENCE_INSTALL  0x10

225 226 227 228 229 230
typedef struct tagMSISCRIPT
{
    LPWSTR  *Actions[TOTAL_SCRIPTS];
    UINT    ActionCount[TOTAL_SCRIPTS];
    BOOL    ExecuteSequenceRun;
    BOOL    CurrentlyScripting;
231 232 233
    UINT    InWhatSequence;
    LPWSTR  *UniqueActions;
    UINT    UniqueActionsCount;
234
} MSISCRIPT;
235

236

237 238 239 240
extern UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, BOOL force);
extern UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action);
extern void ACTION_FinishCustomActions( MSIPACKAGE* package);
extern UINT ACTION_CustomAction(MSIPACKAGE *package,const WCHAR *action, BOOL execute);
241 242

/* actions in other modules */
243 244 245
extern UINT ACTION_AppSearch(MSIPACKAGE *package);
extern UINT ACTION_FindRelatedProducts(MSIPACKAGE *package);
extern UINT ACTION_InstallFiles(MSIPACKAGE *package);
246
extern UINT ACTION_RemoveFiles(MSIPACKAGE *package);
247 248 249 250 251
extern UINT ACTION_DuplicateFiles(MSIPACKAGE *package);
extern UINT ACTION_RegisterClassInfo(MSIPACKAGE *package);
extern UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package);
extern UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package);
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 261 262 263 264 265
extern MSICOMPONENT *get_loaded_component( MSIPACKAGE* package, LPCWSTR Component );
extern MSIFEATURE *get_loaded_feature( MSIPACKAGE* package, LPCWSTR Feature );
extern MSIFILE *get_loaded_file( MSIPACKAGE* package, LPCWSTR file );
extern MSIFOLDER *get_loaded_folder( MSIPACKAGE *package, LPCWSTR dir );
extern int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path);
extern UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action);
266
extern LPWSTR build_icon_path(MSIPACKAGE *, LPCWSTR);
267 268 269
extern DWORD build_version_dword(LPCWSTR);
extern LPWSTR build_directory_name(DWORD , ...);
extern BOOL create_full_pathW(const WCHAR *path);
270
extern BOOL ACTION_VerifyComponentForAction(MSICOMPONENT*, INSTALLSTATE);
271 272 273 274 275 276 277 278
extern BOOL ACTION_VerifyFeatureForAction(MSIFEATURE*, INSTALLSTATE);
extern void reduce_to_longfilename(WCHAR*);
extern void reduce_to_shortfilename(WCHAR*);
extern LPWSTR create_component_advertise_string(MSIPACKAGE*, MSICOMPONENT*, LPCWSTR);
extern void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature);
extern UINT register_unique_action(MSIPACKAGE *, LPCWSTR);
extern BOOL check_unique_action(MSIPACKAGE *, LPCWSTR);
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 286
extern VOID ControlEvent_CleanupSubscriptions(MSIPACKAGE *package);
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 293
extern void ui_progress(MSIPACKAGE *, int, int, int, int);
extern void ui_actiondata(MSIPACKAGE *, LPCWSTR, MSIRECORD *);
294 295 296 297 298 299


/* string consts use a number of places  and defined in helpers.c*/
extern const WCHAR cszSourceDir[];
extern const WCHAR szProductCode[];
extern const WCHAR cszRootDrive[];
300
extern const WCHAR cszbs[];
301 302

#endif /* __MSI_ACTION_H__ */