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 ******************************************************************/
38 /* FUNCTIONS *****************************************************************/
47 IN OUT PINFCONTEXT Context
)
52 ret
= InfFindFirstLine(InfHandle
, Section
, Key
, &pContext
);
56 memcpy(Context
, pContext
, sizeof(INFCONTEXT
));
57 InfFreeContext(pContext
);
70 UNICODE_STRING FileNameU
;
74 RtlInitUnicodeString(&FileNameU
, FileName
);
78 LANGIDFROMLCID(LocaleId
),
80 *ErrorLine
= (UINT
)ErrorLineUL
;
81 if (!NT_SUCCESS(Status
))
82 return INVALID_HANDLE_VALUE
;
87 #endif /* __REACTOS__ */
91 IN PINFCONTEXT Context
,
96 return InfGetData(Context
, Key
, Data
);
98 static PWCHAR pLastCallData
[4] = { NULL
, NULL
, NULL
, NULL
};
99 static DWORD currentIndex
= 0;
105 if (Key
) *Key
= NULL
;
106 if (Data
) *Data
= NULL
;
108 if (SetupGetFieldCount(Context
) != 1)
111 for (i
= 0; i
<= 1; i
++)
113 ret
= SetupGetStringFieldW(
121 HeapFree(GetProcessHeap(), 0, pLastCallData
[i
+ currentIndex
]);
122 pLastCallData
[i
+ currentIndex
] = HeapAlloc(GetProcessHeap(), 0, dwSize
* sizeof(WCHAR
));
123 ret
= SetupGetStringFieldW(
126 pLastCallData
[i
+ currentIndex
],
134 *Key
= pLastCallData
[0 + currentIndex
];
136 *Data
= pLastCallData
[1 + currentIndex
];
138 #endif /* !__REACTOS__ */
143 IN PINFCONTEXT Context
,
148 return InfGetDataField(Context
, FieldIndex
, Data
);
150 static PWCHAR pLastCallsData
[] = { NULL
, NULL
, NULL
};
151 static DWORD NextIndex
= 0;
157 ret
= SetupGetStringFieldW(
165 HeapFree(GetProcessHeap(), 0, pLastCallsData
[NextIndex
]);
166 pLastCallsData
[NextIndex
] = HeapAlloc(GetProcessHeap(), 0, dwSize
* sizeof(WCHAR
));
167 ret
= SetupGetStringFieldW(
170 pLastCallsData
[NextIndex
],
176 *Data
= pLastCallsData
[NextIndex
];
177 NextIndex
= (NextIndex
+ 1) % (sizeof(pLastCallsData
) / sizeof(pLastCallsData
[0]));
179 #endif /* !__REACTOS__ */
183 INF_OpenBufferedFileA(
196 Status
= InfOpenBufferedFile(
200 LANGIDFROMLCID(LocaleId
),
202 *ErrorLine
= (UINT
)ErrorLineUL
;
203 if (!NT_SUCCESS(Status
))
204 return INVALID_HANDLE_VALUE
;
208 return INVALID_HANDLE_VALUE
;
209 #endif /* !__REACTOS__ */