mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
[NEWINFLIB]
- Use LANGID instead of LCID. - Move LANGID and language macros into the host typedefs header. - Remove dead code. svn path=/trunk/; revision=47018
This commit is contained in:
parent
6ebb4c8c3b
commit
f995cc4ea6
8 changed files with 24 additions and 43 deletions
|
@ -65,6 +65,7 @@ typedef PVOID HANDLE, HKEY, *PHKEY;
|
|||
typedef INT NTSTATUS, POOL_TYPE;
|
||||
typedef LONG HRESULT;
|
||||
typedef ULONG_PTR SIZE_T, *PSIZE_T;
|
||||
typedef WORD LANGID;
|
||||
|
||||
#define MAXUSHORT USHRT_MAX
|
||||
|
||||
|
@ -232,6 +233,11 @@ typedef const UNICODE_STRING *PCUNICODE_STRING;
|
|||
#define RtlCopyMemory(Destination, Source, Length) memcpy(Destination, Source, Length)
|
||||
#define RtlMoveMemory(Destination, Source, Length) memmove(Destination, Source, Length)
|
||||
|
||||
#define MAKELANGID(p,s) ((((WORD)(s))<<10)|(WORD)(p))
|
||||
#define PRIMARYLANGID(l) ((WORD)(l)&0x3ff)
|
||||
#define SUBLANGID(l) ((WORD)(l)>>10)
|
||||
#define SUBLANG_NEUTRAL 0x00
|
||||
|
||||
/* Prevent inclusion of some other headers */
|
||||
#define __INTERNAL_DEBUG
|
||||
#define RTL_H
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
typedef char TCHAR, *PTCHAR, *PTSTR;
|
||||
typedef const TCHAR *PCTSTR;
|
||||
typedef WORD LCID;
|
||||
|
||||
#define _T(x) x
|
||||
#define _tcsicmp strcasecmp
|
||||
|
@ -60,11 +59,6 @@ typedef WORD LCID;
|
|||
#define IS_TEXT_UNICODE_NOT_UNICODE_MASK 3840
|
||||
#define IS_TEXT_UNICODE_NOT_ASCII_MASK 61440
|
||||
|
||||
#define SUBLANG_NEUTRAL 0
|
||||
#define PRIMARYLANGID(lgid) ((WORD)(lgid) & 0x3ff)
|
||||
#define MAKELANGID(p, s) ((((WORD)(s)) << 10) | (WORD)(p))
|
||||
|
||||
|
||||
#else /* ! defined(INFLIB_HOST) */
|
||||
|
||||
/* ReactOS definitions */
|
||||
|
|
|
@ -46,11 +46,11 @@ InfpGetSubstitutionString(PINFCACHE Inf,
|
|||
|
||||
DPRINT("Value name: %S\n", ValueName);
|
||||
|
||||
if (Inf->LocaleId != 0)
|
||||
if (Inf->LanguageId != 0)
|
||||
{
|
||||
swprintf(StringLangId,
|
||||
L"Strings.%04hx",
|
||||
Inf->LocaleId);
|
||||
Inf->LanguageId);
|
||||
|
||||
Status = InfpFindFirstLine(Inf,
|
||||
StringLangId,
|
||||
|
@ -60,7 +60,7 @@ InfpGetSubstitutionString(PINFCACHE Inf,
|
|||
{
|
||||
swprintf(StringLangId,
|
||||
L"Strings.%04hx",
|
||||
MAKELANGID(PRIMARYLANGID(Inf->LocaleId), SUBLANG_NEUTRAL));
|
||||
MAKELANGID(PRIMARYLANGID(Inf->LanguageId), SUBLANG_NEUTRAL));
|
||||
|
||||
Status = InfpFindFirstLine(Inf,
|
||||
StringLangId,
|
||||
|
|
|
@ -23,11 +23,11 @@ extern BOOLEAN NTAPI RtlIsTextUnicode( PVOID buf, INT len, INT *pf );
|
|||
extern int InfHostOpenBufferedFile(PHINF InfHandle,
|
||||
void *Buffer,
|
||||
ULONG BufferSize,
|
||||
LCID LocaleId,
|
||||
LANGID LanguageId,
|
||||
ULONG *ErrorLine);
|
||||
extern int InfHostOpenFile(PHINF InfHandle,
|
||||
const CHAR *FileName,
|
||||
LCID LocaleId,
|
||||
LANGID LanguageId,
|
||||
ULONG *ErrorLine);
|
||||
extern int InfHostWriteFile(HINF InfHandle,
|
||||
const CHAR *FileName,
|
||||
|
|
|
@ -20,7 +20,7 @@ int
|
|||
InfHostOpenBufferedFile(PHINF InfHandle,
|
||||
void *Buffer,
|
||||
ULONG BufferSize,
|
||||
LCID LocaleId,
|
||||
LANGID LanguageId,
|
||||
ULONG *ErrorLine)
|
||||
{
|
||||
INFSTATUS Status;
|
||||
|
@ -59,8 +59,9 @@ InfHostOpenBufferedFile(PHINF InfHandle,
|
|||
ZEROMEMORY(Cache,
|
||||
sizeof(INFCACHE));
|
||||
|
||||
Cache->LocaleId = LocaleId;
|
||||
Cache->LanguageId = LanguageId;
|
||||
|
||||
/* Parse the inf buffer */
|
||||
if (!RtlIsTextUnicode(FileBuffer, (INT)FileBufferSize, NULL))
|
||||
{
|
||||
// static const BYTE utf8_bom[3] = { 0xef, 0xbb, 0xbf };
|
||||
|
@ -77,9 +78,6 @@ InfHostOpenBufferedFile(PHINF InfHandle,
|
|||
new_buff = MALLOC(FileBufferSize * sizeof(WCHAR));
|
||||
if (new_buff != NULL)
|
||||
{
|
||||
// DWORD len = MultiByteToWideChar( codepage, 0, (char *)FileBuffer + offset,
|
||||
// FileBufferSize - offset, new_buff, FileBufferSize);
|
||||
|
||||
ULONG len;
|
||||
Status = RtlMultiByteToUnicodeN(new_buff,
|
||||
FileBufferSize * sizeof(WCHAR),
|
||||
|
@ -111,11 +109,6 @@ InfHostOpenBufferedFile(PHINF InfHandle,
|
|||
ErrorLine);
|
||||
}
|
||||
|
||||
/* Parse the inf buffer */
|
||||
// Status = InfpParseBuffer (Cache,
|
||||
// FileBuffer,
|
||||
// FileBuffer + BufferSize,
|
||||
// ErrorLine);
|
||||
if (!INF_SUCCESS(Status))
|
||||
{
|
||||
FREE(Cache);
|
||||
|
@ -134,7 +127,7 @@ InfHostOpenBufferedFile(PHINF InfHandle,
|
|||
int
|
||||
InfHostOpenFile(PHINF InfHandle,
|
||||
const CHAR *FileName,
|
||||
LCID LocaleId,
|
||||
LANGID LanguageId,
|
||||
ULONG *ErrorLine)
|
||||
{
|
||||
FILE *File;
|
||||
|
@ -219,7 +212,7 @@ InfHostOpenFile(PHINF InfHandle,
|
|||
ZEROMEMORY(Cache,
|
||||
sizeof(INFCACHE));
|
||||
|
||||
Cache->LocaleId = LocaleId;
|
||||
Cache->LanguageId = LanguageId;
|
||||
|
||||
/* Parse the inf buffer */
|
||||
if (!RtlIsTextUnicode(FileBuffer, (INT)FileBufferLength, NULL))
|
||||
|
@ -238,9 +231,6 @@ InfHostOpenFile(PHINF InfHandle,
|
|||
new_buff = MALLOC(FileBufferLength * sizeof(WCHAR));
|
||||
if (new_buff != NULL)
|
||||
{
|
||||
// DWORD len = MultiByteToWideChar( codepage, 0, (char *)FileBuffer + offset,
|
||||
// FileLength - offset, new_buff, FileLength);
|
||||
|
||||
ULONG len;
|
||||
Status = RtlMultiByteToUnicodeN(new_buff,
|
||||
FileBufferLength * sizeof(WCHAR),
|
||||
|
@ -273,10 +263,6 @@ InfHostOpenFile(PHINF InfHandle,
|
|||
ErrorLine);
|
||||
}
|
||||
|
||||
// Status = InfpParseBuffer (Cache,
|
||||
// FileBuffer,
|
||||
// FileBuffer + FileLength,
|
||||
// ErrorLine);
|
||||
if (!INF_SUCCESS(Status))
|
||||
{
|
||||
FREE(Cache);
|
||||
|
|
|
@ -55,7 +55,7 @@ typedef struct _INFCACHESECTION
|
|||
|
||||
typedef struct _INFCACHE
|
||||
{
|
||||
LCID LocaleId;
|
||||
LANGID LanguageId;
|
||||
PINFCACHESECTION FirstSection;
|
||||
PINFCACHESECTION LastSection;
|
||||
|
||||
|
|
|
@ -18,11 +18,11 @@ extern VOID InfSetHeap(PVOID Heap);
|
|||
extern NTSTATUS InfOpenBufferedFile(PHINF InfHandle,
|
||||
PVOID Buffer,
|
||||
ULONG BufferSize,
|
||||
LCID LocaleId,
|
||||
LANGID LanguageId,
|
||||
PULONG ErrorLine);
|
||||
extern NTSTATUS InfOpenFile(PHINF InfHandle,
|
||||
PUNICODE_STRING FileName,
|
||||
LCID LocaleId,
|
||||
LANGID LanguageId,
|
||||
PULONG ErrorLine);
|
||||
extern NTSTATUS InfWriteFile(HINF InfHandle,
|
||||
PUNICODE_STRING FileName,
|
||||
|
|
|
@ -51,7 +51,7 @@ NTSTATUS
|
|||
InfOpenBufferedFile(PHINF InfHandle,
|
||||
PVOID Buffer,
|
||||
ULONG BufferSize,
|
||||
LCID LocaleId,
|
||||
LANGID LanguageId,
|
||||
PULONG ErrorLine)
|
||||
{
|
||||
INFSTATUS Status;
|
||||
|
@ -92,8 +92,9 @@ InfOpenBufferedFile(PHINF InfHandle,
|
|||
ZEROMEMORY(Cache,
|
||||
sizeof(INFCACHE));
|
||||
|
||||
Cache->LocaleId = LocaleId;
|
||||
Cache->LanguageId = LanguageId;
|
||||
|
||||
/* Parse the inf buffer */
|
||||
if (!RtlIsTextUnicode(FileBuffer, FileBufferSize, NULL))
|
||||
{
|
||||
// static const BYTE utf8_bom[3] = { 0xef, 0xbb, 0xbf };
|
||||
|
@ -110,9 +111,6 @@ InfOpenBufferedFile(PHINF InfHandle,
|
|||
new_buff = MALLOC(FileBufferSize * sizeof(WCHAR));
|
||||
if (new_buff != NULL)
|
||||
{
|
||||
// DWORD len = MultiByteToWideChar( codepage, 0, (char *)FileBuffer + offset,
|
||||
// FileBufferSize - offset, new_buff, FileBufferSize);
|
||||
|
||||
ULONG len;
|
||||
Status = RtlMultiByteToUnicodeN(new_buff,
|
||||
FileBufferSize * sizeof(WCHAR),
|
||||
|
@ -162,7 +160,7 @@ InfOpenBufferedFile(PHINF InfHandle,
|
|||
NTSTATUS
|
||||
InfOpenFile(PHINF InfHandle,
|
||||
PUNICODE_STRING FileName,
|
||||
LCID LocaleId,
|
||||
LANGID LanguageId,
|
||||
PULONG ErrorLine)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
|
@ -267,7 +265,7 @@ InfOpenFile(PHINF InfHandle,
|
|||
ZEROMEMORY(Cache,
|
||||
sizeof(INFCACHE));
|
||||
|
||||
Cache->LocaleId = LocaleId;
|
||||
Cache->LanguageId = LanguageId;
|
||||
|
||||
/* Parse the inf buffer */
|
||||
if (!RtlIsTextUnicode(FileBuffer, FileBufferLength, NULL))
|
||||
|
@ -286,9 +284,6 @@ InfOpenFile(PHINF InfHandle,
|
|||
new_buff = MALLOC(FileBufferLength * sizeof(WCHAR));
|
||||
if (new_buff != NULL)
|
||||
{
|
||||
// DWORD len = MultiByteToWideChar( codepage, 0, (char *)FileBuffer + offset,
|
||||
// FileLength - offset, new_buff, FileLength);
|
||||
|
||||
ULONG len;
|
||||
Status = RtlMultiByteToUnicodeN(new_buff,
|
||||
FileBufferLength * sizeof(WCHAR),
|
||||
|
|
Loading…
Reference in a new issue