ReactOS  0.4.14-dev-49-gfb4591c
infhostput.c File Reference
#include "inflib.h"
#include "infhost.h"
#include <debug.h>
Include dependency graph for infhostput.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

int InfHostWriteFile (HINF InfHandle, const CHAR *FileName, const CHAR *HeaderComment)
 
int InfHostFindOrAddSection (HINF InfHandle, const WCHAR *Section, PINFCONTEXT *Context)
 
int InfHostAddLine (PINFCONTEXT Context, const WCHAR *Key)
 
int InfHostAddField (PINFCONTEXT Context, const WCHAR *Data)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file infhostput.c.

Function Documentation

◆ InfHostAddField()

int InfHostAddField ( PINFCONTEXT  Context,
const WCHAR Data 
)

Definition at line 99 of file infhostput.c.

100 {
102 
104  if (INF_SUCCESS(Status))
105  {
106  return 0;
107  }
108  else
109  {
110  errno = Status;
111  return -1;
112  }
113 }
#define INF_SUCCESS(x)
Definition: builddep.h:82
INFSTATUS InfpAddField(PINFCONTEXT Context, PCWSTR Data)
Definition: infput.c:254
int errno
int INFSTATUS
Definition: infpriv.h:77
Status
Definition: gdiplustypes.h:24

◆ InfHostAddLine()

int InfHostAddLine ( PINFCONTEXT  Context,
const WCHAR Key 
)

Definition at line 82 of file infhostput.c.

83 {
85 
87  if (INF_SUCCESS(Status))
88  {
89  return 0;
90  }
91  else
92  {
93  errno = Status;
94  return -1;
95  }
96 }
INFSTATUS InfpAddLineWithKey(PINFCONTEXT Context, PCWSTR Key)
Definition: infput.c:224
#define INF_SUCCESS(x)
Definition: builddep.h:82
int errno
int INFSTATUS
Definition: infpriv.h:77
Status
Definition: gdiplustypes.h:24

◆ InfHostFindOrAddSection()

int InfHostFindOrAddSection ( HINF  InfHandle,
const WCHAR Section,
PINFCONTEXT Context 
)

Definition at line 63 of file infhostput.c.

66 {
68 
69  Status = InfpFindOrAddSection((PINFCACHE) InfHandle, Section, Context);
70  if (INF_SUCCESS(Status))
71  {
72  return 0;
73  }
74  else
75  {
76  errno = Status;
77  return -1;
78  }
79 }
#define INF_SUCCESS(x)
Definition: builddep.h:82
INFSTATUS InfpFindOrAddSection(PINFCACHE Cache, PCWSTR Section, PINFCONTEXT *Context)
Definition: infput.c:190
int errno
int INFSTATUS
Definition: infpriv.h:77
Status
Definition: gdiplustypes.h:24

◆ InfHostWriteFile()

int InfHostWriteFile ( HINF  InfHandle,
const CHAR FileName,
const CHAR HeaderComment 
)

Definition at line 16 of file infhostput.c.

19 {
20  WCHAR *Buffer;
23  FILE *File;
24 
26  if (! INF_SUCCESS(Status))
27  {
28  errno = Status;
29  return -1;
30  }
31 
32  File = fopen(FileName, "wb");
33  if (NULL == File)
34  {
35  FREE(Buffer);
36  DPRINT1("fopen() failed (errno %d)\n", errno);
37  return -1;
38  }
39 
40  DPRINT("fopen() successful\n");
41 
42  if (NULL != HeaderComment && '\0' != *HeaderComment)
43  {
44 // fprintf(File, "; %s\r\n\r\n", HeaderComment);
45  }
46 
47  if (BufferSize != fwrite(Buffer, (size_t)1, (size_t)BufferSize, File))
48  {
49  DPRINT1("fwrite() failed (errno %d)\n", errno);
50  fclose(File);
51  FREE(Buffer);
52  return -1;
53  }
54 
55  fclose(File);
56 
57  FREE(Buffer);
58 
59  return 0;
60 }
#define INF_SUCCESS(x)
Definition: builddep.h:82
int errno
_Check_return_opt_ _CRTIMP size_t __cdecl fwrite(_In_reads_bytes_(_Size *_Count) const void *_Str, _In_ size_t _Size, _In_ size_t _Count, _Inout_ FILE *_File)
int INFSTATUS
Definition: infpriv.h:77
INFSTATUS InfpBuildFileBuffer(PINFCACHE InfHandle, PWCHAR *Buffer, PULONG BufferSize)
Definition: infput.c:90
_In_opt_ PVOID _In_ PCSTR File
Definition: iofuncs.h:615
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define BufferSize
Definition: classpnp.h:419
#define FREE(ptr, size)
Definition: auth_des.c:64
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
Status
Definition: gdiplustypes.h:24
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
Definition: File.h:15
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34