3 * Copyright (C) 2002 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 * COPYRIGHT: See COPYING in the top level directory
21 * PROJECT: ReactOS text-mode setup
22 * FILE: subsys/system/usetup/inffile.c
23 * PURPOSE: .inf files support functions
24 * PROGRAMMER: Hervé Poussineau
27 /* INCLUDES ******************************************************************/
34 /* FUNCTIONS *****************************************************************/
44 IN OUT PINFCONTEXT Context
)
49 ret
= InfFindFirstLine(InfHandle
, Section
, Key
, &pContext
);
53 memcpy(Context
, pContext
, sizeof(INFCONTEXT
));
54 InfFreeContext(pContext
);
69 UNICODE_STRING FileNameU
;
73 RtlInitUnicodeString(&FileNameU
, FileName
);
74 Status
= InfOpenFile(&hInf
,
76 LANGIDFROMLCID(LocaleId
),
78 *ErrorLine
= (UINT
)ErrorLineUL
;
79 if (!NT_SUCCESS(Status
))
80 return INVALID_HANDLE_VALUE
;
84 #endif /* __REACTOS__ */
89 IN PINFCONTEXT Context
,
94 return InfGetData(Context
, Key
, Data
);
96 static PWCHAR pLastCallData
[4] = { NULL
, NULL
, NULL
, NULL
};
97 static DWORD currentIndex
= 0;
109 if (SetupGetFieldCount(Context
) != 1)
112 for (i
= 0; i
<= 1; i
++)
114 ret
= SetupGetStringFieldW(Context
,
122 HeapFree(GetProcessHeap(), 0, pLastCallData
[i
+ currentIndex
]);
123 pLastCallData
[i
+ currentIndex
] = HeapAlloc(GetProcessHeap(), 0, dwSize
* sizeof(WCHAR
));
124 ret
= SetupGetStringFieldW(Context
,
126 pLastCallData
[i
+ currentIndex
],
134 *Key
= pLastCallData
[0 + currentIndex
];
137 *Data
= pLastCallData
[1 + currentIndex
];
140 #endif /* !__REACTOS__ */
146 IN PINFCONTEXT Context
,
151 return InfGetDataField(Context
, FieldIndex
, Data
);
153 static PWCHAR pLastCallsData
[] = { NULL
, NULL
, NULL
};
154 static DWORD NextIndex
= 0;
160 ret
= SetupGetStringFieldW(Context
,
168 HeapFree(GetProcessHeap(), 0, pLastCallsData
[NextIndex
]);
169 pLastCallsData
[NextIndex
] = HeapAlloc(GetProcessHeap(), 0, dwSize
* sizeof(WCHAR
));
170 ret
= SetupGetStringFieldW(Context
,
172 pLastCallsData
[NextIndex
],
178 *Data
= pLastCallsData
[NextIndex
];
179 NextIndex
= (NextIndex
+ 1) % (sizeof(pLastCallsData
) / sizeof(pLastCallsData
[0]));
181 #endif /* !__REACTOS__ */
186 INF_OpenBufferedFileA(
199 Status
= InfOpenBufferedFile(&hInf
,
202 LANGIDFROMLCID(LocaleId
),
204 *ErrorLine
= (UINT
)ErrorLineUL
;
205 if (!NT_SUCCESS(Status
))
206 return INVALID_HANDLE_VALUE
;
210 return INVALID_HANDLE_VALUE
;
211 #endif /* !__REACTOS__ */