static BOOL
IntAddConsoleAlias(LPCVOID Source,
- DWORD SourceBufferLength,
+ USHORT SourceBufferLength,
LPCVOID Target,
- DWORD TargetBufferLength,
+ USHORT TargetBufferLength,
LPCVOID lpExeName,
BOOLEAN bUnicode)
{
PCSR_CAPTURE_BUFFER CaptureBuffer;
ULONG CapturedStrings;
- DWORD dwNumChars = (lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0);
+ USHORT NumChars = (USHORT)(lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0);
- if (lpExeName == NULL || dwNumChars == 0)
+ if (lpExeName == NULL || NumChars == 0)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
/* Determine the needed sizes */
ConsoleAliasRequest->SourceLength = SourceBufferLength;
- ConsoleAliasRequest->ExeLength = dwNumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
+ ConsoleAliasRequest->ExeLength = NumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
ConsoleAliasRequest->Unicode =
ConsoleAliasRequest->Unicode2 = bUnicode;
LPCWSTR lpTarget,
LPCWSTR lpExeName)
{
- DWORD SourceBufferLength, TargetBufferLength;
- SourceBufferLength = wcslen(lpSource) * sizeof(WCHAR);
- TargetBufferLength = (lpTarget ? wcslen(lpTarget) * sizeof(WCHAR) : 0);
+ USHORT SourceBufferLength = (USHORT)wcslen(lpSource) * sizeof(WCHAR);
+ USHORT TargetBufferLength = (USHORT)(lpTarget ? wcslen(lpTarget) * sizeof(WCHAR) : 0);
DPRINT1("AddConsoleAliasW entered with lpSource '%S' lpTarget '%S' lpExeName '%S'\n",
lpSource, lpTarget, lpExeName);
LPCSTR lpTarget,
LPCSTR lpExeName)
{
- DWORD SourceBufferLength, TargetBufferLength;
- SourceBufferLength = strlen(lpSource) * sizeof(CHAR);
- TargetBufferLength = (lpTarget ? strlen(lpTarget) * sizeof(CHAR) : 0);
+ USHORT SourceBufferLength = (USHORT)strlen(lpSource) * sizeof(CHAR);
+ USHORT TargetBufferLength = (USHORT)(lpTarget ? strlen(lpTarget) * sizeof(CHAR) : 0);
DPRINT1("AddConsoleAliasA entered with lpSource '%s' lpTarget '%s' lpExeName '%s'\n",
lpSource, lpTarget, lpExeName);
static DWORD
IntGetConsoleAlias(LPVOID Source,
- DWORD SourceBufferLength,
+ USHORT SourceBufferLength,
LPVOID Target,
- DWORD TargetBufferLength,
+ USHORT TargetBufferLength,
LPVOID lpExeName,
BOOLEAN bUnicode)
{
PCONSOLE_ADDGETALIAS ConsoleAliasRequest = &ApiMessage.Data.ConsoleAliasRequest;
PCSR_CAPTURE_BUFFER CaptureBuffer;
- DWORD dwNumChars = (lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0);
+ USHORT NumChars = (USHORT)(lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0);
if (Source == NULL || Target == NULL)
{
return 0;
}
- if (lpExeName == NULL || dwNumChars == 0)
+ if (lpExeName == NULL || NumChars == 0)
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
/* Determine the needed sizes */
ConsoleAliasRequest->SourceLength = SourceBufferLength;
- ConsoleAliasRequest->ExeLength = dwNumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
+ ConsoleAliasRequest->ExeLength = NumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
ConsoleAliasRequest->Unicode =
ConsoleAliasRequest->Unicode2 = bUnicode;
}
/* Copy the returned target string into the user buffer */
- memcpy(Target,
- ConsoleAliasRequest->Target,
- ConsoleAliasRequest->TargetLength);
+ RtlCopyMemory(Target,
+ ConsoleAliasRequest->Target,
+ ConsoleAliasRequest->TargetLength);
/* Release the capture buffer and exit */
CsrFreeCaptureBuffer(CaptureBuffer);
lpSource, lpExeName);
return IntGetConsoleAlias(lpSource,
- wcslen(lpSource) * sizeof(WCHAR),
+ (USHORT)wcslen(lpSource) * sizeof(WCHAR),
lpTargetBuffer,
TargetBufferLength,
lpExeName,
lpSource, lpExeName);
return IntGetConsoleAlias(lpSource,
- strlen(lpSource) * sizeof(CHAR),
+ (USHORT)strlen(lpSource) * sizeof(CHAR),
lpTargetBuffer,
TargetBufferLength,
lpExeName,
PCONSOLE_GETALLALIASES GetAllAliasesRequest = &ApiMessage.Data.GetAllAliasesRequest;
PCSR_CAPTURE_BUFFER CaptureBuffer;
- DWORD dwNumChars = (lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0);
+ USHORT NumChars = (USHORT)(lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0);
- if (lpExeName == NULL || dwNumChars == 0)
+ if (lpExeName == NULL || NumChars == 0)
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
GetAllAliasesRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle;
/* Determine the needed sizes */
- GetAllAliasesRequest->ExeLength = dwNumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
+ GetAllAliasesRequest->ExeLength = NumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
GetAllAliasesRequest->Unicode =
GetAllAliasesRequest->Unicode2 = bUnicode;
}
/* Copy the returned aliases string into the user buffer */
- memcpy(AliasBuffer,
- GetAllAliasesRequest->AliasesBuffer,
- GetAllAliasesRequest->AliasesBufferLength);
+ RtlCopyMemory(AliasBuffer,
+ GetAllAliasesRequest->AliasesBuffer,
+ GetAllAliasesRequest->AliasesBufferLength);
/* Release the capture buffer and exit */
CsrFreeCaptureBuffer(CaptureBuffer);
PCONSOLE_GETALLALIASESLENGTH GetAllAliasesLengthRequest = &ApiMessage.Data.GetAllAliasesLengthRequest;
PCSR_CAPTURE_BUFFER CaptureBuffer;
- DWORD dwNumChars = (lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0);
+ USHORT NumChars = (USHORT)(lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0);
- if (lpExeName == NULL || dwNumChars == 0)
+ if (lpExeName == NULL || NumChars == 0)
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
GetAllAliasesLengthRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle;
- GetAllAliasesLengthRequest->ExeLength = dwNumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
+ GetAllAliasesLengthRequest->ExeLength = NumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR));
GetAllAliasesLengthRequest->Unicode =
GetAllAliasesLengthRequest->Unicode2 = bUnicode;
return 0;
}
- memcpy(lpExeNameBuffer,
- GetAliasesExesRequest->ExeNames,
- GetAliasesExesRequest->Length);
+ RtlCopyMemory(lpExeNameBuffer,
+ GetAliasesExesRequest->ExeNames,
+ GetAliasesExesRequest->Length);
CsrFreeCaptureBuffer(CaptureBuffer);