mirror of
https://github.com/reactos/reactos.git
synced 2025-06-10 20:34:59 +00:00
Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys.
This commit is contained in:
parent
b94e2d8ca0
commit
c2c66aff7d
24198 changed files with 0 additions and 37285 deletions
115
sdk/lib/inflib/infhostput.c
Normal file
115
sdk/lib/inflib/infhostput.c
Normal file
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* PROJECT: .inf file parser
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* COPYRIGHT: Copyright 2005 Ge van Geldorp <gvg@reactos.org>
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include "inflib.h"
|
||||
#include "infhost.h"
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
int
|
||||
InfHostWriteFile(HINF InfHandle,
|
||||
const CHAR *FileName,
|
||||
const CHAR *HeaderComment)
|
||||
{
|
||||
WCHAR *Buffer;
|
||||
ULONG BufferSize;
|
||||
INFSTATUS Status;
|
||||
FILE *File;
|
||||
|
||||
Status = InfpBuildFileBuffer((PINFCACHE) InfHandle, &Buffer, &BufferSize);
|
||||
if (! INF_SUCCESS(Status))
|
||||
{
|
||||
errno = Status;
|
||||
return -1;
|
||||
}
|
||||
|
||||
File = fopen(FileName, "wb");
|
||||
if (NULL == File)
|
||||
{
|
||||
FREE(Buffer);
|
||||
DPRINT1("fopen() failed (errno %d)\n", errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
DPRINT("fopen() successful\n");
|
||||
|
||||
if (NULL != HeaderComment && '\0' != *HeaderComment)
|
||||
{
|
||||
// fprintf(File, "; %s\r\n\r\n", HeaderComment);
|
||||
}
|
||||
|
||||
if (BufferSize != fwrite(Buffer, (size_t)1, (size_t)BufferSize, File))
|
||||
{
|
||||
DPRINT1("fwrite() failed (errno %d)\n", errno);
|
||||
fclose(File);
|
||||
FREE(Buffer);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fclose(File);
|
||||
|
||||
FREE(Buffer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
InfHostFindOrAddSection(HINF InfHandle,
|
||||
const WCHAR *Section,
|
||||
PINFCONTEXT *Context)
|
||||
{
|
||||
INFSTATUS Status;
|
||||
|
||||
Status = InfpFindOrAddSection((PINFCACHE) InfHandle, Section, Context);
|
||||
if (INF_SUCCESS(Status))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
errno = Status;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
InfHostAddLine(PINFCONTEXT Context, const WCHAR *Key)
|
||||
{
|
||||
INFSTATUS Status;
|
||||
|
||||
Status = InfpAddLineWithKey(Context, Key);
|
||||
if (INF_SUCCESS(Status))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
errno = Status;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
InfHostAddField(PINFCONTEXT Context, const WCHAR *Data)
|
||||
{
|
||||
INFSTATUS Status;
|
||||
|
||||
Status = InfpAddField(Context, Data);
|
||||
if (INF_SUCCESS(Status))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
errno = Status;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* EOF */
|
Loading…
Add table
Add a link
Reference in a new issue