[SETUP:REACTOS] Adapt the 1st-stage GUI setup to compile with the setuplib.
[reactos.git] / base / setup / reactos / inffile.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS text-mode setup
4 * FILE: base/setup/usetup/inffile.c
5 * PURPOSE: .inf files support functions
6 * PROGRAMMERS: Hervé Poussineau
7 * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
8 */
9
10 /* INCLUDES ******************************************************************/
11
12 #include "reactos.h"
13
14 #define NDEBUG
15 #include <debug.h>
16
17 /* SETUP* API COMPATIBILITY FUNCTIONS ****************************************/
18
19 /* Functions from the INFLIB library */
20
21 /* SetupOpenInfFileW with support for a user-provided LCID */
22 HINF
23 WINAPI
24 SetupOpenInfFileExW(
25 IN PCWSTR FileName,
26 IN PCWSTR InfClass,
27 IN DWORD InfStyle,
28 IN LCID LocaleId,
29 OUT PUINT ErrorLine)
30 {
31 WCHAR Win32FileName[MAX_PATH];
32
33 UNREFERENCED_PARAMETER(LocaleId);
34
35 /*
36 * SetupOpenInfFileExW is called within setuplib with NT paths, however
37 * the Win32 SetupOpenInfFileW API only takes Win32 paths. We therefore
38 * map the NT path to Win32 path and then call the Win32 API.
39 */
40 if (!ConvertNtPathToWin32Path(Win32FileName,
41 _countof(Win32FileName),
42 FileName))
43 {
44 return INVALID_HANDLE_VALUE;
45 }
46
47 return SetupOpenInfFileW(Win32FileName,
48 InfClass,
49 InfStyle,
50 ErrorLine);
51 }
52
53
54 /* HELPER FUNCTIONS **********************************************************/
55
56 #if 0
57
58 HINF WINAPI
59 INF_OpenBufferedFileA(
60 IN PSTR FileBuffer,
61 IN ULONG FileSize,
62 IN PCSTR InfClass,
63 IN DWORD InfStyle,
64 IN LCID LocaleId,
65 OUT PUINT ErrorLine)
66 {
67 #ifdef __REACTOS__
68 HINF hInf = NULL;
69 ULONG ErrorLineUL;
70 NTSTATUS Status;
71
72 Status = InfOpenBufferedFile(&hInf,
73 FileBuffer,
74 FileSize,
75 LANGIDFROMLCID(LocaleId),
76 &ErrorLineUL);
77 *ErrorLine = (UINT)ErrorLineUL;
78 if (!NT_SUCCESS(Status))
79 return INVALID_HANDLE_VALUE;
80
81 return hInf;
82 #else
83 return INVALID_HANDLE_VALUE;
84 #endif /* !__REACTOS__ */
85 }
86
87 #endif
88
89 /* EOF */