ReactOS 0.4.16-dev-329-g9223134
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
Status
Definition: gdiplustypes.h:25
int INFSTATUS
Definition: infpriv.h:77
INFSTATUS InfpAddField(PINFCONTEXT Context, PCWSTR Data)
Definition: infput.c:254
#define errno
Definition: errno.h:18

◆ InfHostAddLine()

int InfHostAddLine ( PINFCONTEXT  Context,
const WCHAR Key 
)

Definition at line 82 of file infhostput.c.

83{
85
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

◆ 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);
71 {
72 return 0;
73 }
74 else
75 {
76 errno = Status;
77 return -1;
78 }
79}
INFSTATUS InfpFindOrAddSection(PINFCACHE Cache, PCWSTR Section, PINFCONTEXT *Context)
Definition: infput.c:190

◆ InfHostWriteFile()

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

Definition at line 16 of file infhostput.c.

19{
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 FREE(ptr, size)
Definition: auth_des.c:64
#define DPRINT1
Definition: precomp.h:8
Definition: bufpool.h:45
Definition: File.h:16
#define BufferSize
Definition: mmc.h:75
#define NULL
Definition: types.h:112
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_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)
INFSTATUS InfpBuildFileBuffer(PINFCACHE InfHandle, PWCHAR *Buffer, PULONG BufferSize)
Definition: infput.c:90
#define DPRINT
Definition: sndvol32.h:73
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
__wchar_t WCHAR
Definition: xmlstorage.h:180