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

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS InfWriteFile (HINF InfHandle, PUNICODE_STRING FileName, PUNICODE_STRING HeaderComment)
 
BOOLEAN InfFindOrAddSection (HINF InfHandle, PCWSTR Section, PINFCONTEXT *Context)
 
BOOLEAN InfHostAddLine (PINFCONTEXT Context, PCWSTR Key)
 
BOOLEAN InfHostAddField (PINFCONTEXT Context, PCWSTR Data)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file infrosput.c.

Function Documentation

◆ InfFindOrAddSection()

BOOLEAN InfFindOrAddSection ( HINF  InfHandle,
PCWSTR  Section,
PINFCONTEXT Context 
)

Definition at line 111 of file infrosput.c.

114 {
115  return INF_SUCCESS(InfpFindOrAddSection((PINFCACHE) InfHandle,
116  Section, Context));
117 }
#define INF_SUCCESS(x)
Definition: builddep.h:82
INFSTATUS InfpFindOrAddSection(PINFCACHE Cache, PCWSTR Section, PINFCONTEXT *Context)
Definition: infput.c:190

◆ InfHostAddField()

BOOLEAN InfHostAddField ( PINFCONTEXT  Context,
PCWSTR  Data 
)

Definition at line 126 of file infrosput.c.

127 {
129 }
#define INF_SUCCESS(x)
Definition: builddep.h:82
INFSTATUS InfpAddField(PINFCONTEXT Context, PCWSTR Data)
Definition: infput.c:254

◆ InfHostAddLine()

BOOLEAN InfHostAddLine ( PINFCONTEXT  Context,
PCWSTR  Key 
)

Definition at line 120 of file infrosput.c.

121 {
123 }
INFSTATUS InfpAddLineWithKey(PINFCONTEXT Context, PCWSTR Key)
Definition: infput.c:224
#define INF_SUCCESS(x)
Definition: builddep.h:82

◆ InfWriteFile()

NTSTATUS InfWriteFile ( HINF  InfHandle,
PUNICODE_STRING  FileName,
PUNICODE_STRING  HeaderComment 
)

Definition at line 16 of file infrosput.c.

19 {
24  INFSTATUS InfStatus;
25  PWCHAR Buffer;
27  PWCHAR HeaderBuffer;
28  ULONG HeaderBufferSize;
29  UINT Index;
30 
31  InfStatus = InfpBuildFileBuffer((PINFCACHE) InfHandle, &Buffer, &BufferSize);
32  if (! INF_SUCCESS(InfStatus))
33  {
34  DPRINT("Failed to create buffer (Status 0x%lx)\n", InfStatus);
35  return InfStatus;
36  }
37 
38  /* Open the inf file */
40  FileName,
41  0,
42  NULL,
43  NULL);
44 
49  0,
51  if (!INF_SUCCESS(Status))
52  {
53  DPRINT1("NtOpenFile() failed (Status %lx)\n", Status);
54  FREE(Buffer);
55  return Status;
56  }
57 
58  DPRINT("NtOpenFile() successful\n");
59 
60  if (NULL != HeaderComment && 0 != HeaderComment->Length)
61  {
62  /* This is just a comment header, don't abort on errors here */
63  HeaderBufferSize = HeaderComment->Length + 7 * sizeof(WCHAR);
64  HeaderBuffer = MALLOC(HeaderBufferSize);
65  if (NULL != HeaderBuffer)
66  {
67  strcpyW(HeaderBuffer, L"; ");
68  for (Index = 0; Index < HeaderComment->Length / sizeof(WCHAR); Index++)
69  {
70  HeaderBuffer[2 + Index] = HeaderComment->Buffer[Index];
71  }
72  strcpyW(HeaderBuffer + (2 + HeaderComment->Length / sizeof(WCHAR)),
73  L"\r\n\r\n");
75  NULL,
76  NULL,
77  NULL,
79  HeaderBuffer,
80  HeaderBufferSize,
81  NULL,
82  NULL);
83  FREE(HeaderBuffer);
84  }
85  }
86 
87  /* Write main contents */
89  NULL,
90  NULL,
91  NULL,
93  Buffer,
94  BufferSize,
95  NULL,
96  NULL);
97 
99  FREE(Buffer);
100 
101  if (!INF_SUCCESS(Status))
102  {
103  DPRINT1("NtWriteFile() failed (Status %lx)\n", Status);
104  return(Status);
105  }
106 
107  return STATUS_SUCCESS;
108 }
#define INF_SUCCESS(x)
Definition: builddep.h:82
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define MALLOC(Size)
Definition: builddep.h:73
LONG NTSTATUS
Definition: precomp.h:26
uint16_t * PWCHAR
Definition: typedefs.h:54
int INFSTATUS
Definition: infpriv.h:77
HANDLE FileHandle
Definition: stats.c:38
INFSTATUS InfpBuildFileBuffer(PINFCACHE InfHandle, PWCHAR *Buffer, PULONG BufferSize)
Definition: infput.c:90
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3951
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const UCHAR Index[8]
Definition: usbohci.c:18
#define BufferSize
Definition: classpnp.h:419
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
static const WCHAR L[]
Definition: oid.c:1250
#define FREE(ptr, size)
Definition: auth_des.c:64
NTSYSAPI NTSTATUS NTAPI NtWriteFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN PVOID WriteBuffer, IN ULONG WriteBufferLength, IN PLARGE_INTEGER FileOffset OPTIONAL, IN PULONG LockOperationKey OPTIONAL)
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
#define SYNCHRONIZE
Definition: nt_native.h:61
Status
Definition: gdiplustypes.h:24
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
unsigned int UINT
Definition: ndis.h:50
#define DPRINT1
Definition: precomp.h:8
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
unsigned int ULONG
Definition: retypes.h:1
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2966