From 29750a6026d13960ce17964551d4cecf04323c6e Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sat, 12 Nov 2011 12:23:15 +0000 Subject: [PATCH] [BLUE] "Remove" dependencies with user-mode without breaking CSRSS. svn path=/trunk/; revision=54360 --- reactos/drivers/setup/blue/blue.h | 39 ++++++++++++++++--- reactos/drivers/setup/blue/font.c | 19 +++++---- .../include/reactos/drivers/blue/ntddblue.h | 26 ++++++------- 3 files changed, 58 insertions(+), 26 deletions(-) diff --git a/reactos/drivers/setup/blue/blue.h b/reactos/drivers/setup/blue/blue.h index 988031c2b26..b10f45faf79 100644 --- a/reactos/drivers/setup/blue/blue.h +++ b/reactos/drivers/setup/blue/blue.h @@ -9,18 +9,43 @@ /* DEFINITIONS ***************************************************************/ #include -#include typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES; -#include + +// Define material that normally comes from PSDK +// This is mandatory to prevent any inclusion of +// user-mode stuff. +typedef struct tagCOORD { + SHORT X; + SHORT Y; +} COORD, *PCOORD; + +typedef struct tagSMALL_RECT { + SHORT Left; + SHORT Top; + SHORT Right; + SHORT Bottom; +} SMALL_RECT; + +typedef struct tagCONSOLE_SCREEN_BUFFER_INFO { + COORD dwSize; + COORD dwCursorPosition; + USHORT wAttributes; + SMALL_RECT srWindow; + COORD dwMaximumWindowSize; +} CONSOLE_SCREEN_BUFFER_INFO, *PCONSOLE_SCREEN_BUFFER_INFO; + +typedef struct tagCONSOLE_CURSOR_INFO { + ULONG dwSize; + BOOLEAN bVisible; +} CONSOLE_CURSOR_INFO, *PCONSOLE_CURSOR_INFO; + +#define ENABLE_PROCESSED_OUTPUT 0x0001 +#define ENABLE_WRAP_AT_EOL_OUTPUT 0x0002 #include #include -#include -#include -#include - #define TAG_BLUE 'EULB' typedef struct _CFHEADER @@ -89,6 +114,8 @@ typedef struct _CFFILE #define TAB_WIDTH 8 +#define MAX_PATH 260 + #define MISC (PUCHAR)0x3c2 #define SEQ (PUCHAR)0x3c4 #define SEQDATA (PUCHAR)0x3c5 diff --git a/reactos/drivers/setup/blue/font.c b/reactos/drivers/setup/blue/font.c index 015b1961cc9..fb8d73cdc1f 100644 --- a/reactos/drivers/setup/blue/font.c +++ b/reactos/drivers/setup/blue/font.c @@ -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; diff --git a/reactos/include/reactos/drivers/blue/ntddblue.h b/reactos/include/reactos/drivers/blue/ntddblue.h index 3bdfec00f2c..755538556ac 100644 --- a/reactos/include/reactos/drivers/blue/ntddblue.h +++ b/reactos/include/reactos/drivers/blue/ntddblue.h @@ -29,36 +29,36 @@ typedef struct tagCONSOLE_MODE { - DWORD dwMode; + ULONG dwMode; } CONSOLE_MODE, *PCONSOLE_MODE; typedef struct tagOUTPUT_ATTRIBUTE { - WORD wAttribute; - DWORD nLength; - COORD dwCoord; - DWORD dwTransfered; + USHORT wAttribute; + ULONG nLength; + COORD dwCoord; + ULONG dwTransfered; } OUTPUT_ATTRIBUTE, *POUTPUT_ATTRIBUTE; typedef struct tagOUTPUT_CHARACTER { CHAR cCharacter; - DWORD nLength; + ULONG nLength; COORD dwCoord; - DWORD dwTransfered; + ULONG dwTransfered; } OUTPUT_CHARACTER, *POUTPUT_CHARACTER; typedef struct tagCONSOLE_DRAW { - UINT X; /* Origin */ - UINT Y; - UINT SizeX; /* Size of the screen buffer (chars) */ - UINT SizeY; - UINT CursorX; /* New cursor position (screen-relative) */ - UINT CursorY; + ULONG X; /* Origin */ + ULONG Y; + ULONG SizeX; /* Size of the screen buffer (chars) */ + ULONG SizeY; + ULONG CursorX; /* New cursor position (screen-relative) */ + ULONG CursorY; /* Followed by screen buffer in char/attrib format */ } CONSOLE_DRAW, *PCONSOLE_DRAW;