- Implement ReadConsoleInputW, PeekConsoleInputW, ReadConsoleOutputW, WriteConsoleOutputW, SetConsoleIcon and GetConsoleWindow.

- Fix input peeking in CSRSS to not return fake events.

svn path=/trunk/; revision=10658
This commit is contained in:
Filip Navara 2004-08-22 20:52:28 +00:00
parent cce0fb451f
commit 4af77c2b3c
5 changed files with 430 additions and 116 deletions

View file

@ -137,6 +137,7 @@ typedef struct
typedef struct typedef struct
{ {
HANDLE ConsoleHandle; HANDLE ConsoleHandle;
BOOL Unicode;
} CSRSS_READ_INPUT_REQUEST, *PCSRSS_READ_INPUT_REQUEST; } CSRSS_READ_INPUT_REQUEST, *PCSRSS_READ_INPUT_REQUEST;
typedef struct typedef struct
@ -277,6 +278,7 @@ typedef struct
typedef struct typedef struct
{ {
HANDLE ConsoleHandle; HANDLE ConsoleHandle;
BOOL Unicode;
COORD BufferSize; COORD BufferSize;
COORD BufferCoord; COORD BufferCoord;
SMALL_RECT WriteRegion; SMALL_RECT WriteRegion;
@ -389,6 +391,7 @@ typedef struct
typedef struct typedef struct
{ {
HANDLE ConsoleHandle; HANDLE ConsoleHandle;
BOOL Unicode;
DWORD Length; DWORD Length;
INPUT_RECORD* InputRecord; INPUT_RECORD* InputRecord;
} CSRSS_PEEK_CONSOLE_INPUT_REQUEST, *PCSRSS_PEEK_CONSOLE_INPUT_REQUEST; } CSRSS_PEEK_CONSOLE_INPUT_REQUEST, *PCSRSS_PEEK_CONSOLE_INPUT_REQUEST;
@ -401,6 +404,7 @@ typedef struct
typedef struct typedef struct
{ {
HANDLE ConsoleHandle; HANDLE ConsoleHandle;
BOOL Unicode;
COORD BufferSize; COORD BufferSize;
COORD BufferCoord; COORD BufferCoord;
SMALL_RECT ReadRegion; SMALL_RECT ReadRegion;
@ -493,15 +497,21 @@ typedef struct
typedef struct typedef struct
{ {
HANDLE ConsoleHandle; } CSRSS_GET_CONSOLE_WINDOW_REQUEST, *PCSRSS_GET_CONSOLE_WINDOW_REQUEST;
HWND WindowHandle;
} CSRSS_CONSOLE_WINDOW, *PCSRSS_CONSOLE_WINDOW; typedef struct
{
HWND WindowHandle;
} CSRSS_GET_CONSOLE_WINDOW_REPLY, *PCSRSS_GET_CONSOLE_WINDOW_REPLY;
typedef struct typedef struct
{ {
HANDLE ConsoleHandle;
HICON WindowIcon; HICON WindowIcon;
} CSRSS_CONSOLE_SET_WINDOW_ICON, *PCSRSS_CONSOLE_SET_WINDOW_ICON; } CSRSS_SET_CONSOLE_ICON_REQUEST, *PCSRSS_SET_CONSOLE_ICON_REQUEST;
typedef struct
{
} CSRSS_SET_CONSOLE_ICON_REPLY, *PCSRSS_SET_CONSOLE_ICON_REPLY;
typedef struct typedef struct
{ {
@ -551,6 +561,42 @@ typedef struct
{ {
} CSRSS_REGISTER_LOGON_PROCESS_REPLY, *PCSRSS_REGISTER_LOGON_PROCESS_REPLY; } CSRSS_REGISTER_LOGON_PROCESS_REPLY, *PCSRSS_REGISTER_LOGON_PROCESS_REPLY;
typedef struct
{
} CSRSS_GET_CONSOLE_CP_REQUEST, *PCSRSS_GET_CONSOLE_CP_REQUEST;
typedef struct
{
UINT CodePage;
} CSRSS_GET_CONSOLE_CP_REPLY, *PCSRSS_GET_CONSOLE_CP_REPLY;
typedef struct
{
UINT CodePage;
} CSRSS_SET_CONSOLE_CP_REQUEST, *PCSRSS_SET_CONSOLE_CP_REQUEST;
typedef struct
{
} CSRSS_SET_CONSOLE_CP_REPLY, *PCSRSS_SET_CONSOLE_CP_REPLY;
typedef struct
{
} CSRSS_GET_CONSOLE_OUTPUT_CP_REQUEST, *PCSRSS_GET_CONSOLE_OUTPUT_CP_REQUEST;
typedef struct
{
UINT CodePage;
} CSRSS_GET_CONSOLE_OUTPUT_CP_REPLY, *PCSRSS_GET_CONSOLE_OUTPUT_CP_REPLY;
typedef struct
{
UINT CodePage;
} CSRSS_SET_CONSOLE_OUTPUT_CP_REQUEST, *PCSRSS_SET_CONSOLE_OUTPUT_CP_REQUEST;
typedef struct
{
} CSRSS_SET_CONSOLE_OUTPUT_CP_REPLY, *PCSRSS_SET_CONSOLE_OUTPUT_CP_REPLY;
#define CSRSS_MAX_WRITE_CONSOLE_REQUEST \ #define CSRSS_MAX_WRITE_CONSOLE_REQUEST \
(MAX_MESSAGE_DATA - sizeof(ULONG) - sizeof(CSRSS_WRITE_CONSOLE_REQUEST)) (MAX_MESSAGE_DATA - sizeof(ULONG) - sizeof(CSRSS_WRITE_CONSOLE_REQUEST))
@ -618,6 +664,10 @@ typedef struct
#define CSRSS_SET_CONSOLE_ICON (0x2E) #define CSRSS_SET_CONSOLE_ICON (0x2E)
#define CSRSS_SET_LOGON_NOTIFY_WINDOW (0x2F) #define CSRSS_SET_LOGON_NOTIFY_WINDOW (0x2F)
#define CSRSS_REGISTER_LOGON_PROCESS (0x30) #define CSRSS_REGISTER_LOGON_PROCESS (0x30)
#define CSRSS_GET_CONSOLE_CP (0x31)
#define CSRSS_SET_CONSOLE_CP (0x32)
#define CSRSS_GET_CONSOLE_OUTPUT_CP (0x33)
#define CSRSS_SET_CONSOLE_OUTPUT_CP (0x34)
/* Keep in sync with definition below. */ /* Keep in sync with definition below. */
#define CSRSS_REQUEST_HEADER_SIZE (LPC_MESSAGE_BASE_SIZE + sizeof(ULONG)) #define CSRSS_REQUEST_HEADER_SIZE (LPC_MESSAGE_BASE_SIZE + sizeof(ULONG))
@ -672,13 +722,17 @@ typedef struct
CSRSS_VERIFY_HANDLE_REQUEST VerifyHandleRequest; CSRSS_VERIFY_HANDLE_REQUEST VerifyHandleRequest;
CSRSS_DUPLICATE_HANDLE_REQUEST DuplicateHandleRequest; CSRSS_DUPLICATE_HANDLE_REQUEST DuplicateHandleRequest;
CSRSS_SETGET_CONSOLE_HW_STATE_REQUEST ConsoleHardwareStateRequest; CSRSS_SETGET_CONSOLE_HW_STATE_REQUEST ConsoleHardwareStateRequest;
CSRSS_CONSOLE_WINDOW ConsoleWindowRequest; CSRSS_GET_CONSOLE_WINDOW_REQUEST GetConsoleWindowRequest;
CSRSS_CREATE_DESKTOP_REQUEST CreateDesktopRequest; CSRSS_CREATE_DESKTOP_REQUEST CreateDesktopRequest;
CSRSS_SHOW_DESKTOP_REQUEST ShowDesktopRequest; CSRSS_SHOW_DESKTOP_REQUEST ShowDesktopRequest;
CSRSS_HIDE_DESKTOP_REQUEST HideDesktopRequest; CSRSS_HIDE_DESKTOP_REQUEST HideDesktopRequest;
CSRSS_CONSOLE_SET_WINDOW_ICON ConsoleSetWindowIconRequest; CSRSS_SET_CONSOLE_ICON_REQUEST SetConsoleIconRequest;
CSRSS_SET_LOGON_NOTIFY_WINDOW_REQUEST SetLogonNotifyWindowRequest; CSRSS_SET_LOGON_NOTIFY_WINDOW_REQUEST SetLogonNotifyWindowRequest;
CSRSS_REGISTER_LOGON_PROCESS_REQUEST RegisterLogonProcessRequest; CSRSS_REGISTER_LOGON_PROCESS_REQUEST RegisterLogonProcessRequest;
CSRSS_GET_CONSOLE_CP_REQUEST GetConsoleCodePage;
CSRSS_SET_CONSOLE_CP_REQUEST SetConsoleCodePage;
CSRSS_GET_CONSOLE_OUTPUT_CP_REQUEST GetConsoleOutputCodePage;
CSRSS_SET_CONSOLE_OUTPUT_CP_REQUEST SetConsoleOutputCodePage;
} Data; } Data;
}; };
}; };
@ -721,13 +775,17 @@ typedef struct
CSRSS_GET_OUTPUT_HANDLE_REPLY GetOutputHandleReply; CSRSS_GET_OUTPUT_HANDLE_REPLY GetOutputHandleReply;
CSRSS_DUPLICATE_HANDLE_REPLY DuplicateHandleReply; CSRSS_DUPLICATE_HANDLE_REPLY DuplicateHandleReply;
CSRSS_SETGET_CONSOLE_HW_STATE_REPLY ConsoleHardwareStateReply; CSRSS_SETGET_CONSOLE_HW_STATE_REPLY ConsoleHardwareStateReply;
CSRSS_CONSOLE_WINDOW ConsoleWindowReply; CSRSS_GET_CONSOLE_WINDOW_REPLY GetConsoleWindowReply;
CSRSS_CREATE_DESKTOP_REPLY CreateDesktopReply; CSRSS_CREATE_DESKTOP_REPLY CreateDesktopReply;
CSRSS_SHOW_DESKTOP_REPLY ShowDesktopReply; CSRSS_SHOW_DESKTOP_REPLY ShowDesktopReply;
CSRSS_HIDE_DESKTOP_REPLY HideDesktopReply; CSRSS_HIDE_DESKTOP_REPLY HideDesktopReply;
CSRSS_CONSOLE_SET_WINDOW_ICON ConsoleSetWindowIconReply; CSRSS_SET_CONSOLE_ICON_REPLY SetConsoleIconReply;
CSRSS_SET_LOGON_NOTIFY_WINDOW_REPLY SetLogonNotifyWindowReply; CSRSS_SET_LOGON_NOTIFY_WINDOW_REPLY SetLogonNotifyWindowReply;
CSRSS_REGISTER_LOGON_PROCESS_REPLY RegisterLogonProcessReply; CSRSS_REGISTER_LOGON_PROCESS_REPLY RegisterLogonProcessReply;
CSRSS_GET_CONSOLE_CP_REPLY GetConsoleCodePage;
CSRSS_SET_CONSOLE_CP_REPLY SetConsoleCodePage;
CSRSS_GET_CONSOLE_OUTPUT_CP_REPLY GetConsoleOutputCodePage;
CSRSS_SET_CONSOLE_OUTPUT_CP_REPLY SetConsoleOutputCodePage;
} Data; } Data;
}; };
}; };

View file

@ -1,4 +1,4 @@
/* $Id: console.c,v 1.76 2004/06/13 20:04:56 navaraf Exp $ /* $Id: console.c,v 1.77 2004/08/22 20:52:28 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -1394,22 +1394,24 @@ FillConsoleOutputCharacterW(
) )
{ {
/* TO DO */ /* TO DO */
DbgPrint("%s unimplemented\n", __FUNCTION__);
return FALSE; return FALSE;
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
* PeekConsoleInputA * IntPeekConsoleInput
* *
* @implemented * INTERNAL
*/ */
BOOL BOOL
WINAPI WINAPI
PeekConsoleInputA( IntPeekConsoleInput(
HANDLE hConsoleInput, HANDLE hConsoleInput,
PINPUT_RECORD lpBuffer, PINPUT_RECORD lpBuffer,
DWORD nLength, DWORD nLength,
LPDWORD lpNumberOfEventsRead LPDWORD lpNumberOfEventsRead,
BOOL bUnicode
) )
{ {
PCSRSS_API_REQUEST Request; PCSRSS_API_REQUEST Request;
@ -1444,6 +1446,7 @@ PeekConsoleInputA(
Request->Type = CSRSS_PEEK_CONSOLE_INPUT; Request->Type = CSRSS_PEEK_CONSOLE_INPUT;
Request->Data.PeekConsoleInputRequest.ConsoleHandle = hConsoleInput; Request->Data.PeekConsoleInputRequest.ConsoleHandle = hConsoleInput;
Request->Data.PeekConsoleInputRequest.Unicode = bUnicode;
Request->Data.PeekConsoleInputRequest.Length = nLength; Request->Data.PeekConsoleInputRequest.Length = nLength;
Request->Data.PeekConsoleInputRequest.InputRecord = (INPUT_RECORD*)BufferTargetBase; Request->Data.PeekConsoleInputRequest.InputRecord = (INPUT_RECORD*)BufferTargetBase;
@ -1464,14 +1467,32 @@ PeekConsoleInputA(
RtlFreeHeap(GetProcessHeap(), 0, Request); RtlFreeHeap(GetProcessHeap(), 0, Request);
CsrReleaseParameterBuffer(BufferBase); CsrReleaseParameterBuffer(BufferBase);
return TRUE; return TRUE;
}
/*--------------------------------------------------------------
* PeekConsoleInputA
*
* @implemented
*/
BOOL
WINAPI
PeekConsoleInputA(
HANDLE hConsoleInput,
PINPUT_RECORD lpBuffer,
DWORD nLength,
LPDWORD lpNumberOfEventsRead
)
{
return IntPeekConsoleInput(hConsoleInput, lpBuffer, nLength,
lpNumberOfEventsRead, FALSE);
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
* PeekConsoleInputW * PeekConsoleInputW
* *
* @unimplemented * @implemented
*/ */
BOOL BOOL
WINAPI WINAPI
@ -1482,21 +1503,22 @@ PeekConsoleInputW(
LPDWORD lpNumberOfEventsRead LPDWORD lpNumberOfEventsRead
) )
{ {
/* TO DO */ return IntPeekConsoleInput(hConsoleInput, lpBuffer, nLength,
return FALSE; lpNumberOfEventsRead, TRUE);
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
* ReadConsoleInputA * IntReadConsoleInput
* *
* @implemented * INTERNAL
*/ */
BOOL WINAPI BOOL WINAPI
ReadConsoleInputA(HANDLE hConsoleInput, IntReadConsoleInput(HANDLE hConsoleInput,
PINPUT_RECORD lpBuffer, PINPUT_RECORD lpBuffer,
DWORD nLength, DWORD nLength,
LPDWORD lpNumberOfEventsRead) LPDWORD lpNumberOfEventsRead,
BOOL bUnicode)
{ {
CSRSS_API_REQUEST Request; CSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply; CSRSS_API_REPLY Reply;
@ -1525,6 +1547,7 @@ ReadConsoleInputA(HANDLE hConsoleInput,
Request.Type = CSRSS_READ_INPUT; Request.Type = CSRSS_READ_INPUT;
Request.Data.ReadInputRequest.ConsoleHandle = hConsoleInput; Request.Data.ReadInputRequest.ConsoleHandle = hConsoleInput;
Request.Data.ReadInputRequest.Unicode = bUnicode;
Status = CsrClientCallServer(&Request, &Reply, sizeof(CSRSS_API_REQUEST), Status = CsrClientCallServer(&Request, &Reply, sizeof(CSRSS_API_REQUEST),
sizeof(CSRSS_API_REPLY)); sizeof(CSRSS_API_REPLY));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status)) if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status))
@ -1534,10 +1557,9 @@ ReadConsoleInputA(HANDLE hConsoleInput,
} }
} }
NumEventsRead = 0; NumEventsRead = 1;
*lpBuffer = Reply.Data.ReadInputReply.Input; *lpBuffer = Reply.Data.ReadInputReply.Input;
lpBuffer++; lpBuffer++;
NumEventsRead++;
while ((NumEventsRead < nLength) && (Reply.Data.ReadInputReply.MoreEvents)) while ((NumEventsRead < nLength) && (Reply.Data.ReadInputReply.MoreEvents))
{ {
@ -1565,10 +1587,26 @@ ReadConsoleInputA(HANDLE hConsoleInput,
} }
/*--------------------------------------------------------------
* ReadConsoleInputA
*
* @implemented
*/
BOOL WINAPI
ReadConsoleInputA(HANDLE hConsoleInput,
PINPUT_RECORD lpBuffer,
DWORD nLength,
LPDWORD lpNumberOfEventsRead)
{
return IntReadConsoleInput(hConsoleInput, lpBuffer, nLength,
lpNumberOfEventsRead, FALSE);
}
/*-------------------------------------------------------------- /*--------------------------------------------------------------
* ReadConsoleInputW * ReadConsoleInputW
* *
* @unimplemented * @implemented
*/ */
BOOL BOOL
WINAPI WINAPI
@ -1579,8 +1617,8 @@ ReadConsoleInputW(
LPDWORD lpNumberOfEventsRead LPDWORD lpNumberOfEventsRead
) )
{ {
/* TO DO */ return IntReadConsoleInput(hConsoleInput, lpBuffer, nLength,
return FALSE; lpNumberOfEventsRead, TRUE);
} }
@ -1665,23 +1703,25 @@ WriteConsoleInputW(
) )
{ {
/* TO DO */ /* TO DO */
DbgPrint("%s unimplemented\n", __FUNCTION__);
return FALSE; return FALSE;
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
* ReadConsoleOutputA * IntReadConsoleOutput
* *
* @implemented * INTERNAL
*/ */
BOOL BOOL
WINAPI WINAPI
ReadConsoleOutputA( IntReadConsoleOutput(
HANDLE hConsoleOutput, HANDLE hConsoleOutput,
PCHAR_INFO lpBuffer, PCHAR_INFO lpBuffer,
COORD dwBufferSize, COORD dwBufferSize,
COORD dwBufferCoord, COORD dwBufferCoord,
PSMALL_RECT lpReadRegion PSMALL_RECT lpReadRegion,
BOOL bUnicode
) )
{ {
PCSRSS_API_REQUEST Request; PCSRSS_API_REQUEST Request;
@ -1716,6 +1756,7 @@ ReadConsoleOutputA(
Request->Type = CSRSS_READ_CONSOLE_OUTPUT; Request->Type = CSRSS_READ_CONSOLE_OUTPUT;
Request->Data.ReadConsoleOutputRequest.ConsoleHandle = hConsoleOutput; Request->Data.ReadConsoleOutputRequest.ConsoleHandle = hConsoleOutput;
Request->Data.ReadConsoleOutputRequest.Unicode = bUnicode;
Request->Data.ReadConsoleOutputRequest.BufferSize = dwBufferSize; Request->Data.ReadConsoleOutputRequest.BufferSize = dwBufferSize;
Request->Data.ReadConsoleOutputRequest.BufferCoord = dwBufferCoord; Request->Data.ReadConsoleOutputRequest.BufferCoord = dwBufferCoord;
Request->Data.ReadConsoleOutputRequest.ReadRegion = *lpReadRegion; Request->Data.ReadConsoleOutputRequest.ReadRegion = *lpReadRegion;
@ -1742,11 +1783,30 @@ ReadConsoleOutputA(
return TRUE; return TRUE;
} }
/*--------------------------------------------------------------
* ReadConsoleOutputA
*
* @implemented
*/
BOOL
WINAPI
ReadConsoleOutputA(
HANDLE hConsoleOutput,
PCHAR_INFO lpBuffer,
COORD dwBufferSize,
COORD dwBufferCoord,
PSMALL_RECT lpReadRegion
)
{
return IntReadConsoleOutput(hConsoleOutput, lpBuffer, dwBufferSize,
dwBufferCoord, lpReadRegion, FALSE);
}
/*-------------------------------------------------------------- /*--------------------------------------------------------------
* ReadConsoleOutputW * ReadConsoleOutputW
* *
* @unimplemented * @implemented
*/ */
BOOL BOOL
WINAPI WINAPI
@ -1758,21 +1818,23 @@ ReadConsoleOutputW(
PSMALL_RECT lpReadRegion PSMALL_RECT lpReadRegion
) )
{ {
/* TO DO */ return IntReadConsoleOutput(hConsoleOutput, lpBuffer, dwBufferSize,
return FALSE; dwBufferCoord, lpReadRegion, TRUE);
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
* WriteConsoleOutputA * IntWriteConsoleOutput
* *
* @implemented * INTERNAL
*/ */
BOOL WINAPI BOOL WINAPI
WriteConsoleOutputA(HANDLE hConsoleOutput, IntWriteConsoleOutput(HANDLE hConsoleOutput,
CONST CHAR_INFO *lpBuffer, CONST CHAR_INFO *lpBuffer,
COORD dwBufferSize, COORD dwBufferSize,
COORD dwBufferCoord, COORD dwBufferCoord,
PSMALL_RECT lpWriteRegion) PSMALL_RECT lpWriteRegion,
BOOL bUnicode)
{ {
PCSRSS_API_REQUEST Request; PCSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply; CSRSS_API_REPLY Reply;
@ -1803,6 +1865,7 @@ WriteConsoleOutputA(HANDLE hConsoleOutput,
} }
Request->Type = CSRSS_WRITE_CONSOLE_OUTPUT; Request->Type = CSRSS_WRITE_CONSOLE_OUTPUT;
Request->Data.WriteConsoleOutputRequest.ConsoleHandle = hConsoleOutput; Request->Data.WriteConsoleOutputRequest.ConsoleHandle = hConsoleOutput;
Request->Data.WriteConsoleOutputRequest.Unicode = bUnicode;
Request->Data.WriteConsoleOutputRequest.BufferSize = dwBufferSize; Request->Data.WriteConsoleOutputRequest.BufferSize = dwBufferSize;
Request->Data.WriteConsoleOutputRequest.BufferCoord = dwBufferCoord; Request->Data.WriteConsoleOutputRequest.BufferCoord = dwBufferCoord;
Request->Data.WriteConsoleOutputRequest.WriteRegion = *lpWriteRegion; Request->Data.WriteConsoleOutputRequest.WriteRegion = *lpWriteRegion;
@ -1826,11 +1889,27 @@ WriteConsoleOutputA(HANDLE hConsoleOutput,
return(TRUE); return(TRUE);
} }
/*--------------------------------------------------------------
* WriteConsoleOutputA
*
* @implemented
*/
BOOL WINAPI
WriteConsoleOutputA(HANDLE hConsoleOutput,
CONST CHAR_INFO *lpBuffer,
COORD dwBufferSize,
COORD dwBufferCoord,
PSMALL_RECT lpWriteRegion)
{
return IntWriteConsoleOutput(hConsoleOutput, lpBuffer, dwBufferSize,
dwBufferCoord, lpWriteRegion, FALSE);
}
/*-------------------------------------------------------------- /*--------------------------------------------------------------
* WriteConsoleOutputW * WriteConsoleOutputW
* *
* @unimplemented * @implemented
*/ */
BOOL BOOL
WINAPI WINAPI
@ -1842,8 +1921,8 @@ WriteConsoleOutputW(
PSMALL_RECT lpWriteRegion PSMALL_RECT lpWriteRegion
) )
{ {
/* TO DO */ return IntWriteConsoleOutput(hConsoleOutput, lpBuffer, dwBufferSize,
return FALSE; dwBufferCoord, lpWriteRegion, TRUE);
} }
@ -1931,6 +2010,7 @@ ReadConsoleOutputCharacterW(
) )
{ {
/* TO DO */ /* TO DO */
DbgPrint("%s unimplemented\n", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -2443,6 +2523,7 @@ SetConsoleScreenBufferSize(
) )
{ {
/* TO DO */ /* TO DO */
DbgPrint("%s unimplemented\n", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -2538,6 +2619,7 @@ ScrollConsoleScreenBufferW(
) )
{ {
/* TO DO */ /* TO DO */
DbgPrint("%s unimplemented\n", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -2556,6 +2638,7 @@ SetConsoleWindowInfo(
) )
{ {
/* TO DO */ /* TO DO */
DbgPrint("%s unimplemented\n", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -2923,6 +3006,7 @@ ReadConsoleW(
) )
{ {
/* --- TO DO --- */ /* --- TO DO --- */
DbgPrint("%s unimplemented\n", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -2942,6 +3026,7 @@ WriteConsoleW(
LPVOID lpReserved LPVOID lpReserved
) )
{ {
DbgPrint("%s unimplemented\n", __FUNCTION__);
#if 0 #if 0
PCSRSS_API_REQUEST Request; PCSRSS_API_REQUEST Request;
CSRSS_API_REPLY Reply; CSRSS_API_REPLY Reply;
@ -3026,14 +3111,25 @@ CreateConsoleScreenBuffer(
/*-------------------------------------------------------------- /*--------------------------------------------------------------
* GetConsoleCP * GetConsoleCP
* *
* @unimplemented * @implemented
*/ */
UINT UINT
WINAPI WINAPI
GetConsoleCP( VOID ) GetConsoleCP( VOID )
{ {
/* --- TO DO --- */ CSRSS_API_REQUEST Request;
return CP_OEMCP; /* FIXME */ CSRSS_API_REPLY Reply;
NTSTATUS Status;
Request.Type = CSRSS_GET_CONSOLE_CP;
Status = CsrClientCallServer(&Request, &Reply, sizeof(CSRSS_API_REQUEST),
sizeof(CSRSS_API_REPLY));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status))
{
SetLastErrorByStatus (Status);
return 0;
}
return Reply.Data.GetConsoleCodePage.CodePage;
} }
@ -3048,29 +3144,51 @@ SetConsoleCP(
UINT wCodePageID UINT wCodePageID
) )
{ {
/* --- TO DO --- */ CSRSS_API_REQUEST Request;
return FALSE; CSRSS_API_REPLY Reply;
NTSTATUS Status;
Request.Type = CSRSS_SET_CONSOLE_CP;
Request.Data.SetConsoleCodePage.CodePage = wCodePageID;
Status = CsrClientCallServer(&Request, &Reply, sizeof(CSRSS_API_REQUEST),
sizeof(CSRSS_API_REPLY));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status))
{
SetLastErrorByStatus (Status);
}
return NT_SUCCESS(Status);
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
* GetConsoleOutputCP * GetConsoleOutputCP
* *
* @unimplemented * @implemented
*/ */
UINT UINT
WINAPI WINAPI
GetConsoleOutputCP( VOID ) GetConsoleOutputCP( VOID )
{ {
/* --- TO DO --- */ CSRSS_API_REQUEST Request;
return 0; /* FIXME */ CSRSS_API_REPLY Reply;
NTSTATUS Status;
Request.Type = CSRSS_GET_CONSOLE_OUTPUT_CP;
Status = CsrClientCallServer(&Request, &Reply, sizeof(CSRSS_API_REQUEST),
sizeof(CSRSS_API_REPLY));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status))
{
SetLastErrorByStatus (Status);
return 0;
}
return Reply.Data.GetConsoleOutputCodePage.CodePage;
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
* SetConsoleOutputCP * SetConsoleOutputCP
* *
* @unimplemented * @implemented
*/ */
BOOL BOOL
WINAPI WINAPI
@ -3078,8 +3196,19 @@ SetConsoleOutputCP(
UINT wCodePageID UINT wCodePageID
) )
{ {
/* --- TO DO --- */ CSRSS_API_REQUEST Request;
return FALSE; CSRSS_API_REPLY Reply;
NTSTATUS Status;
Request.Type = CSRSS_SET_CONSOLE_OUTPUT_CP;
Request.Data.SetConsoleOutputCodePage.CodePage = wCodePageID;
Status = CsrClientCallServer(&Request, &Reply, sizeof(CSRSS_API_REQUEST),
sizeof(CSRSS_API_REPLY));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status))
{
SetLastErrorByStatus (Status);
}
return NT_SUCCESS(Status);
} }
@ -3136,12 +3265,6 @@ GetConsoleWindow (VOID)
CSRSS_API_REPLY Reply; CSRSS_API_REPLY Reply;
NTSTATUS Status; NTSTATUS Status;
Request.Data.ConsoleWindowRequest.ConsoleHandle =
OpenConsoleW (L"CONOUT$", (GENERIC_READ|GENERIC_WRITE), FALSE, OPEN_EXISTING);
if (INVALID_HANDLE_VALUE == Request.Data.ConsoleWindowRequest.ConsoleHandle)
{
return (HWND) NULL;
}
Request.Type = CSRSS_GET_CONSOLE_WINDOW; Request.Type = CSRSS_GET_CONSOLE_WINDOW;
Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) ); Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) );
if (!NT_SUCCESS(Status ) || !NT_SUCCESS(Status = Reply.Status)) if (!NT_SUCCESS(Status ) || !NT_SUCCESS(Status = Reply.Status))
@ -3149,12 +3272,13 @@ GetConsoleWindow (VOID)
SetLastErrorByStatus (Status); SetLastErrorByStatus (Status);
return (HWND) NULL; return (HWND) NULL;
} }
return Reply.Data.ConsoleWindowReply.WindowHandle; return Reply.Data.GetConsoleWindowReply.WindowHandle;
} }
/*-------------------------------------------------------------- /*--------------------------------------------------------------
* GetConsoleWindow * SetConsoleIcon
*
* @implemented * @implemented
*/ */
BOOL STDCALL SetConsoleIcon(HICON hicon) BOOL STDCALL SetConsoleIcon(HICON hicon)
@ -3163,14 +3287,8 @@ BOOL STDCALL SetConsoleIcon(HICON hicon)
CSRSS_API_REPLY Reply; CSRSS_API_REPLY Reply;
NTSTATUS Status; NTSTATUS Status;
Request.Data.ConsoleSetWindowIconRequest.ConsoleHandle =
OpenConsoleW (L"CONOUT$", (GENERIC_READ|GENERIC_WRITE), FALSE, OPEN_EXISTING);
if (INVALID_HANDLE_VALUE == Request.Data.ConsoleSetWindowIconRequest.ConsoleHandle)
{
return FALSE;
}
Request.Type = CSRSS_SET_CONSOLE_ICON; Request.Type = CSRSS_SET_CONSOLE_ICON;
Request.Data.ConsoleSetWindowIconRequest.WindowIcon = hicon; Request.Data.SetConsoleIconRequest.WindowIcon = hicon;
Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) ); Status = CsrClientCallServer( &Request, &Reply, sizeof( CSRSS_API_REQUEST ), sizeof( CSRSS_API_REPLY ) );
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status)) if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status))
{ {

View file

@ -1,4 +1,4 @@
/* $Id: conio.h,v 1.3 2004/03/14 17:53:27 weiden Exp $ /* $Id: conio.h,v 1.4 2004/08/22 20:52:28 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -84,6 +84,8 @@ typedef struct tagCSRSS_CONSOLE
HICON hWindowIcon; HICON hWindowIcon;
COORD Size; COORD Size;
PVOID PrivateData; PVOID PrivateData;
UINT CodePage;
UINT OutputCodePage;
PCSRSS_CONSOLE_VTBL Vtbl; PCSRSS_CONSOLE_VTBL Vtbl;
LIST_ENTRY ProcessList; LIST_ENTRY ProcessList;
} CSRSS_CONSOLE; } CSRSS_CONSOLE;
@ -132,6 +134,10 @@ CSR_API(CsrWriteConsoleInput);
CSR_API(CsrHardwareStateProperty); CSR_API(CsrHardwareStateProperty);
CSR_API(CsrGetConsoleWindow); CSR_API(CsrGetConsoleWindow);
CSR_API(CsrSetConsoleIcon); CSR_API(CsrSetConsoleIcon);
CSR_API(CsrGetConsoleCodePage);
CSR_API(CsrSetConsoleCodePage);
CSR_API(CsrGetConsoleOutputCodePage);
CSR_API(CsrSetConsoleOutputCodePage);
#define ConioInitScreenBuffer(Console, Buff) (Console)->Vtbl->InitScreenBuffer((Console), (Buff)) #define ConioInitScreenBuffer(Console, Buff) (Console)->Vtbl->InitScreenBuffer((Console), (Buff))
#define ConioDrawRegion(Console, Region) (Console)->Vtbl->DrawRegion((Console), (Region)) #define ConioDrawRegion(Console, Region) (Console)->Vtbl->DrawRegion((Console), (Region))

View file

@ -1,4 +1,4 @@
/* $Id: conio.c,v 1.11 2004/07/04 17:22:33 navaraf Exp $ /* $Id: conio.c,v 1.12 2004/08/22 20:52:28 navaraf Exp $
* *
* reactos/subsys/csrss/win32csr/conio.c * reactos/subsys/csrss/win32csr/conio.c
* *
@ -68,7 +68,7 @@ CsrConsoleCtrlEvent(DWORD Event, PCSRSS_PROCESS_DATA ProcessData)
{ {
HANDLE Process, Thread; HANDLE Process, Thread;
DPRINT("CsrConsoleCtrlEvent Parent ProcessId = %x\n", ClientId.UniqueProcess); DPRINT("CsrConsoleCtrlEvent Parent ProcessId = %x\n", ProcessData->ProcessId);
if (ProcessData->CtrlDispatcher) if (ProcessData->CtrlDispatcher)
{ {
@ -96,11 +96,11 @@ CsrConsoleCtrlEvent(DWORD Event, PCSRSS_PROCESS_DATA ProcessData)
} }
#define GET_CELL_BUFFER(b,o)\ #define GET_CELL_BUFFER(b,o)\
(b)->Buffer[(o)++]; (b)->Buffer[(o)++]
#define SET_CELL_BUFFER(b,o,c,a)\ #define SET_CELL_BUFFER(b,o,c,a)\
(b)->Buffer[(o)++]=(c);\ (b)->Buffer[(o)++]=(c),\
(b)->Buffer[(o)++]=(a); (b)->Buffer[(o)++]=(a)
static VOID FASTCALL static VOID FASTCALL
ClearLineBuffer(PCSRSS_SCREEN_BUFFER Buff) ClearLineBuffer(PCSRSS_SCREEN_BUFFER Buff)
@ -111,7 +111,7 @@ ClearLineBuffer(PCSRSS_SCREEN_BUFFER Buff)
for (Pos = 0; Pos < Buff->MaxX; Pos++) for (Pos = 0; Pos < Buff->MaxX; Pos++)
{ {
/* Fill the cell: Offset is incremented by the macro */ /* Fill the cell: Offset is incremented by the macro */
SET_CELL_BUFFER(Buff, Offset, ' ', Buff->DefaultAttrib) SET_CELL_BUFFER(Buff, Offset, ' ', Buff->DefaultAttrib);
} }
} }
@ -170,6 +170,9 @@ CsrInitConsole(PCSRSS_CONSOLE Console)
InitializeListHead(&Console->InputEvents); InitializeListHead(&Console->InputEvents);
InitializeListHead(&Console->ProcessList); InitializeListHead(&Console->ProcessList);
Console->CodePage = CP_OEMCP;
Console->OutputCodePage = CP_OEMCP;
SecurityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES); SecurityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES);
SecurityAttributes.lpSecurityDescriptor = NULL; SecurityAttributes.lpSecurityDescriptor = NULL;
SecurityAttributes.bInheritHandle = TRUE; SecurityAttributes.bInheritHandle = TRUE;
@ -832,6 +835,18 @@ ConioFillRegion(PCSRSS_SCREEN_BUFFER ScreenBuffer,
} }
} }
STATIC VOID FASTCALL
ConioInputEventToAnsi(PCSRSS_CONSOLE Console, PINPUT_RECORD InputEvent)
{
if (InputEvent->EventType == KEY_EVENT)
{
WideCharToMultiByte(Console->CodePage, 0,
&InputEvent->Event.KeyEvent.uChar.UnicodeChar, 1,
&InputEvent->Event.KeyEvent.uChar.AsciiChar, 1,
NULL, NULL);
}
}
CSR_API(CsrWriteConsole) CSR_API(CsrWriteConsole)
{ {
NTSTATUS Status; NTSTATUS Status;
@ -1200,14 +1215,6 @@ ConioProcessKey(MSG *msg, PCSRSS_CONSOLE Console, BOOL TextMode)
UnicodeChar = (1 == RetChars ? Chars[0] : 0); UnicodeChar = (1 == RetChars ? Chars[0] : 0);
} }
if (UnicodeChar)
{
RtlUnicodeToOemN(&AsciiChar,
1,
&ResultSize,
&UnicodeChar,
sizeof(WCHAR));
}
if (0 == ResultSize) if (0 == ResultSize)
{ {
AsciiChar = 0; AsciiChar = 0;
@ -1216,7 +1223,7 @@ ConioProcessKey(MSG *msg, PCSRSS_CONSOLE Console, BOOL TextMode)
er.EventType = KEY_EVENT; er.EventType = KEY_EVENT;
er.Event.KeyEvent.bKeyDown = Down; er.Event.KeyEvent.bKeyDown = Down;
er.Event.KeyEvent.wRepeatCount = RepeatCount; er.Event.KeyEvent.wRepeatCount = RepeatCount;
er.Event.KeyEvent.uChar.UnicodeChar = AsciiChar & 0xff; er.Event.KeyEvent.uChar.UnicodeChar = UnicodeChar;
er.Event.KeyEvent.dwControlKeyState = ShiftState; er.Event.KeyEvent.dwControlKeyState = ShiftState;
er.Event.KeyEvent.wVirtualKeyCode = VirtualKeyCode; er.Event.KeyEvent.wVirtualKeyCode = VirtualKeyCode;
er.Event.KeyEvent.wVirtualScanCode = VirtualScanCode; er.Event.KeyEvent.wVirtualScanCode = VirtualScanCode;
@ -1255,7 +1262,7 @@ ConioProcessKey(MSG *msg, PCSRSS_CONSOLE Console, BOOL TextMode)
} }
ConInRec->InputEvent = er; ConInRec->InputEvent = er;
ConInRec->Fake = AsciiChar && ConInRec->Fake = UnicodeChar &&
(msg->message != WM_CHAR && msg->message != WM_SYSCHAR && (msg->message != WM_CHAR && msg->message != WM_SYSCHAR &&
msg->message != WM_KEYUP && msg->message != WM_SYSKEYUP); msg->message != WM_KEYUP && msg->message != WM_SYSKEYUP);
ConInRec->NotChar = (msg->message != WM_CHAR && msg->message != WM_SYSCHAR); ConInRec->NotChar = (msg->message != WM_CHAR && msg->message != WM_SYSCHAR);
@ -1599,6 +1606,11 @@ CSR_API(CsrReadInputEvent)
Done = !Input->Fake; Done = !Input->Fake;
Reply->Data.ReadInputReply.Input = Input->InputEvent; Reply->Data.ReadInputReply.Input = Input->InputEvent;
if (Request->Data.ReadInputRequest.Unicode == FALSE)
{
ConioInputEventToAnsi(Console, &Reply->Data.ReadInputReply.Input);
}
if (Input->InputEvent.EventType == KEY_EVENT) if (Input->InputEvent.EventType == KEY_EVENT)
{ {
if (0 != (Console->Mode & ENABLE_LINE_INPUT) if (0 != (Console->Mode & ENABLE_LINE_INPUT)
@ -2228,7 +2240,18 @@ CSR_API(CsrWriteConsoleOutput)
Offset = (((Y + Buff->ShowY) % Buff->MaxY) * Buff->MaxX + WriteRegion.left) * 2; Offset = (((Y + Buff->ShowY) % Buff->MaxY) * Buff->MaxX + WriteRegion.left) * 2;
for (X = WriteRegion.left; X <= WriteRegion.right; X++) for (X = WriteRegion.left; X <= WriteRegion.right; X++)
{ {
SET_CELL_BUFFER(Buff, Offset, CurCharInfo->Char.AsciiChar, CurCharInfo->Attributes); if (Request->Data.WriteConsoleOutputRequest.Unicode)
{
CHAR AsciiChar;
WideCharToMultiByte(Console->OutputCodePage, 0,
&CurCharInfo->Char.UnicodeChar, 1,
&AsciiChar, 1, NULL, NULL);
SET_CELL_BUFFER(Buff, Offset, AsciiChar, CurCharInfo->Attributes);
}
else
{
SET_CELL_BUFFER(Buff, Offset, CurCharInfo->Char.AsciiChar, CurCharInfo->Attributes);
}
CurCharInfo++; CurCharInfo++;
} }
} }
@ -2587,22 +2610,28 @@ CSR_API(CsrPeekConsoleInput)
if (! IsListEmpty(&Console->InputEvents)) if (! IsListEmpty(&Console->InputEvents))
{ {
CurrentItem = &Console->InputEvents; CurrentItem = Console->InputEvents.Flink;
while (NumItems < Length) while (CurrentItem != &Console->InputEvents && NumItems < Length)
{ {
++NumItems;
Item = CONTAINING_RECORD(CurrentItem, ConsoleInput, ListEntry); Item = CONTAINING_RECORD(CurrentItem, ConsoleInput, ListEntry);
*InputRecord++ = Item->InputEvent;
if (Item->Fake)
if (CurrentItem->Flink == &Console->InputEvents)
{
break;
}
else
{ {
CurrentItem = CurrentItem->Flink; CurrentItem = CurrentItem->Flink;
continue;
} }
++NumItems;
*InputRecord = Item->InputEvent;
if (Request->Data.ReadInputRequest.Unicode == FALSE)
{
ConioInputEventToAnsi(Console, InputRecord);
}
InputRecord++;
CurrentItem = CurrentItem->Flink;
} }
} }
@ -2629,6 +2658,7 @@ CSR_API(CsrReadConsoleOutput)
RECT ReadRegion; RECT ReadRegion;
RECT ScreenRect; RECT ScreenRect;
DWORD i, Y, X, Offset; DWORD i, Y, X, Offset;
UINT CodePage;
DPRINT("CsrReadConsoleOutput\n"); DPRINT("CsrReadConsoleOutput\n");
@ -2650,6 +2680,9 @@ CSR_API(CsrReadConsoleOutput)
BufferCoord = Request->Data.ReadConsoleOutputRequest.BufferCoord; BufferCoord = Request->Data.ReadConsoleOutputRequest.BufferCoord;
Length = BufferSize.X * BufferSize.Y; Length = BufferSize.X * BufferSize.Y;
Size = Length * sizeof(CHAR_INFO); Size = Length * sizeof(CHAR_INFO);
/* FIXME: Is this correct? */
CodePage = ProcessData->Console->OutputCodePage;
if (((PVOID)CharInfo < ProcessData->CsrSectionViewBase) if (((PVOID)CharInfo < ProcessData->CsrSectionViewBase)
|| (((PVOID)CharInfo + Size) > (ProcessData->CsrSectionViewBase + ProcessData->CsrSectionViewSize))) || (((PVOID)CharInfo + Size) > (ProcessData->CsrSectionViewBase + ProcessData->CsrSectionViewSize)))
@ -2679,7 +2712,16 @@ CSR_API(CsrReadConsoleOutput)
Offset = (((Y + Buff->ShowY) % Buff->MaxY) * Buff->MaxX + ReadRegion.left) * 2; Offset = (((Y + Buff->ShowY) % Buff->MaxY) * Buff->MaxX + ReadRegion.left) * 2;
for (X = ReadRegion.left; X < ReadRegion.right; ++X) for (X = ReadRegion.left; X < ReadRegion.right; ++X)
{ {
CurCharInfo->Char.AsciiChar = GET_CELL_BUFFER(Buff, Offset); if (Request->Data.ReadConsoleOutputRequest.Unicode)
{
MultiByteToWideChar(CodePage, 0,
&GET_CELL_BUFFER(Buff, Offset), 1,
&CurCharInfo->Char.UnicodeChar, 1);
}
else
{
CurCharInfo->Char.AsciiChar = GET_CELL_BUFFER(Buff, Offset);
}
CurCharInfo->Attributes = GET_CELL_BUFFER(Buff, Offset); CurCharInfo->Attributes = GET_CELL_BUFFER(Buff, Offset);
++CurCharInfo; ++CurCharInfo;
} }
@ -2842,15 +2884,13 @@ CSR_API(CsrGetConsoleWindow)
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY); Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE; Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Status = ConioLockConsole(ProcessData, Status = ConioConsoleFromProcessData(ProcessData, &Console);
Request->Data.ConsoleWindowRequest.ConsoleHandle,
&Console);
if (! NT_SUCCESS(Status)) if (! NT_SUCCESS(Status))
{ {
return Reply->Status = Status; return Reply->Status = Status;
} }
Reply->Data.ConsoleWindowReply.WindowHandle = Console->hWindow; Reply->Data.GetConsoleWindowReply.WindowHandle = Console->hWindow;
ConioUnlockConsole(Console); ConioUnlockConsole(Console);
return Reply->Status = STATUS_SUCCESS; return Reply->Status = STATUS_SUCCESS;
@ -2866,21 +2906,107 @@ CSR_API(CsrSetConsoleIcon)
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY); Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE; Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Status = ConioLockConsole(ProcessData, Status = ConioConsoleFromProcessData(ProcessData, &Console);
Request->Data.ConsoleSetWindowIconRequest.ConsoleHandle,
&Console);
if (! NT_SUCCESS(Status)) if (! NT_SUCCESS(Status))
{ {
return Reply->Status = Status; return Reply->Status = Status;
} }
Console->hWindowIcon = Request->Data.ConsoleSetWindowIconRequest.WindowIcon; Console->hWindowIcon = Request->Data.SetConsoleIconRequest.WindowIcon;
Reply->Status = (ConioChangeIcon(Console) ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL); Reply->Status = (ConioChangeIcon(Console) ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL);
Reply->Data.ConsoleSetWindowIconReply.WindowIcon = Console->hWindowIcon;
ConioUnlockConsole(Console); ConioUnlockConsole(Console);
return Reply->Status; return Reply->Status;
} }
CSR_API(CsrGetConsoleCodePage)
{
PCSRSS_CONSOLE Console;
NTSTATUS Status;
DPRINT("CsrGetConsoleCodePage\n");
Status = ConioConsoleFromProcessData(ProcessData, &Console);
if (! NT_SUCCESS(Status))
{
return Reply->Status = Status;
}
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Reply->Data.GetConsoleCodePage.CodePage = Console->CodePage;
ConioUnlockConsole(Console);
return Reply->Status = STATUS_SUCCESS;
}
CSR_API(CsrSetConsoleCodePage)
{
PCSRSS_CONSOLE Console;
NTSTATUS Status;
DPRINT("CsrSetConsoleCodePage\n");
Status = ConioConsoleFromProcessData(ProcessData, &Console);
if (! NT_SUCCESS(Status))
{
return Reply->Status = Status;
}
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
if (IsValidCodePage(Request->Data.SetConsoleCodePage.CodePage))
{
Console->CodePage = Request->Data.SetConsoleCodePage.CodePage;
ConioUnlockConsole(Console);
return Reply->Status = STATUS_SUCCESS;
}
ConioUnlockConsole(Console);
return Reply->Status = STATUS_UNSUCCESSFUL;
}
CSR_API(CsrGetConsoleOutputCodePage)
{
PCSRSS_CONSOLE Console;
NTSTATUS Status;
DPRINT("CsrGetConsoleOutputCodePage\n");
Status = ConioConsoleFromProcessData(ProcessData, &Console);
if (! NT_SUCCESS(Status))
{
return Reply->Status = Status;
}
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
Reply->Data.GetConsoleOutputCodePage.CodePage = Console->OutputCodePage;
ConioUnlockConsole(Console);
return Reply->Status = STATUS_SUCCESS;
}
CSR_API(CsrSetConsoleOutputCodePage)
{
PCSRSS_CONSOLE Console;
NTSTATUS Status;
DPRINT("CsrSetConsoleOutputCodePage\n");
Status = ConioConsoleFromProcessData(ProcessData, &Console);
if (! NT_SUCCESS(Status))
{
return Reply->Status = Status;
}
Reply->Header.MessageSize = sizeof(CSRSS_API_REPLY);
Reply->Header.DataSize = sizeof(CSRSS_API_REPLY) - LPC_MESSAGE_BASE_SIZE;
if (IsValidCodePage(Request->Data.SetConsoleOutputCodePage.CodePage))
{
Console->OutputCodePage = Request->Data.SetConsoleOutputCodePage.CodePage;
ConioUnlockConsole(Console);
return Reply->Status = STATUS_SUCCESS;
}
ConioUnlockConsole(Console);
return Reply->Status = STATUS_UNSUCCESSFUL;
}
/* EOF */ /* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: dllmain.c,v 1.6 2004/07/12 20:09:34 gvg Exp $ /* $Id: dllmain.c,v 1.7 2004/08/22 20:52:28 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -60,11 +60,17 @@ static CSRSS_API_DEFINITION Win32CsrApiDefinitions[] =
CSRSS_DEFINE_API(CSRSS_READ_CONSOLE_OUTPUT, CsrReadConsoleOutput), CSRSS_DEFINE_API(CSRSS_READ_CONSOLE_OUTPUT, CsrReadConsoleOutput),
CSRSS_DEFINE_API(CSRSS_WRITE_CONSOLE_INPUT, CsrWriteConsoleInput), CSRSS_DEFINE_API(CSRSS_WRITE_CONSOLE_INPUT, CsrWriteConsoleInput),
CSRSS_DEFINE_API(CSRSS_SETGET_CONSOLE_HW_STATE, CsrHardwareStateProperty), CSRSS_DEFINE_API(CSRSS_SETGET_CONSOLE_HW_STATE, CsrHardwareStateProperty),
CSRSS_DEFINE_API(CSRSS_GET_CONSOLE_WINDOW, CsrGetConsoleWindow),
CSRSS_DEFINE_API(CSRSS_CREATE_DESKTOP, CsrCreateDesktop), CSRSS_DEFINE_API(CSRSS_CREATE_DESKTOP, CsrCreateDesktop),
CSRSS_DEFINE_API(CSRSS_SHOW_DESKTOP, CsrShowDesktop), CSRSS_DEFINE_API(CSRSS_SHOW_DESKTOP, CsrShowDesktop),
CSRSS_DEFINE_API(CSRSS_HIDE_DESKTOP, CsrHideDesktop), CSRSS_DEFINE_API(CSRSS_HIDE_DESKTOP, CsrHideDesktop),
CSRSS_DEFINE_API(CSRSS_SET_CONSOLE_ICON, CsrSetConsoleIcon),
CSRSS_DEFINE_API(CSRSS_SET_LOGON_NOTIFY_WINDOW, CsrSetLogonNotifyWindow), CSRSS_DEFINE_API(CSRSS_SET_LOGON_NOTIFY_WINDOW, CsrSetLogonNotifyWindow),
CSRSS_DEFINE_API(CSRSS_REGISTER_LOGON_PROCESS, CsrRegisterLogonProcess), CSRSS_DEFINE_API(CSRSS_REGISTER_LOGON_PROCESS, CsrRegisterLogonProcess),
CSRSS_DEFINE_API(CSRSS_GET_CONSOLE_CP, CsrGetConsoleCodePage),
CSRSS_DEFINE_API(CSRSS_SET_CONSOLE_CP, CsrSetConsoleCodePage),
CSRSS_DEFINE_API(CSRSS_GET_CONSOLE_OUTPUT_CP, CsrGetConsoleOutputCodePage),
CSRSS_DEFINE_API(CSRSS_SET_CONSOLE_OUTPUT_CP, CsrSetConsoleOutputCodePage),
{ 0, 0, 0, NULL } { 0, 0, 0, NULL }
}; };