mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[KERNEL32]
- Move console-related Vista+ functions from client/vista.c to a dedicated client/console/vista.c file, and add it to compilation. - Move some helper functions from console.c to history.c. - Use the new api index names in history.c. [CONSRV] - Merge CSRSS_GET_HISTORY_INFO and PCSRSS_SET_HISTORY_INFO structures declarations into CSRSS_HISTORY_INFO, and therefore use only one member of it inside CONSOLE_API_MESSAGE structure. - WORD --> UINT for few structure members related to history information. svn path=/branches/ros-csrss/; revision=57713
This commit is contained in:
parent
1ccafa6cae
commit
0473031b87
9 changed files with 292 additions and 258 deletions
|
@ -42,6 +42,7 @@ list(APPEND SOURCE
|
|||
client/console/console.c
|
||||
client/console/history.c
|
||||
client/console/readwrite.c
|
||||
client/console/vista.c
|
||||
client/file/backup.c
|
||||
client/file/cnotify.c
|
||||
client/file/copy.c
|
||||
|
|
|
@ -177,37 +177,6 @@ ConsoleControlDispatcher(DWORD CodeAndFlag)
|
|||
ExitThread(nExitCode);
|
||||
}
|
||||
|
||||
/* Get the size needed to copy a string to a capture buffer, including alignment */
|
||||
static ULONG
|
||||
IntStringSize(LPCVOID String,
|
||||
BOOL Unicode)
|
||||
{
|
||||
ULONG Size = (Unicode ? wcslen(String) : strlen(String)) * sizeof(WCHAR);
|
||||
return (Size + 3) & -4;
|
||||
}
|
||||
|
||||
/* Copy a string to a capture buffer */
|
||||
static VOID
|
||||
IntCaptureMessageString(PCSR_CAPTURE_BUFFER CaptureBuffer,
|
||||
LPCVOID String,
|
||||
BOOL Unicode,
|
||||
PUNICODE_STRING RequestString)
|
||||
{
|
||||
ULONG Size;
|
||||
if (Unicode)
|
||||
{
|
||||
Size = wcslen(String) * sizeof(WCHAR);
|
||||
CsrCaptureMessageBuffer(CaptureBuffer, (PVOID)String, Size, (PVOID *)&RequestString->Buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
Size = strlen(String);
|
||||
CsrAllocateMessagePointer(CaptureBuffer, Size * sizeof(WCHAR), (PVOID *)&RequestString->Buffer);
|
||||
Size = MultiByteToWideChar(CP_ACP, 0, String, Size, RequestString->Buffer, Size * sizeof(WCHAR))
|
||||
* sizeof(WCHAR);
|
||||
}
|
||||
RequestString->Length = RequestString->MaximumLength = Size;
|
||||
}
|
||||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
||||
|
|
|
@ -16,12 +16,47 @@
|
|||
|
||||
/* PRIVATE FUNCTIONS **********************************************************/
|
||||
|
||||
/* Get the size needed to copy a string to a capture buffer, including alignment */
|
||||
static ULONG
|
||||
IntStringSize(LPCVOID String,
|
||||
BOOL Unicode)
|
||||
{
|
||||
ULONG Size = (Unicode ? wcslen(String) : strlen(String)) * sizeof(WCHAR);
|
||||
return (Size + 3) & -4;
|
||||
}
|
||||
|
||||
|
||||
/* Copy a string to a capture buffer */
|
||||
static VOID
|
||||
IntCaptureMessageString(PCSR_CAPTURE_BUFFER CaptureBuffer,
|
||||
LPCVOID String,
|
||||
BOOL Unicode,
|
||||
PUNICODE_STRING RequestString)
|
||||
{
|
||||
ULONG Size;
|
||||
if (Unicode)
|
||||
{
|
||||
Size = wcslen(String) * sizeof(WCHAR);
|
||||
CsrCaptureMessageBuffer(CaptureBuffer, (PVOID)String, Size, (PVOID *)&RequestString->Buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
Size = strlen(String);
|
||||
CsrAllocateMessagePointer(CaptureBuffer, Size * sizeof(WCHAR), (PVOID *)&RequestString->Buffer);
|
||||
Size = MultiByteToWideChar(CP_ACP, 0, String, Size, RequestString->Buffer, Size * sizeof(WCHAR))
|
||||
* sizeof(WCHAR);
|
||||
}
|
||||
RequestString->Length = RequestString->MaximumLength = Size;
|
||||
}
|
||||
|
||||
|
||||
static BOOL
|
||||
IntExpungeConsoleCommandHistory(LPCVOID lpExeName, BOOL bUnicode)
|
||||
{
|
||||
CSR_API_MESSAGE Request;
|
||||
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
||||
NTSTATUS Status;
|
||||
CONSOLE_API_MESSAGE ApiMessage;
|
||||
PCSRSS_EXPUNGE_COMMAND_HISTORY ExpungeCommandHistory = &ApiMessage.Data.ExpungeCommandHistory;
|
||||
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
||||
|
||||
if (lpExeName == NULL || !(bUnicode ? *(PWCHAR)lpExeName : *(PCHAR)lpExeName))
|
||||
{
|
||||
|
@ -38,16 +73,16 @@ IntExpungeConsoleCommandHistory(LPCVOID lpExeName, BOOL bUnicode)
|
|||
}
|
||||
|
||||
IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode,
|
||||
&Request.Data.ExpungeCommandHistory.ExeName);
|
||||
&ExpungeCommandHistory->ExeName);
|
||||
|
||||
Status = CsrClientCallServer(&Request,
|
||||
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||
CaptureBuffer,
|
||||
CSR_CREATE_API_NUMBER(CSR_CONSOLE, EXPUNGE_COMMAND_HISTORY),
|
||||
sizeof(CSR_API_MESSAGE));
|
||||
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepExpungeCommandHistory),
|
||||
sizeof(CSRSS_EXPUNGE_COMMAND_HISTORY));
|
||||
|
||||
CsrFreeCaptureBuffer(CaptureBuffer);
|
||||
|
||||
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
||||
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = ApiMessage.Status))
|
||||
{
|
||||
BaseSetLastNTError(Status);
|
||||
return FALSE;
|
||||
|
@ -60,9 +95,10 @@ IntExpungeConsoleCommandHistory(LPCVOID lpExeName, BOOL bUnicode)
|
|||
static DWORD
|
||||
IntGetConsoleCommandHistory(LPVOID lpHistory, DWORD cbHistory, LPCVOID lpExeName, BOOL bUnicode)
|
||||
{
|
||||
CSR_API_MESSAGE Request;
|
||||
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
||||
NTSTATUS Status;
|
||||
CONSOLE_API_MESSAGE ApiMessage;
|
||||
PCSRSS_GET_COMMAND_HISTORY GetCommandHistory = &ApiMessage.Data.GetCommandHistory;
|
||||
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
||||
DWORD HistoryLength = cbHistory * (bUnicode ? 1 : sizeof(WCHAR));
|
||||
|
||||
if (lpExeName == NULL || !(bUnicode ? *(PWCHAR)lpExeName : *(PCHAR)lpExeName))
|
||||
|
@ -81,16 +117,16 @@ IntGetConsoleCommandHistory(LPVOID lpHistory, DWORD cbHistory, LPCVOID lpExeName
|
|||
}
|
||||
|
||||
IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode,
|
||||
&Request.Data.GetCommandHistory.ExeName);
|
||||
Request.Data.GetCommandHistory.Length = HistoryLength;
|
||||
&GetCommandHistory->ExeName);
|
||||
GetCommandHistory->Length = HistoryLength;
|
||||
CsrAllocateMessagePointer(CaptureBuffer, HistoryLength,
|
||||
(PVOID*)&Request.Data.GetCommandHistory.History);
|
||||
(PVOID*)&GetCommandHistory->History);
|
||||
|
||||
Status = CsrClientCallServer(&Request,
|
||||
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||
CaptureBuffer,
|
||||
CSR_CREATE_API_NUMBER(CSR_CONSOLE, GET_COMMAND_HISTORY),
|
||||
sizeof(CSR_API_MESSAGE));
|
||||
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
||||
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetCommandHistory),
|
||||
sizeof(CSRSS_GET_COMMAND_HISTORY));
|
||||
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = ApiMessage.Status))
|
||||
{
|
||||
CsrFreeCaptureBuffer(CaptureBuffer);
|
||||
BaseSetLastNTError(Status);
|
||||
|
@ -100,30 +136,32 @@ IntGetConsoleCommandHistory(LPVOID lpHistory, DWORD cbHistory, LPCVOID lpExeName
|
|||
if (bUnicode)
|
||||
{
|
||||
memcpy(lpHistory,
|
||||
Request.Data.GetCommandHistory.History,
|
||||
Request.Data.GetCommandHistory.Length);
|
||||
GetCommandHistory->History,
|
||||
GetCommandHistory->Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
WideCharToMultiByte(CP_ACP, 0,
|
||||
Request.Data.GetCommandHistory.History,
|
||||
Request.Data.GetCommandHistory.Length / sizeof(WCHAR),
|
||||
GetCommandHistory->History,
|
||||
GetCommandHistory->Length / sizeof(WCHAR),
|
||||
lpHistory,
|
||||
cbHistory,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
CsrFreeCaptureBuffer(CaptureBuffer);
|
||||
return Request.Data.GetCommandHistory.Length;
|
||||
|
||||
return GetCommandHistory->Length;
|
||||
}
|
||||
|
||||
|
||||
static DWORD
|
||||
IntGetConsoleCommandHistoryLength(LPCVOID lpExeName, BOOL bUnicode)
|
||||
{
|
||||
CSR_API_MESSAGE Request;
|
||||
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
||||
NTSTATUS Status;
|
||||
CONSOLE_API_MESSAGE ApiMessage;
|
||||
PCSRSS_GET_COMMAND_HISTORY_LENGTH GetCommandHistoryLength = &ApiMessage.Data.GetCommandHistoryLength;
|
||||
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
||||
|
||||
if (lpExeName == NULL || !(bUnicode ? *(PWCHAR)lpExeName : *(PCHAR)lpExeName))
|
||||
{
|
||||
|
@ -140,22 +178,22 @@ IntGetConsoleCommandHistoryLength(LPCVOID lpExeName, BOOL bUnicode)
|
|||
}
|
||||
|
||||
IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode,
|
||||
&Request.Data.GetCommandHistoryLength.ExeName);
|
||||
&GetCommandHistoryLength->ExeName);
|
||||
|
||||
Status = CsrClientCallServer(&Request,
|
||||
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||
CaptureBuffer,
|
||||
CSR_CREATE_API_NUMBER(CSR_CONSOLE, GET_COMMAND_HISTORY_LENGTH),
|
||||
sizeof(CSR_API_MESSAGE));
|
||||
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetCommandHistoryLength),
|
||||
sizeof(CSRSS_GET_COMMAND_HISTORY_LENGTH));
|
||||
|
||||
CsrFreeCaptureBuffer(CaptureBuffer);
|
||||
|
||||
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
||||
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = ApiMessage.Status))
|
||||
{
|
||||
BaseSetLastNTError(Status);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Request.Data.GetCommandHistoryLength.Length;
|
||||
return GetCommandHistoryLength->Length;
|
||||
}
|
||||
|
||||
|
||||
|
@ -164,9 +202,10 @@ IntSetConsoleNumberOfCommands(DWORD dwNumCommands,
|
|||
LPCVOID lpExeName,
|
||||
BOOL bUnicode)
|
||||
{
|
||||
CSR_API_MESSAGE Request;
|
||||
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
||||
NTSTATUS Status;
|
||||
CONSOLE_API_MESSAGE ApiMessage;
|
||||
PCSRSS_SET_HISTORY_NUMBER_COMMANDS SetHistoryNumberCommands = &ApiMessage.Data.SetHistoryNumberCommands;
|
||||
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
||||
|
||||
if (lpExeName == NULL || !(bUnicode ? *(PWCHAR)lpExeName : *(PCHAR)lpExeName))
|
||||
{
|
||||
|
@ -183,17 +222,17 @@ IntSetConsoleNumberOfCommands(DWORD dwNumCommands,
|
|||
}
|
||||
|
||||
IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode,
|
||||
&Request.Data.SetHistoryNumberCommands.ExeName);
|
||||
Request.Data.SetHistoryNumberCommands.NumCommands = dwNumCommands;
|
||||
&SetHistoryNumberCommands->ExeName);
|
||||
SetHistoryNumberCommands->NumCommands = dwNumCommands;
|
||||
|
||||
Status = CsrClientCallServer(&Request,
|
||||
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||
CaptureBuffer,
|
||||
CSR_CREATE_API_NUMBER(CSR_CONSOLE, SET_HISTORY_NUMBER_COMMANDS),
|
||||
sizeof(CSR_API_MESSAGE));
|
||||
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetNumberOfCommands),
|
||||
sizeof(CSRSS_SET_HISTORY_NUMBER_COMMANDS));
|
||||
|
||||
CsrFreeCaptureBuffer(CaptureBuffer);
|
||||
|
||||
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
|
||||
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = ApiMessage.Status))
|
||||
{
|
||||
BaseSetLastNTError(Status);
|
||||
return FALSE;
|
||||
|
|
177
dll/win32/kernel32/client/console/vista.c
Normal file
177
dll/win32/kernel32/client/console/vista.c
Normal file
|
@ -0,0 +1,177 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Vista functions
|
||||
* PROGRAMMER: Thomas Weidenmueller (w3seek@reactos.com)
|
||||
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
||||
*/
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include <k32.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
|
||||
/* PUBLIC FUNCTIONS ***********************************************************/
|
||||
|
||||
#if _WIN32_WINNT >= 0x600
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
* GetConsoleHistoryInfo
|
||||
*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
WINAPI
|
||||
GetConsoleHistoryInfo(PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
CONSOLE_API_MESSAGE ApiMessage;
|
||||
PCSRSS_HISTORY_INFO HistoryInfoRequest = &ApiMessage.Data.HistoryInfoRequest;
|
||||
|
||||
if (lpConsoleHistoryInfo->cbSize != sizeof(CONSOLE_HISTORY_INFO))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||
NULL,
|
||||
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetHistory),
|
||||
sizeof(CSRSS_HISTORY_INFO));
|
||||
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = ApiMessage.Status))
|
||||
{
|
||||
BaseSetLastNTError(Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lpConsoleHistoryInfo->HistoryBufferSize = HistoryInfoRequest->HistoryBufferSize;
|
||||
lpConsoleHistoryInfo->NumberOfHistoryBuffers = HistoryInfoRequest->NumberOfHistoryBuffers;
|
||||
lpConsoleHistoryInfo->dwFlags = HistoryInfoRequest->dwFlags;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
* SetConsoleHistoryInfo
|
||||
*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
WINAPI
|
||||
SetConsoleHistoryInfo(IN PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
CONSOLE_API_MESSAGE ApiMessage;
|
||||
PCSRSS_HISTORY_INFO HistoryInfoRequest = &ApiMessage.Data.HistoryInfoRequest;
|
||||
|
||||
if (lpConsoleHistoryInfo->cbSize != sizeof(CONSOLE_HISTORY_INFO))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
HistoryInfoRequest->HistoryBufferSize = lpConsoleHistoryInfo->HistoryBufferSize;
|
||||
HistoryInfoRequest->NumberOfHistoryBuffers = lpConsoleHistoryInfo->NumberOfHistoryBuffers;
|
||||
HistoryInfoRequest->dwFlags = lpConsoleHistoryInfo->dwFlags;
|
||||
|
||||
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||
NULL,
|
||||
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetHistory),
|
||||
sizeof(CSRSS_HISTORY_INFO));
|
||||
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = ApiMessage.Status))
|
||||
{
|
||||
BaseSetLastNTError(Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
* GetConsoleOriginalTitleW
|
||||
*
|
||||
* @unimplemented
|
||||
*/
|
||||
DWORD
|
||||
WINAPI
|
||||
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
|
||||
WINAPI
|
||||
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
|
||||
WINAPI
|
||||
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
|
||||
WINAPI
|
||||
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
|
||||
WINAPI
|
||||
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;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* EOF */
|
|
@ -1,9 +1,12 @@
|
|||
/* COPYRIGHT: See COPYING in the top level directory
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Vista functions
|
||||
* PROGRAMMER: Thomas Weidenmueller <w3seek@reactos.com>
|
||||
*/
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include <k32.h>
|
||||
|
||||
#define NDEBUG
|
||||
|
@ -101,8 +104,8 @@ SleepConditionVariableSRW(IN OUT PCONDITION_VARIABLE ConditionVariable,
|
|||
* @implemented
|
||||
*/
|
||||
BOOL WINAPI InitializeCriticalSectionEx(OUT LPCRITICAL_SECTION lpCriticalSection,
|
||||
IN DWORD dwSpinCount,
|
||||
IN DWORD flags )
|
||||
IN DWORD dwSpinCount,
|
||||
IN DWORD flags)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
|
@ -124,7 +127,6 @@ BOOL WINAPI InitializeCriticalSectionEx(OUT LPCRITICAL_SECTION lpCriticalSection
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
@ -228,6 +230,7 @@ QueryFullProcessImageNameA(HANDLE hProcess,
|
|||
return Result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
|
@ -309,160 +312,6 @@ RegisterApplicationRestart(IN PCWSTR pwzCommandline OPTIONAL,
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
* GetConsoleHistoryInfo
|
||||
*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
WINAPI
|
||||
GetConsoleHistoryInfo(PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
CONSOLE_API_MESSAGE ApiMessage;
|
||||
PCSRSS_GET_HISTORY_INFO GetHistoryInfo = &ApiMessage.Data.GetHistoryInfo;
|
||||
|
||||
if (lpConsoleHistoryInfo->cbSize != sizeof(CONSOLE_HISTORY_INFO))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||
NULL,
|
||||
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetHistory),
|
||||
sizeof(CSRSS_GET_HISTORY_INFO));
|
||||
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = ApiMessage.Status))
|
||||
{
|
||||
BaseSetLastNTError(Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lpConsoleHistoryInfo->HistoryBufferSize = GetHistoryInfo->HistoryBufferSize;
|
||||
lpConsoleHistoryInfo->NumberOfHistoryBuffers = GetHistoryInfo->NumberOfHistoryBuffers;
|
||||
lpConsoleHistoryInfo->dwFlags = GetHistoryInfo->dwFlags;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
* SetConsoleHistoryInfo
|
||||
*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
WINAPI
|
||||
SetConsoleHistoryInfo(IN PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
CONSOLE_API_MESSAGE ApiMessage;
|
||||
PCSRSS_SET_HISTORY_INFO SetHistoryInfo = &ApiMessage.Data.SetHistoryInfo;
|
||||
|
||||
if (lpConsoleHistoryInfo->cbSize != sizeof(CONSOLE_HISTORY_INFO))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
SetHistoryInfo->HistoryBufferSize = lpConsoleHistoryInfo->HistoryBufferSize;
|
||||
SetHistoryInfo->NumberOfHistoryBuffers = lpConsoleHistoryInfo->NumberOfHistoryBuffers;
|
||||
SetHistoryInfo->dwFlags = lpConsoleHistoryInfo->dwFlags;
|
||||
|
||||
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
|
||||
NULL,
|
||||
CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetHistory),
|
||||
sizeof(CSRSS_SET_HISTORY_INFO));
|
||||
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = ApiMessage.Status))
|
||||
{
|
||||
BaseSetLastNTError(Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
* GetConsoleOriginalTitleW
|
||||
*
|
||||
* @unimplemented
|
||||
*/
|
||||
DWORD
|
||||
WINAPI
|
||||
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
|
||||
WINAPI
|
||||
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
|
||||
WINAPI
|
||||
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
|
||||
WINAPI
|
||||
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
|
||||
WINAPI
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
|
@ -701,6 +550,7 @@ CreateSymbolicLinkA(IN LPCSTR lpSymlinkFileName,
|
|||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
|
@ -722,6 +572,7 @@ GetFinalPathNameByHandleW(IN HANDLE hFile,
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
@ -789,6 +640,7 @@ GetFinalPathNameByHandleA(IN HANDLE hFile,
|
|||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
|
|
|
@ -465,12 +465,6 @@ typedef struct
|
|||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UNICODE_STRING ExeName;
|
||||
DWORD Length;
|
||||
} CSRSS_GET_COMMAND_HISTORY_LENGTH, *PCSRSS_GET_COMMAND_HISTORY_LENGTH;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UNICODE_STRING ExeName;
|
||||
|
@ -480,7 +474,13 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
UNICODE_STRING ExeName;
|
||||
UNICODE_STRING ExeName;
|
||||
DWORD Length;
|
||||
} CSRSS_GET_COMMAND_HISTORY_LENGTH, *PCSRSS_GET_COMMAND_HISTORY_LENGTH;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UNICODE_STRING ExeName;
|
||||
} CSRSS_EXPUNGE_COMMAND_HISTORY, *PCSRSS_EXPUNGE_COMMAND_HISTORY;
|
||||
|
||||
typedef struct
|
||||
|
@ -491,11 +491,10 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
DWORD HistoryBufferSize;
|
||||
DWORD NumberOfHistoryBuffers;
|
||||
UINT HistoryBufferSize;
|
||||
UINT NumberOfHistoryBuffers;
|
||||
DWORD dwFlags;
|
||||
} CSRSS_GET_HISTORY_INFO, *PCSRSS_GET_HISTORY_INFO,
|
||||
CSRSS_SET_HISTORY_INFO, *PCSRSS_SET_HISTORY_INFO;;
|
||||
} CSRSS_HISTORY_INFO, *PCSRSS_HISTORY_INFO;
|
||||
|
||||
|
||||
|
||||
|
@ -607,8 +606,7 @@ typedef struct _CONSOLE_API_MESSAGE
|
|||
CSRSS_GET_COMMAND_HISTORY_LENGTH GetCommandHistoryLength;
|
||||
CSRSS_EXPUNGE_COMMAND_HISTORY ExpungeCommandHistory;
|
||||
CSRSS_SET_HISTORY_NUMBER_COMMANDS SetHistoryNumberCommands;
|
||||
CSRSS_GET_HISTORY_INFO GetHistoryInfo;
|
||||
CSRSS_SET_HISTORY_INFO SetHistoryInfo;
|
||||
CSRSS_HISTORY_INFO HistoryInfoRequest;
|
||||
|
||||
CSRSS_GENERATE_CTRL_EVENT GenerateCtrlEvent;
|
||||
CSRSS_GET_NUM_INPUT_EVENTS GetNumInputEventsRequest;
|
||||
|
|
|
@ -63,8 +63,8 @@ typedef struct tagCSRSS_CONSOLE
|
|||
BOOLEAN LineInsertToggle; /* replace character over cursor instead of inserting */
|
||||
ULONG LineWakeupMask; /* bitmap of which control characters will end line input */
|
||||
LIST_ENTRY HistoryBuffers;
|
||||
WORD HistoryBufferSize; /* size for newly created history buffers */
|
||||
WORD NumberOfHistoryBuffers; /* maximum number of history buffers allowed */
|
||||
UINT HistoryBufferSize; /* size for newly created history buffers */
|
||||
UINT NumberOfHistoryBuffers; /* maximum number of history buffers allowed */
|
||||
BOOLEAN HistoryNoDup; /* remove old duplicate history entries */
|
||||
LIST_ENTRY BufferList; /* List of all screen buffers for this console */
|
||||
PCSRSS_SCREEN_BUFFER ActiveBuffer; /* Pointer to currently active screen buffer */
|
||||
|
|
|
@ -434,8 +434,7 @@ GuiConsoleWriteUserSettings(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData)
|
|||
}
|
||||
else
|
||||
{
|
||||
DWORD Temp = Console->NumberOfHistoryBuffers;
|
||||
RegSetValueExW(hKey, L"NumberOfHistoryBuffers", 0, REG_DWORD, (const BYTE *)&Temp, sizeof(DWORD));
|
||||
RegSetValueExW(hKey, L"NumberOfHistoryBuffers", 0, REG_DWORD, (const BYTE *)&Console->NumberOfHistoryBuffers, sizeof(DWORD));
|
||||
}
|
||||
|
||||
if (Console->HistoryBufferSize == 50)
|
||||
|
@ -444,8 +443,7 @@ GuiConsoleWriteUserSettings(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData)
|
|||
}
|
||||
else
|
||||
{
|
||||
DWORD Temp = Console->HistoryBufferSize;
|
||||
RegSetValueExW(hKey, L"HistoryBufferSize", 0, REG_DWORD, (const BYTE *)&Temp, sizeof(DWORD));
|
||||
RegSetValueExW(hKey, L"HistoryBufferSize", 0, REG_DWORD, (const BYTE *)&Console->HistoryBufferSize, sizeof(DWORD));
|
||||
}
|
||||
|
||||
if (GuiData->FullScreen == FALSE)
|
||||
|
@ -457,7 +455,7 @@ GuiConsoleWriteUserSettings(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData)
|
|||
RegSetValueExW(hKey, L"FullScreen", 0, REG_DWORD, (const BYTE *)&GuiData->FullScreen, sizeof(DWORD));
|
||||
}
|
||||
|
||||
if ( GuiData->QuickEdit == FALSE)
|
||||
if (GuiData->QuickEdit == FALSE)
|
||||
{
|
||||
RegDeleteKeyW(hKey, L"QuickEdit");
|
||||
}
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
typedef struct tagHISTORY_BUFFER
|
||||
{
|
||||
LIST_ENTRY ListEntry;
|
||||
WORD Position;
|
||||
WORD MaxEntries;
|
||||
WORD NumEntries;
|
||||
UINT Position;
|
||||
UINT MaxEntries;
|
||||
UINT NumEntries;
|
||||
PUNICODE_STRING Entries;
|
||||
UNICODE_STRING ExeName;
|
||||
} HISTORY_BUFFER, *PHISTORY_BUFFER;
|
||||
|
@ -257,7 +257,7 @@ CSR_API(SrvSetConsoleNumberOfCommands)
|
|||
PCSRSS_CONSOLE Console;
|
||||
PHISTORY_BUFFER Hist;
|
||||
NTSTATUS Status;
|
||||
WORD MaxEntries = SetHistoryNumberCommands->NumCommands;
|
||||
UINT MaxEntries = SetHistoryNumberCommands->NumCommands;
|
||||
PUNICODE_STRING OldEntryList, NewEntryList;
|
||||
|
||||
if (!Win32CsrValidateBuffer(Process,
|
||||
|
@ -302,14 +302,14 @@ CSR_API(SrvSetConsoleNumberOfCommands)
|
|||
|
||||
CSR_API(SrvGetConsoleHistory)
|
||||
{
|
||||
PCSRSS_GET_HISTORY_INFO GetHistoryInfo = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetHistoryInfo;
|
||||
PCSRSS_HISTORY_INFO HistoryInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HistoryInfoRequest;
|
||||
PCSRSS_CONSOLE Console;
|
||||
NTSTATUS Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
GetHistoryInfo->HistoryBufferSize = Console->HistoryBufferSize;
|
||||
GetHistoryInfo->NumberOfHistoryBuffers = Console->NumberOfHistoryBuffers;
|
||||
GetHistoryInfo->dwFlags = Console->HistoryNoDup;
|
||||
HistoryInfoRequest->HistoryBufferSize = Console->HistoryBufferSize;
|
||||
HistoryInfoRequest->NumberOfHistoryBuffers = Console->NumberOfHistoryBuffers;
|
||||
HistoryInfoRequest->dwFlags = Console->HistoryNoDup;
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
return Status;
|
||||
|
@ -317,14 +317,14 @@ CSR_API(SrvGetConsoleHistory)
|
|||
|
||||
CSR_API(SrvSetConsoleHistory)
|
||||
{
|
||||
PCSRSS_SET_HISTORY_INFO SetHistoryInfo = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetHistoryInfo;
|
||||
PCSRSS_HISTORY_INFO HistoryInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HistoryInfoRequest;
|
||||
PCSRSS_CONSOLE Console;
|
||||
NTSTATUS Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
Console->HistoryBufferSize = (WORD)SetHistoryInfo->HistoryBufferSize;
|
||||
Console->NumberOfHistoryBuffers = (WORD)SetHistoryInfo->NumberOfHistoryBuffers;
|
||||
Console->HistoryNoDup = SetHistoryInfo->dwFlags & HISTORY_NO_DUP_FLAG;
|
||||
Console->HistoryBufferSize = HistoryInfoRequest->HistoryBufferSize;
|
||||
Console->NumberOfHistoryBuffers = HistoryInfoRequest->NumberOfHistoryBuffers;
|
||||
Console->HistoryNoDup = HistoryInfoRequest->dwFlags & HISTORY_NO_DUP_FLAG;
|
||||
ConioUnlockConsole(Console);
|
||||
}
|
||||
return Status;
|
||||
|
|
Loading…
Reference in a new issue