ReactOS 0.4.15-dev-8339-g4028de8
infsupp.c File Reference
#include "usetup.h"
#include <debug.h>
Include dependency graph for infsupp.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

VOID InfCloseFile (HINF InfHandle)
 
VOID WINAPI SetupCloseInfFile (IN HINF InfHandle)
 
BOOL WINAPI SetupFindFirstLineW (IN HINF InfHandle, IN PCWSTR Section, IN PCWSTR Key, IN OUT PINFCONTEXT Context)
 
BOOLEAN InfFindNextLine (PINFCONTEXT ContextIn, PINFCONTEXT ContextOut)
 
BOOL WINAPI SetupFindNextLine (IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
 
LONG InfGetFieldCount (PINFCONTEXT Context)
 
ULONG WINAPI SetupGetFieldCount (IN PINFCONTEXT Context)
 
BOOLEAN InfGetDataField (PINFCONTEXT Context, ULONG FieldIndex, PWCHAR *Data)
 
PCWSTR WINAPI pSetupGetField (IN PINFCONTEXT Context, IN ULONG FieldIndex)
 
BOOLEAN InfGetBinaryField (PINFCONTEXT Context, ULONG FieldIndex, PUCHAR ReturnBuffer, ULONG ReturnBufferSize, PULONG RequiredSize)
 
BOOL WINAPI SetupGetBinaryField (IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PUCHAR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
 
BOOLEAN InfGetIntField (PINFCONTEXT Context, ULONG FieldIndex, INT *IntegerValue)
 
BOOL WINAPI SetupGetIntField (IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT INT *IntegerValue)
 
BOOLEAN InfGetMultiSzField (PINFCONTEXT Context, ULONG FieldIndex, PWSTR ReturnBuffer, ULONG ReturnBufferSize, PULONG RequiredSize)
 
BOOL WINAPI SetupGetMultiSzFieldW (IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
 
BOOLEAN InfGetStringField (PINFCONTEXT Context, ULONG FieldIndex, PWSTR ReturnBuffer, ULONG ReturnBufferSize, PULONG RequiredSize)
 
BOOL WINAPI SetupGetStringFieldW (IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
 
HINF WINAPI SetupOpenInfFileExW (IN PCWSTR FileName, IN PCWSTR InfClass, IN DWORD InfStyle, IN LCID LocaleId, OUT PUINT ErrorLine)
 
HINF WINAPI INF_OpenBufferedFileA (IN PSTR FileBuffer, IN ULONG FileSize, IN PCSTR InfClass, IN DWORD InfStyle, IN LCID LocaleId, OUT PUINT ErrorLine)
 

Variables

pSpInfCloseInfFile SpInfCloseInfFile = SetupCloseInfFile
 
pSpInfFindFirstLine SpInfFindFirstLine = SetupFindFirstLineW
 
pSpInfFindNextLine SpInfFindNextLine = SetupFindNextLine
 
pSpInfGetFieldCount SpInfGetFieldCount = SetupGetFieldCount
 
pSpInfGetBinaryField SpInfGetBinaryField = SetupGetBinaryField
 
pSpInfGetIntField SpInfGetIntField = SetupGetIntField
 
pSpInfGetMultiSzField SpInfGetMultiSzField = SetupGetMultiSzFieldW
 
pSpInfGetStringField SpInfGetStringField = SetupGetStringFieldW
 
pSpInfGetField SpInfGetField = pSetupGetField
 
pSpInfOpenInfFile SpInfOpenInfFile = SetupOpenInfFileExW
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 34 of file infsupp.c.

Function Documentation

◆ INF_OpenBufferedFileA()

HINF WINAPI INF_OpenBufferedFileA ( IN PSTR  FileBuffer,
IN ULONG  FileSize,
IN PCSTR  InfClass,
IN DWORD  InfStyle,
IN LCID  LocaleId,
OUT PUINT  ErrorLine 
)

Definition at line 246 of file infsupp.c.

253{
254 HINF hInf = NULL;
255 ULONG ErrorLineUL;
257
259 FileBuffer,
260 FileSize,
262 &ErrorLineUL);
263 *ErrorLine = (UINT)ErrorLineUL;
264 if (!NT_SUCCESS(Status))
266
267 return hInf;
268}
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
Definition: fsrtlfuncs.h:108
Status
Definition: gdiplustypes.h:25
NTSTATUS InfOpenBufferedFile(PHINF InfHandle, PVOID Buffer, ULONG BufferSize, LANGID LanguageId, PULONG ErrorLine)
Definition: infrosgen.c:51
unsigned int UINT
Definition: ndis.h:50
#define LANGIDFROMLCID(l)
Definition: nls.h:18
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING _In_ PCUNICODE_STRING _In_ LCID LocaleId
Definition: wdfpdo.h:437

Referenced by PrepareFileCopy().

◆ InfCloseFile()

VOID InfCloseFile ( HINF  InfHandle)

Definition at line 1028 of file inffile.c.

1029{
1031
1032 Cache = (PINFCACHE)InfHandle;
1033
1034 if (Cache == NULL)
1035 {
1036 return;
1037 }
1038
1039 while (Cache->FirstSection != NULL)
1040 {
1041 Cache->FirstSection = InfpCacheFreeSection(Cache->FirstSection);
1042 }
1043 Cache->LastSection = NULL;
1044
1046}
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
Definition: mm.h:197
#define TAG_INF_CACHE
Definition: inffile.c:24
static PINFCACHESECTION InfpCacheFreeSection(PINFCACHESECTION Section)
Definition: inffile.c:170
struct _INFCACHE * PINFCACHE
Definition: fatfs.h:173

Referenced by LoadReactOSSetup(), and SetupCloseInfFile().

◆ InfFindNextLine()

BOOLEAN InfFindNextLine ( PINFCONTEXT  ContextIn,
PINFCONTEXT  ContextOut 
)

Definition at line 1107 of file inffile.c.

1110{
1111 PINFCACHELINE CacheLine;
1112
1113 if ((ContextIn == NULL) || (ContextOut == NULL))
1114 return FALSE;
1115
1116 if (ContextIn->Line == NULL)
1117 return FALSE;
1118
1119 CacheLine = (PINFCACHELINE)ContextIn->Line;
1120 if (CacheLine->Next == NULL)
1121 return FALSE;
1122
1123 if (ContextIn != ContextOut)
1124 {
1125 ContextOut->Inf = ContextIn->Inf;
1126 ContextOut->Section = ContextIn->Section;
1127 }
1128 ContextOut->Line = (PVOID)(CacheLine->Next);
1129
1130 return TRUE;
1131}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
struct _INFCACHELINE * PINFCACHELINE
if(dx< 0)
Definition: linetemp.h:194
struct _INFCACHELINE * Next
Definition: inffile.c:37
HINF Inf
Definition: infsupp.h:24
UINT Line
Definition: infsupp.h:27
UINT Section
Definition: infsupp.h:26
void * PVOID
Definition: typedefs.h:50

Referenced by SetupFindNextLine(), and SetupLdrScanBootDrivers().

◆ InfGetBinaryField()

BOOLEAN InfGetBinaryField ( PINFCONTEXT  Context,
ULONG  FieldIndex,
PUCHAR  ReturnBuffer,
ULONG  ReturnBufferSize,
PULONG  RequiredSize 
)

Definition at line 1260 of file inffile.c.

1266{
1267 PINFCACHELINE CacheLine;
1268 PINFCACHEFIELD CacheField;
1269 ULONG Index;
1270 ULONG Size;
1271 PUCHAR Ptr;
1272
1273 if ((Context == NULL) || (Context->Line == NULL) || (FieldIndex == 0))
1274 {
1275// DPRINT("Invalid parameter\n");
1276 return FALSE;
1277 }
1278
1279 if (RequiredSize != NULL)
1280 *RequiredSize = 0;
1281
1282 CacheLine = (PINFCACHELINE)Context->Line;
1283
1284 if (FieldIndex > CacheLine->FieldCount)
1285 return FALSE;
1286
1287 CacheField = CacheLine->FirstField;
1288 for (Index = 1; Index < FieldIndex; Index++)
1289 CacheField = CacheField->Next;
1290
1291 Size = CacheLine->FieldCount - FieldIndex + 1;
1292
1293 if (RequiredSize != NULL)
1294 *RequiredSize = Size;
1295
1296 if (ReturnBuffer != NULL)
1297 {
1298 if (ReturnBufferSize < Size)
1299 return FALSE;
1300
1301 /* Copy binary data */
1302 Ptr = ReturnBuffer;
1303 while (CacheField != NULL)
1304 {
1305 *Ptr = (UCHAR)atoi(CacheField->Data); //strtoul(CacheField->Data, NULL, 16);
1306
1307 Ptr++;
1308 CacheField = CacheField->Next;
1309 }
1310 }
1311
1312 return TRUE;
1313}
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
_In_ DWORD FieldIndex
Definition: setupapi.h:1895
_In_ DWORD _In_ DWORD ReturnBufferSize
Definition: setupapi.h:1897
struct _INFCACHEFIELD * Next
Definition: inffile.c:29
CHAR Data[1]
Definition: inffile.c:32
PINFCACHEFIELD FirstField
Definition: inffile.c:44
ULONG FieldCount
Definition: inffile.c:40
unsigned char * PUCHAR
Definition: typedefs.h:53
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
Definition: wdfdevice.h:4439
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by SetupGetBinaryField().

◆ InfGetDataField()

BOOLEAN InfGetDataField ( PINFCONTEXT  Context,
ULONG  FieldIndex,
PWCHAR Data 
)

Definition at line 127 of file infrosget.c.

130{
132}
#define INF_SUCCESS(x)
Definition: builddep.h:82
INFSTATUS InfpGetDataField(PINFCONTEXT Context, ULONG FieldIndex, PWCHAR *Data)
Definition: infget.c:643

Referenced by LoadReactOSSetup(), pSetupGetField(), SetupLdrInitErrataInf(), SetupLdrLoadNlsData(), and SetupLdrScanBootDrivers().

◆ InfGetFieldCount()

LONG InfGetFieldCount ( PINFCONTEXT  Context)

Definition at line 1250 of file inffile.c.

1251{
1252 if ((Context == NULL) || (Context->Line == NULL))
1253 return 0;
1254
1255 return ((PINFCACHELINE)Context->Line)->FieldCount;
1256}

Referenced by SetupGetFieldCount().

◆ InfGetIntField()

BOOLEAN InfGetIntField ( PINFCONTEXT  Context,
ULONG  FieldIndex,
INT IntegerValue 
)

Definition at line 85 of file infrosget.c.

88{
89 return INF_SUCCESS(InfpGetIntField(Context, FieldIndex, IntegerValue));
90}
INFSTATUS InfpGetIntField(PINFCONTEXT Context, ULONG FieldIndex, INT *IntegerValue)
Definition: infget.c:433

Referenced by SetupGetIntField().

◆ InfGetMultiSzField()

BOOLEAN InfGetMultiSzField ( PINFCONTEXT  Context,
ULONG  FieldIndex,
PWSTR  ReturnBuffer,
ULONG  ReturnBufferSize,
PULONG  RequiredSize 
)

Definition at line 94 of file infrosget.c.

99{
102}
INFSTATUS InfpGetMultiSzField(PINFCONTEXT Context, ULONG FieldIndex, PWSTR ReturnBuffer, ULONG ReturnBufferSize, PULONG RequiredSize)
Definition: infget.c:476

Referenced by SetupGetMultiSzFieldW().

◆ InfGetStringField()

BOOLEAN InfGetStringField ( PINFCONTEXT  Context,
ULONG  FieldIndex,
PWSTR  ReturnBuffer,
ULONG  ReturnBufferSize,
PULONG  RequiredSize 
)

Definition at line 106 of file infrosget.c.

111{
112 return INF_SUCCESS(InfpGetStringField(Context, FieldIndex, ReturnBuffer,
114}
INFSTATUS InfpGetStringField(PINFCONTEXT Context, ULONG FieldIndex, PWSTR ReturnBuffer, ULONG ReturnBufferSize, PULONG RequiredSize)
Definition: infget.c:545

Referenced by SetupGetStringFieldW().

◆ pSetupGetField()

PCWSTR WINAPI pSetupGetField ( IN PINFCONTEXT  Context,
IN ULONG  FieldIndex 
)

Definition at line 110 of file infsupp.c.

113{
114 PWCHAR Data = NULL;
116 return NULL;
117 return Data;
118}
uint16_t * PWCHAR
Definition: typedefs.h:56
BOOLEAN InfGetDataField(PINFCONTEXT Context, ULONG FieldIndex, PWCHAR *Data)
Definition: infrosget.c:127

◆ SetupCloseInfFile()

◆ SetupFindFirstLineW()

BOOL WINAPI SetupFindFirstLineW ( IN HINF  InfHandle,
IN PCWSTR  Section,
IN PCWSTR  Key,
IN OUT PINFCONTEXT  Context 
)

Definition at line 56 of file infsupp.c.

61{
62 PINFCONTEXT pContext;
63 BOOL ret;
64
65 if (InfHandle == INVALID_HANDLE_VALUE)
66 return FALSE;
67
68 ret = InfFindFirstLine(InfHandle, Section, Key, &pContext);
69 if (!ret)
70 return FALSE;
71
72 memcpy(Context, pContext, sizeof(INFCONTEXT));
73 InfFreeContext(pContext);
74 return TRUE;
75}
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOLEAN InfFindFirstLine(HINF InfHandle, PCSTR Section, PCSTR Key, PINFCONTEXT Context)
Definition: inffile.c:1050
VOID InfFreeContext(PINFCONTEXT Context)
Definition: infrosget.c:135
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
int ret

Referenced by ApplyAuditEvents(), ApplyEventlogSettings(), ApplyLockoutSettings(), ApplyPasswordSettings(), ApplyRegistryValues(), check_admin_rights(), CheckInfFile(), del_dirs_callback(), EnableAccount(), get_dest_dir(), get_destination_dir(), get_source_id(), get_src_file_info(), GetDefaultLayoutForLocale(), GetSupportedCP(), HandleSetupCommand(), InstallPrivileges(), InstallSysSetupInfComponents(), InstallSysSetupInfDevices(), iterate_section_fields(), LoadBootSettings(), LoadFreeldrSettings(), NetClassInstaller(), ParseSetupInf(), per_user_install_callback(), ProcessSetupInf(), ProcessUnattendSection(), profile_items_callback(), ReadFreeldrSection(), register_dlls_callback(), register_ocxs_callback(), RegisterDlls(), registry_callback(), run_setup_commands_callback(), set_ldids(), SetLsaAnonymousNameLookup(), SetNewAccountName(), SetupDiBuildDriverInfoList(), SetupDiInstallDeviceInterfaces(), SetupGetSourceInfoW(), SetupGetTargetPathW(), SetupInstallFileW(), SetupInstallServicesFromInfSectionExW(), SetupQueueCopySectionW(), SetupQueueDeleteSectionW(), SetupQueueRenameSectionW(), and update_ini_callback().

◆ SetupFindNextLine()

◆ SetupGetBinaryField()

BOOL WINAPI SetupGetBinaryField ( IN PINFCONTEXT  Context,
IN ULONG  FieldIndex,
OUT PUCHAR  ReturnBuffer,
IN ULONG  ReturnBufferSize,
OUT PULONG  RequiredSize 
)

Definition at line 128 of file infsupp.c.

134{
135 return !!InfGetBinaryField(Context,
137 ReturnBuffer,
140}
BOOLEAN InfGetBinaryField(PINFCONTEXT Context, ULONG FieldIndex, PUCHAR ReturnBuffer, ULONG ReturnBufferSize, PULONG RequiredSize)
Definition: inffile.c:1260

Referenced by ApplyRegistryValues(), and do_reg_operation().

◆ SetupGetFieldCount()

◆ SetupGetIntField()

◆ SetupGetMultiSzFieldW()

BOOL WINAPI SetupGetMultiSzFieldW ( IN PINFCONTEXT  Context,
IN ULONG  FieldIndex,
OUT PWSTR  ReturnBuffer,
IN ULONG  ReturnBufferSize,
OUT PULONG  RequiredSize 
)

Definition at line 164 of file infsupp.c.

170{
173 ReturnBuffer,
176}
BOOLEAN InfGetMultiSzField(PINFCONTEXT Context, ULONG FieldIndex, PWSTR ReturnBuffer, ULONG ReturnBufferSize, PULONG RequiredSize)
Definition: infrosget.c:94

Referenced by do_reg_operation().

◆ SetupGetStringFieldW()

◆ SetupOpenInfFileExW()

HINF WINAPI SetupOpenInfFileExW ( IN PCWSTR  FileName,
IN PCWSTR  InfClass,
IN DWORD  InfStyle,
IN LCID  LocaleId,
OUT PUINT  ErrorLine 
)

Definition at line 204 of file infsupp.c.

210{
211 HINF hInf = NULL;
212 UNICODE_STRING FileNameU;
213 ULONG ErrorLineUL;
215
216 RtlInitUnicodeString(&FileNameU, FileName);
217 Status = InfOpenFile(&hInf,
218 &FileNameU,
220 &ErrorLineUL);
221 *ErrorLine = (UINT)ErrorLineUL;
222 if (!NT_SUCCESS(Status))
224
225 return hInf;
226}
BOOLEAN InfOpenFile(PHINF InfHandle, PCSTR FileName, PULONG ErrorLine)
Definition: inffile.c:918
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)

Variable Documentation

◆ SpInfCloseInfFile

◆ SpInfFindFirstLine

◆ SpInfFindNextLine

◆ SpInfGetBinaryField

Definition at line 235 of file infsupp.c.

Referenced by do_reg_operation().

◆ SpInfGetField

pSpInfGetField SpInfGetField = pSetupGetField

Definition at line 239 of file infsupp.c.

Referenced by INF_GetDataField().

◆ SpInfGetFieldCount

Definition at line 234 of file infsupp.c.

Referenced by do_reg_operation(), and INF_GetData().

◆ SpInfGetIntField

pSpInfGetIntField SpInfGetIntField = SetupGetIntField

Definition at line 236 of file infsupp.c.

Referenced by CheckUnattendedSetup(), LoadSetupInf(), and registry_callback().

◆ SpInfGetMultiSzField

Definition at line 237 of file infsupp.c.

Referenced by do_reg_operation().

◆ SpInfGetStringField

Definition at line 238 of file infsupp.c.

Referenced by do_reg_operation(), INF_GetDataField(), and registry_callback().

◆ SpInfOpenInfFile