2005-01-25 21:17:09 +01:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2005-05-26 14:24:28 +02:00
|
|
|
#define IDENTIFIER_SIZE 96
|
|
|
|
|
2005-01-25 21:17:09 +01:00
|
|
|
typedef struct tagMSIFEATURE
|
|
|
|
{
|
2005-05-26 14:24:28 +02:00
|
|
|
WCHAR Feature[IDENTIFIER_SIZE];
|
|
|
|
WCHAR Feature_Parent[IDENTIFIER_SIZE];
|
2005-01-25 21:17:09 +01:00
|
|
|
WCHAR Title[0x100];
|
|
|
|
WCHAR Description[0x100];
|
|
|
|
INT Display;
|
|
|
|
INT Level;
|
2005-05-26 14:24:28 +02:00
|
|
|
WCHAR Directory[IDENTIFIER_SIZE];
|
2005-01-25 21:17:09 +01:00
|
|
|
INT Attributes;
|
|
|
|
|
|
|
|
INSTALLSTATE Installed;
|
|
|
|
INSTALLSTATE ActionRequest;
|
|
|
|
INSTALLSTATE Action;
|
|
|
|
|
|
|
|
INT ComponentCount;
|
|
|
|
INT Components[1024]; /* yes hardcoded limit.... I am bad */
|
|
|
|
INT Cost;
|
|
|
|
} MSIFEATURE;
|
|
|
|
|
|
|
|
typedef struct tagMSICOMPONENT
|
|
|
|
{
|
2005-05-26 14:24:28 +02:00
|
|
|
WCHAR Component[IDENTIFIER_SIZE];
|
|
|
|
WCHAR ComponentId[IDENTIFIER_SIZE];
|
|
|
|
WCHAR Directory[IDENTIFIER_SIZE];
|
2005-01-25 21:17:09 +01:00
|
|
|
INT Attributes;
|
|
|
|
WCHAR Condition[0x100];
|
2005-05-26 14:24:28 +02:00
|
|
|
WCHAR KeyPath[IDENTIFIER_SIZE];
|
2005-01-25 21:17:09 +01:00
|
|
|
|
|
|
|
INSTALLSTATE Installed;
|
|
|
|
INSTALLSTATE ActionRequest;
|
|
|
|
INSTALLSTATE Action;
|
|
|
|
|
|
|
|
BOOL Enabled;
|
|
|
|
INT Cost;
|
2005-02-24 13:47:43 +01:00
|
|
|
INT RefCount;
|
|
|
|
|
|
|
|
LPWSTR FullKeypath;
|
2005-05-26 14:24:28 +02:00
|
|
|
LPWSTR AdvertiseString;
|
2005-01-25 21:17:09 +01:00
|
|
|
} MSICOMPONENT;
|
|
|
|
|
|
|
|
typedef struct tagMSIFOLDER
|
|
|
|
{
|
|
|
|
LPWSTR Directory;
|
|
|
|
LPWSTR TargetDefault;
|
|
|
|
LPWSTR SourceDefault;
|
|
|
|
|
|
|
|
LPWSTR ResolvedTarget;
|
|
|
|
LPWSTR ResolvedSource;
|
|
|
|
LPWSTR Property; /* initially set property */
|
|
|
|
INT ParentIndex;
|
|
|
|
INT State;
|
|
|
|
/* 0 = uninitialized */
|
|
|
|
/* 1 = existing */
|
|
|
|
/* 2 = created remove if empty */
|
|
|
|
/* 3 = created persist if empty */
|
|
|
|
INT Cost;
|
|
|
|
INT Space;
|
|
|
|
}MSIFOLDER;
|
|
|
|
|
|
|
|
typedef struct tagMSIFILE
|
|
|
|
{
|
|
|
|
LPWSTR File;
|
|
|
|
INT ComponentIndex;
|
|
|
|
LPWSTR FileName;
|
2005-05-18 15:23:52 +02:00
|
|
|
LPWSTR ShortName;
|
2005-01-25 21:17:09 +01:00
|
|
|
INT FileSize;
|
|
|
|
LPWSTR Version;
|
|
|
|
LPWSTR Language;
|
|
|
|
INT Attributes;
|
|
|
|
INT Sequence;
|
|
|
|
|
|
|
|
INT State;
|
|
|
|
/* 0 = uninitialize */
|
|
|
|
/* 1 = not present */
|
|
|
|
/* 2 = present but replace */
|
|
|
|
/* 3 = present do not replace */
|
|
|
|
/* 4 = Installed */
|
|
|
|
LPWSTR SourcePath;
|
|
|
|
LPWSTR TargetPath;
|
|
|
|
BOOL Temporary;
|
|
|
|
}MSIFILE;
|
|
|
|
|
2005-05-26 14:24:28 +02:00
|
|
|
typedef struct tagMSICLASS
|
|
|
|
{
|
|
|
|
WCHAR CLSID[IDENTIFIER_SIZE]; /* Primary Key */
|
|
|
|
WCHAR Context[IDENTIFIER_SIZE]; /* Primary Key */
|
|
|
|
INT ComponentIndex; /* Primary Key */
|
|
|
|
INT ProgIDIndex;
|
|
|
|
LPWSTR ProgIDText;
|
|
|
|
LPWSTR Description;
|
|
|
|
INT AppIDIndex;
|
|
|
|
LPWSTR FileTypeMask;
|
|
|
|
LPWSTR IconPath;
|
|
|
|
LPWSTR DefInprocHandler;
|
|
|
|
LPWSTR DefInprocHandler32;
|
|
|
|
LPWSTR Argument;
|
|
|
|
INT FeatureIndex;
|
|
|
|
INT Attributes;
|
2005-05-30 11:56:56 +02:00
|
|
|
/* not in the table, set during installation */
|
2005-05-26 14:24:28 +02:00
|
|
|
BOOL Installed;
|
|
|
|
} MSICLASS;
|
|
|
|
|
|
|
|
typedef struct tagMSIEXTENSION
|
|
|
|
{
|
|
|
|
WCHAR Extension[256]; /* Primary Key */
|
|
|
|
INT ComponentIndex; /* Primary Key */
|
|
|
|
INT ProgIDIndex;
|
|
|
|
LPWSTR ProgIDText;
|
|
|
|
INT MIMEIndex;
|
|
|
|
INT FeatureIndex;
|
2005-05-30 11:56:56 +02:00
|
|
|
/* not in the table, set during installation */
|
2005-05-26 14:24:28 +02:00
|
|
|
BOOL Installed;
|
|
|
|
INT VerbCount;
|
2005-05-30 11:56:56 +02:00
|
|
|
INT Verbs[100]; /* yes hard coded limit, but realistically 100 verbs??? */
|
2005-05-26 14:24:28 +02:00
|
|
|
} MSIEXTENSION;
|
|
|
|
|
|
|
|
typedef struct tagMSIPROGID
|
|
|
|
{
|
|
|
|
LPWSTR ProgID; /* Primary Key */
|
|
|
|
INT ParentIndex;
|
|
|
|
INT ClassIndex;
|
|
|
|
LPWSTR Description;
|
|
|
|
LPWSTR IconPath;
|
2005-05-30 11:56:56 +02:00
|
|
|
/* not in the table, set during installation */
|
2005-05-26 14:24:28 +02:00
|
|
|
BOOL InstallMe;
|
2005-05-26 18:08:58 +02:00
|
|
|
INT CurVerIndex;
|
2005-06-02 22:06:11 +02:00
|
|
|
INT VersionIndIndex;
|
2005-05-26 14:24:28 +02:00
|
|
|
} MSIPROGID;
|
|
|
|
|
|
|
|
typedef struct tagMSIVERB
|
|
|
|
{
|
|
|
|
INT ExtensionIndex;
|
|
|
|
LPWSTR Verb;
|
|
|
|
INT Sequence;
|
|
|
|
LPWSTR Command;
|
|
|
|
LPWSTR Argument;
|
|
|
|
} MSIVERB;
|
|
|
|
|
|
|
|
typedef struct tagMSIMIME
|
|
|
|
{
|
|
|
|
LPWSTR ContentType; /* Primary Key */
|
|
|
|
INT ExtensionIndex;
|
|
|
|
WCHAR CLSID[IDENTIFIER_SIZE];
|
|
|
|
INT ClassIndex;
|
2005-05-30 11:56:56 +02:00
|
|
|
/* not in the table, set during installation */
|
2005-05-26 14:24:28 +02:00
|
|
|
BOOL InstallMe;
|
|
|
|
} MSIMIME;
|
|
|
|
|
|
|
|
typedef struct tagMSIAPPID
|
|
|
|
{
|
|
|
|
WCHAR AppID[IDENTIFIER_SIZE]; /* Primary key */
|
|
|
|
LPWSTR RemoteServerName;
|
|
|
|
LPWSTR LocalServer;
|
|
|
|
LPWSTR ServiceParameters;
|
|
|
|
LPWSTR DllSurrogate;
|
|
|
|
BOOL ActivateAtStorage;
|
|
|
|
BOOL RunAsInteractiveUser;
|
|
|
|
} MSIAPPID;
|
|
|
|
|
2005-05-27 21:24:22 +02:00
|
|
|
enum SCRIPTS {
|
|
|
|
INSTALL_SCRIPT = 0,
|
|
|
|
COMMIT_SCRIPT = 1,
|
|
|
|
ROLLBACK_SCRIPT = 2,
|
|
|
|
TOTAL_SCRIPTS = 3
|
|
|
|
};
|
|
|
|
|
2005-06-30 22:45:43 +02:00
|
|
|
#define SEQUENCE_UI 0x1
|
|
|
|
#define SEQUENCE_EXEC 0x2
|
|
|
|
#define SEQUENCE_INSTALL 0x10
|
|
|
|
|
2005-05-27 21:24:22 +02:00
|
|
|
typedef struct tagMSISCRIPT
|
|
|
|
{
|
|
|
|
LPWSTR *Actions[TOTAL_SCRIPTS];
|
|
|
|
UINT ActionCount[TOTAL_SCRIPTS];
|
|
|
|
BOOL ExecuteSequenceRun;
|
|
|
|
BOOL CurrentlyScripting;
|
2005-06-30 22:45:43 +02:00
|
|
|
UINT InWhatSequence;
|
|
|
|
LPWSTR *UniqueActions;
|
|
|
|
UINT UniqueActionsCount;
|
2005-05-27 21:24:22 +02:00
|
|
|
}MSISCRIPT;
|
|
|
|
|
2005-01-25 21:17:09 +01:00
|
|
|
|
2005-05-27 21:24:22 +02:00
|
|
|
UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action, BOOL force);
|
2005-02-01 19:46:26 +01:00
|
|
|
UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action);
|
2005-01-25 21:17:09 +01:00
|
|
|
void ACTION_FinishCustomActions( MSIPACKAGE* package);
|
|
|
|
UINT ACTION_CustomAction(MSIPACKAGE *package,const WCHAR *action, BOOL execute);
|
2005-06-16 17:51:44 +02:00
|
|
|
|
|
|
|
/* actions in other modules */
|
2005-02-01 15:22:31 +01:00
|
|
|
UINT ACTION_AppSearch(MSIPACKAGE *package);
|
2005-06-09 14:05:27 +02:00
|
|
|
UINT ACTION_FindRelatedProducts(MSIPACKAGE *package);
|
2005-06-17 22:56:55 +02:00
|
|
|
UINT ACTION_InstallFiles(MSIPACKAGE *package);
|
|
|
|
UINT ACTION_DuplicateFiles(MSIPACKAGE *package);
|
2005-06-16 17:51:44 +02:00
|
|
|
UINT ACTION_RegisterClassInfo(MSIPACKAGE *package);
|
|
|
|
UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package);
|
|
|
|
UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package);
|
|
|
|
UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package);
|
2005-01-25 21:17:09 +01:00
|
|
|
|
2005-06-15 21:12:42 +02:00
|
|
|
|
|
|
|
/* Helpers */
|
2005-01-25 21:17:09 +01:00
|
|
|
DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data );
|
|
|
|
WCHAR *load_dynamic_stringW(MSIRECORD *row, INT index);
|
|
|
|
LPWSTR load_dynamic_property(MSIPACKAGE *package, LPCWSTR prop, UINT* rc);
|
|
|
|
LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
|
|
|
|
BOOL set_prop, MSIFOLDER **folder);
|
|
|
|
int get_loaded_component(MSIPACKAGE* package, LPCWSTR Component );
|
|
|
|
int get_loaded_feature(MSIPACKAGE* package, LPCWSTR Feature );
|
|
|
|
int get_loaded_file(MSIPACKAGE* package, LPCWSTR file);
|
|
|
|
int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path);
|
2005-05-27 21:24:22 +02:00
|
|
|
UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action);
|
2005-06-15 21:12:42 +02:00
|
|
|
UINT build_icon_path(MSIPACKAGE *, LPCWSTR, LPWSTR *);
|
|
|
|
DWORD build_version_dword(LPCWSTR);
|
|
|
|
LPWSTR build_directory_name(DWORD , ...);
|
|
|
|
BOOL create_full_pathW(const WCHAR *path);
|
|
|
|
BOOL ACTION_VerifyComponentForAction(MSIPACKAGE*, INT, INSTALLSTATE);
|
|
|
|
BOOL ACTION_VerifyFeatureForAction(MSIPACKAGE*, INT, INSTALLSTATE);
|
|
|
|
void reduce_to_longfilename(WCHAR*);
|
|
|
|
void reduce_to_shortfilename(WCHAR*);
|
|
|
|
LPWSTR create_component_advertise_string(MSIPACKAGE*, MSICOMPONENT*, LPCWSTR);
|
|
|
|
void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature);
|
2005-06-30 22:45:43 +02:00
|
|
|
UINT register_unique_action(MSIPACKAGE *, LPCWSTR);
|
|
|
|
BOOL check_unique_action(MSIPACKAGE *, LPCWSTR);
|
2005-06-29 21:19:09 +02:00
|
|
|
WCHAR* generate_error_string(MSIPACKAGE *, UINT, DWORD, ... );
|
2005-06-15 21:12:42 +02:00
|
|
|
|
2005-05-27 11:11:18 +02:00
|
|
|
|
|
|
|
/* control event stuff */
|
|
|
|
VOID ControlEvent_FireSubscribedEvent(MSIPACKAGE *package, LPCWSTR event,
|
|
|
|
MSIRECORD *data);
|
|
|
|
VOID ControlEvent_CleanupSubscriptions(MSIPACKAGE *package);
|
2005-06-04 11:48:47 +02:00
|
|
|
VOID ControlEvent_SubscribeToEvent(MSIPACKAGE *package, LPCWSTR event,
|
|
|
|
LPCWSTR control, LPCWSTR attribute);
|
2005-06-07 22:29:51 +02:00
|
|
|
VOID ControlEvent_UnSubscribeToEvent( MSIPACKAGE *package, LPCWSTR event,
|
|
|
|
LPCWSTR control, LPCWSTR attribute );
|
2005-06-09 14:05:27 +02:00
|
|
|
|
2005-06-15 21:12:42 +02:00
|
|
|
/* User Interface messages from the actions */
|
|
|
|
void ui_progress(MSIPACKAGE *, int, int, int, int);
|
|
|
|
void ui_actiondata(MSIPACKAGE *, LPCWSTR, MSIRECORD *);
|
|
|
|
|
|
|
|
|
|
|
|
/* string consts use a number of places and defined in helpers.c*/
|
|
|
|
extern const WCHAR cszSourceDir[];
|
|
|
|
extern const WCHAR szProductCode[];
|
|
|
|
extern const WCHAR cszRootDrive[];
|
2005-06-17 22:56:55 +02:00
|
|
|
extern const WCHAR cszbs[];
|