[NEWINFLIB]
authorEric Kohl <eric.kohl@reactos.org>
Sun, 25 Apr 2010 19:20:59 +0000 (19:20 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sun, 25 Apr 2010 19:20:59 +0000 (19:20 +0000)
- Use LANGID instead of LCID.
- Move LANGID and language macros into the host typedefs header.
- Remove dead code.

svn path=/trunk/; revision=47018

reactos/include/host/typedefs.h
reactos/lib/newinflib/builddep.h
reactos/lib/newinflib/infget.c
reactos/lib/newinflib/infhost.h
reactos/lib/newinflib/infhostgen.c
reactos/lib/newinflib/infpriv.h
reactos/lib/newinflib/infros.h
reactos/lib/newinflib/infrosgen.c

index 42f30ed..07146c4 100644 (file)
@@ -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
index c768a2c..6930a7d 100644 (file)
@@ -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 */
index 1cdbebf..4238f1c 100644 (file)
@@ -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,
index 6cdb37c..62403da 100644 (file)
@@ -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,
index e5ad1b9..e6269ff 100644 (file)
@@ -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);
index 0d2cea9..c7adede 100644 (file)
@@ -55,7 +55,7 @@ typedef struct _INFCACHESECTION
 
 typedef struct _INFCACHE
 {
-  LCID LocaleId;
+  LANGID LanguageId;
   PINFCACHESECTION FirstSection;
   PINFCACHESECTION LastSection;
 
index c467af9..92dbc51 100644 (file)
@@ -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,
index 8ea53ae..e994b28 100644 (file)
@@ -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),