Author: tfaber
Date: Sat Jun 29 11:46:13 2013
New Revision: 59359
URL:
http://svn.reactos.org/svn/reactos?rev=59359&view=rev
Log:
[SVCHOST]
- Make WCHARs explicit
Modified:
trunk/reactos/base/services/svchost/svchost.c
trunk/reactos/base/services/svchost/svchost.h
Modified: trunk/reactos/base/services/svchost/svchost.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/svchost/svch…
==============================================================================
--- trunk/reactos/base/services/svchost/svchost.c [iso-8859-1] (original)
+++ trunk/reactos/base/services/svchost/svchost.c [iso-8859-1] Sat Jun 29 11:46:13 2013
@@ -15,38 +15,38 @@
/* DEFINES *******************************************************************/
-static LPCTSTR SVCHOST_REG_KEY = _T("SOFTWARE\\Microsoft\\Windows
NT\\CurrentVersion\\SvcHost");
-static LPCTSTR SERVICE_KEY = _T("SYSTEM\\CurrentControlSet\\Services\\");
-static LPCTSTR PARAMETERS_KEY = _T("\\Parameters");
-
-#define SERVICE_KEY_LENGTH _tcslen(SERVICE_KEY);
+static PCWSTR SVCHOST_REG_KEY = L"SOFTWARE\\Microsoft\\Windows
NT\\CurrentVersion\\SvcHost";
+static PCWSTR SERVICE_KEY = L"SYSTEM\\CurrentControlSet\\Services\\";
+static PCWSTR PARAMETERS_KEY = L"\\Parameters";
+
+#define SERVICE_KEY_LENGTH wcslen(SERVICE_KEY);
#define REG_MAX_DATA_SIZE 2048
static PSERVICE FirstService = NULL;
/* FUNCTIONS *****************************************************************/
-BOOL PrepareService(LPCTSTR ServiceName)
+BOOL PrepareService(PCWSTR ServiceName)
{
HKEY hServiceKey;
- TCHAR ServiceKeyBuffer[MAX_PATH + 1];
+ WCHAR ServiceKeyBuffer[MAX_PATH + 1];
DWORD LeftOfBuffer = sizeof(ServiceKeyBuffer) / sizeof(ServiceKeyBuffer[0]);
DWORD KeyType;
- PTSTR Buffer = NULL;
+ PWSTR Buffer = NULL;
DWORD BufferSize = MAX_PATH + 1;
LONG RetVal;
HINSTANCE hServiceDll;
- TCHAR DllPath[MAX_PATH + 2]; /* See MSDN on ExpandEnvironmentStrings() for ANSI
strings for more details on + 2 */
+ WCHAR DllPath[MAX_PATH + 2]; /* See MSDN on ExpandEnvironmentStrings() for ANSI
strings for more details on + 2 */
LPSERVICE_MAIN_FUNCTION ServiceMainFunc;
PSERVICE Service;
/* Compose the registry path to the service's "Parameter" key */
- _tcsncpy(ServiceKeyBuffer, SERVICE_KEY, LeftOfBuffer);
- LeftOfBuffer -= _tcslen(SERVICE_KEY);
- _tcsncat(ServiceKeyBuffer, ServiceName, LeftOfBuffer);
- LeftOfBuffer -= _tcslen(ServiceName);
- _tcsncat(ServiceKeyBuffer, PARAMETERS_KEY, LeftOfBuffer);
- LeftOfBuffer -= _tcslen(PARAMETERS_KEY);
+ wcsncpy(ServiceKeyBuffer, SERVICE_KEY, LeftOfBuffer);
+ LeftOfBuffer -= wcslen(SERVICE_KEY);
+ wcsncat(ServiceKeyBuffer, ServiceName, LeftOfBuffer);
+ LeftOfBuffer -= wcslen(ServiceName);
+ wcsncat(ServiceKeyBuffer, PARAMETERS_KEY, LeftOfBuffer);
+ LeftOfBuffer -= wcslen(PARAMETERS_KEY);
if (LeftOfBuffer < 0)
{
@@ -73,7 +73,7 @@
return FALSE;
}
- RetVal = RegQueryValueEx(hServiceKey, _T("ServiceDll"), NULL,
&KeyType, (LPBYTE)Buffer, &BufferSize);
+ RetVal = RegQueryValueEx(hServiceKey, L"ServiceDll", NULL,
&KeyType, (LPBYTE)Buffer, &BufferSize);
} while (RetVal == ERROR_MORE_DATA);
@@ -119,14 +119,14 @@
}
memset(Service, 0, sizeof(SERVICE));
- Service->Name = HeapAlloc(GetProcessHeap(), 0, (_tcslen(ServiceName)+1) *
sizeof(TCHAR));
+ Service->Name = HeapAlloc(GetProcessHeap(), 0, (wcslen(ServiceName)+1) *
sizeof(WCHAR));
if (Service->Name == NULL)
{
DPRINT1("Not enough memory for service: %s\n", ServiceName);
HeapFree(GetProcessHeap(), 0, Service);
return FALSE;
}
- _tcscpy(Service->Name, ServiceName);
+ wcscpy(Service->Name, ServiceName);
Service->hServiceDll = hServiceDll;
Service->ServiceMainFunc = ServiceMainFunc;
@@ -154,13 +154,13 @@
/*
* Returns the number of services successfully loaded from the category
*/
-DWORD LoadServiceCategory(LPCTSTR ServiceCategory)
+DWORD LoadServiceCategory(PCWSTR ServiceCategory)
{
HKEY hServicesKey;
DWORD KeyType;
DWORD BufferSize = REG_MAX_DATA_SIZE;
- TCHAR Buffer[REG_MAX_DATA_SIZE];
- LPCTSTR ServiceName;
+ WCHAR Buffer[REG_MAX_DATA_SIZE];
+ PCWSTR ServiceName;
DWORD BufferIndex = 0;
DWORD NrOfServices = 0;
@@ -183,11 +183,11 @@
/* Load services in the category */
ServiceName = Buffer;
- while (ServiceName[0] != _T('\0'))
+ while (ServiceName[0] != UNICODE_NULL)
{
size_t Length;
-
- Length = _tcslen(ServiceName);
+
+ Length = wcslen(ServiceName);
if (Length == 0)
break;
@@ -202,7 +202,7 @@
return NrOfServices;
}
-int _tmain (int argc, LPTSTR argv [])
+int wmain(int argc, wchar_t **argv)
{
DWORD NrOfServices;
LPSERVICE_TABLE_ENTRY ServiceTable;
@@ -213,7 +213,7 @@
return 0;
}
- if (_tcscmp(argv[1], _T("-k")) != 0)
+ if (wcscmp(argv[1], L"-k") != 0)
{
/* For now, we only handle "-k" */
return 0;
Modified: trunk/reactos/base/services/svchost/svchost.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/svchost/svch…
==============================================================================
--- trunk/reactos/base/services/svchost/svchost.h [iso-8859-1] (original)
+++ trunk/reactos/base/services/svchost/svchost.h [iso-8859-1] Sat Jun 29 11:46:13 2013
@@ -20,14 +20,13 @@
#include <winbase.h>
#include <winreg.h>
#include <winsvc.h>
-#include <tchar.h>
/* DEFINES *******************************************************************/
#define CS_TIMEOUT 1000
typedef struct _SERVICE {
- PTSTR Name;
+ PWSTR Name;
HINSTANCE hServiceDll;
LPSERVICE_MAIN_FUNCTION ServiceMainFunc;
struct _SERVICE *Next;