- action.c is getting too big, so split out all the handling of
[wine.git] / dlls / msi / action.h
bloba8009ef31091bec82cf85aa10cefddea9bde9d36
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 typedef struct tagMSIFEATURE
23 WCHAR Feature[96];
24 WCHAR Feature_Parent[96];
25 WCHAR Title[0x100];
26 WCHAR Description[0x100];
27 INT Display;
28 INT Level;
29 WCHAR Directory[96];
30 INT Attributes;
32 INSTALLSTATE Installed;
33 INSTALLSTATE ActionRequest;
34 INSTALLSTATE Action;
36 INT ComponentCount;
37 INT Components[1024]; /* yes hardcoded limit.... I am bad */
38 INT Cost;
39 } MSIFEATURE;
41 typedef struct tagMSICOMPONENT
43 WCHAR Component[96];
44 WCHAR ComponentId[96];
45 WCHAR Directory[96];
46 INT Attributes;
47 WCHAR Condition[0x100];
48 WCHAR KeyPath[96];
50 INSTALLSTATE Installed;
51 INSTALLSTATE ActionRequest;
52 INSTALLSTATE Action;
54 BOOL Enabled;
55 INT Cost;
56 } MSICOMPONENT;
58 typedef struct tagMSIFOLDER
60 LPWSTR Directory;
61 LPWSTR TargetDefault;
62 LPWSTR SourceDefault;
64 LPWSTR ResolvedTarget;
65 LPWSTR ResolvedSource;
66 LPWSTR Property; /* initially set property */
67 INT ParentIndex;
68 INT State;
69 /* 0 = uninitialized */
70 /* 1 = existing */
71 /* 2 = created remove if empty */
72 /* 3 = created persist if empty */
73 INT Cost;
74 INT Space;
75 }MSIFOLDER;
77 typedef struct tagMSIFILE
79 LPWSTR File;
80 INT ComponentIndex;
81 LPWSTR FileName;
82 INT FileSize;
83 LPWSTR Version;
84 LPWSTR Language;
85 INT Attributes;
86 INT Sequence;
88 INT State;
89 /* 0 = uninitialize */
90 /* 1 = not present */
91 /* 2 = present but replace */
92 /* 3 = present do not replace */
93 /* 4 = Installed */
94 LPWSTR SourcePath;
95 LPWSTR TargetPath;
96 BOOL Temporary;
97 }MSIFILE;
100 void ACTION_FinishCustomActions( MSIPACKAGE* package);
101 UINT ACTION_CustomAction(MSIPACKAGE *package,const WCHAR *action, BOOL execute);
104 DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data );
105 WCHAR *load_dynamic_stringW(MSIRECORD *row, INT index);
106 LPWSTR load_dynamic_property(MSIPACKAGE *package, LPCWSTR prop, UINT* rc);
107 LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
108 BOOL set_prop, MSIFOLDER **folder);
109 int get_loaded_component(MSIPACKAGE* package, LPCWSTR Component );
110 int get_loaded_feature(MSIPACKAGE* package, LPCWSTR Feature );
111 int get_loaded_file(MSIPACKAGE* package, LPCWSTR file);
112 int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path);
116 inline static char *strdupWtoA( const WCHAR *str )
118 char *ret = NULL;
119 if (str)
121 DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL
123 if ((ret = HeapAlloc( GetProcessHeap(), 0, len )))
124 WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
126 return ret;
129 inline static WCHAR *strdupAtoW( const char *str )
131 WCHAR *ret = NULL;
132 if (str)
134 DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
135 if ((ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
136 MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
138 return ret;
141 inline static LPWSTR dupstrW(LPCWSTR src)
143 LPWSTR dest;
144 if (!src) return NULL;
145 dest = HeapAlloc(GetProcessHeap(), 0, (strlenW(src)+1)*sizeof(WCHAR));
146 strcpyW(dest, src);
147 return dest;