[REACTOS] Fix SIZE_T related warnings

This commit is contained in:
Timo Kreuzer 2019-05-26 15:00:21 +02:00
parent 826704ba6b
commit 7611cc2b12
21 changed files with 103 additions and 46 deletions

View file

@ -1688,7 +1688,7 @@ main (
) )
{ {
//ULONG Flags = 0; //ULONG Flags = 0;
int i; intptr_t i;
uintptr_t j; uintptr_t j;
char a; char a;
int bus_id = -1; int bus_id = -1;

View file

@ -894,7 +894,7 @@ static void delete_stat_item(int n)
static char *ReadConversion(const char *formula) static char *ReadConversion(const char *formula)
{ {
int len = strlen(formula); intptr_t len = strlen(formula);
char *str = (char *)malloc(len+3); char *str = (char *)malloc(len+3);
if (str == NULL) if (str == NULL)

View file

@ -187,7 +187,7 @@ GetAutostartEntriesFromRegistry ( HKEY hRootKey, TCHAR* KeyName )
SendMessage(hStartupListCtrl, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item); SendMessage(hStartupListCtrl, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);
} }
switch (PtrToLong(hRootKey)) switch ((ULONG_PTR)hRootKey)
{ {
case (ULONG_PTR)HKEY_LOCAL_MACHINE: case (ULONG_PTR)HKEY_LOCAL_MACHINE:
_tcscpy(Path, _T("HKLM\\\0")); _tcscpy(Path, _T("HKLM\\\0"));

View file

@ -52,7 +52,7 @@ FileQueryFiles(IN LPCWSTR Path,
WIN32_FIND_DATAW find_data; WIN32_FIND_DATAW find_data;
LPWSTR lpszQuery; LPWSTR lpszQuery;
DWORD dwNumOfChars; SIZE_T dwNumOfChars;
LPWSTR lpszExpandedQuery; LPWSTR lpszExpandedQuery;
HANDLE search; HANDLE search;
@ -93,7 +93,7 @@ FileQueryFiles(IN LPCWSTR Path,
BOOL BackupIniFile(IN LPCWSTR lpszIniFile) BOOL BackupIniFile(IN LPCWSTR lpszIniFile)
{ {
BOOL Success = FALSE; BOOL Success = FALSE;
DWORD dwNumOfChars = 0; SIZE_T dwNumOfChars = 0;
LPWSTR SourceFile, DestFile; LPWSTR SourceFile, DestFile;
LPWSTR lpName, lpPath; LPWSTR lpName, lpPath;

View file

@ -31,7 +31,7 @@ MemFree(IN PVOID lpMem)
PVOID PVOID
MemAlloc(IN DWORD dwFlags, MemAlloc(IN DWORD dwFlags,
IN DWORD dwBytes) IN SIZE_T dwBytes)
{ {
/* Allocate memory from the heap */ /* Allocate memory from the heap */
return HeapAlloc(g_hHeap, dwFlags, dwBytes); return HeapAlloc(g_hHeap, dwFlags, dwBytes);

View file

@ -25,7 +25,7 @@ MemFree(IN PVOID lpMem);
PVOID PVOID
MemAlloc(IN DWORD dwFlags, MemAlloc(IN DWORD dwFlags,
IN DWORD dwBytes); IN SIZE_T dwBytes);
LPWSTR LPWSTR
FormatDateTime(IN LPSYSTEMTIME pDateTime); FormatDateTime(IN LPSYSTEMTIME pDateTime);

View file

@ -560,7 +560,7 @@ SaveSettings(VOID)
Settings.wpPos.rcNormalPosition.bottom, Settings.wpPos.rcNormalPosition.bottom,
Settings.wpPos.showCmd); Settings.wpPos.showCmd);
dwSize = wcslen(buffer) * sizeof(WCHAR); dwSize = (DWORD)(wcslen(buffer) * sizeof(WCHAR));
RegSetValueExW(hKeyEventVwr, L"Window", 0, REG_SZ, (LPBYTE)buffer, dwSize); RegSetValueExW(hKeyEventVwr, L"Window", 0, REG_SZ, (LPBYTE)buffer, dwSize);
Quit: Quit:
@ -1173,9 +1173,9 @@ FormatInteger(LONGLONG Num, LPWSTR pwszResult, UINT cchResultMax)
UINT UINT
FormatByteSize(LONGLONG cbSize, LPWSTR pwszResult, UINT cchResultMax) FormatByteSize(LONGLONG cbSize, LPWSTR pwszResult, UINT cchResultMax)
{ {
INT cchWritten; UINT cchWritten, cchRemaining;
LPWSTR pwszEnd; LPWSTR pwszEnd;
size_t cchRemaining; size_t cchStringRemaining;
/* Write formated bytes count */ /* Write formated bytes count */
cchWritten = FormatInteger(cbSize, pwszResult, cchResultMax); cchWritten = FormatInteger(cbSize, pwszResult, cchResultMax);
@ -1185,7 +1185,8 @@ FormatByteSize(LONGLONG cbSize, LPWSTR pwszResult, UINT cchResultMax)
/* Copy " bytes" to buffer */ /* Copy " bytes" to buffer */
pwszEnd = pwszResult + cchWritten; pwszEnd = pwszResult + cchWritten;
cchRemaining = cchResultMax - cchWritten; cchRemaining = cchResultMax - cchWritten;
StringCchCopyExW(pwszEnd, cchRemaining, L" ", &pwszEnd, &cchRemaining, 0); StringCchCopyExW(pwszEnd, cchRemaining, L" ", &pwszEnd, &cchStringRemaining, 0);
cchRemaining = (UINT)cchStringRemaining;
cchWritten = LoadStringW(hInst, IDS_BYTES_FORMAT, pwszEnd, cchRemaining); cchWritten = LoadStringW(hInst, IDS_BYTES_FORMAT, pwszEnd, cchRemaining);
cchRemaining -= cchWritten; cchRemaining -= cchWritten;
@ -1195,9 +1196,9 @@ FormatByteSize(LONGLONG cbSize, LPWSTR pwszResult, UINT cchResultMax)
LPWSTR LPWSTR
FormatFileSizeWithBytes(const PULARGE_INTEGER lpQwSize, LPWSTR pwszResult, UINT cchResultMax) FormatFileSizeWithBytes(const PULARGE_INTEGER lpQwSize, LPWSTR pwszResult, UINT cchResultMax)
{ {
UINT cchWritten; UINT cchWritten, cchRemaining;
LPWSTR pwszEnd; LPWSTR pwszEnd;
size_t cchRemaining; size_t cchCopyRemaining;
/* Format bytes in KBs, MBs etc */ /* Format bytes in KBs, MBs etc */
if (StrFormatByteSizeW(lpQwSize->QuadPart, pwszResult, cchResultMax) == NULL) if (StrFormatByteSizeW(lpQwSize->QuadPart, pwszResult, cchResultMax) == NULL)
@ -1208,10 +1209,11 @@ FormatFileSizeWithBytes(const PULARGE_INTEGER lpQwSize, LPWSTR pwszResult, UINT
return pwszResult; return pwszResult;
/* Concatenate " (" */ /* Concatenate " (" */
cchWritten = wcslen(pwszResult); cchWritten = (UINT)wcslen(pwszResult);
pwszEnd = pwszResult + cchWritten; pwszEnd = pwszResult + cchWritten;
cchRemaining = cchResultMax - cchWritten; cchRemaining = cchResultMax - cchWritten;
StringCchCopyExW(pwszEnd, cchRemaining, L" (", &pwszEnd, &cchRemaining, 0); StringCchCopyExW(pwszEnd, cchRemaining, L" (", &pwszEnd, &cchCopyRemaining, 0);
cchRemaining = (UINT)cchCopyRemaining;
/* Write formated bytes count */ /* Write formated bytes count */
cchWritten = FormatByteSize(lpQwSize->QuadPart, pwszEnd, cchRemaining); cchWritten = FormatByteSize(lpQwSize->QuadPart, pwszEnd, cchRemaining);
@ -1231,7 +1233,8 @@ GetFileTimeString(LPFILETIME lpFileTime, LPWSTR pwszResult, UINT cchResult)
FILETIME ft; FILETIME ft;
SYSTEMTIME st; SYSTEMTIME st;
int cchWritten; int cchWritten;
size_t cchRemaining = cchResult; UINT cchRemaining = cchResult;
size_t cchCopyRemaining;
LPWSTR pwszEnd = pwszResult; LPWSTR pwszEnd = pwszResult;
if (!FileTimeToLocalFileTime(lpFileTime, &ft) || !FileTimeToSystemTime(&ft, &st)) if (!FileTimeToLocalFileTime(lpFileTime, &ft) || !FileTimeToSystemTime(&ft, &st))
@ -1246,7 +1249,8 @@ GetFileTimeString(LPFILETIME lpFileTime, LPWSTR pwszResult, UINT cchResult)
cchRemaining -= cchWritten; cchRemaining -= cchWritten;
pwszEnd += cchWritten; pwszEnd += cchWritten;
StringCchCopyExW(pwszEnd, cchRemaining, L", ", &pwszEnd, &cchRemaining, 0); StringCchCopyExW(pwszEnd, cchRemaining, L", ", &pwszEnd, &cchCopyRemaining, 0);
cchRemaining = (UINT)cchCopyRemaining;
cchWritten = GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &st, NULL, pwszEnd, cchRemaining); cchWritten = GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &st, NULL, pwszEnd, cchRemaining);
if (cchWritten) if (cchWritten)
@ -1294,7 +1298,7 @@ AllocEventLog(IN PCWSTR ComputerName OPTIONAL,
IN BOOL Permanent) IN BOOL Permanent)
{ {
PEVENTLOG EventLog; PEVENTLOG EventLog;
UINT cchName; SIZE_T cchName;
/* Allocate a new event log entry */ /* Allocate a new event log entry */
EventLog = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*EventLog)); EventLog = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*EventLog));
@ -1467,7 +1471,7 @@ GetExpandedFilePathName(
OUT LPWSTR lpFullFileName OPTIONAL, OUT LPWSTR lpFullFileName OPTIONAL,
IN DWORD nSize) IN DWORD nSize)
{ {
DWORD dwLength; SIZE_T dwLength;
/* Determine the needed size after expansion of any environment strings */ /* Determine the needed size after expansion of any environment strings */
dwLength = ExpandEnvironmentStringsW(lpFileName, NULL, 0); dwLength = ExpandEnvironmentStringsW(lpFileName, NULL, 0);

View file

@ -505,7 +505,7 @@ AddDisplayDevice(PINFO pInfo, PDISPLAY_DEVICEW DisplayDevice)
LPWSTR name = NULL; LPWSTR name = NULL;
LPWSTR key = NULL; LPWSTR key = NULL;
LPWSTR devid = NULL; LPWSTR devid = NULL;
DWORD descriptionSize, nameSize, keySize, devidSize; SIZE_T descriptionSize, nameSize, keySize, devidSize;
PSETTINGS_ENTRY Current; PSETTINGS_ENTRY Current;
DWORD ResolutionsCount = 1; DWORD ResolutionsCount = 1;
DWORD i; DWORD i;

View file

@ -199,7 +199,8 @@ WriteRdpFile(HANDLE hFile,
PRDPSETTINGS pRdpSettings) PRDPSETTINGS pRdpSettings)
{ {
WCHAR line[MAXKEY + MAXVALUE + 4]; WCHAR line[MAXKEY + MAXVALUE + 4];
DWORD BytesToWrite, BytesWritten; SIZE_T BytesToWrite;
ULONG BytesWritten;
BOOL bRet; BOOL bRet;
INT i, k; INT i, k;

View file

@ -9,7 +9,7 @@ PCHAR *GetSubkeyNames( PCHAR MainKeyName, PCHAR Append ) {
DWORD Error; DWORD Error;
HKEY MainKey; HKEY MainKey;
PCHAR *Out, OutKeyName; PCHAR *Out, OutKeyName;
DWORD CharTotal = 0, AppendLen = 1 + strlen(Append); SIZE_T CharTotal = 0, AppendLen = 1 + strlen(Append);
DWORD MaxSubKeyLen = 0, MaxSubKeys = 0; DWORD MaxSubKeyLen = 0, MaxSubKeys = 0;
Error = RegOpenKey( HKEY_LOCAL_MACHINE, MainKeyName, &MainKey ); Error = RegOpenKey( HKEY_LOCAL_MACHINE, MainKeyName, &MainKey );

View file

@ -12,8 +12,13 @@ ssize_t send_packet( struct interface_info *ip,
struct in_addr addr, struct in_addr addr,
struct sockaddr_in *broadcast, struct sockaddr_in *broadcast,
struct hardware *hardware ) { struct hardware *hardware ) {
int result = int result;
sendto( ip->wfdesc, (char *)p, size, 0,
if (size > INT_MAX)
return WSAEMSGSIZE;
result =
sendto( ip->wfdesc, (char *)p, (int)size, 0,
(struct sockaddr *)broadcast, sizeof(*broadcast) ); (struct sockaddr *)broadcast, sizeof(*broadcast) );
if (result < 0) { if (result < 0) {
@ -32,8 +37,13 @@ ssize_t receive_packet(struct interface_info *ip,
struct sockaddr_in *dest, struct sockaddr_in *dest,
struct hardware *hardware ) { struct hardware *hardware ) {
int recv_addr_size = sizeof(*dest); int recv_addr_size = sizeof(*dest);
int result = int result;
recvfrom (ip -> rfdesc, (char *)packet_data, packet_len, 0,
if (packet_len > INT_MAX)
return WSAEMSGSIZE;
result =
recvfrom (ip -> rfdesc, (char *)packet_data, (int)packet_len, 0,
(struct sockaddr *)dest, &recv_addr_size ); (struct sockaddr *)dest, &recv_addr_size );
return result; return result;
} }

View file

@ -119,7 +119,7 @@ ArcGetNextTokenA(
{ {
NTSTATUS Status; NTSTATUS Status;
PCSTR p = ArcPath; PCSTR p = ArcPath;
ULONG SpecifierLength; SIZE_T SpecifierLength;
ULONG KeyValue; ULONG KeyValue;
/* /*
@ -133,6 +133,10 @@ ArcGetNextTokenA(
return NULL; /* Path starts with '(' and is thus invalid */ return NULL; /* Path starts with '(' and is thus invalid */
SpecifierLength = (p - ArcPath) * sizeof(CHAR); SpecifierLength = (p - ArcPath) * sizeof(CHAR);
if (SpecifierLength > MAXUSHORT)
{
return NULL;
}
/* /*
* The strtoul function skips any leading whitespace. * The strtoul function skips any leading whitespace.
@ -163,7 +167,7 @@ ArcGetNextTokenA(
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return NULL; return NULL;
TokenSpecifier->Length = strlen(TokenSpecifier->Buffer) * sizeof(CHAR); TokenSpecifier->Length = (USHORT)SpecifierLength;
/* We succeeded, return the token key value */ /* We succeeded, return the token key value */
*Key = KeyValue; *Key = KeyValue;
@ -180,7 +184,7 @@ ArcGetNextTokenU(
{ {
NTSTATUS Status; NTSTATUS Status;
PCWSTR p = ArcPath; PCWSTR p = ArcPath;
ULONG SpecifierLength; SIZE_T SpecifierLength;
ULONG KeyValue; ULONG KeyValue;
/* /*
@ -194,6 +198,10 @@ ArcGetNextTokenU(
return NULL; /* Path starts with '(' and is thus invalid */ return NULL; /* Path starts with '(' and is thus invalid */
SpecifierLength = (p - ArcPath) * sizeof(WCHAR); SpecifierLength = (p - ArcPath) * sizeof(WCHAR);
if (SpecifierLength > UNICODE_STRING_MAX_BYTES)
{
return NULL;
}
++p; ++p;
@ -226,7 +234,7 @@ ArcGetNextTokenU(
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return NULL; return NULL;
TokenSpecifier->Length = wcslen(TokenSpecifier->Buffer) * sizeof(WCHAR); TokenSpecifier->Length = (USHORT)SpecifierLength;
/* We succeeded, return the token key value */ /* We succeeded, return the token key value */
*Key = KeyValue; *Key = KeyValue;
@ -308,6 +316,7 @@ ArcPathNormalize(
NTSTATUS Status; NTSTATUS Status;
PCWSTR EndOfArcName; PCWSTR EndOfArcName;
PCWSTR p; PCWSTR p;
SIZE_T PathLength;
if (NormalizedArcPath->MaximumLength < sizeof(UNICODE_NULL)) if (NormalizedArcPath->MaximumLength < sizeof(UNICODE_NULL))
return FALSE; return FALSE;
@ -350,7 +359,13 @@ ArcPathNormalize(
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return FALSE; return FALSE;
NormalizedArcPath->Length = wcslen(NormalizedArcPath->Buffer) * sizeof(WCHAR); PathLength = wcslen(NormalizedArcPath->Buffer);
if (PathLength > UNICODE_STRING_MAX_CHARS)
{
return FALSE;
}
NormalizedArcPath->Length = (USHORT)PathLength * sizeof(WCHAR);
return TRUE; return TRUE;
} }
@ -685,6 +700,7 @@ ResolveArcNameManually(
CONTROLLER_TYPE ControllerType; CONTROLLER_TYPE ControllerType;
PERIPHERAL_TYPE PeripheralType; PERIPHERAL_TYPE PeripheralType;
BOOLEAN UseSignature; BOOLEAN UseSignature;
SIZE_T NameLength;
PDISKENTRY DiskEntry; PDISKENTRY DiskEntry;
PPARTENTRY PartEntry = NULL; PPARTENTRY PartEntry = NULL;
@ -787,7 +803,13 @@ ResolveArcNameManually(
} }
/* Update NtName length */ /* Update NtName length */
NtName->Length = wcslen(NtName->Buffer) * sizeof(WCHAR); NameLength = wcslen(NtName->Buffer);
if (NameLength > UNICODE_STRING_MAX_CHARS)
{
return STATUS_NAME_TOO_LONG;
}
NtName->Length = (USHORT)NameLength * sizeof(WCHAR);
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
@ -802,6 +824,7 @@ ArcPathToNtPath(
NTSTATUS Status; NTSTATUS Status;
PCWSTR BeginOfPath; PCWSTR BeginOfPath;
UNICODE_STRING ArcName; UNICODE_STRING ArcName;
SIZE_T PathLength;
/* TODO: We should "normalize" the path, i.e. expand all the xxx() into xxx(0) */ /* TODO: We should "normalize" the path, i.e. expand all the xxx() into xxx(0) */
@ -877,7 +900,14 @@ ArcPathToNtPath(
return FALSE; return FALSE;
} }
} }
NtPath->Length = wcslen(NtPath->Buffer) * sizeof(WCHAR);
PathLength = wcslen(NtPath->Buffer);
if (PathLength > UNICODE_STRING_MAX_CHARS)
{
return FALSE;
}
NtPath->Length = (USHORT)PathLength * sizeof(WCHAR);
return TRUE; return TRUE;
} }

View file

@ -39,7 +39,7 @@ NTAPI
CsrpConnectToServer(IN PWSTR ObjectDirectory) CsrpConnectToServer(IN PWSTR ObjectDirectory)
{ {
NTSTATUS Status; NTSTATUS Status;
ULONG PortNameLength; SIZE_T PortNameLength;
UNICODE_STRING PortName; UNICODE_STRING PortName;
LARGE_INTEGER CsrSectionViewSize; LARGE_INTEGER CsrSectionViewSize;
HANDLE CsrSectionHandle; HANDLE CsrSectionHandle;
@ -62,10 +62,15 @@ CsrpConnectToServer(IN PWSTR ObjectDirectory)
/* Calculate the total port name size */ /* Calculate the total port name size */
PortNameLength = ((wcslen(ObjectDirectory) + 1) * sizeof(WCHAR)) + PortNameLength = ((wcslen(ObjectDirectory) + 1) * sizeof(WCHAR)) +
sizeof(CSR_PORT_NAME); sizeof(CSR_PORT_NAME);
if (PortNameLength > UNICODE_STRING_MAX_BYTES)
{
DPRINT1("PortNameLength too big: %Iu", PortNameLength);
return STATUS_NAME_TOO_LONG;
}
/* Set the port name */ /* Set the port name */
PortName.Length = 0; PortName.Length = 0;
PortName.MaximumLength = PortNameLength; PortName.MaximumLength = (USHORT)PortNameLength;
/* Allocate a buffer for it */ /* Allocate a buffer for it */
PortName.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, PortNameLength); PortName.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, PortNameLength);
@ -366,11 +371,18 @@ CsrClientCallServer(IN OUT PCSR_API_MESSAGE ApiMessage,
ULONG PointerCount; ULONG PointerCount;
PULONG_PTR OffsetPointer; PULONG_PTR OffsetPointer;
/* Make sure the length is valid */
if (DataLength > (MAXSHORT - sizeof(CSR_API_MESSAGE)))
{
DPRINT1("DataLength too big: %lu", DataLength);
return STATUS_INVALID_PARAMETER;
}
/* Fill out the Port Message Header */ /* Fill out the Port Message Header */
ApiMessage->Header.u2.ZeroInit = 0; ApiMessage->Header.u2.ZeroInit = 0;
ApiMessage->Header.u1.s1.TotalLength = DataLength + ApiMessage->Header.u1.s1.TotalLength = (CSHORT)DataLength +
sizeof(CSR_API_MESSAGE) - sizeof(ApiMessage->Data); // FIELD_OFFSET(CSR_API_MESSAGE, Data) + DataLength; sizeof(CSR_API_MESSAGE) - sizeof(ApiMessage->Data); // FIELD_OFFSET(CSR_API_MESSAGE, Data) + DataLength;
ApiMessage->Header.u1.s1.DataLength = DataLength + ApiMessage->Header.u1.s1.DataLength = (CSHORT)DataLength +
FIELD_OFFSET(CSR_API_MESSAGE, Data) - sizeof(ApiMessage->Header); // ApiMessage->Header.u1.s1.TotalLength - sizeof(PORT_MESSAGE); FIELD_OFFSET(CSR_API_MESSAGE, Data) - sizeof(ApiMessage->Header); // ApiMessage->Header.u1.s1.TotalLength - sizeof(PORT_MESSAGE);
/* Fill out the CSR Header */ /* Fill out the CSR Header */

View file

@ -2365,7 +2365,7 @@ LdrpInitializeProcess(IN PCONTEXT Context,
{ {
WCHAR szCSDVersion[128]; WCHAR szCSDVersion[128];
LONG i; LONG i;
ULONG Length = ARRAYSIZE(szCSDVersion) - 1; USHORT Length = (USHORT)ARRAYSIZE(szCSDVersion) - 1;
i = _snwprintf(szCSDVersion, Length, i = _snwprintf(szCSDVersion, Length,
L"Service Pack %d", L"Service Pack %d",
((Peb->OSCSDVersion >> 8) & 0xFF)); ((Peb->OSCSDVersion >> 8) & 0xFF));

View file

@ -67,7 +67,7 @@ LdrpAllocateUnicodeString(IN OUT PUNICODE_STRING StringOut,
if (Length != UNICODE_STRING_MAX_BYTES) if (Length != UNICODE_STRING_MAX_BYTES)
{ {
/* It's not, so set the maximum length to be one char more */ /* It's not, so set the maximum length to be one char more */
StringOut->MaximumLength = Length + sizeof(UNICODE_NULL); StringOut->MaximumLength = (USHORT)Length + sizeof(UNICODE_NULL);
} }
else else
{ {

View file

@ -157,7 +157,7 @@ RtlGetNtVersionNumbers(OUT PULONG pMajorVersion,
NTSTATUS NTAPI NTSTATUS NTAPI
RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation) RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation)
{ {
ULONG Length; SIZE_T Length;
PPEB Peb = NtCurrentPeb(); PPEB Peb = NtCurrentPeb();
if (lpVersionInformation->dwOSVersionInfoSize != sizeof(RTL_OSVERSIONINFOW) && if (lpVersionInformation->dwOSVersionInfoSize != sizeof(RTL_OSVERSIONINFOW) &&

View file

@ -357,7 +357,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName,
IO_STATUS_BLOCK IoStatus; IO_STATUS_BLOCK IoStatus;
PFILE_OBJECT FileObject; PFILE_OBJECT FileObject;
PMMPAGING_FILE PagingFile; PMMPAGING_FILE PagingFile;
ULONG AllocMapSize; SIZE_T AllocMapSize;
ULONG Count; ULONG Count;
KPROCESSOR_MODE PreviousMode; KPROCESSOR_MODE PreviousMode;
UNICODE_STRING PageFileName; UNICODE_STRING PageFileName;

View file

@ -351,7 +351,7 @@ HRESULT inline SHSetStrRet(LPSTRRET pStrRet, LPCSTR pstrValue)
HRESULT inline SHSetStrRet(LPSTRRET pStrRet, LPCWSTR pwstrValue) HRESULT inline SHSetStrRet(LPSTRRET pStrRet, LPCWSTR pwstrValue)
{ {
ULONG cchr = wcslen(pwstrValue); SIZE_T cchr = wcslen(pwstrValue);
LPWSTR buffer = static_cast<LPWSTR>(CoTaskMemAlloc((cchr + 1) * sizeof(WCHAR))); LPWSTR buffer = static_cast<LPWSTR>(CoTaskMemAlloc((cchr + 1) * sizeof(WCHAR)));
if (buffer == NULL) if (buffer == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;

View file

@ -515,7 +515,7 @@ RtlIpv6AddressToStringA(
ASSERT(Result >= Buffer); ASSERT(Result >= Buffer);
ASSERT(Result < Buffer + RTL_NUMBER_OF(Buffer)); ASSERT(Result < Buffer + RTL_NUMBER_OF(Buffer));
Status = RtlUnicodeToMultiByteN(S, RTLIPV6A2S_MAX_LEN, NULL, Buffer, (wcslen(Buffer) + 1) * sizeof(WCHAR)); Status = RtlUnicodeToMultiByteN(S, RTLIPV6A2S_MAX_LEN, NULL, Buffer, (ULONG)(wcslen(Buffer) + 1) * sizeof(WCHAR));
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return (PSTR)~0; return (PSTR)~0;
@ -544,7 +544,7 @@ RtlIpv6AddressToStringExA(
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return Status; return Status;
Status = RtlUnicodeToMultiByteN(AddressString, RTLIPV6A2SEX_MAX_LEN, NULL, Buffer, (wcslen(Buffer) + 1) * sizeof(WCHAR)); Status = RtlUnicodeToMultiByteN(AddressString, RTLIPV6A2SEX_MAX_LEN, NULL, Buffer, (*AddressStringLength + 1) * sizeof(WCHAR));
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return STATUS_INVALID_PARAMETER; return STATUS_INVALID_PARAMETER;

View file

@ -309,7 +309,7 @@ RtlpCollapsePath(PWSTR Path, /* ULONG PathBufferSize, ULONG PathLength, */ ULONG
// FIXME: Do not suppose NULL-terminated strings!! // FIXME: Do not suppose NULL-terminated strings!!
ULONG PathLength = wcslen(Path); SIZE_T PathLength = wcslen(Path);
PWSTR EndBuffer = Path + PathLength; // Path + PathBufferSize / sizeof(WCHAR); PWSTR EndBuffer = Path + PathLength; // Path + PathBufferSize / sizeof(WCHAR);
PWSTR EndPath; PWSTR EndPath;

View file

@ -905,7 +905,7 @@ VideoPortScanRom(
IN ULONG RomLength, IN ULONG RomLength,
IN PUCHAR String) IN PUCHAR String)
{ {
ULONG StringLength; SIZE_T StringLength;
BOOLEAN Found; BOOLEAN Found;
PUCHAR SearchLocation; PUCHAR SearchLocation;