ReactOS 0.4.15-dev-7924-g5949c20
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}
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

◆ InfWriteFile()

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

Definition at line 16 of file infrosput.c.

19{
24 INFSTATUS InfStatus;
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 */
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,
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 FREE(ptr, size)
Definition: auth_des.c:64
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
#define DPRINT1
Definition: precomp.h:8
#define MALLOC(Size)
Definition: builddep.h:73
Definition: bufpool.h:45
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define BufferSize
Definition: mmc.h:75
#define NULL
Definition: types.h:112
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
Status
Definition: gdiplustypes.h:25
INFSTATUS InfpBuildFileBuffer(PINFCACHE InfHandle, PWCHAR *Buffer, PULONG BufferSize)
Definition: infput.c:90
int INFSTATUS
Definition: infpriv.h:77
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
unsigned int UINT
Definition: ndis.h:50
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:3952
#define SYNCHRONIZE
Definition: nt_native.h:61
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)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define GENERIC_WRITE
Definition: nt_native.h:90
#define L(x)
Definition: ntvdm.h:50
#define strcpyW(d, s)
Definition: unicode.h:29
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
__wchar_t WCHAR
Definition: xmlstorage.h:180