"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 ***************************************************************/ /* DEFINITIONS ***************************************************************/
#include <ntddk.h> #include <ntddk.h>
#include <windef.h>
typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES; 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 <blue/ntddblue.h>
#include <ndk/inbvfuncs.h> #include <ndk/inbvfuncs.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#define TAG_BLUE 'EULB' #define TAG_BLUE 'EULB'
typedef struct _CFHEADER typedef struct _CFHEADER
@ -89,6 +114,8 @@ typedef struct _CFFILE
#define TAB_WIDTH 8 #define TAB_WIDTH 8
#define MAX_PATH 260
#define MISC (PUCHAR)0x3c2 #define MISC (PUCHAR)0x3c2
#define SEQ (PUCHAR)0x3c4 #define SEQ (PUCHAR)0x3c4
#define SEQDATA (PUCHAR)0x3c5 #define SEQDATA (PUCHAR)0x3c5

View file

@ -68,7 +68,8 @@ NTSTATUS ExtractFont(UINT32 CodePage, PUCHAR FontBitField)
CFFILE CabFile; CFFILE CabFile;
ULONG CabFileOffset = 0; ULONG CabFileOffset = 0;
LARGE_INTEGER ByteOffset; LARGE_INTEGER ByteOffset;
WCHAR SourceBuffer[_MAX_PATH] = {L'\0'}; WCHAR SourceBuffer[MAX_PATH] = {L'\0'};
ULONG ReadCP;
if(KeGetCurrentIrql() != PASSIVE_LEVEL) if(KeGetCurrentIrql() != PASSIVE_LEVEL)
return STATUS_INVALID_DEVICE_STATE; return STATUS_INVALID_DEVICE_STATE;
@ -90,7 +91,7 @@ NTSTATUS ExtractFont(UINT32 CodePage, PUCHAR FontBitField)
return(Status); return(Status);
SourceName.Length = 0; SourceName.Length = 0;
SourceName.MaximumLength = _MAX_PATH * sizeof(WCHAR); SourceName.MaximumLength = MAX_PATH * sizeof(WCHAR);
SourceName.Buffer = SourceBuffer; SourceName.Buffer = SourceBuffer;
Status = ZwQuerySymbolicLinkObject(Handle, Status = ZwQuerySymbolicLinkObject(Handle,
@ -143,12 +144,16 @@ NTSTATUS ExtractFont(UINT32 CodePage, PUCHAR FontBitField)
if(NT_SUCCESS(Status)) if(NT_SUCCESS(Status))
{ {
if(!bFoundFile && (UINT32)atoi(FileName) == CodePage) if(!bFoundFile)
{ {
// We got the correct file. Status = RtlCharToInteger(FileName, 0, &ReadCP);
// Save the offset and loop through the rest of the file table to find the position, where the actual data starts. if (NT_SUCCESS(Status) && ReadCP == CodePage)
CabFileOffset = CabFile.FileOffset; {
bFoundFile = TRUE; // 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; ByteOffset.LowPart += strlen(FileName) + 1;

View file

@ -29,36 +29,36 @@
typedef struct tagCONSOLE_MODE typedef struct tagCONSOLE_MODE
{ {
DWORD dwMode; ULONG dwMode;
} CONSOLE_MODE, *PCONSOLE_MODE; } CONSOLE_MODE, *PCONSOLE_MODE;
typedef struct tagOUTPUT_ATTRIBUTE typedef struct tagOUTPUT_ATTRIBUTE
{ {
WORD wAttribute; USHORT wAttribute;
DWORD nLength; ULONG nLength;
COORD dwCoord; COORD dwCoord;
DWORD dwTransfered; ULONG dwTransfered;
} OUTPUT_ATTRIBUTE, *POUTPUT_ATTRIBUTE; } OUTPUT_ATTRIBUTE, *POUTPUT_ATTRIBUTE;
typedef struct tagOUTPUT_CHARACTER typedef struct tagOUTPUT_CHARACTER
{ {
CHAR cCharacter; CHAR cCharacter;
DWORD nLength; ULONG nLength;
COORD dwCoord; COORD dwCoord;
DWORD dwTransfered; ULONG dwTransfered;
} OUTPUT_CHARACTER, *POUTPUT_CHARACTER; } OUTPUT_CHARACTER, *POUTPUT_CHARACTER;
typedef struct tagCONSOLE_DRAW typedef struct tagCONSOLE_DRAW
{ {
UINT X; /* Origin */ ULONG X; /* Origin */
UINT Y; ULONG Y;
UINT SizeX; /* Size of the screen buffer (chars) */ ULONG SizeX; /* Size of the screen buffer (chars) */
UINT SizeY; ULONG SizeY;
UINT CursorX; /* New cursor position (screen-relative) */ ULONG CursorX; /* New cursor position (screen-relative) */
UINT CursorY; ULONG CursorY;
/* Followed by screen buffer in char/attrib format */ /* Followed by screen buffer in char/attrib format */
} CONSOLE_DRAW, *PCONSOLE_DRAW; } CONSOLE_DRAW, *PCONSOLE_DRAW;