Author: hbelusca Date: Mon Aug 4 17:13:43 2014 New Revision: 63804
URL: http://svn.reactos.org/svn/reactos?rev=63804&view=rev Log: [KERNEL32][CONSRV] Fix few MSVC dword -> short warnings (basically). Thanks GCC for not having noticed them...
Modified: branches/condrv_restructure/dll/win32/kernel32/client/console/alias.c branches/condrv_restructure/dll/win32/kernel32/client/console/console.c branches/condrv_restructure/dll/win32/kernel32/client/console/history.c branches/condrv_restructure/include/reactos/subsys/win/conmsg.h branches/condrv_restructure/win32ss/user/winsrv/consrv/include/conio.h
Modified: branches/condrv_restructure/dll/win32/kernel32/client/console/alias.c URL: http://svn.reactos.org/svn/reactos/branches/condrv_restructure/dll/win32/ker... ============================================================================== --- branches/condrv_restructure/dll/win32/kernel32/client/console/alias.c [iso-8859-1] (original) +++ branches/condrv_restructure/dll/win32/kernel32/client/console/alias.c [iso-8859-1] Mon Aug 4 17:13:43 2014 @@ -20,9 +20,9 @@
static BOOL IntAddConsoleAlias(LPCVOID Source, - DWORD SourceBufferLength, + USHORT SourceBufferLength, LPCVOID Target, - DWORD TargetBufferLength, + USHORT TargetBufferLength, LPCVOID lpExeName, BOOLEAN bUnicode) { @@ -31,9 +31,9 @@ PCSR_CAPTURE_BUFFER CaptureBuffer; ULONG CapturedStrings;
- DWORD dwNumChars = (lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0); - - if (lpExeName == NULL || dwNumChars == 0) + USHORT NumChars = (USHORT)(lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0); + + if (lpExeName == NULL || NumChars == 0) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; @@ -43,7 +43,7 @@
/* 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;
@@ -120,9 +120,8 @@ 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); @@ -145,9 +144,8 @@ 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); @@ -163,9 +161,9 @@
static DWORD IntGetConsoleAlias(LPVOID Source, - DWORD SourceBufferLength, + USHORT SourceBufferLength, LPVOID Target, - DWORD TargetBufferLength, + USHORT TargetBufferLength, LPVOID lpExeName, BOOLEAN bUnicode) { @@ -173,7 +171,7 @@ 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) { @@ -181,7 +179,7 @@ return 0; }
- if (lpExeName == NULL || dwNumChars == 0) + if (lpExeName == NULL || NumChars == 0) { SetLastError(ERROR_INVALID_PARAMETER); return 0; @@ -191,7 +189,7 @@
/* 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;
@@ -240,9 +238,9 @@ }
/* 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); @@ -265,7 +263,7 @@ lpSource, lpExeName);
return IntGetConsoleAlias(lpSource, - wcslen(lpSource) * sizeof(WCHAR), + (USHORT)wcslen(lpSource) * sizeof(WCHAR), lpTargetBuffer, TargetBufferLength, lpExeName, @@ -287,7 +285,7 @@ lpSource, lpExeName);
return IntGetConsoleAlias(lpSource, - strlen(lpSource) * sizeof(CHAR), + (USHORT)strlen(lpSource) * sizeof(CHAR), lpTargetBuffer, TargetBufferLength, lpExeName, @@ -305,9 +303,9 @@ PCONSOLE_GETALLALIASES GetAllAliasesRequest = &ApiMessage.Data.GetAllAliasesRequest; PCSR_CAPTURE_BUFFER CaptureBuffer;
- DWORD dwNumChars = (lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0); - - if (lpExeName == NULL || dwNumChars == 0) + USHORT NumChars = (USHORT)(lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0); + + if (lpExeName == NULL || NumChars == 0) { SetLastError(ERROR_INVALID_PARAMETER); return 0; @@ -316,7 +314,7 @@ 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;
@@ -354,9 +352,9 @@ }
/* 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); @@ -410,16 +408,16 @@ PCONSOLE_GETALLALIASESLENGTH GetAllAliasesLengthRequest = &ApiMessage.Data.GetAllAliasesLengthRequest; PCSR_CAPTURE_BUFFER CaptureBuffer;
- DWORD dwNumChars = (lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0); - - if (lpExeName == NULL || dwNumChars == 0) + USHORT NumChars = (USHORT)(lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 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;
@@ -511,9 +509,9 @@ return 0; }
- memcpy(lpExeNameBuffer, - GetAliasesExesRequest->ExeNames, - GetAliasesExesRequest->Length); + RtlCopyMemory(lpExeNameBuffer, + GetAliasesExesRequest->ExeNames, + GetAliasesExesRequest->Length);
CsrFreeCaptureBuffer(CaptureBuffer);
Modified: branches/condrv_restructure/dll/win32/kernel32/client/console/console.c URL: http://svn.reactos.org/svn/reactos/branches/condrv_restructure/dll/win32/ker... ============================================================================== --- branches/condrv_restructure/dll/win32/kernel32/client/console/console.c [iso-8859-1] (original) +++ branches/condrv_restructure/dll/win32/kernel32/client/console/console.c [iso-8859-1] Mon Aug 4 17:13:43 2014 @@ -1887,10 +1887,10 @@ PCONSOLE_GETSETCONSOLETITLE TitleRequest = &ApiMessage.Data.TitleRequest; PCSR_CAPTURE_BUFFER CaptureBuffer;
- DWORD dwNumChars = (lpConsoleTitle ? (bUnicode ? wcslen(lpConsoleTitle) : strlen(lpConsoleTitle)) : 0); + ULONG NumChars = (ULONG)(lpConsoleTitle ? (bUnicode ? wcslen(lpConsoleTitle) : strlen(lpConsoleTitle)) : 0);
TitleRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; - TitleRequest->Length = dwNumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); + TitleRequest->Length = NumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); TitleRequest->Unicode = bUnicode;
CaptureBuffer = CsrAllocateCaptureBuffer(1, TitleRequest->Length);
Modified: branches/condrv_restructure/dll/win32/kernel32/client/console/history.c URL: http://svn.reactos.org/svn/reactos/branches/condrv_restructure/dll/win32/ker... ============================================================================== --- branches/condrv_restructure/dll/win32/kernel32/client/console/history.c [iso-8859-1] (original) +++ branches/condrv_restructure/dll/win32/kernel32/client/console/history.c [iso-8859-1] Mon Aug 4 17:13:43 2014 @@ -58,16 +58,16 @@ PCONSOLE_EXPUNGECOMMANDHISTORY ExpungeCommandHistoryRequest = &ApiMessage.Data.ExpungeCommandHistoryRequest; PCSR_CAPTURE_BUFFER CaptureBuffer;
- DWORD dwNumChars = (lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0); - - if (lpExeName == NULL || dwNumChars == 0) + USHORT NumChars = (USHORT)(lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0); + + if (lpExeName == NULL || NumChars == 0) { SetLastError(ERROR_INVALID_PARAMETER); return; }
ExpungeCommandHistoryRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; - ExpungeCommandHistoryRequest->ExeLength = dwNumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); + ExpungeCommandHistoryRequest->ExeLength = NumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); ExpungeCommandHistoryRequest->Unicode = ExpungeCommandHistoryRequest->Unicode2 = bUnicode;
@@ -106,9 +106,9 @@ PCONSOLE_GETCOMMANDHISTORY GetCommandHistoryRequest = &ApiMessage.Data.GetCommandHistoryRequest; PCSR_CAPTURE_BUFFER CaptureBuffer;
- DWORD dwNumChars = (lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0); - - if (lpExeName == NULL || dwNumChars == 0) + USHORT NumChars = (USHORT)(lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0); + + if (lpExeName == NULL || NumChars == 0) { SetLastError(ERROR_INVALID_PARAMETER); return 0; @@ -116,7 +116,7 @@
GetCommandHistoryRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; GetCommandHistoryRequest->HistoryLength = cbHistory; - GetCommandHistoryRequest->ExeLength = dwNumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); + GetCommandHistoryRequest->ExeLength = NumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); GetCommandHistoryRequest->Unicode = GetCommandHistoryRequest->Unicode2 = bUnicode;
@@ -153,9 +153,9 @@ return 0; }
- memcpy(lpHistory, - GetCommandHistoryRequest->History, - GetCommandHistoryRequest->HistoryLength); + RtlCopyMemory(lpHistory, + GetCommandHistoryRequest->History, + GetCommandHistoryRequest->HistoryLength);
CsrFreeCaptureBuffer(CaptureBuffer);
@@ -170,16 +170,16 @@ PCONSOLE_GETCOMMANDHISTORYLENGTH GetCommandHistoryLengthRequest = &ApiMessage.Data.GetCommandHistoryLengthRequest; PCSR_CAPTURE_BUFFER CaptureBuffer;
- DWORD dwNumChars = (lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0); - - if (lpExeName == NULL || dwNumChars == 0) + USHORT NumChars = (USHORT)(lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0); + + if (lpExeName == NULL || NumChars == 0) { SetLastError(ERROR_INVALID_PARAMETER); return 0; }
GetCommandHistoryLengthRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; - GetCommandHistoryLengthRequest->ExeLength = dwNumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); + GetCommandHistoryLengthRequest->ExeLength = NumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); GetCommandHistoryLengthRequest->Unicode = GetCommandHistoryLengthRequest->Unicode2 = bUnicode;
@@ -225,9 +225,9 @@ PCONSOLE_SETHISTORYNUMBERCOMMANDS SetHistoryNumberCommandsRequest = &ApiMessage.Data.SetHistoryNumberCommandsRequest; PCSR_CAPTURE_BUFFER CaptureBuffer;
- DWORD dwNumChars = (lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0); - - if (lpExeName == NULL || dwNumChars == 0) + USHORT NumChars = (USHORT)(lpExeName ? (bUnicode ? wcslen(lpExeName) : strlen(lpExeName)) : 0); + + if (lpExeName == NULL || NumChars == 0) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; @@ -235,7 +235,7 @@
SetHistoryNumberCommandsRequest->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; SetHistoryNumberCommandsRequest->NumCommands = dwNumCommands; - SetHistoryNumberCommandsRequest->ExeLength = dwNumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); + SetHistoryNumberCommandsRequest->ExeLength = NumChars * (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); SetHistoryNumberCommandsRequest->Unicode = SetHistoryNumberCommandsRequest->Unicode2 = bUnicode;
Modified: branches/condrv_restructure/include/reactos/subsys/win/conmsg.h URL: http://svn.reactos.org/svn/reactos/branches/condrv_restructure/include/react... ============================================================================== --- branches/condrv_restructure/include/reactos/subsys/win/conmsg.h [iso-8859-1] (original) +++ branches/condrv_restructure/include/reactos/subsys/win/conmsg.h [iso-8859-1] Mon Aug 4 17:13:43 2014 @@ -422,7 +422,7 @@ typedef struct { HANDLE ConsoleHandle; - DWORD Length; + ULONG Length; PVOID Title; BOOLEAN Unicode; } CONSOLE_GETSETCONSOLETITLE, *PCONSOLE_GETSETCONSOLETITLE;
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/include/conio.h URL: http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user/... ============================================================================== --- branches/condrv_restructure/win32ss/user/winsrv/consrv/include/conio.h [iso-8859-1] (original) +++ branches/condrv_restructure/win32ss/user/winsrv/consrv/include/conio.h [iso-8859-1] Mon Aug 4 17:13:43 2014 @@ -284,9 +284,9 @@
/** Put those things in TEXTMODE_SCREEN_BUFFER ?? **/ PWCHAR LineBuffer; /* Current line being input, in line buffered mode */ - WORD LineMaxSize; /* Maximum size of line in characters (including CR+LF) */ - WORD LineSize; /* Current size of line */ - WORD LinePos; /* Current position within line */ + ULONG LineMaxSize; /* Maximum size of line in characters (including CR+LF) */ + ULONG LineSize; /* Current size of line */ + ULONG LinePos; /* Current position within line */ BOOLEAN LineComplete; /* User pressed enter, ready to send back to client */ BOOLEAN LineUpPressed; BOOLEAN LineInsertToggle; /* Replace character over cursor instead of inserting */