Synchronize with trunk revision 59636 (just before Alex's CreateProcess revamp).
[reactos.git] / drivers / setup / blue / font.c
index 015b196..fb8d73c 100644 (file)
@@ -68,7 +68,8 @@ NTSTATUS ExtractFont(UINT32 CodePage, PUCHAR FontBitField)
     CFFILE             CabFile;
     ULONG              CabFileOffset = 0;
     LARGE_INTEGER      ByteOffset;
-    WCHAR              SourceBuffer[_MAX_PATH] = {L'\0'};
+    WCHAR              SourceBuffer[MAX_PATH] = {L'\0'};
+    ULONG              ReadCP;
 
     if(KeGetCurrentIrql() != PASSIVE_LEVEL)
         return STATUS_INVALID_DEVICE_STATE;
@@ -90,7 +91,7 @@ NTSTATUS ExtractFont(UINT32 CodePage, PUCHAR FontBitField)
         return(Status);
 
     SourceName.Length = 0;
-    SourceName.MaximumLength = _MAX_PATH * sizeof(WCHAR);
+    SourceName.MaximumLength = MAX_PATH * sizeof(WCHAR);
     SourceName.Buffer = SourceBuffer;
 
     Status = ZwQuerySymbolicLinkObject(Handle,
@@ -143,12 +144,16 @@ NTSTATUS ExtractFont(UINT32 CodePage, PUCHAR FontBitField)
 
                         if(NT_SUCCESS(Status))
                         {
-                            if(!bFoundFile && (UINT32)atoi(FileName) == CodePage)
+                            if(!bFoundFile)
                             {
-                                // We got the correct file.
-                                // Save the offset and loop through the rest of the file table to find the position, where the actual data starts.
-                                CabFileOffset = CabFile.FileOffset;
-                                bFoundFile = TRUE;
+                                Status = RtlCharToInteger(FileName, 0, &ReadCP);
+                                if (NT_SUCCESS(Status) && ReadCP == CodePage)
+                                {
+                                    // We got the correct file.
+                                    // Save the offset and loop through the rest of the file table to find the position, where the actual data starts.
+                                    CabFileOffset = CabFile.FileOffset;
+                                    bFoundFile = TRUE;
+                                }
                             }
 
                             ByteOffset.LowPart += strlen(FileName) + 1;