Author: hbelusca
Date: Thu Nov 15 17:09:51 2012
New Revision: 57709
URL:
http://svn.reactos.org/svn/reactos?rev=57709&view=rev
Log:
[KERNEL32]
- Move history-functions to a dedicated source file. The functions were created in r47580
and therefore update the description header of the file.
Added:
branches/ros-csrss/dll/win32/kernel32/client/console/history.c (with props)
Modified:
branches/ros-csrss/dll/win32/kernel32/client/console/console.c
Modified: branches/ros-csrss/dll/win32/kernel32/client/console/console.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/win32/kernel32/cl…
==============================================================================
--- branches/ros-csrss/dll/win32/kernel32/client/console/console.c [iso-8859-1]
(original)
+++ branches/ros-csrss/dll/win32/kernel32/client/console/console.c [iso-8859-1] Thu Nov 15
17:09:51 2012
@@ -266,211 +266,6 @@
}
-static BOOL
-IntExpungeConsoleCommandHistory(LPCVOID lpExeName, BOOL bUnicode)
-{
- CSR_API_MESSAGE Request;
- PCSR_CAPTURE_BUFFER CaptureBuffer;
- NTSTATUS Status;
-
- if (lpExeName == NULL || !(bUnicode ? *(PWCHAR)lpExeName : *(PCHAR)lpExeName))
- {
- SetLastError(ERROR_INVALID_PARAMETER);
- return FALSE;
- }
-
- CaptureBuffer = CsrAllocateCaptureBuffer(1, IntStringSize(lpExeName, bUnicode));
- if (!CaptureBuffer)
- {
- DPRINT1("CsrAllocateCaptureBuffer failed!\n");
- SetLastError(ERROR_NOT_ENOUGH_MEMORY);
- return FALSE;
- }
-
- IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode,
- &Request.Data.ExpungeCommandHistory.ExeName);
-
- Status = CsrClientCallServer(&Request,
- CaptureBuffer,
- CSR_CREATE_API_NUMBER(CSR_CONSOLE,
EXPUNGE_COMMAND_HISTORY),
- sizeof(CSR_API_MESSAGE));
-
- CsrFreeCaptureBuffer(CaptureBuffer);
-
- if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
- {
- BaseSetLastNTError(Status);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/*
- * @implemented (Undocumented)
- */
-BOOL
-WINAPI
-ExpungeConsoleCommandHistoryW(LPCWSTR lpExeName)
-{
- return IntExpungeConsoleCommandHistory(lpExeName, TRUE);
-}
-
-/*
- * @implemented (Undocumented)
- */
-BOOL
-WINAPI
-ExpungeConsoleCommandHistoryA(LPCSTR lpExeName)
-{
- return IntExpungeConsoleCommandHistory(lpExeName, FALSE);
-}
-
-
-static DWORD
-IntGetConsoleCommandHistory(LPVOID lpHistory, DWORD cbHistory, LPCVOID lpExeName, BOOL
bUnicode)
-{
- CSR_API_MESSAGE Request;
- PCSR_CAPTURE_BUFFER CaptureBuffer;
- NTSTATUS Status;
- DWORD HistoryLength = cbHistory * (bUnicode ? 1 : sizeof(WCHAR));
-
- if (lpExeName == NULL || !(bUnicode ? *(PWCHAR)lpExeName : *(PCHAR)lpExeName))
- {
- SetLastError(ERROR_INVALID_PARAMETER);
- return 0;
- }
-
- CaptureBuffer = CsrAllocateCaptureBuffer(2, IntStringSize(lpExeName, bUnicode) +
- HistoryLength);
- if (!CaptureBuffer)
- {
- DPRINT1("CsrAllocateCaptureBuffer failed!\n");
- SetLastError(ERROR_NOT_ENOUGH_MEMORY);
- return 0;
- }
-
- IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode,
- &Request.Data.GetCommandHistory.ExeName);
- Request.Data.GetCommandHistory.Length = HistoryLength;
- CsrAllocateMessagePointer(CaptureBuffer, HistoryLength,
- (PVOID*)&Request.Data.GetCommandHistory.History);
-
- Status = CsrClientCallServer(&Request,
- CaptureBuffer,
- CSR_CREATE_API_NUMBER(CSR_CONSOLE,
GET_COMMAND_HISTORY),
- sizeof(CSR_API_MESSAGE));
- if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
- {
- CsrFreeCaptureBuffer(CaptureBuffer);
- BaseSetLastNTError(Status);
- return 0;
- }
-
- if (bUnicode)
- {
- memcpy(lpHistory,
- Request.Data.GetCommandHistory.History,
- Request.Data.GetCommandHistory.Length);
- }
- else
- {
- WideCharToMultiByte(CP_ACP, 0,
- Request.Data.GetCommandHistory.History,
- Request.Data.GetCommandHistory.Length / sizeof(WCHAR),
- lpHistory,
- cbHistory,
- NULL, NULL);
- }
-
- CsrFreeCaptureBuffer(CaptureBuffer);
- return Request.Data.GetCommandHistory.Length;
-}
-
-/*
- * @implemented (Undocumented)
- */
-DWORD
-WINAPI
-GetConsoleCommandHistoryW(LPWSTR lpHistory,
- DWORD cbHistory,
- LPCWSTR lpExeName)
-{
- return IntGetConsoleCommandHistory(lpHistory, cbHistory, lpExeName, TRUE);
-}
-
-/*
- * @implemented (Undocumented)
- */
-DWORD
-WINAPI
-GetConsoleCommandHistoryA(LPSTR lpHistory,
- DWORD cbHistory,
- LPCSTR lpExeName)
-{
- return IntGetConsoleCommandHistory(lpHistory, cbHistory, lpExeName, FALSE);
-}
-
-
-static DWORD
-IntGetConsoleCommandHistoryLength(LPCVOID lpExeName, BOOL bUnicode)
-{
- CSR_API_MESSAGE Request;
- PCSR_CAPTURE_BUFFER CaptureBuffer;
- NTSTATUS Status;
-
- if (lpExeName == NULL || !(bUnicode ? *(PWCHAR)lpExeName : *(PCHAR)lpExeName))
- {
- SetLastError(ERROR_INVALID_PARAMETER);
- return 0;
- }
-
- CaptureBuffer = CsrAllocateCaptureBuffer(1, IntStringSize(lpExeName, bUnicode));
- if (!CaptureBuffer)
- {
- DPRINT1("CsrAllocateCaptureBuffer failed!\n");
- SetLastError(ERROR_NOT_ENOUGH_MEMORY);
- return 0;
- }
-
- IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode,
- &Request.Data.GetCommandHistoryLength.ExeName);
-
- Status = CsrClientCallServer(&Request,
- CaptureBuffer,
- CSR_CREATE_API_NUMBER(CSR_CONSOLE,
GET_COMMAND_HISTORY_LENGTH),
- sizeof(CSR_API_MESSAGE));
-
- CsrFreeCaptureBuffer(CaptureBuffer);
-
- if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
- {
- BaseSetLastNTError(Status);
- return 0;
- }
-
- return Request.Data.GetCommandHistoryLength.Length;
-}
-
-/*
- * @implemented (Undocumented)
- */
-DWORD
-WINAPI
-GetConsoleCommandHistoryLengthW(LPCWSTR lpExeName)
-{
- return IntGetConsoleCommandHistoryLength(lpExeName, TRUE);
-}
-
-/*
- * @implemented (Undocumented)
- */
-DWORD
-WINAPI
-GetConsoleCommandHistoryLengthA(LPCSTR lpExeName)
-{
- return IntGetConsoleCommandHistoryLength(lpExeName, FALSE) / sizeof(WCHAR);
-}
/*
@@ -799,72 +594,6 @@
DPRINT1("SetConsoleMenuClose(0x%x) UNIMPLEMENTED!\n", Unknown0);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
-}
-
-
-static BOOL
-IntSetConsoleNumberOfCommands(DWORD dwNumCommands,
- LPCVOID lpExeName,
- BOOL bUnicode)
-{
- CSR_API_MESSAGE Request;
- PCSR_CAPTURE_BUFFER CaptureBuffer;
- NTSTATUS Status;
-
- if (lpExeName == NULL || !(bUnicode ? *(PWCHAR)lpExeName : *(PCHAR)lpExeName))
- {
- SetLastError(ERROR_INVALID_PARAMETER);
- return FALSE;
- }
-
- CaptureBuffer = CsrAllocateCaptureBuffer(1, IntStringSize(lpExeName, bUnicode));
- if (!CaptureBuffer)
- {
- DPRINT1("CsrAllocateCaptureBuffer failed!\n");
- SetLastError(ERROR_NOT_ENOUGH_MEMORY);
- return FALSE;
- }
-
- IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode,
- &Request.Data.SetHistoryNumberCommands.ExeName);
- Request.Data.SetHistoryNumberCommands.NumCommands = dwNumCommands;
-
- Status = CsrClientCallServer(&Request,
- CaptureBuffer,
- CSR_CREATE_API_NUMBER(CSR_CONSOLE,
SET_HISTORY_NUMBER_COMMANDS),
- sizeof(CSR_API_MESSAGE));
-
- CsrFreeCaptureBuffer(CaptureBuffer);
-
- if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
- {
- BaseSetLastNTError(Status);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/*
- * @implemented (Undocumented)
- */
-BOOL
-WINAPI
-SetConsoleNumberOfCommandsA(DWORD dwNumCommands,
- LPCWSTR lpExeName)
-{
- return IntSetConsoleNumberOfCommands(dwNumCommands, lpExeName, FALSE);
-}
-
-/*
- * @implemented (Undocumented)
- */
-BOOL
-WINAPI
-SetConsoleNumberOfCommandsW(DWORD dwNumCommands,
- LPCSTR lpExeName)
-{
- return IntSetConsoleNumberOfCommands(dwNumCommands, lpExeName, TRUE);
}
@@ -3840,16 +3569,4 @@
return FALSE;
}
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-SetConsoleCommandHistoryMode(IN DWORD dwMode)
-{
- STUB;
- return FALSE;
-}
-
-
/* EOF */
Added: branches/ros-csrss/dll/win32/kernel32/client/console/history.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/win32/kernel32/cl…
==============================================================================
--- branches/ros-csrss/dll/win32/kernel32/client/console/history.c (added)
+++ branches/ros-csrss/dll/win32/kernel32/client/console/history.c [iso-8859-1] Thu Nov 15
17:09:51 2012
@@ -1,0 +1,313 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS system libraries
+ * FILE: dll/win32/kernel32/client/console/history.c
+ * PURPOSE: Win32 Console Client history functions
+ * PROGRAMMERS: Jeffrey Morlan
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <k32.h>
+
+#define NDEBUG
+#include <debug.h>
+
+
+/* PRIVATE FUNCTIONS **********************************************************/
+
+static BOOL
+IntExpungeConsoleCommandHistory(LPCVOID lpExeName, BOOL bUnicode)
+{
+ CSR_API_MESSAGE Request;
+ PCSR_CAPTURE_BUFFER CaptureBuffer;
+ NTSTATUS Status;
+
+ if (lpExeName == NULL || !(bUnicode ? *(PWCHAR)lpExeName : *(PCHAR)lpExeName))
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ CaptureBuffer = CsrAllocateCaptureBuffer(1, IntStringSize(lpExeName, bUnicode));
+ if (!CaptureBuffer)
+ {
+ DPRINT1("CsrAllocateCaptureBuffer failed!\n");
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return FALSE;
+ }
+
+ IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode,
+ &Request.Data.ExpungeCommandHistory.ExeName);
+
+ Status = CsrClientCallServer(&Request,
+ CaptureBuffer,
+ CSR_CREATE_API_NUMBER(CSR_CONSOLE,
EXPUNGE_COMMAND_HISTORY),
+ sizeof(CSR_API_MESSAGE));
+
+ CsrFreeCaptureBuffer(CaptureBuffer);
+
+ if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
+ {
+ BaseSetLastNTError(Status);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+static DWORD
+IntGetConsoleCommandHistory(LPVOID lpHistory, DWORD cbHistory, LPCVOID lpExeName, BOOL
bUnicode)
+{
+ CSR_API_MESSAGE Request;
+ PCSR_CAPTURE_BUFFER CaptureBuffer;
+ NTSTATUS Status;
+ DWORD HistoryLength = cbHistory * (bUnicode ? 1 : sizeof(WCHAR));
+
+ if (lpExeName == NULL || !(bUnicode ? *(PWCHAR)lpExeName : *(PCHAR)lpExeName))
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return 0;
+ }
+
+ CaptureBuffer = CsrAllocateCaptureBuffer(2, IntStringSize(lpExeName, bUnicode) +
+ HistoryLength);
+ if (!CaptureBuffer)
+ {
+ DPRINT1("CsrAllocateCaptureBuffer failed!\n");
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return 0;
+ }
+
+ IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode,
+ &Request.Data.GetCommandHistory.ExeName);
+ Request.Data.GetCommandHistory.Length = HistoryLength;
+ CsrAllocateMessagePointer(CaptureBuffer, HistoryLength,
+ (PVOID*)&Request.Data.GetCommandHistory.History);
+
+ Status = CsrClientCallServer(&Request,
+ CaptureBuffer,
+ CSR_CREATE_API_NUMBER(CSR_CONSOLE,
GET_COMMAND_HISTORY),
+ sizeof(CSR_API_MESSAGE));
+ if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
+ {
+ CsrFreeCaptureBuffer(CaptureBuffer);
+ BaseSetLastNTError(Status);
+ return 0;
+ }
+
+ if (bUnicode)
+ {
+ memcpy(lpHistory,
+ Request.Data.GetCommandHistory.History,
+ Request.Data.GetCommandHistory.Length);
+ }
+ else
+ {
+ WideCharToMultiByte(CP_ACP, 0,
+ Request.Data.GetCommandHistory.History,
+ Request.Data.GetCommandHistory.Length / sizeof(WCHAR),
+ lpHistory,
+ cbHistory,
+ NULL, NULL);
+ }
+
+ CsrFreeCaptureBuffer(CaptureBuffer);
+ return Request.Data.GetCommandHistory.Length;
+}
+
+
+static DWORD
+IntGetConsoleCommandHistoryLength(LPCVOID lpExeName, BOOL bUnicode)
+{
+ CSR_API_MESSAGE Request;
+ PCSR_CAPTURE_BUFFER CaptureBuffer;
+ NTSTATUS Status;
+
+ if (lpExeName == NULL || !(bUnicode ? *(PWCHAR)lpExeName : *(PCHAR)lpExeName))
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return 0;
+ }
+
+ CaptureBuffer = CsrAllocateCaptureBuffer(1, IntStringSize(lpExeName, bUnicode));
+ if (!CaptureBuffer)
+ {
+ DPRINT1("CsrAllocateCaptureBuffer failed!\n");
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return 0;
+ }
+
+ IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode,
+ &Request.Data.GetCommandHistoryLength.ExeName);
+
+ Status = CsrClientCallServer(&Request,
+ CaptureBuffer,
+ CSR_CREATE_API_NUMBER(CSR_CONSOLE,
GET_COMMAND_HISTORY_LENGTH),
+ sizeof(CSR_API_MESSAGE));
+
+ CsrFreeCaptureBuffer(CaptureBuffer);
+
+ if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
+ {
+ BaseSetLastNTError(Status);
+ return 0;
+ }
+
+ return Request.Data.GetCommandHistoryLength.Length;
+}
+
+
+static BOOL
+IntSetConsoleNumberOfCommands(DWORD dwNumCommands,
+ LPCVOID lpExeName,
+ BOOL bUnicode)
+{
+ CSR_API_MESSAGE Request;
+ PCSR_CAPTURE_BUFFER CaptureBuffer;
+ NTSTATUS Status;
+
+ if (lpExeName == NULL || !(bUnicode ? *(PWCHAR)lpExeName : *(PCHAR)lpExeName))
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ CaptureBuffer = CsrAllocateCaptureBuffer(1, IntStringSize(lpExeName, bUnicode));
+ if (!CaptureBuffer)
+ {
+ DPRINT1("CsrAllocateCaptureBuffer failed!\n");
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return FALSE;
+ }
+
+ IntCaptureMessageString(CaptureBuffer, lpExeName, bUnicode,
+ &Request.Data.SetHistoryNumberCommands.ExeName);
+ Request.Data.SetHistoryNumberCommands.NumCommands = dwNumCommands;
+
+ Status = CsrClientCallServer(&Request,
+ CaptureBuffer,
+ CSR_CREATE_API_NUMBER(CSR_CONSOLE,
SET_HISTORY_NUMBER_COMMANDS),
+ sizeof(CSR_API_MESSAGE));
+
+ CsrFreeCaptureBuffer(CaptureBuffer);
+
+ if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
+ {
+ BaseSetLastNTError(Status);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/* FUNCTIONS ******************************************************************/
+
+/*
+ * @implemented (Undocumented)
+ */
+BOOL
+WINAPI
+ExpungeConsoleCommandHistoryW(LPCWSTR lpExeName)
+{
+ return IntExpungeConsoleCommandHistory(lpExeName, TRUE);
+}
+
+
+/*
+ * @implemented (Undocumented)
+ */
+BOOL
+WINAPI
+ExpungeConsoleCommandHistoryA(LPCSTR lpExeName)
+{
+ return IntExpungeConsoleCommandHistory(lpExeName, FALSE);
+}
+
+
+/*
+ * @implemented (Undocumented)
+ */
+DWORD
+WINAPI
+GetConsoleCommandHistoryW(LPWSTR lpHistory,
+ DWORD cbHistory,
+ LPCWSTR lpExeName)
+{
+ return IntGetConsoleCommandHistory(lpHistory, cbHistory, lpExeName, TRUE);
+}
+
+
+/*
+ * @implemented (Undocumented)
+ */
+DWORD
+WINAPI
+GetConsoleCommandHistoryA(LPSTR lpHistory,
+ DWORD cbHistory,
+ LPCSTR lpExeName)
+{
+ return IntGetConsoleCommandHistory(lpHistory, cbHistory, lpExeName, FALSE);
+}
+
+
+/*
+ * @implemented (Undocumented)
+ */
+DWORD
+WINAPI
+GetConsoleCommandHistoryLengthW(LPCWSTR lpExeName)
+{
+ return IntGetConsoleCommandHistoryLength(lpExeName, TRUE);
+}
+
+
+/*
+ * @implemented (Undocumented)
+ */
+DWORD
+WINAPI
+GetConsoleCommandHistoryLengthA(LPCSTR lpExeName)
+{
+ return IntGetConsoleCommandHistoryLength(lpExeName, FALSE) / sizeof(WCHAR);
+}
+
+
+/*
+ * @implemented (Undocumented)
+ */
+BOOL
+WINAPI
+SetConsoleNumberOfCommandsW(DWORD dwNumCommands,
+ LPCSTR lpExeName)
+{
+ return IntSetConsoleNumberOfCommands(dwNumCommands, lpExeName, TRUE);
+}
+
+
+/*
+ * @implemented (Undocumented)
+ */
+BOOL
+WINAPI
+SetConsoleNumberOfCommandsA(DWORD dwNumCommands,
+ LPCWSTR lpExeName)
+{
+ return IntSetConsoleNumberOfCommands(dwNumCommands, lpExeName, FALSE);
+}
+
+
+/*
+ * @unimplemented
+ */
+BOOL
+WINAPI
+SetConsoleCommandHistoryMode(IN DWORD dwMode)
+{
+ STUB;
+ return FALSE;
+}
+
+/* EOF */
Propchange: branches/ros-csrss/dll/win32/kernel32/client/console/history.c
------------------------------------------------------------------------------
svn:eol-style = native