netio.sys: Add stub for WskDeregister().
[wine.git] / programs / wusa / wusa.h
blobdcd784e7649968c1c4a7633cfdf734812ce740b5
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 void free_dependency(struct dependency_entry *entry) DECLSPEC_HIDDEN;
78 struct assembly_entry *load_manifest(const WCHAR *filename) DECLSPEC_HIDDEN;
79 BOOL load_update(const WCHAR *filename, struct list *update_list) DECLSPEC_HIDDEN;
81 static void *heap_alloc(size_t len) __WINE_ALLOC_SIZE(1);
82 static inline void *heap_alloc(size_t len)
84 return HeapAlloc(GetProcessHeap(), 0, len);
87 static void *heap_alloc_zero(size_t len) __WINE_ALLOC_SIZE(1);
88 static inline void *heap_alloc_zero(size_t len)
90 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
93 static void *heap_realloc(void *mem, size_t len) __WINE_ALLOC_SIZE(2);
94 static inline void *heap_realloc(void *mem, size_t len)
96 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
99 static inline BOOL heap_free(void *mem)
101 return HeapFree(GetProcessHeap(), 0, mem);
104 static inline char *strdupWtoA(const WCHAR *str)
106 char *ret = NULL;
107 DWORD len;
109 if (!str) return ret;
110 len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
111 if ((ret = heap_alloc(len)))
112 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, len, NULL, NULL);
113 return ret;
116 static inline WCHAR *strdupAtoW(const char *str)
118 WCHAR *ret = NULL;
119 DWORD len;
121 if (!str) return ret;
122 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
123 if ((ret = heap_alloc(len * sizeof(WCHAR))))
124 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
125 return ret;
128 static inline WCHAR *strdupW(const WCHAR *str)
130 WCHAR *ret;
131 if (!str) return NULL;
132 ret = heap_alloc((lstrlenW(str) + 1) * sizeof(WCHAR));
133 if (ret) lstrcpyW(ret, str);
134 return ret;
137 static inline WCHAR *strdupWn(const WCHAR *str, DWORD len)
139 WCHAR *ret;
140 if (!str) return NULL;
141 ret = heap_alloc((len + 1) * sizeof(WCHAR));
142 if (ret)
144 memcpy(ret, str, len * sizeof(WCHAR));
145 ret[len] = 0;
147 return ret;