2005-01-03 23:02:15 +00:00
|
|
|
/* $Id$
|
2000-07-01 17:07:02 +00:00
|
|
|
*
|
1999-03-06 10:57:02 +00:00
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS system libraries
|
|
|
|
* FILE: lib/kernel32/misc/console.c
|
|
|
|
* PURPOSE: Win32 server console functions
|
2005-05-09 01:46:57 +00:00
|
|
|
* PROGRAMMER: James Tabor
|
2003-08-07 12:17:56 +00:00
|
|
|
* <jimtabor@adsl-64-217-116-74.dsl.hstntx.swbell.net>
|
1999-03-06 10:57:02 +00:00
|
|
|
* UPDATE HISTORY:
|
|
|
|
* 199901?? ?? Created
|
|
|
|
* 19990204 EA SetConsoleTitleA
|
|
|
|
* 19990306 EA Stubs
|
|
|
|
*/
|
1999-12-26 15:50:53 +00:00
|
|
|
|
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
|
2003-01-15 21:24:36 +00:00
|
|
|
#include <k32.h>
|
2000-03-22 18:36:00 +00:00
|
|
|
|
1999-04-14 00:52:19 +00:00
|
|
|
#define NDEBUG
|
2007-09-02 19:42:22 +00:00
|
|
|
#include <debug.h>
|
1999-03-30 21:58:05 +00:00
|
|
|
|
2003-08-13 06:53:54 +00:00
|
|
|
extern BOOL WINAPI DefaultConsoleCtrlHandler(DWORD Event);
|
2003-08-16 17:37:51 +00:00
|
|
|
extern __declspec(noreturn) VOID CALLBACK ConsoleControlDispatcher(DWORD CodeAndFlag);
|
2005-01-03 23:02:15 +00:00
|
|
|
extern RTL_CRITICAL_SECTION ConsoleLock;
|
2003-08-16 17:37:51 +00:00
|
|
|
extern BOOL WINAPI IsDebuggerPresent(VOID);
|
2003-08-13 06:53:54 +00:00
|
|
|
|
2001-04-04 22:21:32 +00:00
|
|
|
/* GLOBALS *******************************************************************/
|
|
|
|
|
|
|
|
static BOOL IgnoreCtrlEvents = FALSE;
|
2003-08-13 06:53:54 +00:00
|
|
|
|
2003-08-18 10:47:04 +00:00
|
|
|
static PHANDLER_ROUTINE* CtrlHandlers = NULL;
|
|
|
|
static ULONG NrCtrlHandlers = 0;
|
2004-12-18 13:26:57 +00:00
|
|
|
static WCHAR InputExeName[MAX_PATH + 1] = L"";
|
2001-04-04 22:21:32 +00:00
|
|
|
|
2003-08-16 17:37:51 +00:00
|
|
|
/* Default Console Control Handler *******************************************/
|
2003-08-09 04:13:24 +00:00
|
|
|
|
2003-08-13 06:53:54 +00:00
|
|
|
BOOL WINAPI DefaultConsoleCtrlHandler(DWORD Event)
|
2003-08-09 04:13:24 +00:00
|
|
|
{
|
|
|
|
switch(Event)
|
|
|
|
{
|
|
|
|
case CTRL_C_EVENT:
|
|
|
|
DPRINT("Ctrl-C Event\n");
|
|
|
|
break;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2003-08-09 04:13:24 +00:00
|
|
|
case CTRL_BREAK_EVENT:
|
|
|
|
DPRINT("Ctrl-Break Event\n");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CTRL_SHUTDOWN_EVENT:
|
|
|
|
DPRINT("Ctrl Shutdown Event\n");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CTRL_CLOSE_EVENT:
|
|
|
|
DPRINT("Ctrl Close Event\n");
|
|
|
|
break;
|
|
|
|
|
2005-05-09 01:46:57 +00:00
|
|
|
case CTRL_LOGOFF_EVENT:
|
2003-08-09 04:13:24 +00:00
|
|
|
DPRINT("Ctrl Logoff Event\n");
|
|
|
|
break;
|
|
|
|
}
|
2004-09-10 22:14:52 +00:00
|
|
|
ExitProcess(0);
|
2003-08-09 04:13:24 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2003-08-16 17:37:51 +00:00
|
|
|
|
|
|
|
__declspec(noreturn) VOID CALLBACK ConsoleControlDispatcher(DWORD CodeAndFlag)
|
|
|
|
{
|
|
|
|
DWORD nExitCode = 0;
|
|
|
|
DWORD nCode = CodeAndFlag & MAXLONG;
|
|
|
|
UINT i;
|
|
|
|
|
|
|
|
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
|
|
|
|
|
|
|
|
switch(nCode)
|
|
|
|
{
|
|
|
|
case CTRL_C_EVENT:
|
|
|
|
case CTRL_BREAK_EVENT:
|
|
|
|
{
|
|
|
|
if(IsDebuggerPresent())
|
|
|
|
{
|
|
|
|
EXCEPTION_RECORD erException;
|
2005-05-09 01:46:57 +00:00
|
|
|
erException.ExceptionCode =
|
2003-08-16 17:37:51 +00:00
|
|
|
(nCode == CTRL_C_EVENT ? DBG_CONTROL_C : DBG_CONTROL_BREAK);
|
|
|
|
erException.ExceptionFlags = 0;
|
|
|
|
erException.ExceptionRecord = NULL;
|
|
|
|
erException.ExceptionAddress = &DefaultConsoleCtrlHandler;
|
|
|
|
erException.NumberParameters = 0;
|
|
|
|
RtlRaiseException(&erException);
|
2005-05-09 01:46:57 +00:00
|
|
|
}
|
2003-08-16 17:37:51 +00:00
|
|
|
RtlEnterCriticalSection(&ConsoleLock);
|
|
|
|
|
|
|
|
if(!(nCode == CTRL_C_EVENT &&
|
2005-07-12 01:56:14 +00:00
|
|
|
NtCurrentPeb()->ProcessParameters->ConsoleFlags & 1))
|
2003-08-16 17:37:51 +00:00
|
|
|
{
|
|
|
|
for(i = NrCtrlHandlers; i > 0; -- i)
|
|
|
|
if(CtrlHandlers[i - 1](nCode)) break;
|
|
|
|
}
|
|
|
|
RtlLeaveCriticalSection(&ConsoleLock);
|
|
|
|
ExitThread(0);
|
|
|
|
}
|
|
|
|
case CTRL_CLOSE_EVENT:
|
|
|
|
case CTRL_LOGOFF_EVENT:
|
|
|
|
case CTRL_SHUTDOWN_EVENT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: ExitThread(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
RtlEnterCriticalSection(&ConsoleLock);
|
|
|
|
|
|
|
|
if(!(nCode == CTRL_C_EVENT &&
|
2005-07-12 01:56:14 +00:00
|
|
|
NtCurrentPeb()->ProcessParameters->ConsoleFlags & 1))
|
2003-08-16 17:37:51 +00:00
|
|
|
{
|
|
|
|
i = NrCtrlHandlers;
|
|
|
|
while(i > 0)
|
|
|
|
{
|
2005-05-09 01:46:57 +00:00
|
|
|
if (i == 1 && (CodeAndFlag & MINLONG) &&
|
2003-08-16 17:37:51 +00:00
|
|
|
(nCode == CTRL_LOGOFF_EVENT || nCode == CTRL_SHUTDOWN_EVENT))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if(CtrlHandlers[i - 1](nCode))
|
|
|
|
{
|
|
|
|
switch(nCode)
|
|
|
|
{
|
|
|
|
case CTRL_CLOSE_EVENT:
|
|
|
|
case CTRL_LOGOFF_EVENT:
|
|
|
|
case CTRL_SHUTDOWN_EVENT:
|
|
|
|
nExitCode = CodeAndFlag;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
--i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RtlLeaveCriticalSection(&ConsoleLock);
|
|
|
|
ExitThread(nExitCode);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-12-26 15:50:53 +00:00
|
|
|
/* FUNCTIONS *****************************************************************/
|
1999-01-16 02:11:45 +00:00
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
/*
|
2008-02-02 21:06:53 +00:00
|
|
|
* @implemented
|
2003-07-10 18:50:51 +00:00
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
BOOL STDCALL
|
2008-02-02 21:06:53 +00:00
|
|
|
AddConsoleAliasA (LPCSTR lpSource,
|
|
|
|
LPCSTR lpTarget,
|
|
|
|
LPCSTR lpExeName)
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2008-02-02 21:06:53 +00:00
|
|
|
LPWSTR lpSourceW = NULL;
|
|
|
|
LPWSTR lpTargetW = NULL;
|
|
|
|
LPWSTR lpExeNameW = NULL;
|
|
|
|
BOOL bRetVal;
|
|
|
|
|
|
|
|
if (lpSource)
|
|
|
|
BasepAnsiStringToHeapUnicodeString(lpSource, (LPWSTR*) &lpSourceW);
|
|
|
|
if (lpTarget)
|
|
|
|
BasepAnsiStringToHeapUnicodeString(lpTarget, (LPWSTR*) &lpTargetW);
|
|
|
|
if (lpExeName)
|
|
|
|
BasepAnsiStringToHeapUnicodeString(lpExeName, (LPWSTR*) &lpExeNameW);
|
|
|
|
|
|
|
|
bRetVal = AddConsoleAliasW(lpSourceW, lpTargetW, lpExeNameW);
|
|
|
|
|
|
|
|
/* Clean up */
|
|
|
|
if (lpSourceW)
|
|
|
|
RtlFreeHeap(GetProcessHeap(), 0, (LPWSTR*) lpSourceW);
|
|
|
|
if (lpTargetW)
|
|
|
|
RtlFreeHeap(GetProcessHeap(), 0, (LPWSTR*) lpTargetW);
|
|
|
|
if (lpExeNameW)
|
|
|
|
RtlFreeHeap(GetProcessHeap(), 0, (LPWSTR*) lpExeNameW);
|
|
|
|
|
|
|
|
return bRetVal;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
BOOL STDCALL
|
2008-02-02 21:06:53 +00:00
|
|
|
AddConsoleAliasW (LPCWSTR lpSource,
|
|
|
|
LPCWSTR lpTarget,
|
2008-02-04 22:11:56 +00:00
|
|
|
LPCWSTR lpExeName)
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2008-02-06 18:57:40 +00:00
|
|
|
PCSR_API_MESSAGE Request;
|
2008-02-04 18:58:17 +00:00
|
|
|
ULONG CsrRequest;
|
2008-02-04 22:11:56 +00:00
|
|
|
NTSTATUS Status;
|
2008-02-06 18:57:40 +00:00
|
|
|
ULONG SourceLength;
|
|
|
|
ULONG TargetLength = 0;
|
|
|
|
ULONG ExeLength;
|
|
|
|
ULONG Size;
|
|
|
|
ULONG RequestLength;
|
|
|
|
WCHAR * Ptr;
|
|
|
|
|
|
|
|
DPRINT("AddConsoleAliasW enterd with lpSource %S lpTarget %S lpExeName %S\n", lpSource, lpTarget, lpExeName);
|
|
|
|
|
|
|
|
ExeLength = wcslen(lpExeName) + 1;
|
|
|
|
SourceLength = wcslen(lpSource)+ 1;
|
|
|
|
if (lpTarget)
|
|
|
|
TargetLength = wcslen(lpTarget) + 1;
|
|
|
|
|
|
|
|
Size = (ExeLength + SourceLength + TargetLength) * sizeof(WCHAR);
|
|
|
|
RequestLength = sizeof(CSR_API_MESSAGE) + Size;
|
|
|
|
|
|
|
|
Request = RtlAllocateHeap(GetProcessHeap(), HEAP_ZERO_MEMORY, RequestLength);
|
|
|
|
Ptr = (WCHAR*)(((ULONG_PTR)Request) + sizeof(CSR_API_MESSAGE));
|
|
|
|
|
|
|
|
wcscpy(Ptr, lpSource);
|
|
|
|
Request->Data.AddConsoleAlias.SourceLength = SourceLength;
|
|
|
|
Ptr = (WCHAR*)(((ULONG_PTR)Request) + sizeof(CSR_API_MESSAGE) + SourceLength * sizeof(WCHAR));
|
|
|
|
|
|
|
|
wcscpy(Ptr, lpExeName);
|
|
|
|
Request->Data.AddConsoleAlias.ExeLength = ExeLength;
|
|
|
|
Ptr = (WCHAR*)(((ULONG_PTR)Request) + sizeof(CSR_API_MESSAGE) + (ExeLength + SourceLength)* sizeof(WCHAR));
|
|
|
|
|
|
|
|
if (lpTarget) /* target can be optional */
|
|
|
|
wcscpy(Ptr, lpTarget);
|
|
|
|
|
|
|
|
Request->Data.AddConsoleAlias.TargetLength = TargetLength;
|
2008-02-02 21:06:53 +00:00
|
|
|
|
2008-02-04 18:58:17 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(ADD_CONSOLE_ALIAS, CSR_NATIVE);
|
2008-02-06 18:57:40 +00:00
|
|
|
Status = CsrClientCallServer(Request,
|
|
|
|
NULL,
|
2008-02-04 18:58:17 +00:00
|
|
|
CsrRequest,
|
2008-02-06 18:57:40 +00:00
|
|
|
RequestLength);
|
2008-02-02 21:06:53 +00:00
|
|
|
|
2008-02-06 18:57:40 +00:00
|
|
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request->Status))
|
2008-02-04 18:58:17 +00:00
|
|
|
{
|
|
|
|
SetLastErrorByStatus(Status);
|
2008-02-06 18:57:40 +00:00
|
|
|
RtlFreeHeap(GetProcessHeap(), 0, Request);
|
2008-02-04 18:58:17 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2008-02-06 18:57:40 +00:00
|
|
|
RtlFreeHeap(GetProcessHeap(), 0, Request);
|
2008-02-04 18:58:17 +00:00
|
|
|
return TRUE;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
BOOL STDCALL
|
|
|
|
ConsoleMenuControl (HANDLE hConsole,
|
|
|
|
DWORD Unknown1,
|
|
|
|
DWORD Unknown2)
|
2001-04-04 22:21:32 +00:00
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("ConsoleMenuControl(0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", hConsole, Unknown1, Unknown2);
|
2001-03-31 01:17:30 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2003-03-09 21:37:18 +00:00
|
|
|
HANDLE STDCALL
|
2001-04-04 22:21:32 +00:00
|
|
|
DuplicateConsoleHandle (HANDLE hConsole,
|
2003-03-09 21:37:18 +00:00
|
|
|
DWORD dwDesiredAccess,
|
|
|
|
BOOL bInheritHandle,
|
|
|
|
DWORD dwOptions)
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request;
|
|
|
|
ULONG CsrRequest;
|
2003-03-09 21:37:18 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
2008-07-22 17:37:13 +00:00
|
|
|
if (dwOptions & ~(DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)
|
|
|
|
|| (!(dwOptions & DUPLICATE_SAME_ACCESS)
|
|
|
|
&& dwDesiredAccess & ~(GENERIC_READ | GENERIC_WRITE)))
|
2003-03-09 21:37:18 +00:00
|
|
|
{
|
|
|
|
SetLastError (ERROR_INVALID_PARAMETER);
|
|
|
|
return INVALID_HANDLE_VALUE;
|
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(DUPLICATE_HANDLE, CSR_NATIVE);
|
2003-03-09 21:37:18 +00:00
|
|
|
Request.Data.DuplicateHandleRequest.Handle = hConsole;
|
2008-07-22 17:37:13 +00:00
|
|
|
Request.Data.DuplicateHandleRequest.Access = dwDesiredAccess;
|
|
|
|
Request.Data.DuplicateHandleRequest.Inheritable = bInheritHandle;
|
|
|
|
Request.Data.DuplicateHandleRequest.Options = dwOptions;
|
2003-03-09 21:37:18 +00:00
|
|
|
Status = CsrClientCallServer(&Request,
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
NULL,
|
|
|
|
CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
|
|
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status=Request.Status))
|
2003-03-09 21:37:18 +00:00
|
|
|
{
|
|
|
|
SetLastErrorByStatus(Status);
|
|
|
|
return INVALID_HANDLE_VALUE;
|
|
|
|
}
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
return Request.Data.DuplicateHandleRequest.Handle;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
|
|
|
ExpungeConsoleCommandHistoryW (DWORD Unknown0)
|
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("ExpungeConsoleCommandHistoryW(0x%x) UNIMPLEMENTED!\n", Unknown0);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return 0;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
|
|
|
ExpungeConsoleCommandHistoryA (DWORD Unknown0)
|
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
|
|
|
|
DPRINT1("ExpungeConsoleCommandHistoryW(0x%x) UNIMPLEMENTED!\n", Unknown0);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return 0;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
2008-02-02 21:06:53 +00:00
|
|
|
* @implemented
|
2003-07-10 18:50:51 +00:00
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
2005-07-09 10:31:30 +00:00
|
|
|
GetConsoleAliasW (LPWSTR lpSource,
|
|
|
|
LPWSTR lpTargetBuffer,
|
|
|
|
DWORD TargetBufferLength,
|
2008-02-04 18:58:17 +00:00
|
|
|
LPWSTR lpExeName)
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2008-02-06 18:57:40 +00:00
|
|
|
PCSR_API_MESSAGE Request;
|
2008-07-10 15:43:06 +00:00
|
|
|
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
2008-02-04 18:58:17 +00:00
|
|
|
ULONG CsrRequest;
|
2008-02-04 22:11:56 +00:00
|
|
|
NTSTATUS Status;
|
2008-02-06 18:57:40 +00:00
|
|
|
ULONG Size;
|
|
|
|
ULONG ExeLength;
|
|
|
|
ULONG SourceLength;
|
|
|
|
ULONG RequestLength;
|
|
|
|
WCHAR * Ptr;
|
|
|
|
|
|
|
|
DPRINT("GetConsoleAliasW entered lpSource %S lpExeName %S\n", lpSource, lpExeName);
|
2008-02-02 21:06:53 +00:00
|
|
|
|
2008-02-04 18:58:17 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(GET_CONSOLE_ALIAS, CSR_NATIVE);
|
2008-02-02 21:06:53 +00:00
|
|
|
|
2008-02-06 18:57:40 +00:00
|
|
|
ExeLength = wcslen(lpExeName) + 1;
|
|
|
|
SourceLength = wcslen(lpSource) + 1;
|
2008-02-04 18:58:17 +00:00
|
|
|
|
2008-07-10 15:43:06 +00:00
|
|
|
Size = (ExeLength + SourceLength) * sizeof(WCHAR);
|
2008-02-06 18:57:40 +00:00
|
|
|
|
|
|
|
RequestLength = Size + sizeof(CSR_API_MESSAGE);
|
|
|
|
Request = RtlAllocateHeap(GetProcessHeap(), 0, RequestLength);
|
|
|
|
|
|
|
|
CaptureBuffer = CsrAllocateCaptureBuffer(1, TargetBufferLength);
|
|
|
|
if (!CaptureBuffer)
|
|
|
|
{
|
|
|
|
RtlFreeHeap(GetProcessHeap(), 0, Request);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
Request->Data.GetConsoleAlias.TargetBuffer = NULL;
|
|
|
|
CsrCaptureMessageBuffer(CaptureBuffer,
|
|
|
|
NULL,
|
|
|
|
TargetBufferLength,
|
|
|
|
(PVOID*)&Request->Data.GetConsoleAlias.TargetBuffer);
|
|
|
|
Request->Data.GetConsoleAlias.TargetBufferLength = TargetBufferLength;
|
|
|
|
|
|
|
|
Ptr = (LPWSTR)((ULONG_PTR)Request + sizeof(CSR_API_MESSAGE));
|
|
|
|
wcscpy(Ptr, lpSource);
|
|
|
|
Ptr += SourceLength;
|
|
|
|
wcscpy(Ptr, lpExeName);
|
|
|
|
|
|
|
|
Request->Data.GetConsoleAlias.ExeLength = ExeLength;
|
|
|
|
Request->Data.GetConsoleAlias.SourceLength = SourceLength;
|
|
|
|
|
|
|
|
Status = CsrClientCallServer(Request,
|
2008-07-10 15:43:06 +00:00
|
|
|
CaptureBuffer,
|
2008-02-04 18:58:17 +00:00
|
|
|
CsrRequest,
|
2008-02-06 18:57:40 +00:00
|
|
|
sizeof(CSR_API_MESSAGE) + Size);
|
2008-02-02 21:06:53 +00:00
|
|
|
|
2008-02-06 18:57:40 +00:00
|
|
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request->Status))
|
2008-02-04 18:58:17 +00:00
|
|
|
{
|
2008-02-06 18:57:40 +00:00
|
|
|
RtlFreeHeap(GetProcessHeap(), 0, Request);
|
2008-07-10 15:43:06 +00:00
|
|
|
CsrFreeCaptureBuffer(CaptureBuffer);
|
2008-02-04 18:58:17 +00:00
|
|
|
SetLastErrorByStatus(Status);
|
2008-02-04 22:11:56 +00:00
|
|
|
return 0;
|
2008-02-04 18:58:17 +00:00
|
|
|
}
|
|
|
|
|
2008-07-10 15:43:06 +00:00
|
|
|
wcscpy(lpTargetBuffer, Request->Data.GetConsoleAlias.TargetBuffer);
|
2008-02-06 18:57:40 +00:00
|
|
|
RtlFreeHeap(GetProcessHeap(), 0, Request);
|
2008-07-10 15:43:06 +00:00
|
|
|
CsrFreeCaptureBuffer(CaptureBuffer);
|
2008-02-06 18:57:40 +00:00
|
|
|
|
2008-07-10 15:43:06 +00:00
|
|
|
return Request->Data.GetConsoleAlias.BytesWritten;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
/*
|
2008-02-04 18:58:17 +00:00
|
|
|
* @implemented
|
2003-07-10 18:50:51 +00:00
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
2005-07-09 10:31:30 +00:00
|
|
|
GetConsoleAliasA (LPSTR lpSource,
|
|
|
|
LPSTR lpTargetBuffer,
|
|
|
|
DWORD TargetBufferLength,
|
|
|
|
LPSTR lpExeName)
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2008-02-04 18:58:17 +00:00
|
|
|
LPWSTR lpwSource;
|
|
|
|
LPWSTR lpwExeName;
|
|
|
|
LPWSTR lpwTargetBuffer;
|
|
|
|
UINT dwSourceSize;
|
|
|
|
UINT dwExeNameSize;
|
|
|
|
UINT dwResult;
|
|
|
|
|
2008-02-06 18:57:40 +00:00
|
|
|
DPRINT("GetConsoleAliasA entered\n");
|
|
|
|
|
2008-02-04 18:58:17 +00:00
|
|
|
dwSourceSize = (strlen(lpSource)+1) * sizeof(WCHAR);
|
|
|
|
lpwSource = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSourceSize);
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpSource, -1, lpwSource, dwSourceSize);
|
|
|
|
|
|
|
|
dwExeNameSize = (strlen(lpExeName)+1) * sizeof(WCHAR);
|
|
|
|
lpwExeName = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwExeNameSize);
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, lpExeName, -1, lpwExeName, dwExeNameSize);
|
|
|
|
|
|
|
|
lpwTargetBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, TargetBufferLength * sizeof(WCHAR));
|
|
|
|
|
2008-07-10 15:43:06 +00:00
|
|
|
dwResult = GetConsoleAliasW(lpwSource, lpwTargetBuffer, TargetBufferLength * sizeof(WCHAR), lpwExeName);
|
2008-02-04 18:58:17 +00:00
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, lpwSource);
|
|
|
|
HeapFree(GetProcessHeap(), 0, lpwExeName);
|
|
|
|
|
|
|
|
if (dwResult)
|
2008-07-10 15:43:06 +00:00
|
|
|
dwResult = WideCharToMultiByte(CP_ACP, 0, lpwTargetBuffer, dwResult / sizeof(WCHAR), lpTargetBuffer, TargetBufferLength, NULL, NULL);
|
2008-02-04 18:58:17 +00:00
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, lpwTargetBuffer);
|
|
|
|
|
|
|
|
return dwResult;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
2008-02-04 18:58:17 +00:00
|
|
|
* @implemented
|
2003-07-10 18:50:51 +00:00
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
2008-02-04 22:11:56 +00:00
|
|
|
GetConsoleAliasExesW (LPWSTR lpExeNameBuffer,
|
2005-07-09 10:31:30 +00:00
|
|
|
DWORD ExeNameBufferLength)
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2008-02-04 18:58:17 +00:00
|
|
|
CSR_API_MESSAGE Request;
|
2008-07-10 15:43:06 +00:00
|
|
|
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
2008-02-04 18:58:17 +00:00
|
|
|
ULONG CsrRequest;
|
2008-02-04 22:11:56 +00:00
|
|
|
NTSTATUS Status;
|
2008-02-04 18:58:17 +00:00
|
|
|
|
2008-02-06 18:57:40 +00:00
|
|
|
DPRINT("GetConsoleAliasExesW entered\n");
|
|
|
|
|
2008-07-10 15:43:06 +00:00
|
|
|
CaptureBuffer = CsrAllocateCaptureBuffer(1, ExeNameBufferLength);
|
|
|
|
if (!CaptureBuffer)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-02-04 18:58:17 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(GET_CONSOLE_ALIASES_EXES, CSR_NATIVE);
|
2008-07-10 15:43:06 +00:00
|
|
|
CsrAllocateMessagePointer(CaptureBuffer,
|
|
|
|
ExeNameBufferLength,
|
|
|
|
(PVOID*)&Request.Data.GetConsoleAliasesExes.ExeNames);
|
2008-02-04 18:58:17 +00:00
|
|
|
Request.Data.GetConsoleAliasesExes.Length = ExeNameBufferLength;
|
|
|
|
|
|
|
|
Status = CsrClientCallServer(& Request,
|
2008-07-10 15:43:06 +00:00
|
|
|
CaptureBuffer,
|
2008-02-04 18:58:17 +00:00
|
|
|
CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
|
|
|
|
|
|
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
|
|
|
{
|
|
|
|
SetLastErrorByStatus(Status);
|
2008-07-10 15:43:06 +00:00
|
|
|
CsrFreeCaptureBuffer(CaptureBuffer);
|
2008-02-04 22:11:56 +00:00
|
|
|
return 0;
|
2008-02-04 18:58:17 +00:00
|
|
|
}
|
|
|
|
|
2008-07-10 15:43:06 +00:00
|
|
|
memcpy(lpExeNameBuffer,
|
|
|
|
Request.Data.GetConsoleAliasesExes.ExeNames,
|
|
|
|
Request.Data.GetConsoleAliasesExes.BytesWritten);
|
|
|
|
CsrFreeCaptureBuffer(CaptureBuffer);
|
|
|
|
return Request.Data.GetConsoleAliasesExes.BytesWritten;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
/*
|
2008-02-04 18:58:17 +00:00
|
|
|
* @implemented
|
2003-07-10 18:50:51 +00:00
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
2005-07-09 10:31:30 +00:00
|
|
|
GetConsoleAliasExesA (LPSTR lpExeNameBuffer,
|
|
|
|
DWORD ExeNameBufferLength)
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2008-02-04 18:58:17 +00:00
|
|
|
LPWSTR lpwExeNameBuffer;
|
|
|
|
DWORD dwResult;
|
|
|
|
|
2008-02-06 18:57:40 +00:00
|
|
|
DPRINT("GetConsoleAliasExesA entered\n");
|
|
|
|
|
2008-02-04 18:58:17 +00:00
|
|
|
lpwExeNameBuffer = HeapAlloc(GetProcessHeap(), 0, ExeNameBufferLength * sizeof(WCHAR));
|
|
|
|
|
2008-07-10 15:43:06 +00:00
|
|
|
dwResult = GetConsoleAliasExesW(lpwExeNameBuffer, ExeNameBufferLength * sizeof(WCHAR));
|
2001-03-31 01:17:30 +00:00
|
|
|
|
2008-02-04 18:58:17 +00:00
|
|
|
if (dwResult)
|
2008-07-10 15:43:06 +00:00
|
|
|
dwResult = WideCharToMultiByte(CP_ACP, 0, lpwExeNameBuffer, dwResult / sizeof(WCHAR), lpExeNameBuffer, ExeNameBufferLength, NULL, NULL);
|
2008-02-04 18:58:17 +00:00
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, lpwExeNameBuffer);
|
|
|
|
return dwResult;
|
|
|
|
}
|
2001-03-31 01:17:30 +00:00
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
/*
|
2008-02-04 18:58:17 +00:00
|
|
|
* @implemented
|
2003-07-10 18:50:51 +00:00
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
2008-02-04 18:58:17 +00:00
|
|
|
GetConsoleAliasExesLengthW (VOID)
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2008-02-04 18:58:17 +00:00
|
|
|
CSR_API_MESSAGE Request;
|
|
|
|
ULONG CsrRequest;
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
2008-02-06 18:57:40 +00:00
|
|
|
DPRINT("GetConsoleAliasExesLengthW entered\n");
|
|
|
|
|
2008-02-04 18:58:17 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(GET_CONSOLE_ALIASES_EXES_LENGTH, CSR_NATIVE);
|
|
|
|
Request.Data.GetConsoleAliasesExesLength.Length = 0;
|
|
|
|
|
|
|
|
|
|
|
|
Status = CsrClientCallServer(& Request,
|
|
|
|
NULL,
|
|
|
|
CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
2001-03-31 01:17:30 +00:00
|
|
|
|
2008-02-04 18:58:17 +00:00
|
|
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
|
|
|
{
|
|
|
|
SetLastErrorByStatus(Status);
|
2008-02-04 22:11:56 +00:00
|
|
|
return 0;
|
2008-02-04 18:58:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return Request.Data.GetConsoleAliasesExesLength.Length;
|
|
|
|
}
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
2008-02-04 18:58:17 +00:00
|
|
|
* @implemented
|
2003-07-10 18:50:51 +00:00
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
2008-02-04 18:58:17 +00:00
|
|
|
GetConsoleAliasExesLengthA (VOID)
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2008-02-04 18:58:17 +00:00
|
|
|
DWORD dwLength;
|
|
|
|
|
2008-02-06 18:57:40 +00:00
|
|
|
DPRINT("GetConsoleAliasExesLengthA entered\n");
|
|
|
|
|
2008-02-04 18:58:17 +00:00
|
|
|
dwLength = GetConsoleAliasExesLengthW();
|
|
|
|
|
|
|
|
if (dwLength)
|
|
|
|
dwLength /= sizeof(WCHAR);
|
|
|
|
|
|
|
|
return dwLength;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
2008-02-02 21:06:53 +00:00
|
|
|
* @implemented
|
2003-07-10 18:50:51 +00:00
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
2006-12-12 23:57:24 +00:00
|
|
|
GetConsoleAliasesW (LPWSTR AliasBuffer,
|
|
|
|
DWORD AliasBufferLength,
|
2008-02-04 18:58:17 +00:00
|
|
|
LPWSTR ExeName)
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2008-02-04 18:58:17 +00:00
|
|
|
CSR_API_MESSAGE Request;
|
|
|
|
ULONG CsrRequest;
|
2008-02-04 22:11:56 +00:00
|
|
|
NTSTATUS Status;
|
2008-02-04 18:58:17 +00:00
|
|
|
DWORD dwLength;
|
2008-02-02 21:06:53 +00:00
|
|
|
|
2008-02-06 18:57:40 +00:00
|
|
|
DPRINT("GetConsoleAliasesW entered\n");
|
|
|
|
|
2008-02-04 18:58:17 +00:00
|
|
|
dwLength = GetConsoleAliasesLengthW(ExeName);
|
|
|
|
if (!dwLength || dwLength > AliasBufferLength)
|
2008-02-04 22:11:56 +00:00
|
|
|
return 0;
|
2008-02-02 21:06:53 +00:00
|
|
|
|
2008-02-04 18:58:17 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(GET_ALL_CONSOLE_ALIASES, CSR_NATIVE);
|
|
|
|
Request.Data.GetAllConsoleAlias.AliasBuffer = AliasBuffer;
|
|
|
|
Request.Data.GetAllConsoleAlias.AliasBufferLength = AliasBufferLength;
|
|
|
|
Request.Data.GetAllConsoleAlias.lpExeName = ExeName;
|
2008-02-02 21:06:53 +00:00
|
|
|
|
2008-02-04 18:58:17 +00:00
|
|
|
Status = CsrClientCallServer(& Request,
|
|
|
|
NULL,
|
|
|
|
CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
|
|
|
|
|
|
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
|
|
|
{
|
|
|
|
SetLastErrorByStatus(Status);
|
2008-02-04 22:11:56 +00:00
|
|
|
return 0;
|
2008-02-04 18:58:17 +00:00
|
|
|
}
|
2008-02-02 21:06:53 +00:00
|
|
|
|
2008-02-04 18:58:17 +00:00
|
|
|
return Request.Data.GetAllConsoleAlias.BytesWritten / sizeof(WCHAR);
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
2008-02-04 18:58:17 +00:00
|
|
|
* @implemented
|
2003-07-10 18:50:51 +00:00
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
2006-12-12 23:57:24 +00:00
|
|
|
GetConsoleAliasesA (LPSTR AliasBuffer,
|
|
|
|
DWORD AliasBufferLength,
|
|
|
|
LPSTR ExeName)
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2008-02-04 18:58:17 +00:00
|
|
|
DWORD dwRetVal = 0;
|
|
|
|
LPWSTR lpwExeName = NULL;
|
|
|
|
LPWSTR lpwAliasBuffer;
|
|
|
|
|
2008-02-06 18:57:40 +00:00
|
|
|
DPRINT("GetConsoleAliasesA entered\n");
|
|
|
|
|
2008-02-04 18:58:17 +00:00
|
|
|
if (ExeName)
|
|
|
|
BasepAnsiStringToHeapUnicodeString(ExeName, (LPWSTR*) &lpwExeName);
|
|
|
|
|
|
|
|
lpwAliasBuffer = HeapAlloc(GetProcessHeap(), 0, AliasBufferLength * sizeof(WCHAR));
|
|
|
|
|
|
|
|
dwRetVal = GetConsoleAliasesW(lpwAliasBuffer, AliasBufferLength, lpwExeName);
|
|
|
|
|
|
|
|
if (lpwExeName)
|
|
|
|
RtlFreeHeap(GetProcessHeap(), 0, (LPWSTR*) lpwExeName);
|
|
|
|
|
|
|
|
if (dwRetVal)
|
|
|
|
dwRetVal = WideCharToMultiByte(CP_ACP, 0, lpwAliasBuffer, dwRetVal, AliasBuffer, AliasBufferLength, NULL, NULL);
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, lpwAliasBuffer);
|
|
|
|
return dwRetVal;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
2008-02-02 21:06:53 +00:00
|
|
|
* @implemented
|
2003-07-10 18:50:51 +00:00
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
2008-02-04 18:58:17 +00:00
|
|
|
GetConsoleAliasesLengthW (LPWSTR lpExeName)
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2008-02-04 18:58:17 +00:00
|
|
|
CSR_API_MESSAGE Request;
|
|
|
|
ULONG CsrRequest;
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
2008-02-06 18:57:40 +00:00
|
|
|
DPRINT("GetConsoleAliasesLengthW entered\n");
|
|
|
|
|
2008-02-04 18:58:17 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(GET_ALL_CONSOLE_ALIASES_LENGTH, CSR_NATIVE);
|
|
|
|
Request.Data.GetAllConsoleAliasesLength.lpExeName = lpExeName;
|
|
|
|
Request.Data.GetAllConsoleAliasesLength.Length = 0;
|
|
|
|
|
|
|
|
Status = CsrClientCallServer(&Request,
|
|
|
|
NULL,
|
|
|
|
CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
|
|
|
|
|
|
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
|
|
|
{
|
|
|
|
SetLastErrorByStatus(Status);
|
2008-02-04 22:11:56 +00:00
|
|
|
return 0;
|
2008-02-04 18:58:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return Request.Data.GetAllConsoleAliasesLength.Length;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
2008-02-02 21:06:53 +00:00
|
|
|
* @implemented
|
2003-07-10 18:50:51 +00:00
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
2005-07-09 10:31:30 +00:00
|
|
|
GetConsoleAliasesLengthA (LPSTR lpExeName)
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2008-02-02 21:06:53 +00:00
|
|
|
DWORD dwRetVal = 0;
|
|
|
|
LPWSTR lpExeNameW = NULL;
|
|
|
|
|
|
|
|
if (lpExeName)
|
|
|
|
BasepAnsiStringToHeapUnicodeString(lpExeName, (LPWSTR*) &lpExeNameW);
|
|
|
|
|
2008-02-04 18:58:17 +00:00
|
|
|
dwRetVal = GetConsoleAliasesLengthW(lpExeNameW);
|
|
|
|
if (dwRetVal)
|
|
|
|
dwRetVal /= sizeof(WCHAR);
|
2008-02-02 21:06:53 +00:00
|
|
|
|
|
|
|
/* Clean up */
|
|
|
|
if (lpExeNameW)
|
|
|
|
RtlFreeHeap(GetProcessHeap(), 0, (LPWSTR*) lpExeNameW);
|
|
|
|
|
|
|
|
return dwRetVal;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
|
|
|
GetConsoleCommandHistoryW (DWORD Unknown0,
|
|
|
|
DWORD Unknown1,
|
|
|
|
DWORD Unknown2)
|
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("GetConsoleCommandHistoryW(0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1, Unknown2);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return 0;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
|
|
|
GetConsoleCommandHistoryA (DWORD Unknown0,
|
|
|
|
DWORD Unknown1,
|
|
|
|
DWORD Unknown2)
|
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("GetConsoleCommandHistoryA(0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1, Unknown2);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return 0;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
|
|
|
GetConsoleCommandHistoryLengthW (DWORD Unknown0)
|
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("GetConsoleCommandHistoryLengthW(0x%x) UNIMPLEMENTED!\n", Unknown0);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return 0;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
|
|
|
GetConsoleCommandHistoryLengthA (DWORD Unknown0)
|
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("GetConsoleCommandHistoryLengthA(0x%x) UNIMPLEMENTED!\n", Unknown0);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return 0;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2007-01-26 07:22:19 +00:00
|
|
|
INT STDCALL
|
2001-04-04 22:21:32 +00:00
|
|
|
GetConsoleDisplayMode (LPDWORD lpdwMode)
|
|
|
|
/*
|
|
|
|
* FUNCTION: Get the console display mode
|
|
|
|
* ARGUMENTS:
|
|
|
|
* lpdwMode - Address of variable that receives the current value
|
|
|
|
* of display mode
|
|
|
|
* STATUS: Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("GetConsoleDisplayMode(0x%x) UNIMPLEMENTED!\n", lpdwMode);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return 0;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
|
|
|
GetConsoleFontInfo (DWORD Unknown0,
|
|
|
|
DWORD Unknown1,
|
|
|
|
DWORD Unknown2,
|
|
|
|
DWORD Unknown3)
|
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("GetConsoleFontInfo(0x%x, 0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1, Unknown2, Unknown3);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return 0;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2005-07-26 14:00:45 +00:00
|
|
|
COORD STDCALL
|
2002-08-22 15:21:57 +00:00
|
|
|
GetConsoleFontSize(HANDLE hConsoleOutput,
|
|
|
|
DWORD nFont)
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2005-07-26 14:00:45 +00:00
|
|
|
COORD Empty = {0, 0};
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("GetConsoleFontSize(0x%x, 0x%x) UNIMPLEMENTED!\n", hConsoleOutput, nFont);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
2005-07-26 14:00:45 +00:00
|
|
|
return Empty ;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
2003-06-19 19:38:26 +00:00
|
|
|
GetConsoleHardwareState (HANDLE hConsole,
|
|
|
|
DWORD Flags,
|
|
|
|
PDWORD State)
|
2001-04-04 22:21:32 +00:00
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2003-06-19 19:38:26 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(SETGET_CONSOLE_HW_STATE, CSR_CONSOLE);
|
2003-06-19 19:38:26 +00:00
|
|
|
Request.Data.ConsoleHardwareStateRequest.ConsoleHandle = hConsole;
|
|
|
|
Request.Data.ConsoleHardwareStateRequest.SetGet = CONSOLE_HARDWARE_STATE_GET;
|
|
|
|
|
|
|
|
Status = CsrClientCallServer(& Request,
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
NULL,
|
|
|
|
CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
|
|
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
2003-06-19 19:38:26 +00:00
|
|
|
{
|
|
|
|
SetLastErrorByStatus(Status);
|
|
|
|
return FALSE;
|
|
|
|
}
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
*State = Request.Data.ConsoleHardwareStateRequest.State;
|
2005-05-09 01:46:57 +00:00
|
|
|
return TRUE;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
2004-11-14 18:47:10 +00:00
|
|
|
* @implemented
|
2003-07-10 18:50:51 +00:00
|
|
|
*/
|
2006-06-28 17:02:37 +00:00
|
|
|
HANDLE STDCALL
|
2001-03-31 01:17:30 +00:00
|
|
|
GetConsoleInputWaitHandle (VOID)
|
2001-04-04 22:21:32 +00:00
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2004-11-14 18:47:10 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(GET_INPUT_WAIT_HANDLE, CSR_CONSOLE);
|
|
|
|
Status = CsrClientCallServer(&Request, NULL, CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
|
|
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
2004-11-14 18:47:10 +00:00
|
|
|
{
|
|
|
|
SetLastErrorByStatus(Status);
|
|
|
|
return 0;
|
|
|
|
}
|
2006-06-28 17:02:37 +00:00
|
|
|
return Request.Data.GetConsoleInputWaitHandle.InputWaitHandle;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2007-01-26 07:22:19 +00:00
|
|
|
INT STDCALL
|
2002-08-22 15:21:57 +00:00
|
|
|
GetCurrentConsoleFont(HANDLE hConsoleOutput,
|
|
|
|
BOOL bMaximumWindow,
|
|
|
|
PCONSOLE_FONT_INFO lpConsoleCurrentFont)
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("GetCurrentConsoleFont(0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", hConsoleOutput, bMaximumWindow, lpConsoleCurrentFont);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return 0;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
ULONG STDCALL
|
2001-03-31 01:17:30 +00:00
|
|
|
GetNumberOfConsoleFonts (VOID)
|
2001-04-04 22:21:32 +00:00
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("GetNumberOfConsoleFonts() UNIMPLEMENTED!\n");
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return 1; /* FIXME: call csrss.exe */
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
|
|
|
InvalidateConsoleDIBits (DWORD Unknown0,
|
|
|
|
DWORD Unknown1)
|
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("InvalidateConsoleDIBits(0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return 0;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2003-05-05 19:58:27 +00:00
|
|
|
HANDLE STDCALL
|
2008-07-22 17:37:13 +00:00
|
|
|
OpenConsoleW (LPCWSTR wsName,
|
2003-05-16 20:33:15 +00:00
|
|
|
DWORD dwDesiredAccess,
|
|
|
|
BOOL bInheritHandle,
|
2008-07-23 16:21:46 +00:00
|
|
|
DWORD dwShareMode)
|
2001-04-04 22:21:32 +00:00
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2003-05-05 19:58:27 +00:00
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2003-05-05 19:58:27 +00:00
|
|
|
if(0 == _wcsicmp(wsName, L"CONIN$"))
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(GET_INPUT_HANDLE, CSR_NATIVE);
|
2003-05-05 19:58:27 +00:00
|
|
|
}
|
|
|
|
else if (0 == _wcsicmp(wsName, L"CONOUT$"))
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(GET_OUTPUT_HANDLE, CSR_NATIVE);
|
2003-05-05 19:58:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return(INVALID_HANDLE_VALUE);
|
|
|
|
}
|
2008-07-22 17:37:13 +00:00
|
|
|
if (dwDesiredAccess & ~(GENERIC_READ|GENERIC_WRITE))
|
2003-05-05 19:58:27 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return(INVALID_HANDLE_VALUE);
|
|
|
|
}
|
2008-07-23 16:21:46 +00:00
|
|
|
if (dwShareMode & ~(FILE_SHARE_READ|FILE_SHARE_WRITE))
|
2003-05-05 19:58:27 +00:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return(INVALID_HANDLE_VALUE);
|
|
|
|
}
|
2008-07-22 17:37:13 +00:00
|
|
|
/* Structures for GET_INPUT_HANDLE and GET_OUTPUT_HANDLE requests are identical */
|
|
|
|
Request.Data.GetInputHandleRequest.Access = dwDesiredAccess;
|
|
|
|
Request.Data.GetInputHandleRequest.Inheritable = bInheritHandle;
|
2003-05-05 19:58:27 +00:00
|
|
|
Status = CsrClientCallServer(& Request,
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
NULL,
|
|
|
|
CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
|
|
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
2003-05-05 19:58:27 +00:00
|
|
|
{
|
|
|
|
SetLastErrorByStatus(Status);
|
|
|
|
return INVALID_HANDLE_VALUE;
|
|
|
|
}
|
2008-07-22 17:37:13 +00:00
|
|
|
return Request.Data.GetInputHandleRequest.InputHandle;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2004-01-23 17:18:16 +00:00
|
|
|
BOOL STDCALL
|
2001-04-04 22:21:32 +00:00
|
|
|
SetConsoleCommandHistoryMode (DWORD dwMode)
|
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("SetConsoleCommandHistoryMode(0x%x) UNIMPLEMENTED!\n", dwMode);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2004-01-23 17:18:16 +00:00
|
|
|
BOOL STDCALL
|
2001-04-04 22:21:32 +00:00
|
|
|
SetConsoleCursor (DWORD Unknown0,
|
|
|
|
DWORD Unknown1)
|
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("SetConsoleCursor(0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2004-01-23 17:18:16 +00:00
|
|
|
BOOL STDCALL
|
2001-04-04 22:21:32 +00:00
|
|
|
SetConsoleDisplayMode (HANDLE hOut,
|
|
|
|
DWORD dwNewMode,
|
2006-12-12 23:57:24 +00:00
|
|
|
PCOORD lpdwOldMode)
|
2001-04-04 22:21:32 +00:00
|
|
|
/*
|
|
|
|
* FUNCTION: Set the console display mode.
|
|
|
|
* ARGUMENTS:
|
|
|
|
* hOut - Standard output handle.
|
|
|
|
* dwNewMode - New mode.
|
|
|
|
* lpdwOldMode - Address of a variable that receives the old mode.
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2006-12-12 23:57:24 +00:00
|
|
|
DPRINT1("SetConsoleDisplayMode(0x%x, 0x%x, 0x%p) UNIMPLEMENTED!\n", hOut, dwNewMode, lpdwOldMode);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2004-01-23 17:18:16 +00:00
|
|
|
BOOL STDCALL
|
2001-04-04 22:21:32 +00:00
|
|
|
SetConsoleFont (DWORD Unknown0,
|
|
|
|
DWORD Unknown1)
|
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("SetConsoleFont(0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2004-01-23 17:18:16 +00:00
|
|
|
BOOL STDCALL
|
2003-06-19 19:38:26 +00:00
|
|
|
SetConsoleHardwareState (HANDLE hConsole,
|
|
|
|
DWORD Flags,
|
|
|
|
DWORD State)
|
2001-04-04 22:21:32 +00:00
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2003-06-19 19:38:26 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(SETGET_CONSOLE_HW_STATE, CSR_CONSOLE);
|
2003-06-19 19:38:26 +00:00
|
|
|
Request.Data.ConsoleHardwareStateRequest.ConsoleHandle = hConsole;
|
|
|
|
Request.Data.ConsoleHardwareStateRequest.SetGet = CONSOLE_HARDWARE_STATE_SET;
|
|
|
|
Request.Data.ConsoleHardwareStateRequest.State = State;
|
|
|
|
|
|
|
|
Status = CsrClientCallServer(& Request,
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
NULL,
|
|
|
|
CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
|
|
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
2003-06-19 19:38:26 +00:00
|
|
|
{
|
|
|
|
SetLastErrorByStatus(Status);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
return TRUE;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2004-01-23 17:18:16 +00:00
|
|
|
BOOL STDCALL
|
2001-04-04 22:21:32 +00:00
|
|
|
SetConsoleKeyShortcuts (DWORD Unknown0,
|
|
|
|
DWORD Unknown1,
|
|
|
|
DWORD Unknown2,
|
|
|
|
DWORD Unknown3)
|
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("SetConsoleKeyShortcuts(0x%x, 0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1, Unknown2, Unknown3);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2004-01-23 17:18:16 +00:00
|
|
|
BOOL STDCALL
|
2001-04-04 22:21:32 +00:00
|
|
|
SetConsoleMaximumWindowSize (DWORD Unknown0,
|
|
|
|
DWORD Unknown1)
|
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("SetConsoleMaximumWindowSize(0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2004-01-23 17:18:16 +00:00
|
|
|
BOOL STDCALL
|
2001-04-04 22:21:32 +00:00
|
|
|
SetConsoleMenuClose (DWORD Unknown0)
|
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("SetConsoleMenuClose(0x%x) UNIMPLEMENTED!\n", Unknown0);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2004-01-23 17:18:16 +00:00
|
|
|
BOOL STDCALL
|
2001-04-04 22:21:32 +00:00
|
|
|
SetConsoleNumberOfCommandsA (DWORD Unknown0,
|
|
|
|
DWORD Unknown1)
|
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("SetConsoleNumberOfCommandsA(0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2004-01-23 17:18:16 +00:00
|
|
|
BOOL STDCALL
|
2001-04-04 22:21:32 +00:00
|
|
|
SetConsoleNumberOfCommandsW (DWORD Unknown0,
|
|
|
|
DWORD Unknown1)
|
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("SetConsoleNumberOfCommandsW(0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2004-01-23 17:18:16 +00:00
|
|
|
BOOL STDCALL
|
2001-04-04 22:21:32 +00:00
|
|
|
SetConsolePalette (DWORD Unknown0,
|
|
|
|
DWORD Unknown1,
|
|
|
|
DWORD Unknown2)
|
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("SetConsolePalette(0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1, Unknown2);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2004-01-23 17:18:16 +00:00
|
|
|
BOOL STDCALL
|
2001-03-31 01:17:30 +00:00
|
|
|
SetLastConsoleEventActive (VOID)
|
2001-04-04 22:21:32 +00:00
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("SetLastConsoleEventActive() UNIMPLEMENTED!\n");
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
|
|
|
ShowConsoleCursor (DWORD Unknown0,
|
|
|
|
DWORD Unknown1)
|
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("ShowConsoleCursor(0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return 0;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-03-05 22:51:48 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* FUNCTION: Checks whether the given handle is a valid console handle.
|
|
|
|
* ARGUMENTS:
|
|
|
|
* Handle - Handle to be checked
|
|
|
|
* RETURNS:
|
|
|
|
* TRUE: Handle is a valid console handle
|
|
|
|
* FALSE: Handle is not a valid console handle.
|
|
|
|
* STATUS: Officially undocumented
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
2003-03-05 22:51:48 +00:00
|
|
|
*/
|
|
|
|
BOOL STDCALL
|
|
|
|
VerifyConsoleIoHandle(HANDLE Handle)
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2003-03-05 22:51:48 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(VERIFY_HANDLE, CSR_NATIVE);
|
2003-03-05 22:51:48 +00:00
|
|
|
Request.Data.VerifyHandleRequest.Handle = Handle;
|
|
|
|
Status = CsrClientCallServer(&Request,
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
NULL,
|
|
|
|
CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
2003-03-05 22:51:48 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastErrorByStatus(Status);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
return (BOOL)NT_SUCCESS(Request.Status);
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-03-05 22:51:48 +00:00
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
|
|
|
WriteConsoleInputVDMA (DWORD Unknown0,
|
|
|
|
DWORD Unknown1,
|
|
|
|
DWORD Unknown2,
|
|
|
|
DWORD Unknown3)
|
2001-03-31 01:17:30 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("WriteConsoleInputVDMA(0x%x, 0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1, Unknown2, Unknown3);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return 0;
|
2001-03-31 01:17:30 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2001-04-04 22:21:32 +00:00
|
|
|
DWORD STDCALL
|
|
|
|
WriteConsoleInputVDMW (DWORD Unknown0,
|
|
|
|
DWORD Unknown1,
|
|
|
|
DWORD Unknown2,
|
|
|
|
DWORD Unknown3)
|
2000-07-01 17:07:02 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("WriteConsoleInputVDMW(0x%x, 0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1, Unknown2, Unknown3);
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return 0;
|
1999-12-26 15:50:53 +00:00
|
|
|
}
|
1999-01-16 02:11:45 +00:00
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2004-01-23 17:18:16 +00:00
|
|
|
BOOL STDCALL
|
2001-04-04 22:21:32 +00:00
|
|
|
CloseConsoleHandle(HANDLE Handle)
|
|
|
|
/*
|
|
|
|
* Undocumented
|
|
|
|
*/
|
1999-12-26 15:50:53 +00:00
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2003-02-24 23:24:55 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(CLOSE_HANDLE, CSR_NATIVE);
|
2003-02-24 23:24:55 +00:00
|
|
|
Request.Data.CloseHandleRequest.Handle = Handle;
|
|
|
|
Status = CsrClientCallServer(&Request,
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
NULL,
|
|
|
|
CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
2003-03-05 22:51:48 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastErrorByStatus(Status);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-02-24 23:24:55 +00:00
|
|
|
|
2003-03-05 22:51:48 +00:00
|
|
|
return TRUE;
|
1999-12-26 15:50:53 +00:00
|
|
|
}
|
1999-01-16 02:11:45 +00:00
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2004-01-23 17:18:16 +00:00
|
|
|
HANDLE STDCALL
|
2001-04-04 22:21:32 +00:00
|
|
|
GetStdHandle(DWORD nStdHandle)
|
|
|
|
/*
|
|
|
|
* FUNCTION: Get a handle for the standard input, standard output
|
|
|
|
* and a standard error device.
|
|
|
|
* ARGUMENTS:
|
|
|
|
* nStdHandle - Specifies the device for which to return the handle.
|
|
|
|
* RETURNS: If the function succeeds, the return value is the handle
|
|
|
|
* of the specified device. Otherwise the value is INVALID_HANDLE_VALUE.
|
|
|
|
*/
|
1999-03-06 10:57:02 +00:00
|
|
|
{
|
2002-09-08 10:23:54 +00:00
|
|
|
PRTL_USER_PROCESS_PARAMETERS Ppb;
|
2003-03-05 22:51:48 +00:00
|
|
|
|
|
|
|
Ppb = NtCurrentPeb()->ProcessParameters;
|
2001-04-04 22:21:32 +00:00
|
|
|
switch (nStdHandle)
|
|
|
|
{
|
2003-03-05 22:51:48 +00:00
|
|
|
case STD_INPUT_HANDLE:
|
2005-07-12 01:56:14 +00:00
|
|
|
return Ppb->StandardInput;
|
2003-03-05 22:51:48 +00:00
|
|
|
|
|
|
|
case STD_OUTPUT_HANDLE:
|
2005-07-12 01:56:14 +00:00
|
|
|
return Ppb->StandardOutput;
|
2003-03-05 22:51:48 +00:00
|
|
|
|
|
|
|
case STD_ERROR_HANDLE:
|
2005-07-12 01:56:14 +00:00
|
|
|
return Ppb->StandardError;
|
2001-04-04 22:21:32 +00:00
|
|
|
}
|
2003-03-05 22:51:48 +00:00
|
|
|
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError (ERROR_INVALID_PARAMETER);
|
|
|
|
return INVALID_HANDLE_VALUE;
|
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2004-06-13 20:04:56 +00:00
|
|
|
BOOL WINAPI
|
2001-04-04 22:21:32 +00:00
|
|
|
SetStdHandle(DWORD nStdHandle,
|
|
|
|
HANDLE hHandle)
|
|
|
|
/*
|
|
|
|
* FUNCTION: Set the handle for the standard input, standard output or
|
|
|
|
* the standard error device.
|
|
|
|
* ARGUMENTS:
|
|
|
|
* nStdHandle - Specifies the handle to be set.
|
|
|
|
* hHandle - The handle to set.
|
|
|
|
* RETURNS: TRUE if the function succeeds, FALSE otherwise.
|
|
|
|
*/
|
|
|
|
{
|
2002-09-08 10:23:54 +00:00
|
|
|
PRTL_USER_PROCESS_PARAMETERS Ppb;
|
2003-03-05 22:51:48 +00:00
|
|
|
|
2004-05-28 13:17:32 +00:00
|
|
|
/* no need to check if hHandle == INVALID_HANDLE_VALUE */
|
2003-03-05 22:51:48 +00:00
|
|
|
|
2004-05-28 13:17:32 +00:00
|
|
|
Ppb = NtCurrentPeb()->ProcessParameters;
|
2003-03-05 22:51:48 +00:00
|
|
|
|
2001-04-04 22:21:32 +00:00
|
|
|
switch (nStdHandle)
|
|
|
|
{
|
2003-03-05 22:51:48 +00:00
|
|
|
case STD_INPUT_HANDLE:
|
2005-07-12 01:56:14 +00:00
|
|
|
Ppb->StandardInput = hHandle;
|
2003-03-05 22:51:48 +00:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
case STD_OUTPUT_HANDLE:
|
2005-07-12 01:56:14 +00:00
|
|
|
Ppb->StandardOutput = hHandle;
|
2003-03-05 22:51:48 +00:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
case STD_ERROR_HANDLE:
|
2005-07-12 01:56:14 +00:00
|
|
|
Ppb->StandardError = hHandle;
|
2003-03-05 22:51:48 +00:00
|
|
|
return TRUE;
|
2001-04-04 22:21:32 +00:00
|
|
|
}
|
2003-03-05 22:51:48 +00:00
|
|
|
|
2004-05-28 13:17:32 +00:00
|
|
|
/* windows for whatever reason sets the last error to ERROR_INVALID_HANDLE here */
|
|
|
|
SetLastError (ERROR_INVALID_HANDLE);
|
2001-04-04 22:21:32 +00:00
|
|
|
return FALSE;
|
1999-01-16 02:11:45 +00:00
|
|
|
}
|
|
|
|
|
1999-03-06 10:57:02 +00:00
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
static BOOL
|
|
|
|
IntWriteConsole(HANDLE hConsoleOutput,
|
|
|
|
PVOID lpBuffer,
|
|
|
|
DWORD nNumberOfCharsToWrite,
|
|
|
|
LPDWORD lpNumberOfCharsWritten,
|
|
|
|
LPVOID lpReserved,
|
|
|
|
BOOL bUnicode)
|
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
PCSR_API_MESSAGE Request;
|
2005-08-26 20:35:33 +00:00
|
|
|
ULONG CsrRequest;
|
2004-11-02 20:42:06 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
USHORT nChars;
|
2005-08-26 20:35:33 +00:00
|
|
|
ULONG SizeBytes, CharSize;
|
2004-11-02 20:42:06 +00:00
|
|
|
DWORD Written = 0;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
CharSize = (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
|
2005-08-28 12:03:25 +00:00
|
|
|
Request = RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
|
|
|
max(sizeof(CSR_API_MESSAGE),
|
|
|
|
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE)
|
|
|
|
+ min(nNumberOfCharsToWrite, CSRSS_MAX_WRITE_CONSOLE / CharSize) * CharSize));
|
|
|
|
if (Request == NULL)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2004-11-02 20:42:06 +00:00
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(WRITE_CONSOLE, CSR_CONSOLE);
|
2004-11-02 20:42:06 +00:00
|
|
|
|
|
|
|
while(nNumberOfCharsToWrite > 0)
|
|
|
|
{
|
2005-10-24 17:25:23 +00:00
|
|
|
Request->Data.WriteConsoleRequest.ConsoleHandle = hConsoleOutput;
|
|
|
|
Request->Data.WriteConsoleRequest.Unicode = bUnicode;
|
|
|
|
|
2007-01-26 07:22:19 +00:00
|
|
|
nChars = (USHORT)min(nNumberOfCharsToWrite, CSRSS_MAX_WRITE_CONSOLE / CharSize);
|
2005-08-28 12:03:25 +00:00
|
|
|
Request->Data.WriteConsoleRequest.NrCharactersToWrite = nChars;
|
2004-11-02 20:42:06 +00:00
|
|
|
|
|
|
|
SizeBytes = nChars * CharSize;
|
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
memcpy(Request->Data.WriteConsoleRequest.Buffer, lpBuffer, SizeBytes);
|
2004-11-02 20:42:06 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
Status = CsrClientCallServer(Request,
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
NULL,
|
|
|
|
CsrRequest,
|
2005-08-28 12:03:25 +00:00
|
|
|
max(sizeof(CSR_API_MESSAGE), CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE) + SizeBytes));
|
2004-11-02 20:42:06 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request->Status))
|
2004-11-02 20:42:06 +00:00
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
2004-11-02 20:42:06 +00:00
|
|
|
SetLastErrorByStatus(Status);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
nNumberOfCharsToWrite -= nChars;
|
|
|
|
lpBuffer = (PVOID)((ULONG_PTR)lpBuffer + (ULONG_PTR)SizeBytes);
|
2005-08-28 12:03:25 +00:00
|
|
|
Written += Request->Data.WriteConsoleRequest.NrCharactersWritten;
|
2004-11-02 20:42:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(lpNumberOfCharsWritten != NULL)
|
|
|
|
{
|
|
|
|
*lpNumberOfCharsWritten = Written;
|
|
|
|
}
|
2005-08-28 12:03:25 +00:00
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
2004-11-02 20:42:06 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-03-06 10:57:02 +00:00
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* WriteConsoleA
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
2005-05-09 01:46:57 +00:00
|
|
|
BOOL STDCALL
|
2001-11-25 15:21:11 +00:00
|
|
|
WriteConsoleA(HANDLE hConsoleOutput,
|
|
|
|
CONST VOID *lpBuffer,
|
|
|
|
DWORD nNumberOfCharsToWrite,
|
|
|
|
LPDWORD lpNumberOfCharsWritten,
|
|
|
|
LPVOID lpReserved)
|
1999-01-16 02:11:45 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
return IntWriteConsole(hConsoleOutput,
|
|
|
|
(PVOID)lpBuffer,
|
|
|
|
nNumberOfCharsToWrite,
|
|
|
|
lpNumberOfCharsWritten,
|
|
|
|
lpReserved,
|
|
|
|
FALSE);
|
|
|
|
}
|
2003-03-05 22:51:48 +00:00
|
|
|
|
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* WriteConsoleW
|
|
|
|
*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL STDCALL
|
|
|
|
WriteConsoleW(
|
|
|
|
HANDLE hConsoleOutput,
|
|
|
|
CONST VOID *lpBuffer,
|
|
|
|
DWORD nNumberOfCharsToWrite,
|
|
|
|
LPDWORD lpNumberOfCharsWritten,
|
|
|
|
LPVOID lpReserved
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return IntWriteConsole(hConsoleOutput,
|
|
|
|
(PVOID)lpBuffer,
|
|
|
|
nNumberOfCharsToWrite,
|
|
|
|
lpNumberOfCharsWritten,
|
|
|
|
lpReserved,
|
|
|
|
TRUE);
|
|
|
|
}
|
2003-03-05 22:51:48 +00:00
|
|
|
|
2000-05-08 23:27:52 +00:00
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
static BOOL
|
|
|
|
IntReadConsole(HANDLE hConsoleInput,
|
|
|
|
PVOID lpBuffer,
|
|
|
|
DWORD nNumberOfCharsToRead,
|
|
|
|
LPDWORD lpNumberOfCharsRead,
|
2006-12-12 23:57:24 +00:00
|
|
|
PCONSOLE_READCONSOLE_CONTROL lpReserved,
|
2004-11-02 20:42:06 +00:00
|
|
|
BOOL bUnicode)
|
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
PCSR_API_MESSAGE Request;
|
2005-08-26 20:35:33 +00:00
|
|
|
ULONG CsrRequest;
|
2004-11-02 20:42:06 +00:00
|
|
|
NTSTATUS Status;
|
2005-08-26 20:35:33 +00:00
|
|
|
ULONG CharSize, CharsRead = 0;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
CharSize = (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
|
2005-08-28 12:03:25 +00:00
|
|
|
Request = RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
|
|
|
max(sizeof(CSR_API_MESSAGE),
|
|
|
|
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE)
|
|
|
|
+ min(nNumberOfCharsToRead, CSRSS_MAX_READ_CONSOLE / CharSize) * CharSize));
|
|
|
|
if (Request == NULL)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
Request->Status = STATUS_SUCCESS;
|
2005-10-24 17:25:23 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(READ_CONSOLE, CSR_CONSOLE);
|
2003-03-05 22:51:48 +00:00
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
do
|
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
if(Request->Status == STATUS_PENDING)
|
2004-11-02 20:42:06 +00:00
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
Status = NtWaitForSingleObject(Request->Data.ReadConsoleRequest.EventHandle, FALSE, 0);
|
2004-11-02 20:42:06 +00:00
|
|
|
if(!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
DPRINT1("Wait for console input failed!\n");
|
|
|
|
break;
|
|
|
|
}
|
2001-11-25 15:21:11 +00:00
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
Request->Data.ReadConsoleRequest.ConsoleHandle = hConsoleInput;
|
|
|
|
Request->Data.ReadConsoleRequest.Unicode = bUnicode;
|
2007-01-26 07:22:19 +00:00
|
|
|
Request->Data.ReadConsoleRequest.NrCharactersToRead = (WORD)min(nNumberOfCharsToRead, CSRSS_MAX_READ_CONSOLE / CharSize);
|
|
|
|
Request->Data.ReadConsoleRequest.nCharsCanBeDeleted = (WORD)CharsRead;
|
2005-08-28 12:03:25 +00:00
|
|
|
Status = CsrClientCallServer(Request,
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
NULL,
|
|
|
|
CsrRequest,
|
2005-08-28 12:03:25 +00:00
|
|
|
max(sizeof(CSR_API_MESSAGE),
|
|
|
|
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE)
|
|
|
|
+ Request->Data.ReadConsoleRequest.NrCharactersToRead * CharSize));
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request->Status))
|
2004-11-02 20:42:06 +00:00
|
|
|
{
|
|
|
|
DPRINT1("CSR returned error in ReadConsole\n");
|
2005-08-28 12:03:25 +00:00
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
2004-11-02 20:42:06 +00:00
|
|
|
SetLastErrorByStatus(Status);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
nNumberOfCharsToRead -= Request->Data.ReadConsoleRequest.NrCharactersRead;
|
2004-11-02 20:42:06 +00:00
|
|
|
memcpy((PVOID)((ULONG_PTR)lpBuffer + (ULONG_PTR)(CharsRead * CharSize)),
|
2005-08-28 12:03:25 +00:00
|
|
|
Request->Data.ReadConsoleRequest.Buffer,
|
|
|
|
Request->Data.ReadConsoleRequest.NrCharactersRead * CharSize);
|
|
|
|
CharsRead += Request->Data.ReadConsoleRequest.NrCharactersRead;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
if(Request->Status == STATUS_NOTIFY_CLEANUP)
|
2004-11-02 20:42:06 +00:00
|
|
|
{
|
|
|
|
if(CharsRead > 0)
|
|
|
|
{
|
|
|
|
CharsRead--;
|
|
|
|
nNumberOfCharsToRead++;
|
|
|
|
}
|
2005-08-28 12:03:25 +00:00
|
|
|
Request->Status = STATUS_PENDING;
|
2004-11-02 20:42:06 +00:00
|
|
|
}
|
2005-08-28 12:03:25 +00:00
|
|
|
} while(Request->Status == STATUS_PENDING && nNumberOfCharsToRead > 0);
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
if(lpNumberOfCharsRead != NULL)
|
|
|
|
{
|
|
|
|
*lpNumberOfCharsRead = CharsRead;
|
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
|
|
|
|
2004-12-17 00:44:46 +00:00
|
|
|
return TRUE;
|
2004-11-02 20:42:06 +00:00
|
|
|
}
|
2003-03-05 22:51:48 +00:00
|
|
|
|
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* ReadConsoleA
|
|
|
|
*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL STDCALL
|
|
|
|
ReadConsoleA(HANDLE hConsoleInput,
|
|
|
|
LPVOID lpBuffer,
|
|
|
|
DWORD nNumberOfCharsToRead,
|
|
|
|
LPDWORD lpNumberOfCharsRead,
|
2006-12-12 23:57:24 +00:00
|
|
|
PCONSOLE_READCONSOLE_CONTROL pInputControl)
|
2004-11-02 20:42:06 +00:00
|
|
|
{
|
|
|
|
return IntReadConsole(hConsoleInput,
|
|
|
|
lpBuffer,
|
|
|
|
nNumberOfCharsToRead,
|
|
|
|
lpNumberOfCharsRead,
|
2006-12-12 23:57:24 +00:00
|
|
|
pInputControl,
|
2004-11-02 20:42:06 +00:00
|
|
|
FALSE);
|
1999-01-16 02:11:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-03-06 10:57:02 +00:00
|
|
|
/*--------------------------------------------------------------
|
2004-11-02 20:42:06 +00:00
|
|
|
* ReadConsoleW
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
2004-11-02 20:42:06 +00:00
|
|
|
BOOL STDCALL
|
|
|
|
ReadConsoleW(HANDLE hConsoleInput,
|
|
|
|
LPVOID lpBuffer,
|
|
|
|
DWORD nNumberOfCharsToRead,
|
|
|
|
LPDWORD lpNumberOfCharsRead,
|
2006-12-12 23:57:24 +00:00
|
|
|
PCONSOLE_READCONSOLE_CONTROL pInputControl)
|
1999-01-16 02:11:45 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
return IntReadConsole(hConsoleInput,
|
|
|
|
lpBuffer,
|
|
|
|
nNumberOfCharsToRead,
|
|
|
|
lpNumberOfCharsRead,
|
2006-12-12 23:57:24 +00:00
|
|
|
pInputControl,
|
2004-11-02 20:42:06 +00:00
|
|
|
TRUE);
|
1999-01-16 02:11:45 +00:00
|
|
|
}
|
|
|
|
|
1999-03-06 10:57:02 +00:00
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* AllocConsole
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
2004-01-23 17:18:16 +00:00
|
|
|
BOOL STDCALL AllocConsole(VOID)
|
1999-01-16 02:11:45 +00:00
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2000-04-23 17:41:40 +00:00
|
|
|
NTSTATUS Status;
|
2003-03-09 21:37:18 +00:00
|
|
|
HANDLE hStdError;
|
2000-04-23 17:41:40 +00:00
|
|
|
|
2005-07-12 01:56:14 +00:00
|
|
|
if(NtCurrentPeb()->ProcessParameters->ConsoleHandle)
|
2003-08-18 07:32:00 +00:00
|
|
|
{
|
|
|
|
DPRINT("AllocConsole: Allocate duplicate console to the same Process\n");
|
2005-05-09 01:46:57 +00:00
|
|
|
SetLastErrorByStatus (STATUS_OBJECT_NAME_EXISTS);
|
|
|
|
return FALSE;
|
2003-08-18 07:32:00 +00:00
|
|
|
}
|
|
|
|
|
2005-02-10 19:38:47 +00:00
|
|
|
Request.Data.AllocConsoleRequest.CtrlDispatcher = ConsoleControlDispatcher;
|
2005-07-28 04:12:43 +00:00
|
|
|
Request.Data.AllocConsoleRequest.ConsoleNeeded = TRUE;
|
2003-08-18 07:32:00 +00:00
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(ALLOC_CONSOLE, CSR_CONSOLE);
|
|
|
|
Status = CsrClientCallServer( &Request, NULL, CsrRequest, sizeof( CSR_API_MESSAGE ) );
|
|
|
|
if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Request.Status ) )
|
2000-05-26 06:06:42 +00:00
|
|
|
{
|
2004-12-24 17:45:59 +00:00
|
|
|
SetLastErrorByStatus ( Status );
|
2000-05-26 06:06:42 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2005-07-12 01:56:14 +00:00
|
|
|
NtCurrentPeb()->ProcessParameters->ConsoleHandle = Request.Data.AllocConsoleRequest.Console;
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
SetStdHandle( STD_INPUT_HANDLE, Request.Data.AllocConsoleRequest.InputHandle );
|
|
|
|
SetStdHandle( STD_OUTPUT_HANDLE, Request.Data.AllocConsoleRequest.OutputHandle );
|
|
|
|
hStdError = DuplicateConsoleHandle(Request.Data.AllocConsoleRequest.OutputHandle,
|
2003-03-09 21:37:18 +00:00
|
|
|
0,
|
|
|
|
TRUE,
|
|
|
|
DUPLICATE_SAME_ACCESS);
|
|
|
|
SetStdHandle( STD_ERROR_HANDLE, hStdError );
|
2000-04-23 17:41:40 +00:00
|
|
|
return TRUE;
|
1999-01-16 02:11:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-03-06 10:57:02 +00:00
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* FreeConsole
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
2003-08-17 22:45:40 +00:00
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
2004-01-23 17:18:16 +00:00
|
|
|
BOOL STDCALL FreeConsole(VOID)
|
1999-01-16 02:11:45 +00:00
|
|
|
{
|
2003-08-17 22:45:40 +00:00
|
|
|
// AG: I'm not sure if this is correct (what happens to std handles?)
|
|
|
|
// but I just tried to reverse what AllocConsole() does...
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2003-08-17 22:45:40 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(FREE_CONSOLE, CSR_CONSOLE);
|
|
|
|
Status = CsrClientCallServer( &Request, NULL, CsrRequest, sizeof( CSR_API_MESSAGE ) );
|
|
|
|
if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Request.Status ) )
|
2003-08-17 22:45:40 +00:00
|
|
|
{
|
|
|
|
SetLastErrorByStatus ( Status );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-06-27 12:34:08 +00:00
|
|
|
NtCurrentPeb()->ProcessParameters->ConsoleHandle = NULL;
|
2003-08-17 22:45:40 +00:00
|
|
|
return TRUE;
|
1999-01-16 02:11:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-03-06 10:57:02 +00:00
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* GetConsoleScreenBufferInfo
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
2004-01-23 17:18:16 +00:00
|
|
|
BOOL
|
1999-01-16 02:11:45 +00:00
|
|
|
STDCALL
|
|
|
|
GetConsoleScreenBufferInfo(
|
|
|
|
HANDLE hConsoleOutput,
|
|
|
|
PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo
|
|
|
|
)
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2000-05-26 06:06:42 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(SCREEN_BUFFER_INFO, CSR_CONSOLE);
|
2000-05-26 06:06:42 +00:00
|
|
|
Request.Data.ScreenBufferInfoRequest.ConsoleHandle = hConsoleOutput;
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
Status = CsrClientCallServer( &Request, NULL, CsrRequest, sizeof( CSR_API_MESSAGE ) );
|
|
|
|
if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Request.Status ) )
|
2000-05-26 06:06:42 +00:00
|
|
|
{
|
2000-07-01 17:07:02 +00:00
|
|
|
SetLastErrorByStatus ( Status );
|
2000-05-26 06:06:42 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
*lpConsoleScreenBufferInfo = Request.Data.ScreenBufferInfoRequest.Info;
|
2000-05-26 06:06:42 +00:00
|
|
|
return TRUE;
|
1999-01-16 02:11:45 +00:00
|
|
|
}
|
|
|
|
|
1999-03-06 10:57:02 +00:00
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* SetConsoleCursorPosition
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
2004-01-23 17:18:16 +00:00
|
|
|
BOOL
|
1999-01-16 02:11:45 +00:00
|
|
|
STDCALL
|
|
|
|
SetConsoleCursorPosition(
|
|
|
|
HANDLE hConsoleOutput,
|
|
|
|
COORD dwCursorPosition
|
|
|
|
)
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2000-05-26 06:06:42 +00:00
|
|
|
NTSTATUS Status;
|
1999-01-16 02:11:45 +00:00
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(SET_CURSOR, CSR_CONSOLE);
|
2000-05-26 06:06:42 +00:00
|
|
|
Request.Data.SetCursorRequest.ConsoleHandle = hConsoleOutput;
|
|
|
|
Request.Data.SetCursorRequest.Position = dwCursorPosition;
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
Status = CsrClientCallServer( &Request, NULL, CsrRequest, sizeof( CSR_API_MESSAGE ) );
|
|
|
|
if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Request.Status ) )
|
2000-05-26 06:06:42 +00:00
|
|
|
{
|
2000-07-01 17:07:02 +00:00
|
|
|
SetLastErrorByStatus ( Status );
|
2000-05-26 06:06:42 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
1999-01-16 02:11:45 +00:00
|
|
|
}
|
|
|
|
|
1999-03-06 10:57:02 +00:00
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
static BOOL
|
|
|
|
IntFillConsoleOutputCharacter(HANDLE hConsoleOutput,
|
|
|
|
PVOID cCharacter,
|
|
|
|
DWORD nLength,
|
|
|
|
COORD dwWriteCoord,
|
|
|
|
LPDWORD lpNumberOfCharsWritten,
|
|
|
|
BOOL bUnicode)
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(FILL_OUTPUT, CSR_CONSOLE);
|
2004-11-02 20:42:06 +00:00
|
|
|
Request.Data.FillOutputRequest.ConsoleHandle = hConsoleOutput;
|
|
|
|
Request.Data.FillOutputRequest.Unicode = bUnicode;
|
|
|
|
if(bUnicode)
|
|
|
|
Request.Data.FillOutputRequest.Char.UnicodeChar = *((WCHAR*)cCharacter);
|
|
|
|
else
|
|
|
|
Request.Data.FillOutputRequest.Char.AsciiChar = *((CHAR*)cCharacter);
|
|
|
|
Request.Data.FillOutputRequest.Position = dwWriteCoord;
|
2007-01-26 07:22:19 +00:00
|
|
|
Request.Data.FillOutputRequest.Length = (WORD)nLength;
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
Status = CsrClientCallServer(&Request, NULL,
|
|
|
|
CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
2004-11-02 20:42:06 +00:00
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
2004-11-02 20:42:06 +00:00
|
|
|
{
|
|
|
|
SetLastErrorByStatus(Status);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(lpNumberOfCharsWritten != NULL)
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
*lpNumberOfCharsWritten = Request.Data.FillOutputRequest.NrCharactersWritten;
|
2004-11-02 20:42:06 +00:00
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1999-03-06 10:57:02 +00:00
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* FillConsoleOutputCharacterA
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
2004-01-23 17:18:16 +00:00
|
|
|
BOOL STDCALL
|
1999-01-16 02:11:45 +00:00
|
|
|
FillConsoleOutputCharacterA(
|
1999-03-06 10:57:02 +00:00
|
|
|
HANDLE hConsoleOutput,
|
|
|
|
CHAR cCharacter,
|
|
|
|
DWORD nLength,
|
|
|
|
COORD dwWriteCoord,
|
|
|
|
LPDWORD lpNumberOfCharsWritten
|
|
|
|
)
|
1999-01-16 02:11:45 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
return IntFillConsoleOutputCharacter(hConsoleOutput,
|
|
|
|
&cCharacter,
|
|
|
|
nLength,
|
|
|
|
dwWriteCoord,
|
|
|
|
lpNumberOfCharsWritten,
|
|
|
|
FALSE);
|
1999-01-16 02:11:45 +00:00
|
|
|
}
|
|
|
|
|
1999-03-06 10:57:02 +00:00
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* FillConsoleOutputCharacterW
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
2004-11-02 20:42:06 +00:00
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
2004-01-23 17:18:16 +00:00
|
|
|
BOOL
|
1999-01-16 02:11:45 +00:00
|
|
|
STDCALL
|
|
|
|
FillConsoleOutputCharacterW(
|
1999-03-06 10:57:02 +00:00
|
|
|
HANDLE hConsoleOutput,
|
|
|
|
WCHAR cCharacter,
|
|
|
|
DWORD nLength,
|
|
|
|
COORD dwWriteCoord,
|
|
|
|
LPDWORD lpNumberOfCharsWritten
|
|
|
|
)
|
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
return IntFillConsoleOutputCharacter(hConsoleOutput,
|
|
|
|
&cCharacter,
|
|
|
|
nLength,
|
|
|
|
dwWriteCoord,
|
|
|
|
lpNumberOfCharsWritten,
|
|
|
|
TRUE);
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
static BOOL
|
|
|
|
IntPeekConsoleInput(HANDLE hConsoleInput,
|
|
|
|
PINPUT_RECORD lpBuffer,
|
|
|
|
DWORD nLength,
|
|
|
|
LPDWORD lpNumberOfEventsRead,
|
|
|
|
BOOL bUnicode)
|
1999-03-06 10:57:02 +00:00
|
|
|
{
|
2005-08-26 20:35:33 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
2005-09-07 19:37:28 +00:00
|
|
|
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
2002-10-29 03:49:32 +00:00
|
|
|
NTSTATUS Status;
|
2004-11-02 20:42:06 +00:00
|
|
|
ULONG Size;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2002-10-29 03:49:32 +00:00
|
|
|
if(lpBuffer == NULL)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2002-10-29 03:49:32 +00:00
|
|
|
Size = nLength * sizeof(INPUT_RECORD);
|
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Allocate a Capture Buffer */
|
2005-09-26 07:43:55 +00:00
|
|
|
DPRINT("IntPeekConsoleInput: %lx %p\n", Size, lpNumberOfEventsRead);
|
2005-09-07 19:37:28 +00:00
|
|
|
CaptureBuffer = CsrAllocateCaptureBuffer(1, Size);
|
|
|
|
|
|
|
|
/* Allocate space in the Buffer */
|
2005-09-26 07:43:55 +00:00
|
|
|
CsrCaptureMessageBuffer(CaptureBuffer,
|
|
|
|
NULL,
|
|
|
|
Size,
|
|
|
|
(PVOID*)&Request.Data.PeekConsoleInputRequest.InputRecord);
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Set up the data to send to the Console Server */
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(PEEK_CONSOLE_INPUT, CSR_CONSOLE);
|
2005-08-26 20:35:33 +00:00
|
|
|
Request.Data.PeekConsoleInputRequest.ConsoleHandle = hConsoleInput;
|
|
|
|
Request.Data.PeekConsoleInputRequest.Unicode = bUnicode;
|
|
|
|
Request.Data.PeekConsoleInputRequest.Length = nLength;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Call the server */
|
2005-08-26 20:35:33 +00:00
|
|
|
Status = CsrClientCallServer(&Request,
|
2005-09-07 19:37:28 +00:00
|
|
|
CaptureBuffer,
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
2005-09-26 07:43:55 +00:00
|
|
|
DPRINT("Server returned: %x\n", Request.Status);
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Check for success*/
|
|
|
|
if (NT_SUCCESS(Request.Status))
|
2002-10-29 03:49:32 +00:00
|
|
|
{
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Return the number of events read */
|
2005-09-26 07:43:55 +00:00
|
|
|
DPRINT("Events read: %lx\n", Request.Data.PeekConsoleInputRequest.Length);
|
2005-09-07 19:37:28 +00:00
|
|
|
*lpNumberOfEventsRead = Request.Data.PeekConsoleInputRequest.Length;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Copy into the buffer */
|
2005-09-26 07:43:55 +00:00
|
|
|
DPRINT("Copying to buffer\n");
|
|
|
|
RtlCopyMemory(lpBuffer,
|
2005-09-07 19:37:28 +00:00
|
|
|
Request.Data.PeekConsoleInputRequest.InputRecord,
|
|
|
|
sizeof(INPUT_RECORD) * *lpNumberOfEventsRead);
|
|
|
|
}
|
|
|
|
else
|
2004-11-02 20:42:06 +00:00
|
|
|
{
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Error out */
|
|
|
|
*lpNumberOfEventsRead = 0;
|
|
|
|
SetLastErrorByStatus(Request.Status);
|
2004-11-02 20:42:06 +00:00
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Release the capture buffer */
|
|
|
|
CsrFreeCaptureBuffer(CaptureBuffer);
|
|
|
|
|
|
|
|
/* Return TRUE or FALSE */
|
|
|
|
return NT_SUCCESS(Request.Status);
|
2004-08-22 20:52:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* PeekConsoleInputA
|
|
|
|
*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
PeekConsoleInputA(
|
|
|
|
HANDLE hConsoleInput,
|
|
|
|
PINPUT_RECORD lpBuffer,
|
|
|
|
DWORD nLength,
|
|
|
|
LPDWORD lpNumberOfEventsRead
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return IntPeekConsoleInput(hConsoleInput, lpBuffer, nLength,
|
|
|
|
lpNumberOfEventsRead, FALSE);
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* PeekConsoleInputW
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
2004-08-22 20:52:28 +00:00
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
PeekConsoleInputW(
|
|
|
|
HANDLE hConsoleInput,
|
|
|
|
PINPUT_RECORD lpBuffer,
|
|
|
|
DWORD nLength,
|
|
|
|
LPDWORD lpNumberOfEventsRead
|
2005-05-09 01:46:57 +00:00
|
|
|
)
|
1999-03-06 10:57:02 +00:00
|
|
|
{
|
2004-08-22 20:52:28 +00:00
|
|
|
return IntPeekConsoleInput(hConsoleInput, lpBuffer, nLength,
|
|
|
|
lpNumberOfEventsRead, TRUE);
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
static BOOL
|
2004-08-22 20:52:28 +00:00
|
|
|
IntReadConsoleInput(HANDLE hConsoleInput,
|
|
|
|
PINPUT_RECORD lpBuffer,
|
|
|
|
DWORD nLength,
|
|
|
|
LPDWORD lpNumberOfEventsRead,
|
|
|
|
BOOL bUnicode)
|
1999-03-06 10:57:02 +00:00
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
ULONG Read;
|
2001-11-20 02:29:45 +00:00
|
|
|
NTSTATUS Status;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(READ_INPUT, CSR_CONSOLE);
|
2004-11-02 20:42:06 +00:00
|
|
|
Read = 0;
|
|
|
|
while(nLength > 0)
|
|
|
|
{
|
2005-10-24 17:25:23 +00:00
|
|
|
Request.Data.ReadInputRequest.ConsoleHandle = hConsoleInput;
|
|
|
|
Request.Data.ReadInputRequest.Unicode = bUnicode;
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
Status = CsrClientCallServer(&Request, NULL,
|
|
|
|
CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
|
|
|
if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
2001-11-20 02:29:45 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
if(Read == 0)
|
|
|
|
{
|
|
|
|
/* we couldn't read a single record, fail */
|
|
|
|
SetLastErrorByStatus(Status);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* FIXME - fail gracefully in case we already read at least one record? */
|
|
|
|
break;
|
|
|
|
}
|
2001-11-20 02:29:45 +00:00
|
|
|
}
|
2004-11-02 20:42:06 +00:00
|
|
|
else if(Status == STATUS_PENDING)
|
2001-11-20 02:29:45 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
if(Read == 0)
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
Status = NtWaitForSingleObject(Request.Data.ReadInputRequest.Event, FALSE, 0);
|
2004-11-02 20:42:06 +00:00
|
|
|
if(!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastErrorByStatus(Status);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* nothing more to read (waiting for more input??), let's just bail */
|
|
|
|
break;
|
|
|
|
}
|
2001-11-20 02:29:45 +00:00
|
|
|
}
|
2004-11-02 20:42:06 +00:00
|
|
|
else
|
2001-11-20 02:29:45 +00:00
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
lpBuffer[Read++] = Request.Data.ReadInputRequest.Input;
|
2004-11-02 20:42:06 +00:00
|
|
|
nLength--;
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
if(!Request.Data.ReadInputRequest.MoreEvents)
|
2004-11-02 20:42:06 +00:00
|
|
|
{
|
|
|
|
/* nothing more to read, bail */
|
|
|
|
break;
|
|
|
|
}
|
2001-11-20 02:29:45 +00:00
|
|
|
}
|
2004-11-02 20:42:06 +00:00
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
if(lpNumberOfEventsRead != NULL)
|
|
|
|
{
|
|
|
|
*lpNumberOfEventsRead = Read;
|
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
return (Read > 0);
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-08-22 20:52:28 +00:00
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* ReadConsoleInputA
|
|
|
|
*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL WINAPI
|
|
|
|
ReadConsoleInputA(HANDLE hConsoleInput,
|
|
|
|
PINPUT_RECORD lpBuffer,
|
|
|
|
DWORD nLength,
|
|
|
|
LPDWORD lpNumberOfEventsRead)
|
|
|
|
{
|
|
|
|
return IntReadConsoleInput(hConsoleInput, lpBuffer, nLength,
|
|
|
|
lpNumberOfEventsRead, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-03-06 10:57:02 +00:00
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* ReadConsoleInputW
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
2004-08-22 20:52:28 +00:00
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
ReadConsoleInputW(
|
|
|
|
HANDLE hConsoleInput,
|
|
|
|
PINPUT_RECORD lpBuffer,
|
|
|
|
DWORD nLength,
|
|
|
|
LPDWORD lpNumberOfEventsRead
|
|
|
|
)
|
|
|
|
{
|
2004-08-22 20:52:28 +00:00
|
|
|
return IntReadConsoleInput(hConsoleInput, lpBuffer, nLength,
|
|
|
|
lpNumberOfEventsRead, TRUE);
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
static BOOL
|
|
|
|
IntWriteConsoleInput(HANDLE hConsoleInput,
|
|
|
|
PINPUT_RECORD lpBuffer,
|
|
|
|
DWORD nLength,
|
|
|
|
LPDWORD lpNumberOfEventsWritten,
|
|
|
|
BOOL bUnicode)
|
1999-03-06 10:57:02 +00:00
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
2005-09-07 19:37:28 +00:00
|
|
|
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
2002-11-12 00:48:26 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
DWORD Size;
|
2004-11-02 20:42:06 +00:00
|
|
|
|
2002-11-12 00:48:26 +00:00
|
|
|
if(lpBuffer == NULL)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2004-11-02 20:42:06 +00:00
|
|
|
|
2002-11-12 00:48:26 +00:00
|
|
|
Size = nLength * sizeof(INPUT_RECORD);
|
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Allocate a Capture Buffer */
|
2005-09-26 07:43:55 +00:00
|
|
|
DPRINT("IntWriteConsoleInput: %lx %p\n", Size, lpNumberOfEventsWritten);
|
2005-09-07 19:37:28 +00:00
|
|
|
CaptureBuffer = CsrAllocateCaptureBuffer(1, Size);
|
|
|
|
|
|
|
|
/* Allocate space in the Buffer */
|
2005-09-26 07:43:55 +00:00
|
|
|
CsrCaptureMessageBuffer(CaptureBuffer,
|
2008-07-26 15:20:21 +00:00
|
|
|
lpBuffer,
|
2005-09-26 07:43:55 +00:00
|
|
|
Size,
|
|
|
|
(PVOID*)&Request.Data.WriteConsoleInputRequest.InputRecord);
|
2002-11-12 00:48:26 +00:00
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Set up the data to send to the Console Server */
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(WRITE_CONSOLE_INPUT, CSR_CONSOLE);
|
2004-11-02 20:42:06 +00:00
|
|
|
Request.Data.WriteConsoleInputRequest.ConsoleHandle = hConsoleInput;
|
|
|
|
Request.Data.WriteConsoleInputRequest.Unicode = bUnicode;
|
|
|
|
Request.Data.WriteConsoleInputRequest.Length = nLength;
|
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Call the server */
|
|
|
|
Status = CsrClientCallServer(&Request,
|
|
|
|
CaptureBuffer,
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
2005-09-26 07:43:55 +00:00
|
|
|
DPRINT("Server returned: %x\n", Request.Status);
|
2004-11-02 20:42:06 +00:00
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Check for success*/
|
|
|
|
if (NT_SUCCESS(Request.Status))
|
2002-11-12 00:48:26 +00:00
|
|
|
{
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Return the number of events read */
|
2005-09-26 07:43:55 +00:00
|
|
|
DPRINT("Events read: %lx\n", Request.Data.WriteConsoleInputRequest.Length);
|
2005-09-07 19:37:28 +00:00
|
|
|
*lpNumberOfEventsWritten = Request.Data.WriteConsoleInputRequest.Length;
|
|
|
|
}
|
|
|
|
else
|
2004-11-02 20:42:06 +00:00
|
|
|
{
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Error out */
|
|
|
|
*lpNumberOfEventsWritten = 0;
|
|
|
|
SetLastErrorByStatus(Request.Status);
|
2004-11-02 20:42:06 +00:00
|
|
|
}
|
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Release the capture buffer */
|
|
|
|
CsrFreeCaptureBuffer(CaptureBuffer);
|
|
|
|
|
|
|
|
/* Return TRUE or FALSE */
|
|
|
|
return NT_SUCCESS(Request.Status);
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
2004-11-02 20:42:06 +00:00
|
|
|
* WriteConsoleInputA
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
2004-11-02 20:42:06 +00:00
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
2004-11-02 20:42:06 +00:00
|
|
|
WriteConsoleInputA(
|
1999-03-06 10:57:02 +00:00
|
|
|
HANDLE hConsoleInput,
|
|
|
|
CONST INPUT_RECORD *lpBuffer,
|
|
|
|
DWORD nLength,
|
|
|
|
LPDWORD lpNumberOfEventsWritten
|
|
|
|
)
|
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
return IntWriteConsoleInput(hConsoleInput,
|
|
|
|
(PINPUT_RECORD)lpBuffer,
|
|
|
|
nLength,
|
|
|
|
lpNumberOfEventsWritten,
|
|
|
|
FALSE);
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
2004-11-02 20:42:06 +00:00
|
|
|
* WriteConsoleInputW
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
2004-11-02 20:42:06 +00:00
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
2004-11-02 20:42:06 +00:00
|
|
|
WriteConsoleInputW(
|
|
|
|
HANDLE hConsoleInput,
|
|
|
|
CONST INPUT_RECORD *lpBuffer,
|
|
|
|
DWORD nLength,
|
|
|
|
LPDWORD lpNumberOfEventsWritten
|
1999-03-06 10:57:02 +00:00
|
|
|
)
|
2004-11-02 20:42:06 +00:00
|
|
|
{
|
|
|
|
return IntWriteConsoleInput(hConsoleInput,
|
|
|
|
(PINPUT_RECORD)lpBuffer,
|
|
|
|
nLength,
|
|
|
|
lpNumberOfEventsWritten,
|
|
|
|
TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static BOOL
|
|
|
|
IntReadConsoleOutput(HANDLE hConsoleOutput,
|
|
|
|
PCHAR_INFO lpBuffer,
|
|
|
|
COORD dwBufferSize,
|
|
|
|
COORD dwBufferCoord,
|
|
|
|
PSMALL_RECT lpReadRegion,
|
|
|
|
BOOL bUnicode)
|
1999-03-06 10:57:02 +00:00
|
|
|
{
|
2005-08-26 20:35:33 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
2005-09-07 19:37:28 +00:00
|
|
|
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
2002-11-12 00:48:26 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
DWORD Size, SizeX, SizeY;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2002-11-12 00:48:26 +00:00
|
|
|
if(lpBuffer == NULL)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2002-11-12 00:48:26 +00:00
|
|
|
Size = dwBufferSize.X * dwBufferSize.Y * sizeof(CHAR_INFO);
|
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Allocate a Capture Buffer */
|
2005-09-26 07:43:55 +00:00
|
|
|
DPRINT("IntReadConsoleOutput: %lx %p\n", Size, lpReadRegion);
|
2005-09-07 19:37:28 +00:00
|
|
|
CaptureBuffer = CsrAllocateCaptureBuffer(1, Size);
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Allocate space in the Buffer */
|
2005-09-26 07:43:55 +00:00
|
|
|
CsrCaptureMessageBuffer(CaptureBuffer,
|
|
|
|
NULL,
|
|
|
|
Size,
|
|
|
|
(PVOID*)&Request.Data.ReadConsoleOutputRequest.CharInfo);
|
2005-09-07 19:37:28 +00:00
|
|
|
|
|
|
|
/* Set up the data to send to the Console Server */
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(READ_CONSOLE_OUTPUT, CSR_CONSOLE);
|
2005-08-26 20:35:33 +00:00
|
|
|
Request.Data.ReadConsoleOutputRequest.ConsoleHandle = hConsoleOutput;
|
|
|
|
Request.Data.ReadConsoleOutputRequest.Unicode = bUnicode;
|
|
|
|
Request.Data.ReadConsoleOutputRequest.BufferSize = dwBufferSize;
|
|
|
|
Request.Data.ReadConsoleOutputRequest.BufferCoord = dwBufferCoord;
|
|
|
|
Request.Data.ReadConsoleOutputRequest.ReadRegion = *lpReadRegion;
|
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Call the server */
|
2005-08-26 20:35:33 +00:00
|
|
|
Status = CsrClientCallServer(&Request,
|
2005-09-07 19:37:28 +00:00
|
|
|
CaptureBuffer,
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
2005-09-26 07:43:55 +00:00
|
|
|
DPRINT("Server returned: %x\n", Request.Status);
|
2004-11-02 20:42:06 +00:00
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Check for success*/
|
|
|
|
if (NT_SUCCESS(Request.Status))
|
2002-11-12 00:48:26 +00:00
|
|
|
{
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Copy into the buffer */
|
2005-09-26 07:43:55 +00:00
|
|
|
DPRINT("Copying to buffer\n");
|
2005-09-07 19:37:28 +00:00
|
|
|
SizeX = Request.Data.ReadConsoleOutputRequest.ReadRegion.Right -
|
|
|
|
Request.Data.ReadConsoleOutputRequest.ReadRegion.Left + 1;
|
|
|
|
SizeY = Request.Data.ReadConsoleOutputRequest.ReadRegion.Bottom -
|
|
|
|
Request.Data.ReadConsoleOutputRequest.ReadRegion.Top + 1;
|
|
|
|
RtlCopyMemory(lpBuffer,
|
|
|
|
Request.Data.ReadConsoleOutputRequest.CharInfo,
|
|
|
|
sizeof(CHAR_INFO) * SizeX * SizeY);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Error out */
|
|
|
|
SetLastErrorByStatus(Request.Status);
|
2002-11-12 00:48:26 +00:00
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Return the read region */
|
2005-09-26 07:43:55 +00:00
|
|
|
DPRINT("read region: %lx\n", Request.Data.ReadConsoleOutputRequest.ReadRegion);
|
2005-08-26 20:35:33 +00:00
|
|
|
*lpReadRegion = Request.Data.ReadConsoleOutputRequest.ReadRegion;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Release the capture buffer */
|
|
|
|
CsrFreeCaptureBuffer(CaptureBuffer);
|
|
|
|
|
|
|
|
/* Return TRUE or FALSE */
|
|
|
|
return NT_SUCCESS(Request.Status);
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
2004-08-22 20:52:28 +00:00
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* 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);
|
|
|
|
}
|
|
|
|
|
1999-03-06 10:57:02 +00:00
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* ReadConsoleOutputW
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
2004-08-22 20:52:28 +00:00
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
ReadConsoleOutputW(
|
|
|
|
HANDLE hConsoleOutput,
|
|
|
|
PCHAR_INFO lpBuffer,
|
|
|
|
COORD dwBufferSize,
|
|
|
|
COORD dwBufferCoord,
|
|
|
|
PSMALL_RECT lpReadRegion
|
|
|
|
)
|
|
|
|
{
|
2004-08-22 20:52:28 +00:00
|
|
|
return IntReadConsoleOutput(hConsoleOutput, lpBuffer, dwBufferSize,
|
|
|
|
dwBufferCoord, lpReadRegion, TRUE);
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
2004-08-22 20:52:28 +00:00
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
static BOOL
|
|
|
|
IntWriteConsoleOutput(HANDLE hConsoleOutput,
|
2004-08-22 20:52:28 +00:00
|
|
|
CONST CHAR_INFO *lpBuffer,
|
2004-11-02 20:42:06 +00:00
|
|
|
COORD dwBufferSize,
|
|
|
|
COORD dwBufferCoord,
|
|
|
|
PSMALL_RECT lpWriteRegion,
|
|
|
|
BOOL bUnicode)
|
1999-03-06 10:57:02 +00:00
|
|
|
{
|
2005-08-26 20:35:33 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
2005-09-07 19:37:28 +00:00
|
|
|
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
2001-11-25 15:21:11 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
ULONG Size;
|
2001-09-01 15:36:45 +00:00
|
|
|
|
2001-11-25 15:21:11 +00:00
|
|
|
Size = dwBufferSize.Y * dwBufferSize.X * sizeof(CHAR_INFO);
|
2001-09-01 15:36:45 +00:00
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Allocate a Capture Buffer */
|
2005-09-26 07:43:55 +00:00
|
|
|
DPRINT("IntWriteConsoleOutput: %lx %p\n", Size, lpWriteRegion);
|
2005-09-07 19:37:28 +00:00
|
|
|
CaptureBuffer = CsrAllocateCaptureBuffer(1, Size);
|
|
|
|
|
|
|
|
/* Allocate space in the Buffer */
|
2005-09-26 07:43:55 +00:00
|
|
|
CsrCaptureMessageBuffer(CaptureBuffer,
|
|
|
|
NULL,
|
|
|
|
Size,
|
|
|
|
(PVOID*)&Request.Data.WriteConsoleOutputRequest.CharInfo);
|
2005-09-07 19:37:28 +00:00
|
|
|
|
|
|
|
/* Copy from the buffer */
|
2005-09-26 11:35:23 +00:00
|
|
|
RtlCopyMemory(Request.Data.WriteConsoleOutputRequest.CharInfo, lpBuffer, Size);
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Set up the data to send to the Console Server */
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(WRITE_CONSOLE_OUTPUT, CSR_CONSOLE);
|
2005-08-26 20:35:33 +00:00
|
|
|
Request.Data.WriteConsoleOutputRequest.ConsoleHandle = hConsoleOutput;
|
|
|
|
Request.Data.WriteConsoleOutputRequest.Unicode = bUnicode;
|
|
|
|
Request.Data.WriteConsoleOutputRequest.BufferSize = dwBufferSize;
|
|
|
|
Request.Data.WriteConsoleOutputRequest.BufferCoord = dwBufferCoord;
|
|
|
|
Request.Data.WriteConsoleOutputRequest.WriteRegion = *lpWriteRegion;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Call the server */
|
2005-08-26 20:35:33 +00:00
|
|
|
Status = CsrClientCallServer(&Request,
|
2005-09-07 19:37:28 +00:00
|
|
|
CaptureBuffer,
|
|
|
|
CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
2005-09-26 07:43:55 +00:00
|
|
|
DPRINT("Server returned: %x\n", Request.Status);
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Check for success*/
|
|
|
|
if (!NT_SUCCESS(Request.Status))
|
|
|
|
{
|
|
|
|
/* Error out */
|
|
|
|
SetLastErrorByStatus(Request.Status);
|
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Return the read region */
|
2005-09-26 07:43:55 +00:00
|
|
|
DPRINT("read region: %lx\n", Request.Data.WriteConsoleOutputRequest.WriteRegion);
|
2005-08-26 20:35:33 +00:00
|
|
|
*lpWriteRegion = Request.Data.WriteConsoleOutputRequest.WriteRegion;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-09-07 19:37:28 +00:00
|
|
|
/* Release the capture buffer */
|
|
|
|
CsrFreeCaptureBuffer(CaptureBuffer);
|
|
|
|
|
|
|
|
/* Return TRUE or FALSE */
|
|
|
|
return NT_SUCCESS(Request.Status);
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
2004-08-22 20:52:28 +00:00
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* 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);
|
|
|
|
}
|
|
|
|
|
1999-03-06 10:57:02 +00:00
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* WriteConsoleOutputW
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
2004-08-22 20:52:28 +00:00
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
WriteConsoleOutputW(
|
|
|
|
HANDLE hConsoleOutput,
|
|
|
|
CONST CHAR_INFO *lpBuffer,
|
|
|
|
COORD dwBufferSize,
|
|
|
|
COORD dwBufferCoord,
|
|
|
|
PSMALL_RECT lpWriteRegion
|
|
|
|
)
|
|
|
|
{
|
2004-08-22 20:52:28 +00:00
|
|
|
return IntWriteConsoleOutput(hConsoleOutput, lpBuffer, dwBufferSize,
|
|
|
|
dwBufferCoord, lpWriteRegion, TRUE);
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
static BOOL
|
|
|
|
IntReadConsoleOutputCharacter(HANDLE hConsoleOutput,
|
|
|
|
PVOID lpCharacter,
|
|
|
|
DWORD nLength,
|
|
|
|
COORD dwReadCoord,
|
|
|
|
LPDWORD lpNumberOfCharsRead,
|
|
|
|
BOOL bUnicode)
|
1999-03-06 10:57:02 +00:00
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
PCSR_API_MESSAGE Request; ULONG CsrRequest;
|
2002-08-22 15:21:57 +00:00
|
|
|
NTSTATUS Status;
|
2004-11-02 20:42:06 +00:00
|
|
|
ULONG nChars, SizeBytes, CharSize;
|
|
|
|
DWORD CharsRead = 0;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
CharSize = (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
|
2005-05-09 01:46:57 +00:00
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
nChars = min(nLength, CSRSS_MAX_READ_CONSOLE_OUTPUT_CHAR) / CharSize;
|
2004-11-02 20:42:06 +00:00
|
|
|
SizeBytes = nChars * CharSize;
|
2002-08-22 15:21:57 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
Request = RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
|
|
|
max(sizeof(CSR_API_MESSAGE),
|
|
|
|
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE_OUTPUT_CHAR)
|
|
|
|
+ min (nChars, CSRSS_MAX_READ_CONSOLE_OUTPUT_CHAR / CharSize) * CharSize));
|
|
|
|
if (Request == NULL)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(READ_CONSOLE_OUTPUT_CHAR, CSR_CONSOLE);
|
2005-08-28 12:03:25 +00:00
|
|
|
Request->Data.ReadConsoleOutputCharRequest.ReadCoord = dwReadCoord;
|
2002-08-22 15:21:57 +00:00
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
while(nLength > 0)
|
|
|
|
{
|
|
|
|
DWORD BytesRead;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-10-24 17:25:23 +00:00
|
|
|
Request->Data.ReadConsoleOutputCharRequest.ConsoleHandle = hConsoleOutput;
|
|
|
|
Request->Data.ReadConsoleOutputCharRequest.Unicode = bUnicode;
|
2005-08-28 12:03:25 +00:00
|
|
|
Request->Data.ReadConsoleOutputCharRequest.NumCharsToRead = min(nLength, nChars);
|
|
|
|
SizeBytes = Request->Data.ReadConsoleOutputCharRequest.NumCharsToRead * CharSize;
|
2004-11-02 20:42:06 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
Status = CsrClientCallServer(Request,
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
NULL,
|
|
|
|
CsrRequest,
|
2005-08-28 12:03:25 +00:00
|
|
|
max (sizeof(CSR_API_MESSAGE),
|
|
|
|
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE_OUTPUT_CHAR) + SizeBytes));
|
|
|
|
if(!NT_SUCCESS(Status) || !NT_SUCCESS(Request->Status))
|
2002-08-22 15:21:57 +00:00
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
2004-11-02 20:42:06 +00:00
|
|
|
SetLastErrorByStatus(Status);
|
|
|
|
break;
|
|
|
|
}
|
2002-08-22 15:21:57 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
BytesRead = Request->Data.ReadConsoleOutputCharRequest.CharsRead * CharSize;
|
|
|
|
memcpy(lpCharacter, Request->Data.ReadConsoleOutputCharRequest.String, BytesRead);
|
2004-11-02 20:42:06 +00:00
|
|
|
lpCharacter = (PVOID)((ULONG_PTR)lpCharacter + (ULONG_PTR)BytesRead);
|
2005-08-28 12:03:25 +00:00
|
|
|
CharsRead += Request->Data.ReadConsoleOutputCharRequest.CharsRead;
|
|
|
|
nLength -= Request->Data.ReadConsoleOutputCharRequest.CharsRead;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
Request->Data.ReadConsoleOutputCharRequest.ReadCoord = Request->Data.ReadConsoleOutputCharRequest.EndCoord;
|
2004-11-02 20:42:06 +00:00
|
|
|
}
|
2002-08-22 15:21:57 +00:00
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
if(lpNumberOfCharsRead != NULL)
|
|
|
|
{
|
|
|
|
*lpNumberOfCharsRead = CharsRead;
|
|
|
|
}
|
2002-08-22 15:21:57 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2002-08-22 15:21:57 +00:00
|
|
|
|
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* ReadConsoleOutputCharacterA
|
|
|
|
*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
ReadConsoleOutputCharacterA(
|
|
|
|
HANDLE hConsoleOutput,
|
|
|
|
LPSTR lpCharacter,
|
|
|
|
DWORD nLength,
|
|
|
|
COORD dwReadCoord,
|
|
|
|
LPDWORD lpNumberOfCharsRead
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return IntReadConsoleOutputCharacter(hConsoleOutput,
|
|
|
|
(PVOID)lpCharacter,
|
|
|
|
nLength,
|
|
|
|
dwReadCoord,
|
|
|
|
lpNumberOfCharsRead,
|
|
|
|
FALSE);
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
1999-03-30 21:58:05 +00:00
|
|
|
* ReadConsoleOutputCharacterW
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
2004-11-02 20:42:06 +00:00
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
ReadConsoleOutputCharacterW(
|
|
|
|
HANDLE hConsoleOutput,
|
|
|
|
LPWSTR lpCharacter,
|
|
|
|
DWORD nLength,
|
|
|
|
COORD dwReadCoord,
|
|
|
|
LPDWORD lpNumberOfCharsRead
|
|
|
|
)
|
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
return IntReadConsoleOutputCharacter(hConsoleOutput,
|
|
|
|
(PVOID)lpCharacter,
|
|
|
|
nLength,
|
|
|
|
dwReadCoord,
|
|
|
|
lpNumberOfCharsRead,
|
|
|
|
TRUE);
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* ReadConsoleOutputAttribute
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
ReadConsoleOutputAttribute(
|
|
|
|
HANDLE hConsoleOutput,
|
|
|
|
LPWORD lpAttribute,
|
|
|
|
DWORD nLength,
|
|
|
|
COORD dwReadCoord,
|
|
|
|
LPDWORD lpNumberOfAttrsRead
|
|
|
|
)
|
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
PCSR_API_MESSAGE Request; ULONG CsrRequest;
|
2002-10-20 00:34:40 +00:00
|
|
|
NTSTATUS Status;
|
2005-08-26 20:35:33 +00:00
|
|
|
DWORD Size;
|
2002-10-20 00:34:40 +00:00
|
|
|
|
|
|
|
if (lpNumberOfAttrsRead != NULL)
|
|
|
|
*lpNumberOfAttrsRead = nLength;
|
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
Request = RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
|
|
|
max(sizeof(CSR_API_MESSAGE),
|
|
|
|
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE_OUTPUT_ATTRIB)
|
|
|
|
+ min (nLength, CSRSS_MAX_READ_CONSOLE_OUTPUT_ATTRIB / sizeof(WORD)) * sizeof(WORD)));
|
|
|
|
if (Request == NULL)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(READ_CONSOLE_OUTPUT_ATTRIB, CSR_CONSOLE);
|
2002-10-20 00:34:40 +00:00
|
|
|
|
|
|
|
while (nLength != 0)
|
|
|
|
{
|
2005-10-24 17:25:23 +00:00
|
|
|
Request->Data.ReadConsoleOutputAttribRequest.ConsoleHandle = hConsoleOutput;
|
|
|
|
Request->Data.ReadConsoleOutputAttribRequest.ReadCoord = dwReadCoord;
|
|
|
|
|
2005-08-26 20:35:33 +00:00
|
|
|
if (nLength > CSRSS_MAX_READ_CONSOLE_OUTPUT_ATTRIB / sizeof(WORD))
|
|
|
|
Size = CSRSS_MAX_READ_CONSOLE_OUTPUT_ATTRIB / sizeof(WCHAR);
|
2002-10-20 00:34:40 +00:00
|
|
|
else
|
|
|
|
Size = nLength;
|
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
Request->Data.ReadConsoleOutputAttribRequest.NumAttrsToRead = Size;
|
2002-10-20 00:34:40 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
Status = CsrClientCallServer(Request,
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
NULL,
|
|
|
|
CsrRequest,
|
2005-08-28 12:03:25 +00:00
|
|
|
max (sizeof(CSR_API_MESSAGE),
|
|
|
|
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE_OUTPUT_ATTRIB) + Size * sizeof(WORD)));
|
|
|
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Request->Status))
|
2002-10-20 00:34:40 +00:00
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
2002-10-20 00:34:40 +00:00
|
|
|
SetLastErrorByStatus(Status);
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
memcpy(lpAttribute, Request->Data.ReadConsoleOutputAttribRequest.Attribute, Size * sizeof(WORD));
|
2005-08-26 20:35:33 +00:00
|
|
|
lpAttribute += Size;
|
2002-10-20 00:34:40 +00:00
|
|
|
nLength -= Size;
|
2005-08-28 12:03:25 +00:00
|
|
|
Request->Data.ReadConsoleOutputAttribRequest.ReadCoord = Request->Data.ReadConsoleOutputAttribRequest.EndCoord;
|
2002-10-20 00:34:40 +00:00
|
|
|
}
|
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
|
|
|
|
2002-10-20 00:34:40 +00:00
|
|
|
return(TRUE);
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
static BOOL
|
|
|
|
IntWriteConsoleOutputCharacter(HANDLE hConsoleOutput,
|
|
|
|
PVOID lpCharacter,
|
|
|
|
DWORD nLength,
|
|
|
|
COORD dwWriteCoord,
|
|
|
|
LPDWORD lpNumberOfCharsWritten,
|
|
|
|
BOOL bUnicode)
|
1999-03-06 10:57:02 +00:00
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
PCSR_API_MESSAGE Request; ULONG CsrRequest;
|
2001-12-20 03:56:10 +00:00
|
|
|
NTSTATUS Status;
|
2004-11-02 20:42:06 +00:00
|
|
|
ULONG SizeBytes, CharSize, nChars;
|
|
|
|
DWORD Written = 0;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
CharSize = (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-08-26 20:35:33 +00:00
|
|
|
nChars = min(nLength, CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR / CharSize);
|
2004-11-02 20:42:06 +00:00
|
|
|
SizeBytes = nChars * CharSize;
|
2004-08-24 17:21:12 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
Request = RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
|
|
|
max (sizeof(CSR_API_MESSAGE),
|
|
|
|
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE_OUTPUT_CHAR)
|
|
|
|
+ min (nChars, CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR / CharSize) * CharSize));
|
|
|
|
if (Request == NULL)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(WRITE_CONSOLE_OUTPUT_CHAR, CSR_CONSOLE);
|
2005-08-28 12:03:25 +00:00
|
|
|
Request->Data.WriteConsoleOutputCharRequest.Coord = dwWriteCoord;
|
2004-11-02 20:42:06 +00:00
|
|
|
|
|
|
|
while(nLength > 0)
|
|
|
|
{
|
|
|
|
DWORD BytesWrite;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-10-24 17:25:23 +00:00
|
|
|
Request->Data.WriteConsoleOutputCharRequest.ConsoleHandle = hConsoleOutput;
|
|
|
|
Request->Data.WriteConsoleOutputCharRequest.Unicode = bUnicode;
|
2007-01-26 07:22:19 +00:00
|
|
|
Request->Data.WriteConsoleOutputCharRequest.Length = (WORD)min(nLength, nChars);
|
2005-08-28 12:03:25 +00:00
|
|
|
BytesWrite = Request->Data.WriteConsoleOutputCharRequest.Length * CharSize;
|
2004-11-02 20:42:06 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
memcpy(Request->Data.WriteConsoleOutputCharRequest.String, lpCharacter, BytesWrite);
|
2004-11-02 20:42:06 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
Status = CsrClientCallServer(Request,
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
NULL,
|
|
|
|
CsrRequest,
|
2005-08-28 12:03:25 +00:00
|
|
|
max (sizeof(CSR_API_MESSAGE),
|
|
|
|
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE_OUTPUT_CHAR) + BytesWrite));
|
2004-11-02 20:42:06 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request->Status))
|
2001-12-20 03:56:10 +00:00
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
2004-11-02 20:42:06 +00:00
|
|
|
SetLastErrorByStatus(Status);
|
|
|
|
return FALSE;
|
2001-12-20 03:56:10 +00:00
|
|
|
}
|
2004-11-02 20:42:06 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
nLength -= Request->Data.WriteConsoleOutputCharRequest.NrCharactersWritten;
|
|
|
|
lpCharacter = (PVOID)((ULONG_PTR)lpCharacter + (ULONG_PTR)(Request->Data.WriteConsoleOutputCharRequest.NrCharactersWritten * CharSize));
|
|
|
|
Written += Request->Data.WriteConsoleOutputCharRequest.NrCharactersWritten;
|
2004-11-02 20:42:06 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
Request->Data.WriteConsoleOutputCharRequest.Coord = Request->Data.WriteConsoleOutputCharRequest.EndCoord;
|
2004-11-02 20:42:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(lpNumberOfCharsWritten != NULL)
|
|
|
|
{
|
|
|
|
*lpNumberOfCharsWritten = Written;
|
|
|
|
}
|
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
|
|
|
|
2001-12-20 03:56:10 +00:00
|
|
|
return TRUE;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* WriteConsoleOutputCharacterA
|
|
|
|
*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL WINAPI
|
|
|
|
WriteConsoleOutputCharacterA(HANDLE hConsoleOutput,
|
|
|
|
LPCSTR lpCharacter,
|
|
|
|
DWORD nLength,
|
|
|
|
COORD dwWriteCoord,
|
|
|
|
LPDWORD lpNumberOfCharsWritten)
|
|
|
|
{
|
|
|
|
return IntWriteConsoleOutputCharacter(hConsoleOutput,
|
|
|
|
(PVOID)lpCharacter,
|
|
|
|
nLength,
|
|
|
|
dwWriteCoord,
|
|
|
|
lpNumberOfCharsWritten,
|
|
|
|
FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-03-06 10:57:02 +00:00
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* WriteConsoleOutputCharacterW
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
2004-06-13 20:04:56 +00:00
|
|
|
BOOL WINAPI
|
2003-07-09 10:43:08 +00:00
|
|
|
WriteConsoleOutputCharacterW(HANDLE hConsoleOutput,
|
|
|
|
LPCWSTR lpCharacter,
|
|
|
|
DWORD nLength,
|
|
|
|
COORD dwWriteCoord,
|
|
|
|
LPDWORD lpNumberOfCharsWritten)
|
1999-03-06 10:57:02 +00:00
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
return IntWriteConsoleOutputCharacter(hConsoleOutput,
|
|
|
|
(PVOID)lpCharacter,
|
|
|
|
nLength,
|
|
|
|
dwWriteCoord,
|
|
|
|
lpNumberOfCharsWritten,
|
|
|
|
TRUE);
|
2003-07-09 10:43:08 +00:00
|
|
|
}
|
1999-03-06 10:57:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* WriteConsoleOutputAttribute
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
WriteConsoleOutputAttribute(
|
|
|
|
HANDLE hConsoleOutput,
|
|
|
|
CONST WORD *lpAttribute,
|
|
|
|
DWORD nLength,
|
|
|
|
COORD dwWriteCoord,
|
|
|
|
LPDWORD lpNumberOfAttrsWritten
|
|
|
|
)
|
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
PCSR_API_MESSAGE Request; ULONG CsrRequest;
|
2000-05-26 06:06:42 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
WORD Size;
|
2005-08-26 20:35:33 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
Request = RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
|
|
|
max (sizeof(CSR_API_MESSAGE),
|
|
|
|
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB)
|
|
|
|
+ min(nLength, CSRSS_MAX_WRITE_CONSOLE_OUTPUT_ATTRIB / sizeof(WORD)) * sizeof(WORD)));
|
|
|
|
if (Request == NULL)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(WRITE_CONSOLE_OUTPUT_ATTRIB, CSR_CONSOLE);
|
2005-08-28 12:03:25 +00:00
|
|
|
Request->Data.WriteConsoleOutputAttribRequest.Coord = dwWriteCoord;
|
2005-10-24 17:25:23 +00:00
|
|
|
|
2000-05-26 06:06:42 +00:00
|
|
|
if( lpNumberOfAttrsWritten )
|
|
|
|
*lpNumberOfAttrsWritten = nLength;
|
|
|
|
while( nLength )
|
|
|
|
{
|
2007-01-26 07:22:19 +00:00
|
|
|
Size = (WORD)min(nLength, CSRSS_MAX_WRITE_CONSOLE_OUTPUT_ATTRIB / sizeof(WORD));
|
2005-10-24 17:25:23 +00:00
|
|
|
Request->Data.WriteConsoleOutputAttribRequest.ConsoleHandle = hConsoleOutput;
|
2005-08-28 12:03:25 +00:00
|
|
|
Request->Data.WriteConsoleOutputAttribRequest.Length = Size;
|
|
|
|
memcpy(Request->Data.WriteConsoleOutputAttribRequest.Attribute, lpAttribute, Size * sizeof(WORD));
|
|
|
|
|
|
|
|
Status = CsrClientCallServer( Request,
|
|
|
|
NULL,
|
|
|
|
CsrRequest,
|
|
|
|
max (sizeof(CSR_API_MESSAGE),
|
|
|
|
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB) + Size * sizeof(WORD)));
|
|
|
|
|
|
|
|
if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Request->Status ) )
|
2000-05-26 06:06:42 +00:00
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
2000-07-01 17:07:02 +00:00
|
|
|
SetLastErrorByStatus ( Status );
|
2000-05-26 06:06:42 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
nLength -= Size;
|
|
|
|
lpAttribute += Size;
|
2005-08-28 12:03:25 +00:00
|
|
|
Request->Data.WriteConsoleOutputAttribRequest.Coord = Request->Data.WriteConsoleOutputAttribRequest.EndCoord;
|
2000-05-26 06:06:42 +00:00
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
|
|
|
|
2000-05-26 06:06:42 +00:00
|
|
|
return TRUE;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* FillConsoleOutputAttribute
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
FillConsoleOutputAttribute(
|
|
|
|
HANDLE hConsoleOutput,
|
|
|
|
WORD wAttribute,
|
|
|
|
DWORD nLength,
|
|
|
|
COORD dwWriteCoord,
|
|
|
|
LPDWORD lpNumberOfAttrsWritten
|
|
|
|
)
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2000-05-26 06:06:42 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(FILL_OUTPUT_ATTRIB, CSR_CONSOLE);
|
2000-05-26 06:06:42 +00:00
|
|
|
Request.Data.FillOutputAttribRequest.ConsoleHandle = hConsoleOutput;
|
2007-01-26 07:22:19 +00:00
|
|
|
Request.Data.FillOutputAttribRequest.Attribute = (CHAR)wAttribute;
|
2000-05-26 06:06:42 +00:00
|
|
|
Request.Data.FillOutputAttribRequest.Coord = dwWriteCoord;
|
2007-01-26 07:22:19 +00:00
|
|
|
Request.Data.FillOutputAttribRequest.Length = (WORD)nLength;
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
Status = CsrClientCallServer( &Request, NULL, CsrRequest, sizeof( CSR_API_MESSAGE ) );
|
|
|
|
if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Request.Status ) )
|
2000-05-26 06:06:42 +00:00
|
|
|
{
|
2000-07-01 17:07:02 +00:00
|
|
|
SetLastErrorByStatus ( Status );
|
2000-05-26 06:06:42 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if( lpNumberOfAttrsWritten )
|
|
|
|
*lpNumberOfAttrsWritten = nLength;
|
|
|
|
return TRUE;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* GetConsoleMode
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
GetConsoleMode(
|
|
|
|
HANDLE hConsoleHandle,
|
|
|
|
LPDWORD lpMode
|
|
|
|
)
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2000-07-11 04:09:25 +00:00
|
|
|
NTSTATUS Status;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(GET_CONSOLE_MODE, CSR_CONSOLE);
|
2000-07-11 04:09:25 +00:00
|
|
|
Request.Data.GetConsoleModeRequest.ConsoleHandle = hConsoleHandle;
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
Status = CsrClientCallServer( &Request, NULL, CsrRequest, sizeof( CSR_API_MESSAGE ) );
|
|
|
|
if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Request.Status ) )
|
2000-07-11 04:09:25 +00:00
|
|
|
{
|
|
|
|
SetLastErrorByStatus ( Status );
|
|
|
|
return FALSE;
|
|
|
|
}
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
*lpMode = Request.Data.GetConsoleModeRequest.ConsoleMode;
|
2000-07-11 04:09:25 +00:00
|
|
|
return TRUE;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* GetNumberOfConsoleInputEvents
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
GetNumberOfConsoleInputEvents(
|
|
|
|
HANDLE hConsoleInput,
|
|
|
|
LPDWORD lpNumberOfEvents
|
|
|
|
)
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2002-10-20 00:34:40 +00:00
|
|
|
NTSTATUS Status;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2002-10-20 00:34:40 +00:00
|
|
|
if(lpNumberOfEvents == NULL)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(GET_NUM_INPUT_EVENTS, CSR_CONSOLE);
|
2002-10-20 00:34:40 +00:00
|
|
|
Request.Data.GetNumInputEventsRequest.ConsoleHandle = hConsoleInput;
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE));
|
|
|
|
if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
2002-10-20 00:34:40 +00:00
|
|
|
{
|
2003-01-18 00:10:59 +00:00
|
|
|
SetLastErrorByStatus(Status);
|
2002-10-20 00:34:40 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
*lpNumberOfEvents = Request.Data.GetNumInputEventsRequest.NumInputEvents;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2002-10-20 00:34:40 +00:00
|
|
|
return TRUE;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* GetLargestConsoleWindowSize
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
COORD
|
|
|
|
WINAPI
|
|
|
|
GetLargestConsoleWindowSize(
|
|
|
|
HANDLE hConsoleOutput
|
|
|
|
)
|
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
COORD Coord = {80,25};
|
|
|
|
DPRINT1("GetLargestConsoleWindowSize(0x%x) UNIMPLEMENTED!\n", hConsoleOutput);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return Coord;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* GetConsoleCursorInfo
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
GetConsoleCursorInfo(
|
|
|
|
HANDLE hConsoleOutput,
|
|
|
|
PCONSOLE_CURSOR_INFO lpConsoleCursorInfo
|
|
|
|
)
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2000-05-26 06:06:42 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(GET_CURSOR_INFO, CSR_CONSOLE);
|
2000-05-26 06:06:42 +00:00
|
|
|
Request.Data.GetCursorInfoRequest.ConsoleHandle = hConsoleOutput;
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
Status = CsrClientCallServer( &Request, NULL, CsrRequest, sizeof( CSR_API_MESSAGE ) );
|
2001-09-01 15:36:45 +00:00
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Request.Status ) )
|
2000-05-26 06:06:42 +00:00
|
|
|
{
|
2000-07-01 17:07:02 +00:00
|
|
|
SetLastErrorByStatus ( Status );
|
2000-05-26 06:06:42 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
*lpConsoleCursorInfo = Request.Data.GetCursorInfoRequest.Info;
|
2000-05-26 06:06:42 +00:00
|
|
|
return TRUE;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* GetNumberOfConsoleMouseButtons
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
GetNumberOfConsoleMouseButtons(
|
|
|
|
LPDWORD lpNumberOfMouseButtons
|
|
|
|
)
|
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("GetNumberOfConsoleMouseButtons(0x%x) UNIMPLEMENTED!\n", lpNumberOfMouseButtons);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* SetConsoleMode
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
SetConsoleMode(
|
|
|
|
HANDLE hConsoleHandle,
|
|
|
|
DWORD dwMode
|
|
|
|
)
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2000-07-11 04:09:25 +00:00
|
|
|
NTSTATUS Status;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(SET_CONSOLE_MODE, CSR_CONSOLE);
|
2000-07-11 04:09:25 +00:00
|
|
|
Request.Data.SetConsoleModeRequest.ConsoleHandle = hConsoleHandle;
|
|
|
|
Request.Data.SetConsoleModeRequest.Mode = dwMode;
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
Status = CsrClientCallServer( &Request, NULL, CsrRequest, sizeof( CSR_API_MESSAGE ) );
|
|
|
|
if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Request.Status ) )
|
2000-07-11 04:09:25 +00:00
|
|
|
{
|
|
|
|
SetLastErrorByStatus ( Status );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* SetConsoleActiveScreenBuffer
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
SetConsoleActiveScreenBuffer(
|
|
|
|
HANDLE hConsoleOutput
|
|
|
|
)
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2001-01-21 00:07:03 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(SET_SCREEN_BUFFER, CSR_CONSOLE);
|
2003-12-02 11:38:47 +00:00
|
|
|
Request.Data.SetScreenBufferRequest.OutputHandle = hConsoleOutput;
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
Status = CsrClientCallServer( &Request, NULL, CsrRequest, sizeof( CSR_API_MESSAGE ) );
|
|
|
|
if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Request.Status ) )
|
2001-01-21 00:07:03 +00:00
|
|
|
{
|
|
|
|
SetLastErrorByStatus ( Status );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* FlushConsoleInputBuffer
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
FlushConsoleInputBuffer(
|
|
|
|
HANDLE hConsoleInput
|
|
|
|
)
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2001-09-01 15:36:45 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(FLUSH_INPUT_BUFFER, CSR_CONSOLE);
|
2001-09-01 15:36:45 +00:00
|
|
|
Request.Data.FlushInputBufferRequest.ConsoleInput = hConsoleInput;
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
Status = CsrClientCallServer( &Request, NULL, CsrRequest, sizeof( CSR_API_MESSAGE ) );
|
|
|
|
if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Request.Status ) )
|
2001-09-01 15:36:45 +00:00
|
|
|
{
|
|
|
|
SetLastErrorByStatus ( Status );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* SetConsoleScreenBufferSize
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
SetConsoleScreenBufferSize(
|
|
|
|
HANDLE hConsoleOutput,
|
|
|
|
COORD dwSize
|
|
|
|
)
|
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("SetConsoleScreenBufferSize(0x%x, 0x%x) UNIMPLEMENTED!\n", hConsoleOutput, dwSize);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* SetConsoleCursorInfo
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
SetConsoleCursorInfo(
|
|
|
|
HANDLE hConsoleOutput,
|
|
|
|
CONST CONSOLE_CURSOR_INFO *lpConsoleCursorInfo
|
|
|
|
)
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2000-05-26 06:06:42 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(SET_CURSOR_INFO, CSR_CONSOLE);
|
2000-05-26 06:06:42 +00:00
|
|
|
Request.Data.SetCursorInfoRequest.ConsoleHandle = hConsoleOutput;
|
|
|
|
Request.Data.SetCursorInfoRequest.Info = *lpConsoleCursorInfo;
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
Status = CsrClientCallServer( &Request, NULL, CsrRequest, sizeof( CSR_API_MESSAGE ) );
|
2001-09-01 15:36:45 +00:00
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Request.Status ) )
|
2000-05-26 06:06:42 +00:00
|
|
|
{
|
2000-07-01 17:07:02 +00:00
|
|
|
SetLastErrorByStatus ( Status );
|
2000-05-26 06:06:42 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
static BOOL
|
|
|
|
IntScrollConsoleScreenBuffer(HANDLE hConsoleOutput,
|
2007-01-21 23:29:10 +00:00
|
|
|
const SMALL_RECT *lpScrollRectangle,
|
|
|
|
const SMALL_RECT *lpClipRectangle,
|
2004-11-02 20:42:06 +00:00
|
|
|
COORD dwDestinationOrigin,
|
2007-01-21 23:29:10 +00:00
|
|
|
const CHAR_INFO *lpFill,
|
2004-11-02 20:42:06 +00:00
|
|
|
BOOL bUnicode)
|
1999-03-06 10:57:02 +00:00
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2001-09-01 15:36:45 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(SCROLL_CONSOLE_SCREEN_BUFFER, CSR_CONSOLE);
|
2001-09-01 15:36:45 +00:00
|
|
|
Request.Data.ScrollConsoleScreenBufferRequest.ConsoleHandle = hConsoleOutput;
|
2004-11-02 20:42:06 +00:00
|
|
|
Request.Data.ScrollConsoleScreenBufferRequest.Unicode = bUnicode;
|
2001-09-01 15:36:45 +00:00
|
|
|
Request.Data.ScrollConsoleScreenBufferRequest.ScrollRectangle = *lpScrollRectangle;
|
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
if(lpClipRectangle != NULL)
|
|
|
|
{
|
|
|
|
Request.Data.ScrollConsoleScreenBufferRequest.UseClipRectangle = TRUE;
|
|
|
|
Request.Data.ScrollConsoleScreenBufferRequest.ClipRectangle = *lpClipRectangle;
|
|
|
|
}
|
2001-09-01 15:36:45 +00:00
|
|
|
else
|
2004-11-02 20:42:06 +00:00
|
|
|
{
|
|
|
|
Request.Data.ScrollConsoleScreenBufferRequest.UseClipRectangle = FALSE;
|
|
|
|
}
|
2001-09-01 15:36:45 +00:00
|
|
|
|
|
|
|
Request.Data.ScrollConsoleScreenBufferRequest.DestinationOrigin = dwDestinationOrigin;
|
|
|
|
Request.Data.ScrollConsoleScreenBufferRequest.Fill = *lpFill;
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
Status = CsrClientCallServer(&Request, NULL,
|
|
|
|
CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
2004-11-02 20:42:06 +00:00
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
2004-11-02 20:42:06 +00:00
|
|
|
{
|
|
|
|
SetLastErrorByStatus(Status);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2001-09-01 15:36:45 +00:00
|
|
|
|
|
|
|
return TRUE;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-11-02 20:42:06 +00:00
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* ScrollConsoleScreenBufferA
|
|
|
|
*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
ScrollConsoleScreenBufferA(
|
|
|
|
HANDLE hConsoleOutput,
|
|
|
|
CONST SMALL_RECT *lpScrollRectangle,
|
|
|
|
CONST SMALL_RECT *lpClipRectangle,
|
|
|
|
COORD dwDestinationOrigin,
|
|
|
|
CONST CHAR_INFO *lpFill
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return IntScrollConsoleScreenBuffer(hConsoleOutput,
|
|
|
|
(PSMALL_RECT)lpScrollRectangle,
|
|
|
|
(PSMALL_RECT)lpClipRectangle,
|
|
|
|
dwDestinationOrigin,
|
|
|
|
(PCHAR_INFO)lpFill,
|
|
|
|
FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-03-06 10:57:02 +00:00
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* ScrollConsoleScreenBufferW
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
2004-11-02 20:42:06 +00:00
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
ScrollConsoleScreenBufferW(
|
|
|
|
HANDLE hConsoleOutput,
|
|
|
|
CONST SMALL_RECT *lpScrollRectangle,
|
|
|
|
CONST SMALL_RECT *lpClipRectangle,
|
|
|
|
COORD dwDestinationOrigin,
|
|
|
|
CONST CHAR_INFO *lpFill
|
|
|
|
)
|
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
return IntScrollConsoleScreenBuffer(hConsoleOutput,
|
2007-01-21 23:29:10 +00:00
|
|
|
lpScrollRectangle,
|
|
|
|
lpClipRectangle,
|
2004-11-02 20:42:06 +00:00
|
|
|
dwDestinationOrigin,
|
2007-01-21 23:29:10 +00:00
|
|
|
lpFill,
|
2004-11-02 20:42:06 +00:00
|
|
|
TRUE);
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* SetConsoleWindowInfo
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
SetConsoleWindowInfo(
|
|
|
|
HANDLE hConsoleOutput,
|
|
|
|
BOOL bAbsolute,
|
|
|
|
CONST SMALL_RECT *lpConsoleWindow
|
|
|
|
)
|
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("SetConsoleWindowInfo(0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", hConsoleOutput, bAbsolute, lpConsoleWindow);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
1999-03-30 21:58:05 +00:00
|
|
|
* SetConsoleTextAttribute
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
SetConsoleTextAttribute(
|
2003-01-18 00:10:59 +00:00
|
|
|
HANDLE hConsoleOutput,
|
1999-03-30 21:58:05 +00:00
|
|
|
WORD wAttributes
|
|
|
|
)
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2000-05-26 06:06:42 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(SET_ATTRIB, CSR_CONSOLE);
|
2000-05-26 06:06:42 +00:00
|
|
|
Request.Data.SetAttribRequest.ConsoleHandle = hConsoleOutput;
|
2007-01-26 07:22:19 +00:00
|
|
|
Request.Data.SetAttribRequest.Attrib = (CHAR)wAttributes;
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
Status = CsrClientCallServer( &Request, NULL, CsrRequest, sizeof( CSR_API_MESSAGE ) );
|
|
|
|
if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Request.Status ) )
|
2000-05-26 06:06:42 +00:00
|
|
|
{
|
2000-07-01 17:07:02 +00:00
|
|
|
SetLastErrorByStatus ( Status );
|
2000-05-26 06:06:42 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
2005-11-22 00:05:23 +00:00
|
|
|
static BOOL
|
2001-04-04 22:21:32 +00:00
|
|
|
AddConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine)
|
|
|
|
{
|
|
|
|
if (HandlerRoutine == NULL)
|
|
|
|
{
|
|
|
|
IgnoreCtrlEvents = TRUE;
|
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
NrCtrlHandlers++;
|
2004-08-28 22:14:08 +00:00
|
|
|
if (CtrlHandlers == NULL)
|
|
|
|
{
|
|
|
|
CtrlHandlers = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY,
|
2005-05-09 01:46:57 +00:00
|
|
|
NrCtrlHandlers * sizeof(PHANDLER_ROUTINE));
|
2004-08-28 22:14:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CtrlHandlers = RtlReAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
|
|
(PVOID)CtrlHandlers,
|
2005-05-09 01:46:57 +00:00
|
|
|
NrCtrlHandlers * sizeof(PHANDLER_ROUTINE));
|
2004-08-28 22:14:08 +00:00
|
|
|
}
|
2001-04-04 22:21:32 +00:00
|
|
|
if (CtrlHandlers == NULL)
|
|
|
|
{
|
2003-08-18 10:47:04 +00:00
|
|
|
NrCtrlHandlers = 0;
|
2001-04-04 22:21:32 +00:00
|
|
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
CtrlHandlers[NrCtrlHandlers - 1] = HandlerRoutine;
|
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
}
|
1999-03-06 10:57:02 +00:00
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
2005-11-22 00:05:23 +00:00
|
|
|
static BOOL
|
2001-04-04 22:21:32 +00:00
|
|
|
RemoveConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine)
|
1999-03-06 10:57:02 +00:00
|
|
|
{
|
2001-04-04 22:21:32 +00:00
|
|
|
ULONG i;
|
|
|
|
|
|
|
|
if (HandlerRoutine == NULL)
|
|
|
|
{
|
|
|
|
IgnoreCtrlEvents = FALSE;
|
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (i = 0; i < NrCtrlHandlers; i++)
|
|
|
|
{
|
2003-07-29 16:42:35 +00:00
|
|
|
if ( ((void*)(CtrlHandlers[i])) == (void*)HandlerRoutine)
|
2001-04-04 22:21:32 +00:00
|
|
|
{
|
|
|
|
NrCtrlHandlers--;
|
2005-05-09 01:46:57 +00:00
|
|
|
memmove(CtrlHandlers + i, CtrlHandlers + i + 1,
|
2003-08-18 10:47:04 +00:00
|
|
|
(NrCtrlHandlers - i) * sizeof(PHANDLER_ROUTINE));
|
2005-05-09 01:46:57 +00:00
|
|
|
CtrlHandlers =
|
2001-04-04 22:21:32 +00:00
|
|
|
RtlReAllocateHeap(RtlGetProcessHeap(),
|
|
|
|
HEAP_ZERO_MEMORY,
|
|
|
|
(PVOID)CtrlHandlers,
|
|
|
|
NrCtrlHandlers * sizeof(PHANDLER_ROUTINE));
|
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-06-27 12:34:08 +00:00
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
2001-04-04 22:21:32 +00:00
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2004-06-13 20:04:56 +00:00
|
|
|
BOOL WINAPI
|
2003-07-09 10:43:08 +00:00
|
|
|
SetConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine,
|
2001-04-04 22:21:32 +00:00
|
|
|
BOOL Add)
|
|
|
|
{
|
2007-01-26 07:22:19 +00:00
|
|
|
BOOL Ret;
|
2001-04-04 22:21:32 +00:00
|
|
|
|
|
|
|
RtlEnterCriticalSection(&DllLock);
|
|
|
|
if (Add)
|
|
|
|
{
|
|
|
|
Ret = AddConsoleCtrlHandler(HandlerRoutine);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Ret = RemoveConsoleCtrlHandler(HandlerRoutine);
|
|
|
|
}
|
|
|
|
RtlLeaveCriticalSection(&DllLock);
|
|
|
|
return(Ret);
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* GenerateConsoleCtrlEvent
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
2004-06-13 20:04:56 +00:00
|
|
|
BOOL WINAPI
|
1999-03-06 10:57:02 +00:00
|
|
|
GenerateConsoleCtrlEvent(
|
|
|
|
DWORD dwCtrlEvent,
|
|
|
|
DWORD dwProcessGroupId
|
|
|
|
)
|
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("GenerateConsoleCtrlEvent(0x%x, 0x%x) UNIMPLEMENTED!\n", dwCtrlEvent, dwProcessGroupId);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
2001-04-04 22:21:32 +00:00
|
|
|
return FALSE;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* GetConsoleTitleW
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
DWORD
|
|
|
|
WINAPI
|
|
|
|
GetConsoleTitleW(
|
|
|
|
LPWSTR lpConsoleTitle,
|
|
|
|
DWORD nSize
|
|
|
|
)
|
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
PCSR_API_MESSAGE Request; ULONG CsrRequest;
|
2003-03-02 01:23:19 +00:00
|
|
|
NTSTATUS Status;
|
2003-03-09 21:37:18 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
Request = RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
|
|
|
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_GET_TITLE) + CSRSS_MAX_TITLE_LENGTH * sizeof(WCHAR));
|
|
|
|
if (Request == NULL)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(GET_TITLE, CSR_CONSOLE);
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
Status = CsrClientCallServer(Request,
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
NULL,
|
|
|
|
CsrRequest,
|
2005-08-28 12:03:25 +00:00
|
|
|
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_GET_TITLE) + CSRSS_MAX_TITLE_LENGTH * sizeof(WCHAR));
|
|
|
|
if(!NT_SUCCESS(Status) || !(NT_SUCCESS(Status = Request->Status)))
|
2003-03-02 01:23:19 +00:00
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
2003-03-02 01:23:19 +00:00
|
|
|
SetLastErrorByStatus(Status);
|
|
|
|
return 0;
|
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-09-10 15:18:42 +00:00
|
|
|
if(nSize * sizeof(WCHAR) <= Request->Data.GetTitleRequest.Length)
|
2003-03-02 01:23:19 +00:00
|
|
|
{
|
2005-09-10 15:18:42 +00:00
|
|
|
nSize--;
|
2003-03-02 01:23:19 +00:00
|
|
|
}
|
|
|
|
else
|
2005-05-09 01:46:57 +00:00
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
nSize = Request->Data.GetTitleRequest.Length / sizeof (WCHAR);
|
2003-03-02 01:23:19 +00:00
|
|
|
}
|
2005-09-10 15:18:42 +00:00
|
|
|
memcpy(lpConsoleTitle, Request->Data.GetTitleRequest.Title, nSize * sizeof(WCHAR));
|
|
|
|
lpConsoleTitle[nSize] = L'\0';
|
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
|
|
|
|
2003-03-02 01:23:19 +00:00
|
|
|
return nSize;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* GetConsoleTitleA
|
|
|
|
*
|
|
|
|
* 19990306 EA
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
DWORD
|
|
|
|
WINAPI
|
|
|
|
GetConsoleTitleA(
|
|
|
|
LPSTR lpConsoleTitle,
|
|
|
|
DWORD nSize
|
|
|
|
)
|
|
|
|
{
|
2005-09-10 15:18:42 +00:00
|
|
|
WCHAR WideTitle [CSRSS_MAX_TITLE_LENGTH + 1];
|
|
|
|
DWORD nWideTitle = CSRSS_MAX_TITLE_LENGTH + 1;
|
2003-03-02 01:23:19 +00:00
|
|
|
DWORD nWritten;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
1999-03-06 10:57:02 +00:00
|
|
|
if (!lpConsoleTitle || !nSize) return 0;
|
|
|
|
nWideTitle = GetConsoleTitleW( (LPWSTR) WideTitle, nWideTitle );
|
|
|
|
if (!nWideTitle) return 0;
|
2003-03-02 01:23:19 +00:00
|
|
|
|
1999-03-06 10:57:02 +00:00
|
|
|
if ( (nWritten = WideCharToMultiByte(
|
2005-05-09 01:46:57 +00:00
|
|
|
CP_ACP, // ANSI code page
|
|
|
|
0, // performance and mapping flags
|
|
|
|
(LPWSTR) WideTitle, // address of wide-character string
|
|
|
|
nWideTitle, // number of characters in string
|
|
|
|
lpConsoleTitle, // address of buffer for new string
|
2005-09-10 15:18:42 +00:00
|
|
|
nSize - 1, // size of buffer
|
1999-03-06 10:57:02 +00:00
|
|
|
NULL, // FAST
|
|
|
|
NULL // FAST
|
|
|
|
)))
|
|
|
|
{
|
|
|
|
lpConsoleTitle[nWritten] = '\0';
|
|
|
|
return nWritten;
|
|
|
|
}
|
2003-03-02 01:23:19 +00:00
|
|
|
|
1999-03-06 10:57:02 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* SetConsoleTitleW
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
SetConsoleTitleW(
|
|
|
|
LPCWSTR lpConsoleTitle
|
|
|
|
)
|
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
PCSR_API_MESSAGE Request; ULONG CsrRequest;
|
2001-06-22 02:11:44 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
unsigned int c;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
Request = RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
|
|
|
max (sizeof(CSR_API_MESSAGE),
|
|
|
|
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_SET_TITLE) +
|
|
|
|
min (wcslen(lpConsoleTitle), CSRSS_MAX_TITLE_LENGTH) * sizeof(WCHAR)));
|
|
|
|
if (Request == NULL)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(SET_TITLE, CSR_CONSOLE);
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2001-06-22 02:11:44 +00:00
|
|
|
for( c = 0; lpConsoleTitle[c] && c < CSRSS_MAX_TITLE_LENGTH; c++ )
|
2005-08-28 12:03:25 +00:00
|
|
|
Request->Data.SetTitleRequest.Title[c] = lpConsoleTitle[c];
|
|
|
|
Request->Data.SetTitleRequest.Length = c * sizeof(WCHAR);
|
|
|
|
Status = CsrClientCallServer(Request,
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
NULL,
|
2005-08-26 20:35:33 +00:00
|
|
|
CsrRequest,
|
2005-08-28 12:03:25 +00:00
|
|
|
max (sizeof(CSR_API_MESSAGE), CSR_API_MESSAGE_HEADER_SIZE(CSRSS_SET_TITLE) + c * sizeof(WCHAR)));
|
|
|
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS( Status = Request->Status ) )
|
2001-06-22 02:11:44 +00:00
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
2001-06-22 02:11:44 +00:00
|
|
|
SetLastErrorByStatus (Status);
|
|
|
|
return(FALSE);
|
|
|
|
}
|
2005-08-28 12:03:25 +00:00
|
|
|
|
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
|
|
|
|
2001-06-22 02:11:44 +00:00
|
|
|
return TRUE;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* SetConsoleTitleA
|
2005-05-09 01:46:57 +00:00
|
|
|
*
|
1999-03-06 10:57:02 +00:00
|
|
|
* 19990204 EA Added
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
SetConsoleTitleA(
|
|
|
|
LPCSTR lpConsoleTitle
|
|
|
|
)
|
1999-01-16 02:11:45 +00:00
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
PCSR_API_MESSAGE Request; ULONG CsrRequest;
|
2001-06-22 02:11:44 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
unsigned int c;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
Request = RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
|
|
|
max (sizeof(CSR_API_MESSAGE),
|
|
|
|
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_SET_TITLE) +
|
|
|
|
min (strlen(lpConsoleTitle), CSRSS_MAX_TITLE_LENGTH) * sizeof(WCHAR)));
|
|
|
|
if (Request == NULL)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(SET_TITLE, CSR_CONSOLE);
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2001-06-22 02:11:44 +00:00
|
|
|
for( c = 0; lpConsoleTitle[c] && c < CSRSS_MAX_TITLE_LENGTH; c++ )
|
2005-08-28 12:03:25 +00:00
|
|
|
Request->Data.SetTitleRequest.Title[c] = lpConsoleTitle[c];
|
|
|
|
Request->Data.SetTitleRequest.Length = c * sizeof(WCHAR);
|
|
|
|
Status = CsrClientCallServer(Request,
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
NULL,
|
2005-08-26 20:35:33 +00:00
|
|
|
CsrRequest,
|
2005-08-28 12:03:25 +00:00
|
|
|
max (sizeof(CSR_API_MESSAGE), CSR_API_MESSAGE_HEADER_SIZE(CSRSS_SET_TITLE) + c * sizeof(WCHAR)));
|
|
|
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS( Status = Request->Status ) )
|
2001-06-22 02:11:44 +00:00
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
2001-06-22 02:11:44 +00:00
|
|
|
SetLastErrorByStatus (Status);
|
|
|
|
return(FALSE);
|
|
|
|
}
|
2005-08-28 12:03:25 +00:00
|
|
|
|
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
|
|
|
|
2001-06-22 02:11:44 +00:00
|
|
|
return TRUE;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* CreateConsoleScreenBuffer
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
HANDLE
|
|
|
|
WINAPI
|
|
|
|
CreateConsoleScreenBuffer(
|
|
|
|
DWORD dwDesiredAccess,
|
|
|
|
DWORD dwShareMode,
|
|
|
|
CONST SECURITY_ATTRIBUTES *lpSecurityAttributes,
|
|
|
|
DWORD dwFlags,
|
|
|
|
LPVOID lpScreenBufferData
|
|
|
|
)
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
2008-07-22 17:37:13 +00:00
|
|
|
|
2001-01-21 00:07:03 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
|
2008-07-22 17:37:13 +00:00
|
|
|
if (dwDesiredAccess & ~(GENERIC_READ | GENERIC_WRITE)
|
|
|
|
|| dwShareMode & ~(FILE_SHARE_READ | FILE_SHARE_WRITE)
|
|
|
|
|| dwFlags != CONSOLE_TEXTMODE_BUFFER)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return INVALID_HANDLE_VALUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
Request.Data.CreateScreenBufferRequest.Access = dwDesiredAccess;
|
|
|
|
Request.Data.CreateScreenBufferRequest.ShareMode = dwShareMode;
|
|
|
|
Request.Data.CreateScreenBufferRequest.Inheritable =
|
|
|
|
lpSecurityAttributes ? lpSecurityAttributes->bInheritHandle : FALSE;
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(CREATE_SCREEN_BUFFER, CSR_CONSOLE);
|
|
|
|
Status = CsrClientCallServer( &Request, NULL, CsrRequest, sizeof( CSR_API_MESSAGE ) );
|
|
|
|
if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Request.Status ) )
|
2001-01-21 00:07:03 +00:00
|
|
|
{
|
|
|
|
SetLastErrorByStatus ( Status );
|
2008-07-22 17:37:13 +00:00
|
|
|
return INVALID_HANDLE_VALUE;
|
2001-01-21 00:07:03 +00:00
|
|
|
}
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
return Request.Data.CreateScreenBufferRequest.OutputHandle;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* GetConsoleCP
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
2004-08-22 20:52:28 +00:00
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
UINT
|
|
|
|
WINAPI
|
|
|
|
GetConsoleCP( VOID )
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2004-08-22 20:52:28 +00:00
|
|
|
NTSTATUS Status;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(GET_CONSOLE_CP, CSR_CONSOLE);
|
|
|
|
Status = CsrClientCallServer(&Request, NULL, CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
|
|
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
2004-08-22 20:52:28 +00:00
|
|
|
{
|
|
|
|
SetLastErrorByStatus (Status);
|
|
|
|
return 0;
|
|
|
|
}
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
return Request.Data.GetConsoleCodePage.CodePage;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* SetConsoleCP
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
2004-08-24 17:21:12 +00:00
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
SetConsoleCP(
|
|
|
|
UINT wCodePageID
|
|
|
|
)
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2004-08-22 20:52:28 +00:00
|
|
|
NTSTATUS Status;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(SET_CONSOLE_CP, CSR_CONSOLE);
|
2004-08-22 20:52:28 +00:00
|
|
|
Request.Data.SetConsoleCodePage.CodePage = wCodePageID;
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
Status = CsrClientCallServer(&Request, NULL, CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
|
|
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
2004-08-22 20:52:28 +00:00
|
|
|
{
|
|
|
|
SetLastErrorByStatus (Status);
|
|
|
|
}
|
|
|
|
return NT_SUCCESS(Status);
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* GetConsoleOutputCP
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
2004-08-22 20:52:28 +00:00
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
UINT
|
|
|
|
WINAPI
|
|
|
|
GetConsoleOutputCP( VOID )
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2004-08-22 20:52:28 +00:00
|
|
|
NTSTATUS Status;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(GET_CONSOLE_OUTPUT_CP, CSR_CONSOLE);
|
|
|
|
Status = CsrClientCallServer(&Request, NULL, CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
|
|
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
2004-08-22 20:52:28 +00:00
|
|
|
{
|
|
|
|
SetLastErrorByStatus (Status);
|
|
|
|
return 0;
|
|
|
|
}
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
return Request.Data.GetConsoleOutputCodePage.CodePage;
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* SetConsoleOutputCP
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
2004-08-22 20:52:28 +00:00
|
|
|
* @implemented
|
1999-03-06 10:57:02 +00:00
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
SetConsoleOutputCP(
|
|
|
|
UINT wCodePageID
|
|
|
|
)
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2004-08-22 20:52:28 +00:00
|
|
|
NTSTATUS Status;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(SET_CONSOLE_OUTPUT_CP, CSR_CONSOLE);
|
2004-08-22 20:52:28 +00:00
|
|
|
Request.Data.SetConsoleOutputCodePage.CodePage = wCodePageID;
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
Status = CsrClientCallServer(&Request, NULL, CsrRequest,
|
|
|
|
sizeof(CSR_API_MESSAGE));
|
|
|
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
2004-08-22 20:52:28 +00:00
|
|
|
{
|
|
|
|
SetLastErrorByStatus (Status);
|
|
|
|
}
|
|
|
|
return NT_SUCCESS(Status);
|
1999-03-06 10:57:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-10-20 00:34:40 +00:00
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* GetConsoleProcessList
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
2005-02-05 01:44:05 +00:00
|
|
|
* @implemented
|
2002-10-20 00:34:40 +00:00
|
|
|
*/
|
|
|
|
DWORD STDCALL
|
|
|
|
GetConsoleProcessList(LPDWORD lpdwProcessList,
|
2005-02-05 01:44:05 +00:00
|
|
|
DWORD dwProcessCount)
|
2002-10-20 00:34:40 +00:00
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
PCSR_API_MESSAGE Request; ULONG CsrRequest;
|
2005-08-26 20:35:33 +00:00
|
|
|
ULONG nProcesses;
|
2005-02-05 01:44:05 +00:00
|
|
|
NTSTATUS Status;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-02-05 01:44:05 +00:00
|
|
|
if(lpdwProcessList == NULL || dwProcessCount == 0)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
Request = RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
|
|
|
max (sizeof(CSR_API_MESSAGE),
|
|
|
|
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_GET_PROCESS_LIST)
|
|
|
|
+ min (dwProcessCount, CSRSS_MAX_GET_PROCESS_LIST / sizeof(DWORD)) * sizeof(DWORD)));
|
|
|
|
if (Request == NULL)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(GET_PROCESS_LIST, CSR_CONSOLE);
|
2005-08-28 12:03:25 +00:00
|
|
|
Request->Data.GetProcessListRequest.nMaxIds = min (dwProcessCount, CSRSS_MAX_GET_PROCESS_LIST / sizeof(DWORD));
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
Status = CsrClientCallServer(Request,
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
NULL,
|
|
|
|
CsrRequest,
|
2005-08-28 12:03:25 +00:00
|
|
|
max (sizeof(CSR_API_MESSAGE),
|
|
|
|
CSR_API_MESSAGE_HEADER_SIZE(CSRSS_GET_PROCESS_LIST)
|
|
|
|
+ Request->Data.GetProcessListRequest.nMaxIds * sizeof(DWORD)));
|
|
|
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request->Status))
|
2005-02-05 01:44:05 +00:00
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
2005-02-05 01:44:05 +00:00
|
|
|
SetLastErrorByStatus (Status);
|
|
|
|
nProcesses = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
nProcesses = Request->Data.GetProcessListRequest.nProcessIdsCopied;
|
|
|
|
if(dwProcessCount >= nProcesses)
|
2005-02-05 01:44:05 +00:00
|
|
|
{
|
2005-08-28 12:03:25 +00:00
|
|
|
memcpy(lpdwProcessList, Request->Data.GetProcessListRequest.ProcessId, nProcesses * sizeof(DWORD));
|
2005-02-05 01:44:05 +00:00
|
|
|
}
|
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2005-08-28 12:03:25 +00:00
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Request);
|
|
|
|
|
2005-02-05 01:44:05 +00:00
|
|
|
return nProcesses;
|
2002-10-20 00:34:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* GetConsoleSelectionInfo
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
2002-10-20 00:34:40 +00:00
|
|
|
*/
|
|
|
|
BOOL STDCALL
|
|
|
|
GetConsoleSelectionInfo(PCONSOLE_SELECTION_INFO lpConsoleSelectionInfo)
|
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("GetConsoleSelectionInfo(0x%x) UNIMPLEMENTED!\n", lpConsoleSelectionInfo);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
2002-10-20 00:34:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* AttachConsole
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @unimplemented
|
2002-10-20 00:34:40 +00:00
|
|
|
*/
|
2005-05-09 01:46:57 +00:00
|
|
|
BOOL STDCALL
|
2002-10-20 00:34:40 +00:00
|
|
|
AttachConsole(DWORD dwProcessId)
|
|
|
|
{
|
2004-11-02 20:42:06 +00:00
|
|
|
DPRINT1("AttachConsole(0x%x) UNIMPLEMENTED!\n", dwProcessId);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
2002-10-20 00:34:40 +00:00
|
|
|
}
|
|
|
|
|
2003-06-19 19:38:26 +00:00
|
|
|
/*--------------------------------------------------------------
|
2004-03-14 17:53:27 +00:00
|
|
|
* GetConsoleWindow
|
2003-07-10 18:50:51 +00:00
|
|
|
*
|
|
|
|
* @implemented
|
2003-06-19 19:38:26 +00:00
|
|
|
*/
|
|
|
|
HWND STDCALL
|
|
|
|
GetConsoleWindow (VOID)
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2003-06-19 19:38:26 +00:00
|
|
|
NTSTATUS Status;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(GET_CONSOLE_WINDOW, CSR_CONSOLE);
|
|
|
|
Status = CsrClientCallServer( &Request, NULL, CsrRequest, sizeof( CSR_API_MESSAGE ) );
|
|
|
|
if (!NT_SUCCESS(Status ) || !NT_SUCCESS(Status = Request.Status))
|
2003-06-19 19:38:26 +00:00
|
|
|
{
|
|
|
|
SetLastErrorByStatus (Status);
|
|
|
|
return (HWND) NULL;
|
|
|
|
}
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
return Request.Data.GetConsoleWindowRequest.WindowHandle;
|
2003-06-19 19:38:26 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 17:53:27 +00:00
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
2004-08-22 20:52:28 +00:00
|
|
|
* SetConsoleIcon
|
|
|
|
*
|
2004-03-14 17:53:27 +00:00
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL STDCALL SetConsoleIcon(HICON hicon)
|
|
|
|
{
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CSR_API_MESSAGE Request; ULONG CsrRequest;
|
|
|
|
|
2004-03-14 17:53:27 +00:00
|
|
|
NTSTATUS Status;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
CsrRequest = MAKE_CSR_API(SET_CONSOLE_ICON, CSR_CONSOLE);
|
2004-08-22 20:52:28 +00:00
|
|
|
Request.Data.SetConsoleIconRequest.WindowIcon = hicon;
|
Large change to modify NTDLL'S CSR Functions to be compatible with NT. They are external and we should at least try to match the number of arguments (one vs eight? come on!). Because this is also the direction that Emanuele wants to be taking, the whole external calling interface was modified to be more compatible with NT (although internally it still isn't, and does not have a reason to be). API Names are now generated by a macro from the Server ID, like Emanuele and I noticed from traces, and I've entirely removed the concept of a reply structure. CSRSS uses full-duplex one-way structures, not dual-strutures (this would've been incompatible with the external interface anyways). I don't seem to have introduced any new bugs (console-ROS works great for me, as does the GUI), but there is still a chance some obscure bug might happen, so please bear with me, I had to hand-edit over 250 calls. Also, this now allows full removal of ntdll headers and the next commits will clean this up
svn path=/trunk/; revision=16213
2005-06-22 04:02:32 +00:00
|
|
|
Status = CsrClientCallServer( &Request, NULL, CsrRequest, sizeof( CSR_API_MESSAGE ) );
|
|
|
|
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
2004-03-14 17:53:27 +00:00
|
|
|
{
|
|
|
|
SetLastErrorByStatus (Status);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return NT_SUCCESS(Status);
|
|
|
|
}
|
|
|
|
|
2004-12-18 13:26:57 +00:00
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* SetConsoleInputExeNameW
|
|
|
|
*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL STDCALL
|
|
|
|
SetConsoleInputExeNameW(LPCWSTR lpInputExeName)
|
|
|
|
{
|
2004-12-18 13:33:09 +00:00
|
|
|
BOOL Ret = FALSE;
|
2004-12-18 13:26:57 +00:00
|
|
|
int lenName = lstrlenW(lpInputExeName);
|
|
|
|
|
|
|
|
if(lenName < 1 ||
|
2005-07-05 22:35:29 +00:00
|
|
|
lenName > (int)(sizeof(InputExeName) / sizeof(InputExeName[0])) - 1)
|
2004-12-18 13:26:57 +00:00
|
|
|
{
|
|
|
|
/* Fail if string is empty or too long */
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2004-12-18 13:26:57 +00:00
|
|
|
RtlEnterCriticalSection(&ConsoleLock);
|
2004-12-18 13:33:09 +00:00
|
|
|
/* wrap copying into SEH as we may copy from invalid buffer and in case of an
|
|
|
|
exception the console lock would've never been released, which would cause
|
|
|
|
further calls (if the exception was handled by the caller) to recursively
|
|
|
|
acquire the lock... */
|
|
|
|
_SEH_TRY
|
|
|
|
{
|
|
|
|
RtlCopyMemory(InputExeName, lpInputExeName, lenName * sizeof(WCHAR));
|
|
|
|
InputExeName[lenName] = L'\0';
|
|
|
|
Ret = TRUE;
|
|
|
|
}
|
|
|
|
_SEH_HANDLE
|
|
|
|
{
|
|
|
|
lenName = 0;
|
|
|
|
SetLastErrorByStatus(_SEH_GetExceptionCode());
|
|
|
|
}
|
|
|
|
_SEH_END;
|
2004-12-18 13:26:57 +00:00
|
|
|
RtlLeaveCriticalSection(&ConsoleLock);
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2004-12-18 13:33:09 +00:00
|
|
|
return Ret;
|
2004-12-18 13:26:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* SetConsoleInputExeNameA
|
|
|
|
*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL STDCALL
|
|
|
|
SetConsoleInputExeNameA(LPCSTR lpInputExeName)
|
|
|
|
{
|
|
|
|
ANSI_STRING InputExeNameA;
|
|
|
|
UNICODE_STRING InputExeNameU;
|
|
|
|
NTSTATUS Status;
|
|
|
|
BOOL Ret;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2004-12-18 13:26:57 +00:00
|
|
|
RtlInitAnsiString(&InputExeNameA, lpInputExeName);
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2004-12-18 13:26:57 +00:00
|
|
|
if(InputExeNameA.Length < sizeof(InputExeNameA.Buffer[0]) ||
|
|
|
|
InputExeNameA.Length >= (sizeof(InputExeName) / sizeof(InputExeName[0])) - 1)
|
|
|
|
{
|
|
|
|
/* Fail if string is empty or too long */
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2004-12-18 13:26:57 +00:00
|
|
|
Status = RtlAnsiStringToUnicodeString(&InputExeNameU, &InputExeNameA, TRUE);
|
|
|
|
if(NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
Ret = SetConsoleInputExeNameW(InputExeNameU.Buffer);
|
|
|
|
RtlFreeUnicodeString(&InputExeNameU);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetLastErrorByStatus(Status);
|
|
|
|
Ret = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* GetConsoleInputExeNameW
|
|
|
|
*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
DWORD STDCALL
|
|
|
|
GetConsoleInputExeNameW(DWORD nBufferLength, LPWSTR lpBuffer)
|
|
|
|
{
|
|
|
|
int lenName;
|
|
|
|
|
|
|
|
RtlEnterCriticalSection(&ConsoleLock);
|
|
|
|
|
|
|
|
lenName = lstrlenW(InputExeName);
|
2005-07-05 22:35:29 +00:00
|
|
|
if(lenName >= (int)nBufferLength)
|
2004-12-18 13:26:57 +00:00
|
|
|
{
|
|
|
|
/* buffer is not large enough, return the required size */
|
|
|
|
RtlLeaveCriticalSection(&ConsoleLock);
|
2008-06-27 12:34:08 +00:00
|
|
|
SetLastError(ERROR_BUFFER_OVERFLOW);
|
2004-12-18 13:26:57 +00:00
|
|
|
return lenName + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* wrap copying into SEH as we may copy to invalid buffer and in case of an
|
|
|
|
exception the console lock would've never been released, which would cause
|
|
|
|
further calls (if the exception was handled by the caller) to recursively
|
|
|
|
acquire the lock... */
|
|
|
|
_SEH_TRY
|
|
|
|
{
|
|
|
|
RtlCopyMemory(lpBuffer, InputExeName, (lenName + 1) * sizeof(WCHAR));
|
|
|
|
}
|
|
|
|
_SEH_HANDLE
|
|
|
|
{
|
|
|
|
lenName = 0;
|
|
|
|
SetLastErrorByStatus(_SEH_GetExceptionCode());
|
|
|
|
}
|
|
|
|
_SEH_END;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2004-12-18 13:26:57 +00:00
|
|
|
RtlLeaveCriticalSection(&ConsoleLock);
|
|
|
|
|
|
|
|
return lenName;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* GetConsoleInputExeNameA
|
|
|
|
*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
DWORD STDCALL
|
|
|
|
GetConsoleInputExeNameA(DWORD nBufferLength, LPSTR lpBuffer)
|
|
|
|
{
|
|
|
|
WCHAR *Buffer;
|
|
|
|
DWORD Ret;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2004-12-18 13:26:57 +00:00
|
|
|
if(nBufferLength > 0)
|
|
|
|
{
|
|
|
|
Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, nBufferLength * sizeof(WCHAR));
|
|
|
|
if(Buffer == NULL)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Buffer = NULL;
|
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2004-12-18 13:26:57 +00:00
|
|
|
Ret = GetConsoleInputExeNameW(nBufferLength, Buffer);
|
|
|
|
if(nBufferLength > 0)
|
|
|
|
{
|
|
|
|
if(Ret > 0)
|
|
|
|
{
|
|
|
|
UNICODE_STRING BufferU;
|
|
|
|
ANSI_STRING BufferA;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2004-12-18 13:26:57 +00:00
|
|
|
RtlInitUnicodeString(&BufferU, Buffer);
|
|
|
|
|
|
|
|
BufferA.Length = 0;
|
2007-01-26 07:22:19 +00:00
|
|
|
BufferA.MaximumLength = (USHORT)nBufferLength;
|
2004-12-18 13:26:57 +00:00
|
|
|
BufferA.Buffer = lpBuffer;
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2004-12-18 13:26:57 +00:00
|
|
|
RtlUnicodeStringToAnsiString(&BufferA, &BufferU, FALSE);
|
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2004-12-18 13:26:57 +00:00
|
|
|
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
|
|
|
}
|
2005-05-09 01:46:57 +00:00
|
|
|
|
2004-12-18 13:26:57 +00:00
|
|
|
return Ret;
|
|
|
|
}
|
|
|
|
|
2005-08-25 19:47:44 +00:00
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* GetConsoleHistoryInfo
|
|
|
|
*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
|
|
|
BOOL STDCALL
|
|
|
|
GetConsoleHistoryInfo(PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo)
|
|
|
|
{
|
|
|
|
DPRINT1("GetConsoleHistoryInfo(0x%p) UNIMPLEMENTED!\n", lpConsoleHistoryInfo);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* SetConsoleHistoryInfo
|
|
|
|
*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
|
|
|
BOOL STDCALL
|
|
|
|
SetConsoleHistoryInfo(IN PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo)
|
|
|
|
{
|
|
|
|
DPRINT1("SetConsoleHistoryInfo(0x%p) UNIMPLEMENTED!\n", lpConsoleHistoryInfo);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* GetConsoleOriginalTitleW
|
|
|
|
*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
|
|
|
DWORD STDCALL
|
|
|
|
GetConsoleOriginalTitleW(OUT LPWSTR lpConsoleTitle,
|
|
|
|
IN DWORD nSize)
|
|
|
|
{
|
|
|
|
DPRINT1("GetConsoleOriginalTitleW(0x%p, 0x%x) UNIMPLEMENTED!\n", lpConsoleTitle, nSize);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* GetConsoleOriginalTitleA
|
|
|
|
*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
|
|
|
DWORD STDCALL
|
|
|
|
GetConsoleOriginalTitleA(OUT LPSTR lpConsoleTitle,
|
|
|
|
IN DWORD nSize)
|
|
|
|
{
|
|
|
|
DPRINT1("GetConsoleOriginalTitleA(0x%p, 0x%x) UNIMPLEMENTED!\n", lpConsoleTitle, nSize);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* GetConsoleScreenBufferInfoEx
|
|
|
|
*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
|
|
|
BOOL STDCALL
|
|
|
|
GetConsoleScreenBufferInfoEx(IN HANDLE hConsoleOutput,
|
|
|
|
OUT PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx)
|
|
|
|
{
|
|
|
|
DPRINT1("GetConsoleScreenBufferInfoEx(0x%p, 0x%p) UNIMPLEMENTED!\n", hConsoleOutput, lpConsoleScreenBufferInfoEx);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* SetConsoleScreenBufferInfoEx
|
|
|
|
*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
|
|
|
BOOL STDCALL
|
|
|
|
SetConsoleScreenBufferInfoEx(IN HANDLE hConsoleOutput,
|
|
|
|
IN PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx)
|
|
|
|
{
|
|
|
|
DPRINT1("SetConsoleScreenBufferInfoEx(0x%p, 0x%p) UNIMPLEMENTED!\n", hConsoleOutput, lpConsoleScreenBufferInfoEx);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------
|
|
|
|
* GetCurrentConsoleFontEx
|
|
|
|
*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
|
|
|
BOOL STDCALL
|
|
|
|
GetCurrentConsoleFontEx(IN HANDLE hConsoleOutput,
|
|
|
|
IN BOOL bMaximumWindow,
|
|
|
|
OUT PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx)
|
|
|
|
{
|
|
|
|
DPRINT1("GetCurrentConsoleFontEx(0x%p, 0x%x, 0x%p) UNIMPLEMENTED!\n", hConsoleOutput, bMaximumWindow, lpConsoleCurrentFontEx);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
1999-03-06 10:57:02 +00:00
|
|
|
/* EOF */
|