Partially implement AppSearch action.
[wine/wine64.git] / dlls / msi / action.h
blob1ebaa9fa99fe1d64620db59f2bcc814dae656071
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 UINT ACTION_PerformAction(MSIPACKAGE *package, const WCHAR *action);
101 void ACTION_FinishCustomActions( MSIPACKAGE* package);
102 UINT ACTION_CustomAction(MSIPACKAGE *package,const WCHAR *action, BOOL execute);
103 void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature);
104 UINT ACTION_AppSearch(MSIPACKAGE *package);
106 DWORD deformat_string(MSIPACKAGE *package, LPCWSTR ptr, WCHAR** data );
107 WCHAR *load_dynamic_stringW(MSIRECORD *row, INT index);
108 LPWSTR load_dynamic_property(MSIPACKAGE *package, LPCWSTR prop, UINT* rc);
109 LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
110 BOOL set_prop, MSIFOLDER **folder);
111 int get_loaded_component(MSIPACKAGE* package, LPCWSTR Component );
112 int get_loaded_feature(MSIPACKAGE* package, LPCWSTR Feature );
113 int get_loaded_file(MSIPACKAGE* package, LPCWSTR file);
114 int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path);
118 inline static char *strdupWtoA( const WCHAR *str )
120 char *ret = NULL;
121 if (str)
123 DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL
125 if ((ret = HeapAlloc( GetProcessHeap(), 0, len )))
126 WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
128 return ret;
131 inline static WCHAR *strdupAtoW( const char *str )
133 WCHAR *ret = NULL;
134 if (str)
136 DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
137 if ((ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
138 MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
140 return ret;
143 inline static LPWSTR dupstrW(LPCWSTR src)
145 LPWSTR dest;
146 if (!src) return NULL;
147 dest = HeapAlloc(GetProcessHeap(), 0, (strlenW(src)+1)*sizeof(WCHAR));
148 strcpyW(dest, src);
149 return dest;