From 742f2e36bfd7c5a6038de043322732c44717281b Mon Sep 17 00:00:00 2001 From: Ged Murphy Date: Mon, 26 Dec 2005 20:40:45 +0000 Subject: [PATCH] Shut MSVC warnings up svn path=/trunk/; revision=20339 --- reactos/subsys/system/sc/query.c | 22 ++++++++++++---------- reactos/subsys/system/sc/sc.c | 23 +++++++++++------------ reactos/subsys/system/sc/usage.c | 2 +- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/reactos/subsys/system/sc/query.c b/reactos/subsys/system/sc/query.c index f4ab2f09935..456c0a26b1b 100644 --- a/reactos/subsys/system/sc/query.c +++ b/reactos/subsys/system/sc/query.c @@ -16,9 +16,12 @@ #include "sc.h" +#define DEBUG +#include + /* local function decs */ VOID PrintService(BOOL bExtended); -BOOL EnumServices(LPCTSTR ServiceName, DWORD ServiceType, DWORD ServiceState); +BOOL EnumServices(DWORD ServiceType, DWORD ServiceState); BOOL QueryService(LPCTSTR ServiceName, BOOL bExtended); /* global variables */ @@ -29,11 +32,10 @@ DWORD NumServices = 0; BOOL Query(LPCTSTR ServiceName, LPCTSTR *ServiceArgs, BOOL bExtended) { - if (! ServiceName) /* display all running services and drivers */ { /* get default values */ - EnumServices(NULL, SERVICE_WIN32, SERVICE_ACTIVE); + EnumServices(SERVICE_WIN32, SERVICE_ACTIVE); /* print default values */ PrintService(bExtended); @@ -43,11 +45,11 @@ Query(LPCTSTR ServiceName, LPCTSTR *ServiceArgs, BOOL bExtended) LPCTSTR Type = *ServiceArgs; if (_tcsicmp(Type, _T("driver")) == 0) - EnumServices(NULL, SERVICE_DRIVER, SERVICE_ACTIVE); + EnumServices(SERVICE_DRIVER, SERVICE_ACTIVE); else if (_tcsicmp(Type, _T("service")) == 0) - EnumServices(NULL, SERVICE_WIN32, SERVICE_ACTIVE); + EnumServices(SERVICE_WIN32, SERVICE_ACTIVE); else if (_tcsicmp(Type, _T("all")) == 0) - EnumServices(NULL, SERVICE_DRIVER|SERVICE_WIN32, SERVICE_ACTIVE); + EnumServices(SERVICE_DRIVER|SERVICE_WIN32, SERVICE_ACTIVE); else { _tprintf(_T("\nERROR following \"type=\"!\n")); @@ -61,9 +63,9 @@ Query(LPCTSTR ServiceName, LPCTSTR *ServiceArgs, BOOL bExtended) LPCTSTR State = *ServiceArgs; if (_tcsicmp(State, _T("inactive")) == 0) - EnumServices(NULL, SERVICE_WIN32, SERVICE_INACTIVE); + EnumServices(SERVICE_WIN32, SERVICE_INACTIVE); else if (_tcsicmp(State, _T("all")) == 0) - EnumServices(NULL, SERVICE_WIN32, SERVICE_STATE_ALL); + EnumServices(SERVICE_WIN32, SERVICE_STATE_ALL); else { _tprintf(_T("\nERROR following \"state=\"!\n")); @@ -202,7 +204,7 @@ QueryService(LPCTSTR ServiceName, BOOL bExtended) BOOL -EnumServices(LPCTSTR ServiceName, DWORD ServiceType, DWORD ServiceState) +EnumServices(DWORD ServiceType, DWORD ServiceState) { DWORD BufSize = 0; DWORD BytesNeeded = 0; @@ -265,7 +267,7 @@ EnumServices(LPCTSTR ServiceName, DWORD ServiceType, DWORD ServiceState) VOID PrintService(BOOL bExtended) { - int i; + DWORD i; for (i=0; i < NumServices; i++) { diff --git a/reactos/subsys/system/sc/sc.c b/reactos/subsys/system/sc/sc.c index 98691f88cc3..de8333d5306 100644 --- a/reactos/subsys/system/sc/sc.c +++ b/reactos/subsys/system/sc/sc.c @@ -21,16 +21,17 @@ DWORD ReportLastError(VOID) DWORD ErrorCode = GetLastError(); if (ErrorCode != ERROR_SUCCESS) { - if ((RetVal = FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - ErrorCode, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ - (LPTSTR) &lpMsgBuf, - 0, - NULL ))) + RetVal = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + ErrorCode, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ + (LPTSTR) &lpMsgBuf, + 0, + NULL ); + + if (RetVal != 0) { _tprintf(_T("%s"), (LPTSTR)lpMsgBuf); @@ -169,8 +170,6 @@ int _tmain(int argc, LPCTSTR argv[]) ServiceName = argv[2]; return ScControl(MachineName, Command, ServiceName, &argv[3], argc); } - - return MainUsage(); } diff --git a/reactos/subsys/system/sc/usage.c b/reactos/subsys/system/sc/usage.c index 813ed9e31fa..8c745c4c068 100644 --- a/reactos/subsys/system/sc/usage.c +++ b/reactos/subsys/system/sc/usage.c @@ -13,7 +13,7 @@ INT MainUsage(VOID) { - TCHAR c; + INT c; _tprintf(_T("DESCRIPTION:\n") _T("\tSC is a command line program used for communicating with\n")