mirror of
https://github.com/reactos/reactos.git
synced 2025-04-19 20:19:26 +00:00
[KERNEL32]
No need to precalculate the string lengths before calling the helper functions. They can do it instead. svn path=/branches/condrv_restructure/; revision=63198
This commit is contained in:
parent
c26bc793ac
commit
d639063cc3
3 changed files with 29 additions and 78 deletions
|
@ -388,12 +388,14 @@ GetConsoleAliasesA(LPSTR AliasBuffer,
|
|||
|
||||
|
||||
static DWORD
|
||||
IntGetConsoleAliasesLength(LPVOID lpExeName, DWORD dwNumChars, BOOLEAN bUnicode)
|
||||
IntGetConsoleAliasesLength(LPVOID lpExeName, BOOLEAN bUnicode)
|
||||
{
|
||||
CONSOLE_API_MESSAGE ApiMessage;
|
||||
PCONSOLE_GETALLALIASESLENGTH GetAllAliasesLengthRequest = &ApiMessage.Data.GetAllAliasesLengthRequest;
|
||||
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
||||
|
||||
DWORD dwNumChars = (lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0);
|
||||
|
||||
if (lpExeName == NULL || dwNumChars == 0)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
|
@ -442,13 +444,7 @@ DWORD
|
|||
WINAPI
|
||||
GetConsoleAliasesLengthW(LPWSTR lpExeName)
|
||||
{
|
||||
if (lpExeName == NULL)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return IntGetConsoleAliasesLength(lpExeName, wcslen(lpExeName), TRUE);
|
||||
return IntGetConsoleAliasesLength(lpExeName, TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -459,13 +455,7 @@ DWORD
|
|||
WINAPI
|
||||
GetConsoleAliasesLengthA(LPSTR lpExeName)
|
||||
{
|
||||
if (lpExeName == NULL)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return IntGetConsoleAliasesLength(lpExeName, strlen(lpExeName), FALSE);
|
||||
return IntGetConsoleAliasesLength(lpExeName, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1867,12 +1867,14 @@ GetConsoleTitleA(LPSTR lpConsoleTitle,
|
|||
|
||||
|
||||
static BOOL
|
||||
IntSetConsoleTitle(CONST VOID *lpConsoleTitle, DWORD dwNumChars, BOOLEAN bUnicode)
|
||||
IntSetConsoleTitle(CONST VOID *lpConsoleTitle, BOOLEAN bUnicode)
|
||||
{
|
||||
CONSOLE_API_MESSAGE ApiMessage;
|
||||
PCONSOLE_GETSETCONSOLETITLE TitleRequest = &ApiMessage.Data.TitleRequest;
|
||||
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
||||
|
||||
DWORD dwNumChars = (lpConsoleTitle ? (bUnicode ? wcslen(lpConsoleTitle) : strlen(lpConsoleTitle)) : 0);
|
||||
|
||||
TitleRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle;
|
||||
TitleRequest->Length = dwNumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
|
||||
TitleRequest->Unicode = bUnicode;
|
||||
|
@ -1915,7 +1917,7 @@ BOOL
|
|||
WINAPI
|
||||
SetConsoleTitleW(LPCWSTR lpConsoleTitle)
|
||||
{
|
||||
return IntSetConsoleTitle(lpConsoleTitle, wcslen(lpConsoleTitle), TRUE);
|
||||
return IntSetConsoleTitle(lpConsoleTitle, TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1928,7 +1930,7 @@ BOOL
|
|||
WINAPI
|
||||
SetConsoleTitleA(LPCSTR lpConsoleTitle)
|
||||
{
|
||||
return IntSetConsoleTitle(lpConsoleTitle, strlen(lpConsoleTitle), FALSE);
|
||||
return IntSetConsoleTitle(lpConsoleTitle, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -52,12 +52,14 @@ IntCaptureMessageString(PCSR_CAPTURE_BUFFER CaptureBuffer,
|
|||
#endif
|
||||
|
||||
static VOID
|
||||
IntExpungeConsoleCommandHistory(LPCVOID lpExeName, DWORD dwNumChars, BOOLEAN bUnicode)
|
||||
IntExpungeConsoleCommandHistory(LPCVOID lpExeName, BOOLEAN bUnicode)
|
||||
{
|
||||
CONSOLE_API_MESSAGE ApiMessage;
|
||||
PCONSOLE_EXPUNGECOMMANDHISTORY ExpungeCommandHistoryRequest = &ApiMessage.Data.ExpungeCommandHistoryRequest;
|
||||
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
||||
|
||||
DWORD dwNumChars = (lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0);
|
||||
|
||||
if (lpExeName == NULL || dwNumChars == 0)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
|
@ -98,12 +100,14 @@ IntExpungeConsoleCommandHistory(LPCVOID lpExeName, DWORD dwNumChars, BOOLEAN bUn
|
|||
|
||||
|
||||
static DWORD
|
||||
IntGetConsoleCommandHistory(LPVOID lpHistory, DWORD cbHistory, LPCVOID lpExeName, DWORD dwNumChars, BOOLEAN bUnicode)
|
||||
IntGetConsoleCommandHistory(LPVOID lpHistory, DWORD cbHistory, LPCVOID lpExeName, BOOLEAN bUnicode)
|
||||
{
|
||||
CONSOLE_API_MESSAGE ApiMessage;
|
||||
PCONSOLE_GETCOMMANDHISTORY GetCommandHistoryRequest = &ApiMessage.Data.GetCommandHistoryRequest;
|
||||
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
||||
|
||||
DWORD dwNumChars = (lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0);
|
||||
|
||||
if (lpExeName == NULL || dwNumChars == 0)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
|
@ -160,12 +164,14 @@ IntGetConsoleCommandHistory(LPVOID lpHistory, DWORD cbHistory, LPCVOID lpExeName
|
|||
|
||||
|
||||
static DWORD
|
||||
IntGetConsoleCommandHistoryLength(LPCVOID lpExeName, DWORD dwNumChars, BOOL bUnicode)
|
||||
IntGetConsoleCommandHistoryLength(LPCVOID lpExeName, BOOL bUnicode)
|
||||
{
|
||||
CONSOLE_API_MESSAGE ApiMessage;
|
||||
PCONSOLE_GETCOMMANDHISTORYLENGTH GetCommandHistoryLengthRequest = &ApiMessage.Data.GetCommandHistoryLengthRequest;
|
||||
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
||||
|
||||
DWORD dwNumChars = (lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0);
|
||||
|
||||
if (lpExeName == NULL || dwNumChars == 0)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
|
@ -213,13 +219,14 @@ IntGetConsoleCommandHistoryLength(LPCVOID lpExeName, DWORD dwNumChars, BOOL bUni
|
|||
static BOOL
|
||||
IntSetConsoleNumberOfCommands(DWORD dwNumCommands,
|
||||
LPCVOID lpExeName,
|
||||
DWORD dwNumChars,
|
||||
BOOLEAN bUnicode)
|
||||
{
|
||||
CONSOLE_API_MESSAGE ApiMessage;
|
||||
PCONSOLE_SETHISTORYNUMBERCOMMANDS SetHistoryNumberCommandsRequest = &ApiMessage.Data.SetHistoryNumberCommandsRequest;
|
||||
PCSR_CAPTURE_BUFFER CaptureBuffer;
|
||||
|
||||
DWORD dwNumChars = (lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0);
|
||||
|
||||
if (lpExeName == NULL || dwNumChars == 0)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
|
@ -274,13 +281,7 @@ VOID
|
|||
WINAPI
|
||||
ExpungeConsoleCommandHistoryW(LPCWSTR lpExeName)
|
||||
{
|
||||
if (lpExeName == NULL)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return;
|
||||
}
|
||||
|
||||
IntExpungeConsoleCommandHistory(lpExeName, wcslen(lpExeName), TRUE);
|
||||
IntExpungeConsoleCommandHistory(lpExeName, TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -291,13 +292,7 @@ VOID
|
|||
WINAPI
|
||||
ExpungeConsoleCommandHistoryA(LPCSTR lpExeName)
|
||||
{
|
||||
if (lpExeName == NULL)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return;
|
||||
}
|
||||
|
||||
IntExpungeConsoleCommandHistory(lpExeName, strlen(lpExeName), FALSE);
|
||||
IntExpungeConsoleCommandHistory(lpExeName, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -310,13 +305,7 @@ GetConsoleCommandHistoryW(LPWSTR lpHistory,
|
|||
DWORD cbHistory,
|
||||
LPCWSTR lpExeName)
|
||||
{
|
||||
if (lpExeName == NULL)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return IntGetConsoleCommandHistory(lpHistory, cbHistory, lpExeName, wcslen(lpExeName), TRUE);
|
||||
return IntGetConsoleCommandHistory(lpHistory, cbHistory, lpExeName, TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -329,13 +318,7 @@ GetConsoleCommandHistoryA(LPSTR lpHistory,
|
|||
DWORD cbHistory,
|
||||
LPCSTR lpExeName)
|
||||
{
|
||||
if (lpExeName == NULL)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return IntGetConsoleCommandHistory(lpHistory, cbHistory, lpExeName, strlen(lpExeName), FALSE);
|
||||
return IntGetConsoleCommandHistory(lpHistory, cbHistory, lpExeName, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -346,13 +329,7 @@ DWORD
|
|||
WINAPI
|
||||
GetConsoleCommandHistoryLengthW(LPCWSTR lpExeName)
|
||||
{
|
||||
if (lpExeName == NULL)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return IntGetConsoleCommandHistoryLength(lpExeName, wcslen(lpExeName), TRUE);
|
||||
return IntGetConsoleCommandHistoryLength(lpExeName, TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -363,13 +340,7 @@ DWORD
|
|||
WINAPI
|
||||
GetConsoleCommandHistoryLengthA(LPCSTR lpExeName)
|
||||
{
|
||||
if (lpExeName == NULL)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return IntGetConsoleCommandHistoryLength(lpExeName, strlen(lpExeName), FALSE);
|
||||
return IntGetConsoleCommandHistoryLength(lpExeName, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -381,13 +352,7 @@ WINAPI
|
|||
SetConsoleNumberOfCommandsW(DWORD dwNumCommands,
|
||||
LPCWSTR lpExeName)
|
||||
{
|
||||
if (lpExeName == NULL)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return IntSetConsoleNumberOfCommands(dwNumCommands, lpExeName, wcslen(lpExeName), TRUE);
|
||||
return IntSetConsoleNumberOfCommands(dwNumCommands, lpExeName, TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -399,13 +364,7 @@ WINAPI
|
|||
SetConsoleNumberOfCommandsA(DWORD dwNumCommands,
|
||||
LPCSTR lpExeName)
|
||||
{
|
||||
if (lpExeName == NULL)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return IntSetConsoleNumberOfCommands(dwNumCommands, lpExeName, strlen(lpExeName), FALSE);
|
||||
return IntSetConsoleNumberOfCommands(dwNumCommands, lpExeName, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue