https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7611cc2b12fa875729f11…
commit 7611cc2b12fa875729f119b8febc6bc5b419d61c
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sun May 26 15:00:21 2019 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Thu Aug 15 14:20:00 2019 +0200
[REACTOS] Fix SIZE_T related warnings
---
base/applications/atactl/atactl.cpp | 2 +-
base/applications/calc/winmain.c | 2 +-
base/applications/msconfig/startuppage.c | 2 +-
base/applications/msconfig_new/fileutils.c | 4 +--
base/applications/msconfig_new/utils.c | 2 +-
base/applications/msconfig_new/utils.h | 2 +-
base/applications/mscutils/eventvwr/eventvwr.c | 28 +++++++++-------
base/applications/mstsc/connectdialog.c | 2 +-
base/applications/mstsc/settings.c | 3 +-
base/services/dhcpcsvc/dhcp/adapter.c | 2 +-
base/services/dhcpcsvc/dhcp/socket.c | 18 ++++++++---
base/setup/lib/utils/arcname.c | 44 ++++++++++++++++++++++----
dll/ntdll/csr/connect.c | 20 +++++++++---
dll/ntdll/ldr/ldrinit.c | 2 +-
dll/ntdll/ldr/ldrutils.c | 2 +-
dll/ntdll/rtl/version.c | 2 +-
ntoskrnl/mm/pagefile.c | 2 +-
sdk/include/reactos/shellutils.h | 2 +-
sdk/lib/rtl/network.c | 4 +--
sdk/lib/rtl/path.c | 2 +-
win32ss/drivers/videoprt/videoprt.c | 2 +-
21 files changed, 103 insertions(+), 46 deletions(-)
diff --git a/base/applications/atactl/atactl.cpp b/base/applications/atactl/atactl.cpp
index 3eac17a1e9a..48a10944714 100644
--- a/base/applications/atactl/atactl.cpp
+++ b/base/applications/atactl/atactl.cpp
@@ -1688,7 +1688,7 @@ main (
)
{
//ULONG Flags = 0;
- int i;
+ intptr_t i;
uintptr_t j;
char a;
int bus_id = -1;
diff --git a/base/applications/calc/winmain.c b/base/applications/calc/winmain.c
index 4d9376bdf91..222dff44faf 100644
--- a/base/applications/calc/winmain.c
+++ b/base/applications/calc/winmain.c
@@ -894,7 +894,7 @@ static void delete_stat_item(int n)
static char *ReadConversion(const char *formula)
{
- int len = strlen(formula);
+ intptr_t len = strlen(formula);
char *str = (char *)malloc(len+3);
if (str == NULL)
diff --git a/base/applications/msconfig/startuppage.c
b/base/applications/msconfig/startuppage.c
index 2eb5817d795..2d06cdc5e64 100644
--- a/base/applications/msconfig/startuppage.c
+++ b/base/applications/msconfig/startuppage.c
@@ -187,7 +187,7 @@ GetAutostartEntriesFromRegistry ( HKEY hRootKey, TCHAR* KeyName )
SendMessage(hStartupListCtrl, LVM_SETITEMTEXT, item.iItem,
(LPARAM) &item);
}
- switch (PtrToLong(hRootKey))
+ switch ((ULONG_PTR)hRootKey)
{
case (ULONG_PTR)HKEY_LOCAL_MACHINE:
_tcscpy(Path, _T("HKLM\\\0"));
diff --git a/base/applications/msconfig_new/fileutils.c
b/base/applications/msconfig_new/fileutils.c
index 8164a586356..45296d8a6d0 100644
--- a/base/applications/msconfig_new/fileutils.c
+++ b/base/applications/msconfig_new/fileutils.c
@@ -52,7 +52,7 @@ FileQueryFiles(IN LPCWSTR Path,
WIN32_FIND_DATAW find_data;
LPWSTR lpszQuery;
- DWORD dwNumOfChars;
+ SIZE_T dwNumOfChars;
LPWSTR lpszExpandedQuery;
HANDLE search;
@@ -93,7 +93,7 @@ FileQueryFiles(IN LPCWSTR Path,
BOOL BackupIniFile(IN LPCWSTR lpszIniFile)
{
BOOL Success = FALSE;
- DWORD dwNumOfChars = 0;
+ SIZE_T dwNumOfChars = 0;
LPWSTR SourceFile, DestFile;
LPWSTR lpName, lpPath;
diff --git a/base/applications/msconfig_new/utils.c
b/base/applications/msconfig_new/utils.c
index 104081f78c5..3715fcf0da3 100644
--- a/base/applications/msconfig_new/utils.c
+++ b/base/applications/msconfig_new/utils.c
@@ -31,7 +31,7 @@ MemFree(IN PVOID lpMem)
PVOID
MemAlloc(IN DWORD dwFlags,
- IN DWORD dwBytes)
+ IN SIZE_T dwBytes)
{
/* Allocate memory from the heap */
return HeapAlloc(g_hHeap, dwFlags, dwBytes);
diff --git a/base/applications/msconfig_new/utils.h
b/base/applications/msconfig_new/utils.h
index 873cd06d755..9fb97011ef2 100644
--- a/base/applications/msconfig_new/utils.h
+++ b/base/applications/msconfig_new/utils.h
@@ -25,7 +25,7 @@ MemFree(IN PVOID lpMem);
PVOID
MemAlloc(IN DWORD dwFlags,
- IN DWORD dwBytes);
+ IN SIZE_T dwBytes);
LPWSTR
FormatDateTime(IN LPSYSTEMTIME pDateTime);
diff --git a/base/applications/mscutils/eventvwr/eventvwr.c
b/base/applications/mscutils/eventvwr/eventvwr.c
index 01c416e1a68..db6a9cf7ced 100644
--- a/base/applications/mscutils/eventvwr/eventvwr.c
+++ b/base/applications/mscutils/eventvwr/eventvwr.c
@@ -560,7 +560,7 @@ SaveSettings(VOID)
Settings.wpPos.rcNormalPosition.bottom,
Settings.wpPos.showCmd);
- dwSize = wcslen(buffer) * sizeof(WCHAR);
+ dwSize = (DWORD)(wcslen(buffer) * sizeof(WCHAR));
RegSetValueExW(hKeyEventVwr, L"Window", 0, REG_SZ, (LPBYTE)buffer,
dwSize);
Quit:
@@ -1173,9 +1173,9 @@ FormatInteger(LONGLONG Num, LPWSTR pwszResult, UINT cchResultMax)
UINT
FormatByteSize(LONGLONG cbSize, LPWSTR pwszResult, UINT cchResultMax)
{
- INT cchWritten;
+ UINT cchWritten, cchRemaining;
LPWSTR pwszEnd;
- size_t cchRemaining;
+ size_t cchStringRemaining;
/* Write formated bytes count */
cchWritten = FormatInteger(cbSize, pwszResult, cchResultMax);
@@ -1185,7 +1185,8 @@ FormatByteSize(LONGLONG cbSize, LPWSTR pwszResult, UINT
cchResultMax)
/* Copy " bytes" to buffer */
pwszEnd = pwszResult + 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);
cchRemaining -= cchWritten;
@@ -1195,9 +1196,9 @@ FormatByteSize(LONGLONG cbSize, LPWSTR pwszResult, UINT
cchResultMax)
LPWSTR
FormatFileSizeWithBytes(const PULARGE_INTEGER lpQwSize, LPWSTR pwszResult, UINT
cchResultMax)
{
- UINT cchWritten;
+ UINT cchWritten, cchRemaining;
LPWSTR pwszEnd;
- size_t cchRemaining;
+ size_t cchCopyRemaining;
/* Format bytes in KBs, MBs etc */
if (StrFormatByteSizeW(lpQwSize->QuadPart, pwszResult, cchResultMax) == NULL)
@@ -1208,10 +1209,11 @@ FormatFileSizeWithBytes(const PULARGE_INTEGER lpQwSize, LPWSTR
pwszResult, UINT
return pwszResult;
/* Concatenate " (" */
- cchWritten = wcslen(pwszResult);
+ cchWritten = (UINT)wcslen(pwszResult);
pwszEnd = pwszResult + 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 */
cchWritten = FormatByteSize(lpQwSize->QuadPart, pwszEnd, cchRemaining);
@@ -1231,7 +1233,8 @@ GetFileTimeString(LPFILETIME lpFileTime, LPWSTR pwszResult, UINT
cchResult)
FILETIME ft;
SYSTEMTIME st;
int cchWritten;
- size_t cchRemaining = cchResult;
+ UINT cchRemaining = cchResult;
+ size_t cchCopyRemaining;
LPWSTR pwszEnd = pwszResult;
if (!FileTimeToLocalFileTime(lpFileTime, &ft) || !FileTimeToSystemTime(&ft,
&st))
@@ -1246,7 +1249,8 @@ GetFileTimeString(LPFILETIME lpFileTime, LPWSTR pwszResult, UINT
cchResult)
cchRemaining -= 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);
if (cchWritten)
@@ -1294,7 +1298,7 @@ AllocEventLog(IN PCWSTR ComputerName OPTIONAL,
IN BOOL Permanent)
{
PEVENTLOG EventLog;
- UINT cchName;
+ SIZE_T cchName;
/* Allocate a new event log entry */
EventLog = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*EventLog));
@@ -1467,7 +1471,7 @@ GetExpandedFilePathName(
OUT LPWSTR lpFullFileName OPTIONAL,
IN DWORD nSize)
{
- DWORD dwLength;
+ SIZE_T dwLength;
/* Determine the needed size after expansion of any environment strings */
dwLength = ExpandEnvironmentStringsW(lpFileName, NULL, 0);
diff --git a/base/applications/mstsc/connectdialog.c
b/base/applications/mstsc/connectdialog.c
index 67f0966d7e1..5e3d2720f69 100644
--- a/base/applications/mstsc/connectdialog.c
+++ b/base/applications/mstsc/connectdialog.c
@@ -505,7 +505,7 @@ AddDisplayDevice(PINFO pInfo, PDISPLAY_DEVICEW DisplayDevice)
LPWSTR name = NULL;
LPWSTR key = NULL;
LPWSTR devid = NULL;
- DWORD descriptionSize, nameSize, keySize, devidSize;
+ SIZE_T descriptionSize, nameSize, keySize, devidSize;
PSETTINGS_ENTRY Current;
DWORD ResolutionsCount = 1;
DWORD i;
diff --git a/base/applications/mstsc/settings.c b/base/applications/mstsc/settings.c
index 6a68282d556..a38ba4d4a1a 100644
--- a/base/applications/mstsc/settings.c
+++ b/base/applications/mstsc/settings.c
@@ -199,7 +199,8 @@ WriteRdpFile(HANDLE hFile,
PRDPSETTINGS pRdpSettings)
{
WCHAR line[MAXKEY + MAXVALUE + 4];
- DWORD BytesToWrite, BytesWritten;
+ SIZE_T BytesToWrite;
+ ULONG BytesWritten;
BOOL bRet;
INT i, k;
diff --git a/base/services/dhcpcsvc/dhcp/adapter.c
b/base/services/dhcpcsvc/dhcp/adapter.c
index 91edf74dfd0..b2ff127285f 100644
--- a/base/services/dhcpcsvc/dhcp/adapter.c
+++ b/base/services/dhcpcsvc/dhcp/adapter.c
@@ -9,7 +9,7 @@ PCHAR *GetSubkeyNames( PCHAR MainKeyName, PCHAR Append ) {
DWORD Error;
HKEY MainKey;
PCHAR *Out, OutKeyName;
- DWORD CharTotal = 0, AppendLen = 1 + strlen(Append);
+ SIZE_T CharTotal = 0, AppendLen = 1 + strlen(Append);
DWORD MaxSubKeyLen = 0, MaxSubKeys = 0;
Error = RegOpenKey( HKEY_LOCAL_MACHINE, MainKeyName, &MainKey );
diff --git a/base/services/dhcpcsvc/dhcp/socket.c b/base/services/dhcpcsvc/dhcp/socket.c
index 4b406f51cce..007e082d2db 100644
--- a/base/services/dhcpcsvc/dhcp/socket.c
+++ b/base/services/dhcpcsvc/dhcp/socket.c
@@ -12,8 +12,13 @@ ssize_t send_packet( struct interface_info *ip,
struct in_addr addr,
struct sockaddr_in *broadcast,
struct hardware *hardware ) {
- int result =
- sendto( ip->wfdesc, (char *)p, size, 0,
+ int result;
+
+ if (size > INT_MAX)
+ return WSAEMSGSIZE;
+
+ result =
+ sendto( ip->wfdesc, (char *)p, (int)size, 0,
(struct sockaddr *)broadcast, sizeof(*broadcast) );
if (result < 0) {
@@ -32,8 +37,13 @@ ssize_t receive_packet(struct interface_info *ip,
struct sockaddr_in *dest,
struct hardware *hardware ) {
int recv_addr_size = sizeof(*dest);
- int result =
- recvfrom (ip -> rfdesc, (char *)packet_data, packet_len, 0,
+ int result;
+
+ if (packet_len > INT_MAX)
+ return WSAEMSGSIZE;
+
+ result =
+ recvfrom (ip -> rfdesc, (char *)packet_data, (int)packet_len, 0,
(struct sockaddr *)dest, &recv_addr_size );
return result;
}
diff --git a/base/setup/lib/utils/arcname.c b/base/setup/lib/utils/arcname.c
index 5d63dd02b34..77e7b579c58 100644
--- a/base/setup/lib/utils/arcname.c
+++ b/base/setup/lib/utils/arcname.c
@@ -119,7 +119,7 @@ ArcGetNextTokenA(
{
NTSTATUS Status;
PCSTR p = ArcPath;
- ULONG SpecifierLength;
+ SIZE_T SpecifierLength;
ULONG KeyValue;
/*
@@ -133,6 +133,10 @@ ArcGetNextTokenA(
return NULL; /* Path starts with '(' and is thus invalid */
SpecifierLength = (p - ArcPath) * sizeof(CHAR);
+ if (SpecifierLength > MAXUSHORT)
+ {
+ return NULL;
+ }
/*
* The strtoul function skips any leading whitespace.
@@ -163,7 +167,7 @@ ArcGetNextTokenA(
if (!NT_SUCCESS(Status))
return NULL;
- TokenSpecifier->Length = strlen(TokenSpecifier->Buffer) * sizeof(CHAR);
+ TokenSpecifier->Length = (USHORT)SpecifierLength;
/* We succeeded, return the token key value */
*Key = KeyValue;
@@ -180,7 +184,7 @@ ArcGetNextTokenU(
{
NTSTATUS Status;
PCWSTR p = ArcPath;
- ULONG SpecifierLength;
+ SIZE_T SpecifierLength;
ULONG KeyValue;
/*
@@ -194,6 +198,10 @@ ArcGetNextTokenU(
return NULL; /* Path starts with '(' and is thus invalid */
SpecifierLength = (p - ArcPath) * sizeof(WCHAR);
+ if (SpecifierLength > UNICODE_STRING_MAX_BYTES)
+ {
+ return NULL;
+ }
++p;
@@ -226,7 +234,7 @@ ArcGetNextTokenU(
if (!NT_SUCCESS(Status))
return NULL;
- TokenSpecifier->Length = wcslen(TokenSpecifier->Buffer) * sizeof(WCHAR);
+ TokenSpecifier->Length = (USHORT)SpecifierLength;
/* We succeeded, return the token key value */
*Key = KeyValue;
@@ -308,6 +316,7 @@ ArcPathNormalize(
NTSTATUS Status;
PCWSTR EndOfArcName;
PCWSTR p;
+ SIZE_T PathLength;
if (NormalizedArcPath->MaximumLength < sizeof(UNICODE_NULL))
return FALSE;
@@ -350,7 +359,13 @@ ArcPathNormalize(
if (!NT_SUCCESS(Status))
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;
}
@@ -685,6 +700,7 @@ ResolveArcNameManually(
CONTROLLER_TYPE ControllerType;
PERIPHERAL_TYPE PeripheralType;
BOOLEAN UseSignature;
+ SIZE_T NameLength;
PDISKENTRY DiskEntry;
PPARTENTRY PartEntry = NULL;
@@ -787,7 +803,13 @@ ResolveArcNameManually(
}
/* 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;
}
@@ -802,6 +824,7 @@ ArcPathToNtPath(
NTSTATUS Status;
PCWSTR BeginOfPath;
UNICODE_STRING ArcName;
+ SIZE_T PathLength;
/* TODO: We should "normalize" the path, i.e. expand all the xxx() into
xxx(0) */
@@ -877,7 +900,14 @@ ArcPathToNtPath(
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;
}
diff --git a/dll/ntdll/csr/connect.c b/dll/ntdll/csr/connect.c
index a1a95096e37..213b48b9457 100644
--- a/dll/ntdll/csr/connect.c
+++ b/dll/ntdll/csr/connect.c
@@ -39,7 +39,7 @@ NTAPI
CsrpConnectToServer(IN PWSTR ObjectDirectory)
{
NTSTATUS Status;
- ULONG PortNameLength;
+ SIZE_T PortNameLength;
UNICODE_STRING PortName;
LARGE_INTEGER CsrSectionViewSize;
HANDLE CsrSectionHandle;
@@ -62,10 +62,15 @@ CsrpConnectToServer(IN PWSTR ObjectDirectory)
/* Calculate the total port name size */
PortNameLength = ((wcslen(ObjectDirectory) + 1) * sizeof(WCHAR)) +
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 */
PortName.Length = 0;
- PortName.MaximumLength = PortNameLength;
+ PortName.MaximumLength = (USHORT)PortNameLength;
/* Allocate a buffer for it */
PortName.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY,
PortNameLength);
@@ -366,11 +371,18 @@ CsrClientCallServer(IN OUT PCSR_API_MESSAGE ApiMessage,
ULONG PointerCount;
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 */
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;
- 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);
/* Fill out the CSR Header */
diff --git a/dll/ntdll/ldr/ldrinit.c b/dll/ntdll/ldr/ldrinit.c
index 39567578d91..16a3361421a 100644
--- a/dll/ntdll/ldr/ldrinit.c
+++ b/dll/ntdll/ldr/ldrinit.c
@@ -2365,7 +2365,7 @@ LdrpInitializeProcess(IN PCONTEXT Context,
{
WCHAR szCSDVersion[128];
LONG i;
- ULONG Length = ARRAYSIZE(szCSDVersion) - 1;
+ USHORT Length = (USHORT)ARRAYSIZE(szCSDVersion) - 1;
i = _snwprintf(szCSDVersion, Length,
L"Service Pack %d",
((Peb->OSCSDVersion >> 8) & 0xFF));
diff --git a/dll/ntdll/ldr/ldrutils.c b/dll/ntdll/ldr/ldrutils.c
index 1011a850468..4c1adbf7810 100644
--- a/dll/ntdll/ldr/ldrutils.c
+++ b/dll/ntdll/ldr/ldrutils.c
@@ -67,7 +67,7 @@ LdrpAllocateUnicodeString(IN OUT PUNICODE_STRING StringOut,
if (Length != UNICODE_STRING_MAX_BYTES)
{
/* 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
{
diff --git a/dll/ntdll/rtl/version.c b/dll/ntdll/rtl/version.c
index ac59adab139..37f0960ec66 100644
--- a/dll/ntdll/rtl/version.c
+++ b/dll/ntdll/rtl/version.c
@@ -157,7 +157,7 @@ RtlGetNtVersionNumbers(OUT PULONG pMajorVersion,
NTSTATUS NTAPI
RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation)
{
- ULONG Length;
+ SIZE_T Length;
PPEB Peb = NtCurrentPeb();
if (lpVersionInformation->dwOSVersionInfoSize != sizeof(RTL_OSVERSIONINFOW)
&&
diff --git a/ntoskrnl/mm/pagefile.c b/ntoskrnl/mm/pagefile.c
index 54af15974a8..f94b65a60aa 100644
--- a/ntoskrnl/mm/pagefile.c
+++ b/ntoskrnl/mm/pagefile.c
@@ -357,7 +357,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName,
IO_STATUS_BLOCK IoStatus;
PFILE_OBJECT FileObject;
PMMPAGING_FILE PagingFile;
- ULONG AllocMapSize;
+ SIZE_T AllocMapSize;
ULONG Count;
KPROCESSOR_MODE PreviousMode;
UNICODE_STRING PageFileName;
diff --git a/sdk/include/reactos/shellutils.h b/sdk/include/reactos/shellutils.h
index 1e8aa314ad4..f7f6bd03353 100644
--- a/sdk/include/reactos/shellutils.h
+++ b/sdk/include/reactos/shellutils.h
@@ -351,7 +351,7 @@ HRESULT inline SHSetStrRet(LPSTRRET pStrRet, LPCSTR pstrValue)
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)));
if (buffer == NULL)
return E_OUTOFMEMORY;
diff --git a/sdk/lib/rtl/network.c b/sdk/lib/rtl/network.c
index 025cd9ea472..44151e42b5e 100644
--- a/sdk/lib/rtl/network.c
+++ b/sdk/lib/rtl/network.c
@@ -515,7 +515,7 @@ RtlIpv6AddressToStringA(
ASSERT(Result >= 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))
return (PSTR)~0;
@@ -544,7 +544,7 @@ RtlIpv6AddressToStringExA(
if (!NT_SUCCESS(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))
return STATUS_INVALID_PARAMETER;
diff --git a/sdk/lib/rtl/path.c b/sdk/lib/rtl/path.c
index dd183b6801f..6031ae32087 100644
--- a/sdk/lib/rtl/path.c
+++ b/sdk/lib/rtl/path.c
@@ -309,7 +309,7 @@ RtlpCollapsePath(PWSTR Path, /* ULONG PathBufferSize, ULONG
PathLength, */ ULONG
// 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 EndPath;
diff --git a/win32ss/drivers/videoprt/videoprt.c b/win32ss/drivers/videoprt/videoprt.c
index e840593be98..812f55ad6af 100644
--- a/win32ss/drivers/videoprt/videoprt.c
+++ b/win32ss/drivers/videoprt/videoprt.c
@@ -905,7 +905,7 @@ VideoPortScanRom(
IN ULONG RomLength,
IN PUCHAR String)
{
- ULONG StringLength;
+ SIZE_T StringLength;
BOOLEAN Found;
PUCHAR SearchLocation;