Author: gedmurphy
Date: Tue Jan 5 19:39:47 2010
New Revision: 44954
URL:
http://svn.reactos.org/svn/reactos?rev=44954&view=rev
Log:
Switch to crt string safe functions. Remove some commented code
Modified:
trunk/reactos/base/applications/mscutils/servman/propsheet_depends.c
trunk/reactos/base/applications/mscutils/servman/query.c
trunk/reactos/base/applications/mscutils/servman/stop.c
Modified: trunk/reactos/base/applications/mscutils/servman/propsheet_depends.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/propsheet_depends.c [iso-8859-1]
(original)
+++ trunk/reactos/base/applications/mscutils/servman/propsheet_depends.c [iso-8859-1] Tue
Jan 5 19:39:47 2010
@@ -20,6 +20,8 @@
{
TV_ITEM tvi;
TV_INSERTSTRUCT tvins;
+ LPTSTR lpName;
+ DWORD dwSize;
ZeroMemory(&tvi, sizeof(tvi));
ZeroMemory(&tvins, sizeof(tvins));
@@ -52,13 +54,15 @@
if (lpServiceName)
{
+ dwSize = _tcslen(lpServiceName) + 1;
/* Attach the service name */
- tvi.lParam = (LPARAM)(LPTSTR)HeapAlloc(GetProcessHeap(),
- 0,
- (_tcslen(lpServiceName) + 1) *
sizeof(TCHAR));
- if (tvi.lParam)
- {
- _tcscpy((LPTSTR)tvi.lParam, lpServiceName);
+ lpName = (LPTSTR)HeapAlloc(GetProcessHeap(),
+ 0,
+ dwSize * sizeof(TCHAR));
+ if (lpName)
+ {
+ _tcscpy_s(lpName, dwSize, lpServiceName);
+ tvi.lParam = (LPARAM)lpName;
}
}
Modified: trunk/reactos/base/applications/mscutils/servman/query.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/query.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mscutils/servman/query.c [iso-8859-1] Tue Jan 5
19:39:47 2010
@@ -143,6 +143,7 @@
SERVICE_DESCRIPTION *pServiceDescription = NULL;
LPTSTR lpDescription = NULL;
DWORD BytesNeeded = 0;
+ DWORD dwSize;
hSCManager = OpenSCManager(NULL,
NULL,
@@ -180,12 +181,16 @@
{
if (pServiceDescription->lpDescription)
{
+ dwSize = _tcslen(pServiceDescription->lpDescription) + 1;
lpDescription = HeapAlloc(ProcessHeap,
0,
-
(_tcslen(pServiceDescription->lpDescription) + 1) * sizeof(TCHAR));
+ dwSize * sizeof(TCHAR));
if (lpDescription)
- _tcscpy(lpDescription,
- pServiceDescription->lpDescription);
+ {
+ _tcscpy_s(lpDescription,
+ dwSize,
+ pServiceDescription->lpDescription);
+ }
}
}
}
Modified: trunk/reactos/base/applications/mscutils/servman/stop.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/stop.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mscutils/servman/stop.c [iso-8859-1] Tue Jan 5
19:39:47 2010
@@ -101,52 +101,13 @@
return bRet;
}
-
-
-
static BOOL
StopDependantServices(PMAIN_WND_INFO pInfo,
LPWSTR lpServiceName)
{
- //LPENUM_SERVICE_STATUS lpDependencies;
- //SC_HANDLE hDepService;
- //DWORD dwCount;
BOOL bRet = FALSE;
MessageBox(NULL, L"Rewrite StopDependentServices", NULL, 0);
- /*
-
- lpDependencies = GetServiceDependents(hService, &dwCount);
- if (lpDependencies)
- {
- LPENUM_SERVICE_STATUS lpEnumServiceStatus;
- DWORD i;
-
- for (i = 0; i < dwCount; i++)
- {
- lpEnumServiceStatus = &lpDependencies[i];
-
- hDepService = OpenService(pStopInfo->hSCManager,
- lpEnumServiceStatus->lpServiceName,
- SERVICE_STOP | SERVICE_QUERY_STATUS);
- if (hDepService)
- {
- bRet = StopService(pStopInfo, hDepService);
-
- CloseServiceHandle(hDepService);
-
- if (!bRet)
- {
- GetError();
- break;
- }
- }
- }
-
- HeapFree(GetProcessHeap(),
- 0,
- lpDependencies);
- }*/
return bRet;
}
@@ -186,13 +147,14 @@
pInfo->pCurrentService->lpServiceName,
IDS_PROGRESS_INFO_STOP);
- /* Finally, stop the requested service */
+ /* Stop the requested service */
bRet = StopService(pInfo,
pInfo->pCurrentService->lpServiceName,
hProgress);
if (hProgress)
{
+ /* Complete and destroy the progress bar */
DestroyProgressDialog(hProgress, TRUE);
}
}