Author: ekohl
Date: Sun Aug 19 10:01:05 2012
New Revision: 57108
URL:
http://svn.reactos.org/svn/reactos?rev=57108&view=rev
Log:
[SERVICES]
Remove "size_t to DWORD/int..." conversion warnings in x64 build.
Patch by Hermes Belusca.
I replaced size_t by SIZE_T, as this is the proper Win32 type. And I also used the prefix
'cch' (count of characters) instead of the generic 'dw'.
See issue #7149 for more details.
Modified:
trunk/reactos/base/system/services/config.c
trunk/reactos/base/system/services/database.c
trunk/reactos/base/system/services/rpcserver.c
Modified: trunk/reactos/base/system/services/config.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/confi…
==============================================================================
--- trunk/reactos/base/system/services/config.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/config.c [iso-8859-1] Sun Aug 19 10:01:05 2012
@@ -98,9 +98,9 @@
DWORD dwDependenciesLength)
{
DWORD dwError = ERROR_SUCCESS;
- DWORD dwGroupLength = 0;
- DWORD dwServiceLength = 0;
- DWORD dwLength;
+ SIZE_T cchGroupLength = 0;
+ SIZE_T cchServiceLength = 0;
+ SIZE_T cchLength;
LPWSTR lpGroupDeps;
LPWSTR lpServiceDeps;
LPCWSTR lpSrc;
@@ -125,46 +125,46 @@
lpDst = lpGroupDeps;
while (*lpSrc != 0)
{
- dwLength = wcslen(lpSrc) + 1;
+ cchLength = wcslen(lpSrc) + 1;
if (*lpSrc == SC_GROUP_IDENTIFIERW)
{
lpSrc++;
- dwGroupLength += dwLength;
+ cchGroupLength += cchLength;
wcscpy(lpDst, lpSrc);
- lpDst = lpDst + dwLength;
+ lpDst = lpDst + cchLength;
}
- lpSrc = lpSrc + dwLength;
+ lpSrc = lpSrc + cchLength;
}
*lpDst = 0;
lpDst++;
- dwGroupLength++;
+ cchGroupLength++;
lpSrc = lpDependencies;
lpServiceDeps = lpDst;
while (*lpSrc != 0)
{
- dwLength = wcslen(lpSrc) + 1;
+ cchLength = wcslen(lpSrc) + 1;
if (*lpSrc != SC_GROUP_IDENTIFIERW)
{
- dwServiceLength += dwLength;
+ cchServiceLength += cchLength;
wcscpy(lpDst, lpSrc);
- lpDst = lpDst + dwLength;
+ lpDst = lpDst + cchLength;
}
- lpSrc = lpSrc + dwLength;
+ lpSrc = lpSrc + cchLength;
}
*lpDst = 0;
- dwServiceLength++;
-
- if (dwGroupLength > 1)
+ cchServiceLength++;
+
+ if (cchGroupLength > 1)
{
dwError = RegSetValueExW(hServiceKey,
L"DependOnGroup",
0,
REG_MULTI_SZ,
(LPBYTE)lpGroupDeps,
- dwGroupLength * sizeof(WCHAR));
+ (DWORD)(cchGroupLength * sizeof(WCHAR)));
}
else
{
@@ -174,14 +174,14 @@
if (dwError == ERROR_SUCCESS)
{
- if (dwServiceLength > 1)
+ if (cchServiceLength > 1)
{
dwError = RegSetValueExW(hServiceKey,
L"DependOnService",
0,
REG_MULTI_SZ,
(LPBYTE)lpServiceDeps,
- dwServiceLength * sizeof(WCHAR));
+ (DWORD)(cchServiceLength * sizeof(WCHAR)));
}
else
{
@@ -324,12 +324,12 @@
{
LPWSTR lpGroups = NULL;
LPWSTR lpServices = NULL;
- DWORD dwGroupsLength = 0;
- DWORD dwServicesLength = 0;
+ SIZE_T cchGroupsLength = 0;
+ SIZE_T cchServicesLength = 0;
LPWSTR lpSrc;
LPWSTR lpDest;
- DWORD len;
- DWORD dwTotalLength;
+ SIZE_T cchLength;
+ SIZE_T cchTotalLength;
*lpDependencies = NULL;
*lpdwDependenciesLength = 0;
@@ -356,10 +356,10 @@
{
DPRINT(" %S\n", lpSrc);
- len = wcslen(lpSrc) + 1;
- dwGroupsLength += len + 1;
-
- lpSrc = lpSrc + len;
+ cchLength = wcslen(lpSrc) + 1;
+ cchGroupsLength += cchLength + 1;
+
+ lpSrc = lpSrc + cchLength;
}
}
@@ -371,18 +371,18 @@
{
DPRINT(" %S\n", lpSrc);
- len = wcslen(lpSrc) + 1;
- dwServicesLength += len;
-
- lpSrc = lpSrc + len;
- }
- }
-
- dwTotalLength = dwGroupsLength + dwServicesLength + 1;
- DPRINT("dwTotalLength: %lu\n", dwTotalLength);
+ cchLength = wcslen(lpSrc) + 1;
+ cchServicesLength += cchLength;
+
+ lpSrc = lpSrc + cchLength;
+ }
+ }
+
+ cchTotalLength = cchGroupsLength + cchServicesLength + 1;
+ DPRINT("cchTotalLength: %lu\n", cchTotalLength);
/* Allocate the common buffer for the dependencies */
- *lpDependencies = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwTotalLength *
sizeof(WCHAR));
+ *lpDependencies = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cchTotalLength *
sizeof(WCHAR));
if (*lpDependencies == NULL)
{
if (lpGroups)
@@ -395,7 +395,7 @@
}
/* Return the allocated buffer length in characters */
- *lpdwDependenciesLength = dwTotalLength;
+ *lpdwDependenciesLength = (DWORD)cchTotalLength;
/* Copy the service dependencies into the common buffer */
lpDest = *lpDependencies;
@@ -403,9 +403,9 @@
{
memcpy(lpDest,
lpServices,
- dwServicesLength * sizeof(WCHAR));
-
- lpDest = lpDest + dwServicesLength;
+ cchServicesLength * sizeof(WCHAR));
+
+ lpDest = lpDest + cchServicesLength;
}
/* Copy the group dependencies into the common buffer */
@@ -414,15 +414,15 @@
lpSrc = lpGroups;
while (*lpSrc != 0)
{
- len = wcslen(lpSrc) + 1;
+ cchLength = wcslen(lpSrc) + 1;
*lpDest = SC_GROUP_IDENTIFIERW;
lpDest++;
wcscpy(lpDest, lpSrc);
- lpDest = lpDest + len;
- lpSrc = lpSrc + len;
+ lpDest = lpDest + cchLength;
+ lpSrc = lpSrc + cchLength;
}
}
Modified: trunk/reactos/base/system/services/database.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/datab…
==============================================================================
--- trunk/reactos/base/system/services/database.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/database.c [iso-8859-1] Sun Aug 19 10:01:05 2012
@@ -902,7 +902,7 @@
/* Calculate the total length of the start command line */
PacketSize = sizeof(SCM_CONTROL_PACKET);
- PacketSize += (wcslen(Service->lpServiceName) + 1) * sizeof(WCHAR);
+ PacketSize += (DWORD)((wcslen(Service->lpServiceName) + 1) * sizeof(WCHAR));
ControlPacket = HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
@@ -1117,7 +1117,7 @@
/* Calculate the total length of the start command line */
PacketSize = sizeof(SCM_CONTROL_PACKET) +
- (wcslen(Service->lpServiceName) + 1) * sizeof(WCHAR);
+ (DWORD)((wcslen(Service->lpServiceName) + 1) * sizeof(WCHAR));
/* Calculate the required packet size for the start arguments */
if (argc > 0 && argv != NULL)
@@ -1128,7 +1128,7 @@
for (i = 0; i < argc; i++)
{
DPRINT("Argv[%lu]: %S\n", i, argv[i]);
- PacketSize += (wcslen(argv[i]) + 1) * sizeof(WCHAR) + sizeof(PWSTR);
+ PacketSize += (DWORD)((wcslen(argv[i]) + 1) * sizeof(WCHAR) +
sizeof(PWSTR));
}
}
Modified: trunk/reactos/base/system/services/rpcserver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/rpcse…
==============================================================================
--- trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] Sun Aug 19 10:01:05 2012
@@ -395,7 +395,8 @@
DWORD
ScmConvertToBootPathName(wchar_t *CanonName, wchar_t **RelativeName)
{
- DWORD ServiceNameLen, BufferSize, ExpandedLen;
+ SIZE_T ServiceNameLen, ExpandedLen;
+ DWORD BufferSize;
WCHAR Dest;
WCHAR *Expanded;
UNICODE_STRING NtPathName, SystemRoot, LinkTarget;
@@ -652,7 +653,8 @@
const wchar_t *lpServiceName,
wchar_t **lpCanonName)
{
- DWORD ServiceNameLen, Result;
+ DWORD Result;
+ SIZE_T ServiceNameLen;
UNICODE_STRING NtServiceName;
WCHAR *RelativeName;
const WCHAR *SourceName = lpServiceName;
@@ -895,8 +897,8 @@
{
/* Calculate the required size */
dwRequiredSize += sizeof(SERVICE_STATUS);
- dwRequiredSize += ((wcslen(lpCurrentService->lpServiceName) +
1) * sizeof(WCHAR));
- dwRequiredSize += ((wcslen(lpCurrentService->lpDisplayName) +
1) * sizeof(WCHAR));
+ dwRequiredSize +=
(DWORD)((wcslen(lpCurrentService->lpServiceName) + 1) * sizeof(WCHAR));
+ dwRequiredSize +=
(DWORD)((wcslen(lpCurrentService->lpDisplayName) + 1) * sizeof(WCHAR));
/* Add the size for service name and display name pointers */
dwRequiredSize += (2 * sizeof(PVOID));
@@ -923,7 +925,7 @@
}
}
- dwDependServiceStrPtr += (wcslen(lpszValueBuf + dwDependServiceStrPtr) +
1);
+ dwDependServiceStrPtr += (DWORD)(wcslen(lpszValueBuf +
dwDependServiceStrPtr) + 1);
}
}
else if (*pcbBytesNeeded)
@@ -1813,7 +1815,7 @@
0,
REG_SZ,
(LPBYTE)lpDisplayName,
- (wcslen(lpDisplayName) + 1) * sizeof(WCHAR));
+ (DWORD)((wcslen(lpDisplayName) + 1) * sizeof(WCHAR)));
/* Update the display name */
lpDisplayNameW = HeapAlloc(GetProcessHeap(),
@@ -1896,7 +1898,7 @@
0,
REG_EXPAND_SZ,
(LPBYTE)lpImagePathW,
- (wcslen(lpImagePathW) + 1) * sizeof(WCHAR));
+ (DWORD)((wcslen(lpImagePathW) + 1) * sizeof(WCHAR)));
if (lpImagePathW != lpBinaryPathName)
HeapFree(GetProcessHeap(), 0, lpImagePathW);
@@ -1913,7 +1915,7 @@
0,
REG_SZ,
(LPBYTE)lpLoadOrderGroup,
- (wcslen(lpLoadOrderGroup) + 1) * sizeof(WCHAR));
+ (DWORD)((wcslen(lpLoadOrderGroup) + 1) *
sizeof(WCHAR)));
if (dwError != ERROR_SUCCESS)
goto done;
@@ -2183,7 +2185,7 @@
0,
REG_SZ,
(LPBYTE)lpDisplayName,
- (wcslen(lpDisplayName) + 1) * sizeof(WCHAR));
+ (DWORD)((wcslen(lpDisplayName) + 1) * sizeof(WCHAR)));
}
/* Set the service type */
@@ -2224,7 +2226,7 @@
0,
REG_EXPAND_SZ,
(LPBYTE)lpBinaryPathName,
- (wcslen(lpBinaryPathName) + 1) * sizeof(WCHAR));
+ (DWORD)((wcslen(lpBinaryPathName) + 1) *
sizeof(WCHAR)));
if (dwError != ERROR_SUCCESS)
goto done;
}
@@ -2235,7 +2237,7 @@
0,
REG_EXPAND_SZ,
(LPBYTE)lpImagePath,
- (wcslen(lpImagePath) + 1) * sizeof(WCHAR));
+ (DWORD)((wcslen(lpImagePath) + 1) * sizeof(WCHAR)));
if (dwError != ERROR_SUCCESS)
goto done;
}
@@ -2248,7 +2250,7 @@
0,
REG_SZ,
(LPBYTE)lpLoadOrderGroup,
- (wcslen(lpLoadOrderGroup) + 1) * sizeof(WCHAR));
+ (DWORD)((wcslen(lpLoadOrderGroup) + 1) *
sizeof(WCHAR)));
if (dwError != ERROR_SUCCESS)
goto done;
}
@@ -2284,7 +2286,7 @@
0,
REG_SZ,
(LPBYTE)lpObjectName,
- (wcslen(lpObjectName) + 1) * sizeof(WCHAR));
+ (DWORD)((wcslen(lpObjectName) + 1) * sizeof(WCHAR)));
if (dwError != ERROR_SUCCESS)
goto done;
}
@@ -2716,12 +2718,12 @@
dwRequiredSize = sizeof(QUERY_SERVICE_CONFIGW);
if (lpImagePath != NULL)
- dwRequiredSize += ((wcslen(lpImagePath) + 1) * sizeof(WCHAR));
+ dwRequiredSize += (DWORD)((wcslen(lpImagePath) + 1) * sizeof(WCHAR));
else
dwRequiredSize += 2 * sizeof(WCHAR);
if (lpService->lpGroup != NULL)
- dwRequiredSize += ((wcslen(lpService->lpGroup->lpGroupName) + 1) *
sizeof(WCHAR));
+ dwRequiredSize += (DWORD)((wcslen(lpService->lpGroup->lpGroupName) + 1) *
sizeof(WCHAR));
else
dwRequiredSize += 2 * sizeof(WCHAR);
@@ -2731,12 +2733,12 @@
dwRequiredSize += 2 * sizeof(WCHAR);
if (lpServiceStartName != NULL)
- dwRequiredSize += ((wcslen(lpServiceStartName) + 1) * sizeof(WCHAR));
+ dwRequiredSize += (DWORD)((wcslen(lpServiceStartName) + 1) * sizeof(WCHAR));
else
dwRequiredSize += 2 * sizeof(WCHAR);
if (lpService->lpDisplayName != NULL)
- dwRequiredSize += ((wcslen(lpService->lpDisplayName) + 1) * sizeof(WCHAR));
+ dwRequiredSize += (DWORD)((wcslen(lpService->lpDisplayName) + 1) *
sizeof(WCHAR));
else
dwRequiredSize += 2 * sizeof(WCHAR);
@@ -2995,7 +2997,7 @@
*lpcchBuffer = 2;
if (lpDisplayName != NULL)
{
- *lpDisplayName = '\0';
+ *lpDisplayName = 0;
}
}
@@ -3004,7 +3006,7 @@
if (!lpService->lpDisplayName)
{
- dwLength = wcslen(lpService->lpServiceName);
+ dwLength = (DWORD)wcslen(lpService->lpServiceName);
if (lpDisplayName != NULL &&
*lpcchBuffer > dwLength)
@@ -3014,7 +3016,7 @@
}
else
{
- dwLength = wcslen(lpService->lpDisplayName);
+ dwLength = (DWORD)wcslen(lpService->lpDisplayName);
if (lpDisplayName != NULL &&
*lpcchBuffer > dwLength)
@@ -3069,14 +3071,14 @@
*lpcchBuffer = 2;
if (lpServiceName != NULL)
{
- *lpServiceName = '\0';
+ *lpServiceName = 0;
}
}
return ERROR_SERVICE_DOES_NOT_EXIST;
}
- dwLength = wcslen(lpService->lpServiceName);
+ dwLength = (DWORD)wcslen(lpService->lpServiceName);
if (lpServiceName != NULL &&
*lpcchBuffer > dwLength)
@@ -3202,14 +3204,14 @@
lpDisplayName,
-1,
lpDisplayNameW,
- strlen(lpDisplayName) + 1);
+ (int)(strlen(lpDisplayName) + 1));
RegSetValueExW(hServiceKey,
L"DisplayName",
0,
REG_SZ,
(LPBYTE)lpDisplayNameW,
- (wcslen(lpDisplayNameW) + 1) * sizeof(WCHAR));
+ (DWORD)((wcslen(lpDisplayNameW) + 1) * sizeof(WCHAR)));
/* Update lpService->lpDisplayName */
if (lpService->lpDisplayName)
@@ -3280,7 +3282,7 @@
lpBinaryPathName,
-1,
lpBinaryPathNameW,
- strlen(lpBinaryPathName) + 1);
+ (int)(strlen(lpBinaryPathName) + 1));
if (lpService->Status.dwServiceType & SERVICE_DRIVER)
{
@@ -3301,7 +3303,7 @@
0,
REG_EXPAND_SZ,
(LPBYTE)lpBinaryPathNameW,
- (wcslen(lpBinaryPathNameW) + 1) * sizeof(WCHAR));
+ (DWORD)((wcslen(lpBinaryPathNameW) + 1) *
sizeof(WCHAR)));
HeapFree(GetProcessHeap(), 0, lpBinaryPathNameW);
@@ -3326,14 +3328,14 @@
lpLoadOrderGroup,
-1,
lpLoadOrderGroupW,
- strlen(lpLoadOrderGroup) + 1);
+ (int)(strlen(lpLoadOrderGroup) + 1));
dwError = RegSetValueExW(hServiceKey,
L"Group",
0,
REG_SZ,
(LPBYTE)lpLoadOrderGroupW,
- (wcslen(lpLoadOrderGroupW) + 1) * sizeof(WCHAR));
+ (DWORD)((wcslen(lpLoadOrderGroupW) + 1) *
sizeof(WCHAR)));
if (dwError != ERROR_SUCCESS)
{
HeapFree(GetProcessHeap(), 0, lpLoadOrderGroupW);
@@ -3384,7 +3386,7 @@
lpDependencies,
dwDependSize,
lpDependenciesW,
- strlen(lpDependencies) + 1);
+ (int)(strlen(lpDependencies) + 1));
dwError = ScmWriteDependencies(hServiceKey,
(LPWSTR)lpDependenciesW,
@@ -3438,7 +3440,7 @@
LPWSTR lpDependenciesW = NULL;
LPWSTR lpServiceStartNameW = NULL;
DWORD dwDependenciesLength = 0;
- DWORD dwLength;
+ SIZE_T cchLength;
int len;
LPCSTR lpStr;
@@ -3495,9 +3497,9 @@
lpStr = (LPCSTR)lpDependencies;
while (*lpStr)
{
- dwLength = strlen(lpStr) + 1;
- dwDependenciesLength += dwLength;
- lpStr = lpStr + dwLength;
+ cchLength = strlen(lpStr) + 1;
+ dwDependenciesLength += (DWORD)cchLength;
+ lpStr = lpStr + cchLength;
}
dwDependenciesLength++;
@@ -3679,7 +3681,7 @@
lpService->lpDisplayName,
-1,
lpStr,
- wcslen(lpService->lpDisplayName),
+ (int)wcslen(lpService->lpDisplayName),
0,
0);
lpServicesPtr->lpDisplayName = (LPSTR)((ULONG_PTR)lpStr -
(ULONG_PTR)lpServices);
@@ -3691,7 +3693,7 @@
lpService->lpServiceName,
-1,
lpStr,
- wcslen(lpService->lpServiceName),
+ (int)wcslen(lpService->lpServiceName),
0,
0);
lpServicesPtr->lpServiceName = (LPSTR)((ULONG_PTR)lpStr -
(ULONG_PTR)lpServices);
@@ -3773,7 +3775,7 @@
lpStringPtrW,
-1,
lpStringPtrA,
- wcslen(lpStringPtrW),
+ (int)wcslen(lpStringPtrW),
0,
0);
@@ -3787,7 +3789,7 @@
lpStringPtrW,
-1,
lpStringPtrA,
- wcslen(lpStringPtrW),
+ (int)wcslen(lpStringPtrW),
0,
0);
@@ -3954,12 +3956,12 @@
dwRequiredSize = sizeof(QUERY_SERVICE_CONFIGA);
if (lpImagePath != NULL)
- dwRequiredSize += wcslen(lpImagePath) + 1;
+ dwRequiredSize += (DWORD)(wcslen(lpImagePath) + 1);
else
dwRequiredSize += 2;
if ((lpService->lpGroup != NULL) && (lpService->lpGroup->lpGroupName
!= NULL))
- dwRequiredSize += wcslen(lpService->lpGroup->lpGroupName) + 1;
+ dwRequiredSize += (DWORD)(wcslen(lpService->lpGroup->lpGroupName) + 1);
else
dwRequiredSize += 2;
@@ -3970,12 +3972,12 @@
dwRequiredSize += 2;
if (lpServiceStartName != NULL)
- dwRequiredSize += wcslen(lpServiceStartName) + 1;
+ dwRequiredSize += (DWORD)(wcslen(lpServiceStartName) + 1);
else
dwRequiredSize += 2;
if (lpService->lpDisplayName != NULL)
- dwRequiredSize += wcslen(lpService->lpDisplayName) + 1;
+ dwRequiredSize += (DWORD)(wcslen(lpService->lpDisplayName) + 1);
else
dwRequiredSize += 2;
@@ -4003,7 +4005,7 @@
lpImagePath,
-1,
lpStr,
- wcslen(lpImagePath) + 1,
+ (int)(wcslen(lpImagePath) + 1),
0,
0);
}
@@ -4022,7 +4024,7 @@
lpService->lpGroup->lpGroupName,
-1,
lpStr,
- wcslen(lpService->lpGroup->lpGroupName) + 1,
+ (int)(wcslen(lpService->lpGroup->lpGroupName) +
1),
0,
0);
}
@@ -4064,7 +4066,7 @@
lpServiceStartName,
-1,
lpStr,
- wcslen(lpServiceStartName) + 1,
+ (int)(wcslen(lpServiceStartName) + 1),
0,
0);
}
@@ -4083,7 +4085,7 @@
lpService->lpDisplayName,
-1,
lpStr,
- wcslen(lpService->lpDisplayName) + 1,
+ (int)(wcslen(lpService->lpDisplayName) + 1),
0,
0);
}
@@ -4298,7 +4300,7 @@
if (lpServiceName != NULL)
{
- dwLength = strlen(lpServiceName) + 1;
+ dwLength = (DWORD)(strlen(lpServiceName) + 1);
lpServiceNameW = HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
dwLength * sizeof(WCHAR));
@@ -4328,7 +4330,7 @@
*lpcchBuffer = 1;
if (lpDisplayName != NULL)
{
- *lpDisplayName = '\0';
+ *lpDisplayName = 0;
}
}
return ERROR_SERVICE_DOES_NOT_EXIST;
@@ -4336,14 +4338,14 @@
if (!lpService->lpDisplayName)
{
- dwLength = wcslen(lpService->lpServiceName);
+ dwLength = (DWORD)wcslen(lpService->lpServiceName);
if (lpDisplayName != NULL &&
*lpcchBuffer > dwLength)
{
WideCharToMultiByte(CP_ACP,
0,
lpService->lpServiceName,
- wcslen(lpService->lpServiceName),
+ (int)wcslen(lpService->lpServiceName),
lpDisplayName,
dwLength + 1,
NULL,
@@ -4353,14 +4355,14 @@
}
else
{
- dwLength = wcslen(lpService->lpDisplayName);
+ dwLength = (DWORD)wcslen(lpService->lpDisplayName);
if (lpDisplayName != NULL &&
*lpcchBuffer > dwLength)
{
WideCharToMultiByte(CP_ACP,
0,
lpService->lpDisplayName,
- wcslen(lpService->lpDisplayName),
+ (int)wcslen(lpService->lpDisplayName),
lpDisplayName,
dwLength + 1,
NULL,
@@ -4395,7 +4397,7 @@
DPRINT("lpServiceName: %p\n", lpServiceName);
DPRINT("*lpcchBuffer: %lu\n", *lpcchBuffer);
- dwLength = strlen(lpDisplayName) + 1;
+ dwLength = (DWORD)(strlen(lpDisplayName) + 1);
lpDisplayNameW = HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
dwLength * sizeof(WCHAR));
@@ -4424,21 +4426,21 @@
*lpcchBuffer = 1;
if (lpServiceName != NULL)
{
- *lpServiceName = '\0';
+ *lpServiceName = 0;
}
}
return ERROR_SERVICE_DOES_NOT_EXIST;
}
- dwLength = wcslen(lpService->lpServiceName);
+ dwLength = (DWORD)wcslen(lpService->lpServiceName);
if (lpServiceName != NULL &&
*lpcchBuffer > dwLength)
{
WideCharToMultiByte(CP_ACP,
0,
lpService->lpServiceName,
- wcslen(lpService->lpServiceName),
+ (int)wcslen(lpService->lpServiceName),
lpServiceName,
dwLength + 1,
NULL,
@@ -4578,8 +4580,8 @@
}
dwSize = sizeof(ENUM_SERVICE_STATUSW) +
- ((wcslen(CurrentService->lpServiceName) + 1) * sizeof(WCHAR)) +
- ((wcslen(CurrentService->lpDisplayName) + 1) * sizeof(WCHAR));
+ (DWORD)((wcslen(CurrentService->lpServiceName) + 1) * sizeof(WCHAR))
+
+ (DWORD)((wcslen(CurrentService->lpDisplayName) + 1) *
sizeof(WCHAR));
if (dwRequiredSize + dwSize > cbBufSize)
{
@@ -4630,8 +4632,8 @@
}
dwRequiredSize += (sizeof(ENUM_SERVICE_STATUSW) +
- ((wcslen(CurrentService->lpServiceName) + 1) *
sizeof(WCHAR)) +
- ((wcslen(CurrentService->lpDisplayName) + 1) *
sizeof(WCHAR)));
+ (DWORD)((wcslen(CurrentService->lpServiceName) + 1) *
sizeof(WCHAR)) +
+ (DWORD)((wcslen(CurrentService->lpDisplayName) + 1) *
sizeof(WCHAR)));
dwError = ERROR_MORE_DATA;
}
@@ -4683,8 +4685,8 @@
}
dwSize = sizeof(ENUM_SERVICE_STATUSW) +
- ((wcslen(CurrentService->lpServiceName) + 1) * sizeof(WCHAR)) +
- ((wcslen(CurrentService->lpDisplayName) + 1) * sizeof(WCHAR));
+ (DWORD)((wcslen(CurrentService->lpServiceName) + 1) * sizeof(WCHAR))
+
+ (DWORD)((wcslen(CurrentService->lpDisplayName) + 1) *
sizeof(WCHAR));
if (dwRequiredSize + dwSize > cbBufSize)
break;
@@ -4751,7 +4753,7 @@
///if (lpServiceDescriptonA &&
///lpServiceDescriptonA->lpDescription)
///{
- dwLength = (strlen(Info.lpDescription) + 1) * sizeof(WCHAR);
+ dwLength = (DWORD)((strlen(Info.lpDescription) + 1) * sizeof(WCHAR));
lpServiceDescriptonW = HeapAlloc(GetProcessHeap(),
0,
@@ -4787,11 +4789,11 @@
{
if (lpServiceFailureActionsA->lpRebootMsg)
{
- dwRebootLen = (strlen(lpServiceFailureActionsA->lpRebootMsg) + 1) *
sizeof(WCHAR);
+ dwRebootLen = (DWORD)((strlen(lpServiceFailureActionsA->lpRebootMsg) +
1) * sizeof(WCHAR));
}
if (lpServiceFailureActionsA->lpCommand)
{
- dwCommandLen = (strlen(lpServiceFailureActionsA->lpCommand) + 1) *
sizeof(WCHAR);
+ dwCommandLen = (DWORD)((strlen(lpServiceFailureActionsA->lpCommand) +
1) * sizeof(WCHAR));
}
dwLength = dwRebootLen + dwCommandLen + sizeof(SERVICE_FAILURE_ACTIONSW);
@@ -5068,7 +5070,7 @@
0,
REG_SZ,
(LPBYTE)lpFailureActions->lpRebootMsg,
- (wcslen(lpFailureActions->lpRebootMsg) + 1) *
sizeof(WCHAR));
+ (DWORD)((wcslen(lpFailureActions->lpRebootMsg) + 1) *
sizeof(WCHAR)));
}
}
@@ -5089,7 +5091,7 @@
0,
REG_SZ,
(LPBYTE)lpFailureActions->lpCommand,
- (wcslen(lpFailureActions->lpCommand) + 1) *
sizeof(WCHAR));
+ (DWORD)((wcslen(lpFailureActions->lpCommand) + 1) *
sizeof(WCHAR)));
}
}
}
@@ -5184,7 +5186,7 @@
0,
REG_SZ,
(LPBYTE)lpServiceDescription->lpDescription,
- (wcslen(lpServiceDescription->lpDescription)
+ 1) * sizeof(WCHAR));
+
(DWORD)((wcslen(lpServiceDescription->lpDescription) + 1) * sizeof(WCHAR)));
}
}
else
@@ -5283,7 +5285,7 @@
*pcbBytesNeeded = sizeof(SERVICE_DESCRIPTIONA);
if (dwError == ERROR_SUCCESS)
- *pcbBytesNeeded += ((wcslen(lpDescriptionW) + 1) * sizeof(WCHAR));
+ *pcbBytesNeeded += (DWORD)((wcslen(lpDescriptionW) + 1) * sizeof(WCHAR));
if (cbBufSize < *pcbBytesNeeded)
{
@@ -5300,7 +5302,7 @@
lpDescriptionW,
-1,
lpStr,
- wcslen(lpDescriptionW),
+ (int)wcslen(lpDescriptionW),
NULL,
NULL);
lpServiceDescription->lpDescription = (LPSTR)((ULONG_PTR)lpStr -
(ULONG_PTR)lpServiceDescription);
@@ -5341,10 +5343,10 @@
&lpRebootMessageW);
if (lpRebootMessageW)
- dwRequiredSize += (wcslen(lpRebootMessageW) + 1) * sizeof(WCHAR);
+ dwRequiredSize += (DWORD)((wcslen(lpRebootMessageW) + 1) * sizeof(WCHAR));
if (lpFailureCommandW)
- dwRequiredSize += (wcslen(lpFailureCommandW) + 1) * sizeof(WCHAR);
+ dwRequiredSize += (DWORD)((wcslen(lpFailureCommandW) + 1) * sizeof(WCHAR));
if (cbBufSize < dwRequiredSize)
{
@@ -5404,7 +5406,7 @@
lpRebootMessageW,
-1,
lpStr,
- wcslen(lpRebootMessageW),
+ (int)wcslen(lpRebootMessageW),
NULL,
NULL);
lpFailureActions->lpRebootMsg = (LPSTR)((ULONG_PTR)lpStr -
(ULONG_PTR)lpFailureActions);
@@ -5418,7 +5420,7 @@
lpFailureCommandW,
-1,
lpStr,
- wcslen(lpFailureCommandW),
+ (int)wcslen(lpFailureCommandW),
NULL,
NULL);
lpFailureActions->lpCommand = (LPSTR)((ULONG_PTR)lpStr -
(ULONG_PTR)lpFailureActions);
@@ -5519,7 +5521,7 @@
*pcbBytesNeeded = sizeof(SERVICE_DESCRIPTIONW);
if (dwError == ERROR_SUCCESS)
- *pcbBytesNeeded += ((wcslen(lpDescription) + 1) * sizeof(WCHAR));
+ *pcbBytesNeeded += (DWORD)((wcslen(lpDescription) + 1) * sizeof(WCHAR));
if (cbBufSize < *pcbBytesNeeded)
{
@@ -5569,10 +5571,10 @@
&lpRebootMessage);
if (lpRebootMessage)
- dwRequiredSize += (wcslen(lpRebootMessage) + 1) * sizeof(WCHAR);
+ dwRequiredSize += (DWORD)((wcslen(lpRebootMessage) + 1) * sizeof(WCHAR));
if (lpFailureCommand)
- dwRequiredSize += (wcslen(lpFailureCommand) + 1) * sizeof(WCHAR);
+ dwRequiredSize += (DWORD)((wcslen(lpFailureCommand) + 1) * sizeof(WCHAR));
if (cbBufSize < dwRequiredSize)
{
@@ -5768,7 +5770,7 @@
pszGroupName,
-1,
pszGroupNameW,
- strlen(pszGroupName) + 1);
+ (int)(strlen(pszGroupName) + 1));
}
if ((cbBufSize > 0) && (lpBuffer))
@@ -5811,7 +5813,7 @@
lpStringPtrW,
-1,
lpStringPtrA,
- wcslen(lpStringPtrW),
+ (int)wcslen(lpStringPtrW),
0,
0);
@@ -5825,7 +5827,7 @@
lpStringPtrW,
-1,
lpStringPtrA,
- wcslen(lpStringPtrW),
+ (int)wcslen(lpStringPtrW),
0,
0);
@@ -5975,8 +5977,8 @@
}
dwSize = sizeof(ENUM_SERVICE_STATUS_PROCESSW) +
- ((wcslen(CurrentService->lpServiceName) + 1) * sizeof(WCHAR)) +
- ((wcslen(CurrentService->lpDisplayName) + 1) * sizeof(WCHAR));
+ (DWORD)((wcslen(CurrentService->lpServiceName) + 1) * sizeof(WCHAR))
+
+ (DWORD)((wcslen(CurrentService->lpDisplayName) + 1) *
sizeof(WCHAR));
if (dwRequiredSize + dwSize <= cbBufSize)
{
@@ -6030,8 +6032,8 @@
}
dwRequiredSize += (sizeof(ENUM_SERVICE_STATUS_PROCESSW) +
- ((wcslen(CurrentService->lpServiceName) + 1) *
sizeof(WCHAR)) +
- ((wcslen(CurrentService->lpDisplayName) + 1) *
sizeof(WCHAR)));
+ (DWORD)((wcslen(CurrentService->lpServiceName) + 1) *
sizeof(WCHAR)) +
+ (DWORD)((wcslen(CurrentService->lpDisplayName) + 1) *
sizeof(WCHAR)));
dwError = ERROR_MORE_DATA;
}
@@ -6090,8 +6092,8 @@
}
dwSize = sizeof(ENUM_SERVICE_STATUS_PROCESSW) +
- ((wcslen(CurrentService->lpServiceName) + 1) * sizeof(WCHAR)) +
- ((wcslen(CurrentService->lpDisplayName) + 1) * sizeof(WCHAR));
+ (DWORD)((wcslen(CurrentService->lpServiceName) + 1) * sizeof(WCHAR))
+
+ (DWORD)((wcslen(CurrentService->lpDisplayName) + 1) *
sizeof(WCHAR));
if (dwRequiredSize + dwSize <= cbBufSize)
{