"Remove" dependencies with user-mode without breaking CSRSS.

svn path=/trunk/; revision=54360
This commit is contained in:
Pierre Schweitzer 2011-11-12 12:23:15 +00:00
parent 18e346207b
commit 29750a6026
3 changed files with 58 additions and 26 deletions

View file

@ -9,18 +9,43 @@
/* DEFINITIONS ***************************************************************/
#include <ntddk.h>
#include <windef.h>
typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES;
#include <wincon.h>
// 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 <blue/ntddblue.h>
#include <ndk/inbvfuncs.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#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

View 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;

View file

@ -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;