1 /* 2 * Copyright 2016 Michael Müller 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17 */ 18 19 #pragma once 20 21 #include "windef.h" 22 #include "winbase.h" 23 #include "winuser.h" 24 #ifdef __REACTOS__ 25 #include "winnls.h" 26 #endif 27 #include "ole2.h" 28 #include "rpcproxy.h" 29 #include "inseng.h" 30 #include "wine/heap.h" 31 32 33 static inline char *strdupA(const char *src) 34 { 35 char *dest = heap_alloc(strlen(src) + 1); 36 if (dest) strcpy(dest, src); 37 return dest; 38 } 39 40 static inline WCHAR *strdupW(const WCHAR *src) 41 { 42 WCHAR *dest; 43 if (!src) return NULL; 44 dest = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(src) + 1) * sizeof(WCHAR)); 45 if (dest) lstrcpyW(dest, src); 46 return dest; 47 } 48 49 static inline LPWSTR strAtoW(const char *str) 50 { 51 LPWSTR ret = NULL; 52 53 if (str) 54 { 55 DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 ); 56 if ((ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) 57 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); 58 } 59 60 return ret; 61 } 62 63 struct inf_value; 64 struct inf_section; 65 struct inf_file; 66 67 HRESULT inf_load(const char *path, struct inf_file **inf_file) DECLSPEC_HIDDEN; 68 void inf_free(struct inf_file *inf) DECLSPEC_HIDDEN; 69 70 BOOL inf_next_section(struct inf_file *inf, struct inf_section **sec) DECLSPEC_HIDDEN; 71 struct inf_section *inf_get_section(struct inf_file *inf, const char *name) DECLSPEC_HIDDEN; 72 char *inf_section_get_name(struct inf_section *section) DECLSPEC_HIDDEN; 73 BOOL inf_section_next_value(struct inf_section *sec, struct inf_value **value) DECLSPEC_HIDDEN; 74 75 struct inf_value *inf_get_value(struct inf_section *sec, const char *key) DECLSPEC_HIDDEN; 76 char *inf_value_get_key(struct inf_value *value) DECLSPEC_HIDDEN; 77 char *inf_value_get_value(struct inf_value *value) DECLSPEC_HIDDEN; 78 79 char *trim(char *str, char **last_chr, BOOL strip_quotes) DECLSPEC_HIDDEN; 80 81 void component_set_actual_download_size(ICifComponent *iface, DWORD size) DECLSPEC_HIDDEN; 82 void component_set_downloaded(ICifComponent *iface, BOOL value) DECLSPEC_HIDDEN; 83 void component_set_installed(ICifComponent *iface, BOOL value) DECLSPEC_HIDDEN; 84 char *component_get_id(ICifComponent *iface) DECLSPEC_HIDDEN; 85