1 /* 2 * COPYRIGHT: See COPYING in the top level directory 3 * PROJECT: ReactOS Setup Library 4 * FILE: base/setup/lib/infsupp.h 5 * PURPOSE: Interfacing with Setup* API .INF Files support functions 6 * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr) 7 */ 8 9 #pragma once 10 11 #include "spapisup.h" 12 13 // FIXME: Temporary measure until all the users of this header 14 // (usetup...) use or define SetupAPI-conforming APIs. 15 #if defined(_SETUPAPI_H_) || defined(_INC_SETUPAPI) 16 17 #include <setupapi.h> 18 19 #else 20 21 typedef PVOID HINF; 22 typedef struct _INFCONTEXT 23 { 24 HINF Inf; 25 HINF CurrentInf; 26 UINT Section; 27 UINT Line; 28 } INFCONTEXT, *PINFCONTEXT; 29 30 #endif 31 32 /* Lower the MAX_INF_STRING_LENGTH value in order to avoid too much stack usage */ 33 #undef MAX_INF_STRING_LENGTH 34 #define MAX_INF_STRING_LENGTH 1024 // Still larger than in infcommon.h 35 36 #ifndef INF_STYLE_OLDNT 37 #define INF_STYLE_OLDNT 0x00000001 38 #endif 39 40 #ifndef INF_STYLE_WIN4 41 #define INF_STYLE_WIN4 0x00000002 42 #endif 43 44 #if 0 45 typedef PVOID HINF; 46 typedef struct _INFCONTEXT 47 { 48 HINF Inf; 49 HINF CurrentInf; 50 UINT Section; 51 UINT Line; 52 } INFCONTEXT, *PINFCONTEXT; 53 #endif 54 55 C_ASSERT(sizeof(INFCONTEXT) == 2 * sizeof(HINF) + 2 * sizeof(UINT)); 56 57 58 // #define SetupCloseInfFile InfCloseFile 59 typedef VOID 60 (WINAPI* pSpInfCloseInfFile)( 61 IN HINF InfHandle); 62 63 extern pSpInfCloseInfFile SpInfCloseInfFile; 64 65 // #define SetupFindFirstLineW InfpFindFirstLineW 66 typedef BOOL 67 (WINAPI* pSpInfFindFirstLine)( 68 IN HINF InfHandle, 69 IN PCWSTR Section, 70 IN PCWSTR Key, 71 IN OUT PINFCONTEXT Context); 72 73 extern pSpInfFindFirstLine SpInfFindFirstLine; 74 75 // #define SetupFindNextLine InfFindNextLine 76 typedef BOOL 77 (WINAPI* pSpInfFindNextLine)( 78 IN PINFCONTEXT ContextIn, 79 OUT PINFCONTEXT ContextOut); 80 81 extern pSpInfFindNextLine SpInfFindNextLine; 82 83 // #define SetupGetFieldCount InfGetFieldCount 84 typedef ULONG 85 (WINAPI* pSpInfGetFieldCount)( 86 IN PINFCONTEXT Context); 87 88 extern pSpInfGetFieldCount SpInfGetFieldCount; 89 90 // #define SetupGetBinaryField InfGetBinaryField 91 typedef BOOL 92 (WINAPI* pSpInfGetBinaryField)( 93 IN PINFCONTEXT Context, 94 IN ULONG FieldIndex, 95 OUT PUCHAR ReturnBuffer, 96 IN ULONG ReturnBufferSize, 97 OUT PULONG RequiredSize); 98 99 extern pSpInfGetBinaryField SpInfGetBinaryField; 100 101 // #define SetupGetIntField InfGetIntField 102 typedef BOOL 103 (WINAPI* pSpInfGetIntField)( 104 IN PINFCONTEXT Context, 105 IN ULONG FieldIndex, 106 OUT INT *IntegerValue); // PINT 107 108 extern pSpInfGetIntField SpInfGetIntField; 109 110 // #define SetupGetMultiSzFieldW InfGetMultiSzField 111 typedef BOOL 112 (WINAPI* pSpInfGetMultiSzField)( 113 IN PINFCONTEXT Context, 114 IN ULONG FieldIndex, 115 OUT PWSTR ReturnBuffer, 116 IN ULONG ReturnBufferSize, 117 OUT PULONG RequiredSize); 118 119 extern pSpInfGetMultiSzField SpInfGetMultiSzField; 120 121 // #define SetupGetStringFieldW InfGetStringField 122 typedef BOOL 123 (WINAPI* pSpInfGetStringField)( 124 IN PINFCONTEXT Context, 125 IN ULONG FieldIndex, 126 OUT PWSTR ReturnBuffer, 127 IN ULONG ReturnBufferSize, 128 OUT PULONG RequiredSize); 129 130 extern pSpInfGetStringField SpInfGetStringField; 131 132 // #define pSetupGetField 133 typedef PCWSTR 134 (WINAPI* pSpInfGetField)( 135 IN PINFCONTEXT Context, 136 IN ULONG FieldIndex); 137 138 extern pSpInfGetField SpInfGetField; 139 140 /* A version of SetupOpenInfFileW with support for a user-provided LCID */ 141 // #define SetupOpenInfFileExW InfpOpenInfFileW 142 typedef HINF 143 (WINAPI* pSpInfOpenInfFile)( 144 IN PCWSTR FileName, 145 IN PCWSTR InfClass, 146 IN DWORD InfStyle, 147 IN LCID LocaleId, 148 OUT PUINT ErrorLine); 149 150 extern pSpInfOpenInfFile SpInfOpenInfFile; 151 152 153 /* HELPER FUNCTIONS **********************************************************/ 154 155 FORCEINLINE 156 VOID 157 INF_FreeData( 158 IN PCWSTR InfData) 159 { 160 #if 0 161 if (InfData) 162 RtlFreeHeap(ProcessHeap, 0, InfData); 163 #else 164 UNREFERENCED_PARAMETER(InfData); 165 #endif 166 } 167 168 BOOLEAN 169 INF_GetDataField( 170 IN PINFCONTEXT Context, 171 IN ULONG FieldIndex, 172 OUT PCWSTR* Data); 173 174 BOOLEAN 175 INF_GetData( 176 IN PINFCONTEXT Context, 177 OUT PCWSTR* Key, 178 OUT PCWSTR* Data); 179 180 /* EOF */ 181