wusa: Parse assembly manifests.
[wine.git] / programs / wusa / wusa.h
blob2c81b639b91b8d5f4a24d627537f2d21071274d0
1 /*
2 * Copyright 2015 Michael Müller
3 * Copyright 2015 Sebastian Lackner
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 enum
22 ASSEMBLY_STATUS_NONE,
23 ASSEMBLY_STATUS_IN_PROGRESS,
24 ASSEMBLY_STATUS_INSTALLED,
27 struct assembly_identity
29 WCHAR *name;
30 WCHAR *version;
31 WCHAR *architecture;
32 WCHAR *language;
33 WCHAR *pubkey_token;
36 struct dependency_entry
38 struct list entry;
39 struct assembly_identity identity;
42 struct fileop_entry
44 struct list entry;
45 WCHAR *source;
46 WCHAR *target;
49 struct registrykv_entry
51 struct list entry;
52 WCHAR *name;
53 WCHAR *value_type;
54 WCHAR *value;
57 struct registryop_entry
59 struct list entry;
60 WCHAR *key;
61 struct list keyvalues;
64 struct assembly_entry
66 struct list entry;
67 DWORD status;
68 WCHAR *filename;
69 WCHAR *displayname;
70 struct assembly_identity identity;
71 struct list dependencies;
72 struct list fileops;
73 struct list registryops;
76 void free_assembly(struct assembly_entry *entry) DECLSPEC_HIDDEN;
77 struct assembly_entry *load_manifest(const WCHAR *filename) DECLSPEC_HIDDEN;
79 static void *heap_alloc(size_t len) __WINE_ALLOC_SIZE(1);
80 static inline void *heap_alloc(size_t len)
82 return HeapAlloc(GetProcessHeap(), 0, len);
85 static void *heap_alloc_zero(size_t len) __WINE_ALLOC_SIZE(1);
86 static inline void *heap_alloc_zero(size_t len)
88 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
91 static inline BOOL heap_free(void *mem)
93 return HeapFree(GetProcessHeap(), 0, mem);
96 static inline char *strdupWtoA(const WCHAR *str)
98 char *ret = NULL;
99 DWORD len;
101 if (!str) return ret;
102 len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
103 if ((ret = heap_alloc(len)))
104 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, len, NULL, NULL);
105 return ret;
108 static inline WCHAR *strdupAtoW(const char *str)
110 WCHAR *ret = NULL;
111 DWORD len;
113 if (!str) return ret;
114 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
115 if ((ret = heap_alloc(len * sizeof(WCHAR))))
116 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
117 return ret;
120 static inline WCHAR *strdupW(const WCHAR *str)
122 WCHAR *ret;
123 if (!str) return NULL;
124 ret = heap_alloc((lstrlenW(str) + 1) * sizeof(WCHAR));
125 if (ret) lstrcpyW(ret, str);
126 return ret;