ReactOS  0.4.12-dev-90-g2e2e63e
inseng_private.h File Reference
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
#include "rpcproxy.h"
#include "inseng.h"
#include "wine/heap.h"
#include "wine/unicode.h"
Include dependency graph for inseng_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static charstrdupA (const char *src)
 
static WCHARstrdupW (const WCHAR *src)
 
static LPWSTR strAtoW (const char *str)
 
HRESULT inf_load (const char *path, struct inf_file **inf_file) DECLSPEC_HIDDEN
 
void inf_free (struct inf_file *inf) DECLSPEC_HIDDEN
 
BOOL inf_next_section (struct inf_file *inf, struct inf_section **sec) DECLSPEC_HIDDEN
 
struct inf_sectioninf_get_section (struct inf_file *inf, const char *name) DECLSPEC_HIDDEN
 
charinf_section_get_name (struct inf_section *section) DECLSPEC_HIDDEN
 
BOOL inf_section_next_value (struct inf_section *sec, struct inf_value **value) DECLSPEC_HIDDEN
 
struct inf_valueinf_get_value (struct inf_section *sec, const char *key) DECLSPEC_HIDDEN
 
charinf_value_get_key (struct inf_value *value) DECLSPEC_HIDDEN
 
charinf_value_get_value (struct inf_value *value) DECLSPEC_HIDDEN
 
chartrim (char *str, char **last_chr, BOOL strip_quotes) DECLSPEC_HIDDEN
 
void component_set_actual_download_size (ICifComponent *iface, DWORD size) DECLSPEC_HIDDEN
 
void component_set_downloaded (ICifComponent *iface, BOOL value) DECLSPEC_HIDDEN
 
void component_set_installed (ICifComponent *iface, BOOL value) DECLSPEC_HIDDEN
 
charcomponent_get_id (ICifComponent *iface) DECLSPEC_HIDDEN
 

Function Documentation

◆ component_get_id()

char* component_get_id ( ICifComponent iface)

Definition at line 339 of file icif.c.

Referenced by InstallEngine_EnumDownloadIDs(), and strAtoW().

340 {
341  struct cifcomponent *This = impl_from_ICifComponent(iface);
342 
343  return This->id;
344 }
static struct cifcomponent * impl_from_ICifComponent(ICifComponent *iface)
Definition: icif.c:163
char * id
Definition: icif.c:100

◆ component_set_actual_download_size()

void component_set_actual_download_size ( ICifComponent iface,
DWORD  size 
)

Definition at line 318 of file icif.c.

Referenced by strAtoW().

319 {
320  struct cifcomponent *This = impl_from_ICifComponent(iface);
321 
322  This->size_actual_download = size;
323 }
DWORD size_actual_download
Definition: icif.c:142
GLsizeiptr size
Definition: glext.h:5919
static struct cifcomponent * impl_from_ICifComponent(ICifComponent *iface)
Definition: icif.c:163

◆ component_set_downloaded()

void component_set_downloaded ( ICifComponent iface,
BOOL  value 
)

Definition at line 325 of file icif.c.

Referenced by process_component(), and strAtoW().

326 {
327  struct cifcomponent *This = impl_from_ICifComponent(iface);
328 
329  This->downloaded = value;
330 }
BOOL downloaded
Definition: icif.c:143
static struct cifcomponent * impl_from_ICifComponent(ICifComponent *iface)
Definition: icif.c:163
GLsizei const GLfloat * value
Definition: glext.h:6069

◆ component_set_installed()

void component_set_installed ( ICifComponent iface,
BOOL  value 
)

Definition at line 332 of file icif.c.

Referenced by strAtoW().

333 {
334  struct cifcomponent *This = impl_from_ICifComponent(iface);
335 
336  This->installed = value;
337 }
static struct cifcomponent * impl_from_ICifComponent(ICifComponent *iface)
Definition: icif.c:163
BOOL installed
Definition: icif.c:144
GLsizei const GLfloat * value
Definition: glext.h:6069

◆ inf_free()

void inf_free ( struct inf_file inf)

Definition at line 172 of file inf.c.

Referenced by inf_load(), load_ciffile(), and strAtoW().

173 {
174  struct inf_section *sec, *sec_next;
175  LIST_FOR_EACH_ENTRY_SAFE(sec, sec_next, &inf->sections, struct inf_section, entry)
176  {
177  list_remove(&sec->entry);
178  inf_section_free(sec);
179  }
180 
181  heap_free(inf->content);
182  heap_free(inf);
183 }
static void inf_section_free(struct inf_section *section)
Definition: inf.c:60
uint8_t entry
Definition: isohybrid.c:63
struct list entry
Definition: inf.c:41
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
char * content
Definition: inf.c:50
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
struct list sections
Definition: inf.c:52
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ inf_get_section()

struct inf_section* inf_get_section ( struct inf_file inf,
const char name 
)

Definition at line 201 of file inf.c.

Referenced by get_substitution(), and strAtoW().

202 {
203  struct inf_section *sec = NULL;
204 
205  while (inf_next_section(inf, &sec))
206  {
207  if (!strcasecmp(sec->name, name))
208  return sec;
209  }
210 
211  return NULL;
212 }
#define strcasecmp
Definition: fake.h:9
smooth NULL
Definition: ftsmooth.c:416
BOOL inf_next_section(struct inf_file *inf, struct inf_section **sec)
Definition: inf.c:185
Definition: name.c:36
char * name
Definition: inf.c:42

◆ inf_get_value()

struct inf_value* inf_get_value ( struct inf_section sec,
const char key 
)

Definition at line 235 of file inf.c.

Referenced by section_get_dword(), section_get_dword_field(), section_get_str(), and strAtoW().

236 {
237  struct inf_value *value = NULL;
238 
239  while (inf_section_next_value(sec, &value))
240  {
241  if (!strcasecmp(value->key, key))
242  return value;
243  }
244 
245  return NULL;
246 }
Definition: get.c:139
#define strcasecmp
Definition: fake.h:9
char * key
Definition: inf.c:33
smooth NULL
Definition: ftsmooth.c:416
GLsizei const GLfloat * value
Definition: glext.h:6069
BOOL inf_section_next_value(struct inf_section *sec, struct inf_value **value)
Definition: inf.c:219
Definition: inf.c:30
Definition: path.c:42

◆ inf_load()

HRESULT inf_load ( const char path,
struct inf_file **  inf_file 
)

Definition at line 405 of file inf.c.

Referenced by load_ciffile(), and strAtoW().

406 {
408  struct inf_file *inf;
409  HRESULT hr = E_FAIL;
410  HANDLE file;
411  DWORD read;
412 
414  if (file == INVALID_HANDLE_VALUE) return E_FAIL;
415 
416  inf = heap_alloc_zero(sizeof(*inf));
417  if (!inf) goto error;
418 
419  if (!GetFileSizeEx(file, &file_size))
420  goto error;
421 
422  inf->size = file_size.QuadPart;
423 
424  inf->content = heap_alloc_zero(inf->size);
425  if (!inf->content) goto error;
426 
427  list_init(&inf->sections);
428 
429  if (!ReadFile(file, inf->content, inf->size, &read, NULL) || read != inf->size)
430  goto error;
431 
432  hr = inf_process_content(inf);
433  if (FAILED(hr)) goto error;
434 
435  CloseHandle(file);
436  *inf_file = inf;
437  return S_OK;
438 
439 error:
440  if (inf) inf_free(inf);
441  CloseHandle(file);
442  return hr;
443 }
#define CloseHandle
Definition: compat.h:398
#define error(str)
Definition: mkdosfs.c:1605
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define E_FAIL
Definition: ddrawi.h:102
void inf_free(struct inf_file *inf)
Definition: inf.c:172
DWORD size
Definition: inf.c:51
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:426
LONG HRESULT
Definition: typedefs.h:77
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GetFileSizeEx
Definition: compat.h:414
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
static HRESULT inf_process_content(struct inf_file *inf)
Definition: inf.c:387
#define GENERIC_READ
Definition: compat.h:124
#define S_OK
Definition: intsafe.h:59
char * content
Definition: inf.c:50
Definition: services.c:325
struct list sections
Definition: inf.c:52
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123
#define file_size(inode)
Definition: reiserfs_fs.h:1869
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
LONGLONG QuadPart
Definition: typedefs.h:112

◆ inf_next_section()

BOOL inf_next_section ( struct inf_file inf,
struct inf_section **  sec 
)

Definition at line 185 of file inf.c.

Referenced by inf_get_section(), process_inf(), and strAtoW().

186 {
187  struct list *next_entry, *cur_position;
188 
189  if (*sec)
190  cur_position = &(*sec)->entry;
191  else
192  cur_position = &inf->sections;
193 
194  next_entry = list_next(&inf->sections, cur_position);
195  if (!next_entry) return FALSE;
196 
197  *sec = CONTAINING_RECORD(next_entry, struct inf_section, entry);
198  return TRUE;
199 }
#define TRUE
Definition: types.h:120
uint8_t entry
Definition: isohybrid.c:63
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
Definition: _list.h:228
struct list sections
Definition: inf.c:52
__WINE_SERVER_LIST_INLINE struct list * list_next(const struct list *list, const struct list *elem)
Definition: list.h:115

◆ inf_section_get_name()

char* inf_section_get_name ( struct inf_section section)

Definition at line 214 of file inf.c.

Referenced by process_inf(), and strAtoW().

215 {
216  return strdupA(section->name);
217 }
char * name
Definition: inf.c:42
static LPSTR strdupA(LPCSTR str)
Definition: mimeole.c:482

◆ inf_section_next_value()

BOOL inf_section_next_value ( struct inf_section sec,
struct inf_value **  value 
)

Definition at line 219 of file inf.c.

Referenced by get_substitution(), inf_get_value(), read_urls(), and strAtoW().

220 {
221  struct list *next_entry, *cur_position;
222 
223  if (*value)
224  cur_position = &(*value)->entry;
225  else
226  cur_position = &sec->values;
227 
228  next_entry = list_next(&sec->values, cur_position);
229  if (!next_entry) return FALSE;
230 
231  *value = CONTAINING_RECORD(next_entry, struct inf_value, entry);
232  return TRUE;
233 }
#define TRUE
Definition: types.h:120
uint8_t entry
Definition: isohybrid.c:63
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct list values
Definition: inf.c:43
Definition: _list.h:228
Definition: inf.c:30
__WINE_SERVER_LIST_INLINE struct list * list_next(const struct list *list, const struct list *elem)
Definition: list.h:115

◆ inf_value_get_key()

char* inf_value_get_key ( struct inf_value value)

Definition at line 248 of file inf.c.

Referenced by read_urls(), and strAtoW().

249 {
250  return strdupA(value->key);
251 }
char * key
Definition: inf.c:33
static LPSTR strdupA(LPCSTR str)
Definition: mimeole.c:482

◆ inf_value_get_value()

char* inf_value_get_value ( struct inf_value value)

Definition at line 253 of file inf.c.

Referenced by section_get_dword(), section_get_str(), strAtoW(), and value_get_str_field().

254 {
255  return expand_variables(value->section->file, value->value);
256 }
char * value
Definition: inf.c:34
static char * expand_variables(struct inf_file *inf, const char *str)
Definition: inf.c:159
struct inf_section * section
Definition: inf.c:36

◆ strAtoW()

static LPWSTR strAtoW ( const char str)
inlinestatic

Definition at line 46 of file inseng_private.h.

Referenced by cldap_openA(), downloadcb_create(), generate_moniker(), ldap_add_ext_sA(), ldap_add_extA(), ldap_add_sA(), ldap_addA(), ldap_bind_sA(), ldap_bindA(), ldap_check_filterA(), ldap_compare_ext_sA(), ldap_compare_extA(), ldap_compare_sA(), ldap_compareA(), ldap_create_page_controlA(), ldap_delete_ext_sA(), ldap_delete_extA(), ldap_delete_sA(), ldap_deleteA(), ldap_dn2ufnA(), ldap_explode_dnA(), ldap_extended_operation_sA(), ldap_extended_operationA(), ldap_get_optionA(), ldap_get_values_lenA(), ldap_get_valuesA(), ldap_initA(), ldap_modify_ext_sA(), ldap_modify_extA(), ldap_modify_sA(), ldap_modifyA(), ldap_modrdn2_sA(), ldap_modrdn2A(), ldap_modrdn_sA(), ldap_modrdnA(), ldap_openA(), ldap_rename_ext_sA(), ldap_rename_extA(), ldap_sasl_bind_sA(), ldap_sasl_bindA(), ldap_search_ext_sA(), ldap_search_extA(), ldap_search_sA(), ldap_search_stA(), ldap_searchA(), ldap_simple_bind_sA(), ldap_simple_bindA(), ldap_sslinitA(), and ldap_ufn2dnA().

47 {
48  LPWSTR ret = NULL;
49 
50  if (str)
51  {
52  DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
53  if ((ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
54  MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
55  }
56 
57  return ret;
58 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CP_ACP
Definition: compat.h:99
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ strdupA()

static char* strdupA ( const char src)
inlinestatic

Definition at line 30 of file inseng_private.h.

31 {
32  char *dest = heap_alloc(strlen(src) + 1);
33  if (dest) strcpy(dest, src);
34  return dest;
35 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
GLuint const GLubyte GLvoid * src
Definition: s_context.h:57
GLfloat CONST GLvector4f CONST GLfloat GLvector4f * dest
Definition: m_xform.h:122
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

◆ strdupW()

static WCHAR* strdupW ( const WCHAR src)
inlinestatic

Definition at line 37 of file inseng_private.h.

38 {
39  WCHAR *dest;
40  if (!src) return NULL;
41  dest = HeapAlloc(GetProcessHeap(), 0, (strlenW(src) + 1) * sizeof(WCHAR));
42  if (dest) strcpyW(dest, src);
43  return dest;
44 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLuint const GLubyte GLvoid * src
Definition: s_context.h:57
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLfloat CONST GLvector4f CONST GLfloat GLvector4f * dest
Definition: m_xform.h:122
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219

◆ trim()

char* trim ( char str,
char **  last_chr,
BOOL  strip_quotes 
)

Definition at line 258 of file inf.c.

Referenced by NurbsTessellator::do_endsurface(), get_next_line(), inf_section_parse(), inf_value_parse(), next_part(), and strAtoW().

259 {
260  char *last;
261 
262  for (; *str; str++)
263  {
264  if (*str != '\t' && *str != ' ')
265  break;
266  }
267 
268  if (!*str)
269  {
270  if (last_chr) *last_chr = str;
271  return str;
272  }
273 
274  last = str + strlen(str) - 1;
275 
276  for (; last > str; last--)
277  {
278  if (*last != '\t' && *last != ' ')
279  break;
280  *last = 0;
281  }
282 
283  if (strip_quotes && last != str)
284  {
285  if (*last == '"' && *str == '"')
286  {
287  str++;
288  *last = 0;
289  }
290  }
291 
292  if (last_chr) *last_chr = last;
293  return str;
294 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
POINT last
Definition: font.c:46
const WCHAR * str
static void strip_quotes(WCHAR *word, WCHAR **end)
Definition: xcopy.c:701