Author: ekohl
Date: Mon Feb 16 11:47:40 2015
New Revision: 66314
URL:
http://svn.reactos.org/svn/reactos?rev=66314&view=rev
Log:
[SERVICES]
Replace hard-coded strings by string resources.
Added:
trunk/reactos/base/system/services/lang/ (with props)
trunk/reactos/base/system/services/lang/en-US.rc (with props)
trunk/reactos/base/system/services/resource.h (with props)
Modified:
trunk/reactos/base/system/services/database.c
trunk/reactos/base/system/services/rpcserver.c
trunk/reactos/base/system/services/services.h
trunk/reactos/base/system/services/services.rc
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] Mon Feb 16 11:47:40 2015
@@ -1340,7 +1340,7 @@
OVERLAPPED Overlapped = {0};
#endif
#if 0
- LPCWSTR lpErrorStrings[3];
+ LPCWSTR lpLogStrings[3];
WCHAR szBuffer1[20];
WCHAR szBuffer2[20];
#endif
@@ -1377,13 +1377,13 @@
#if 0
_ultow(PipeTimeout, szBuffer1, 10);
- lpErrorStrings[0] = Service->lpDisplayName;
- lpErrorStrings[1] = szBuffer1;
+ lpLogStrings[0] = Service->lpDisplayName;
+ lpLogStrings[1] = szBuffer1;
ScmLogEvent(EVENT_CONNECTION_TIMEOUT,
EVENTLOG_ERROR_TYPE,
2,
- lpErrorStrings);
+ lpLogStrings);
#endif
DPRINT1("Log EVENT_CONNECTION_TIMEOUT by %S\n",
Service->lpDisplayName);
@@ -1444,12 +1444,12 @@
#if 0
_ultow(PipeTimeout, szBuffer1, 10);
- lpErrorStrings[0] = szBuffer1;
+ lpLogStrings[0] = szBuffer1;
ScmLogEvent(EVENT_READFILE_TIMEOUT,
EVENTLOG_ERROR_TYPE,
1,
- lpErrorStrings);
+ lpLogStrings);
#endif
DPRINT1("Log EVENT_READFILE_TIMEOUT by %S\n",
Service->lpDisplayName);
@@ -1491,14 +1491,14 @@
_ultow(Service->lpImage->dwProcessId, szBuffer1, 10);
_ultow(dwProcessId, szBuffer2, 10);
- lpErrorStrings[0] = Service->lpDisplayName;
- lpErrorStrings[1] = szBuffer1;
- lpErrorStrings[2] = szBuffer2;
+ lpLogStrings[0] = Service->lpDisplayName;
+ lpLogStrings[1] = szBuffer1;
+ lpLogStrings[2] = szBuffer2;
ScmLogEvent(EVENT_SERVICE_DIFFERENT_PID_CONNECTED,
EVENTLOG_WARNING_TYPE,
3,
- lpErrorStrings);
+ lpLogStrings);
#endif
DPRINT1("Log EVENT_SERVICE_DIFFERENT_PID_CONNECTED by %S\n",
Service->lpDisplayName);
@@ -1625,8 +1625,8 @@
{
PSERVICE_GROUP Group = Service->lpGroup;
DWORD dwError = ERROR_SUCCESS;
- LPCWSTR lpErrorStrings[2];
- WCHAR szErrorBuffer[32];
+ LPCWSTR lpLogStrings[2];
+ WCHAR szLogBuffer[80];
DPRINT("ScmLoadService() called\n");
DPRINT("Start Service %p (%S)\n", Service, Service->lpServiceName);
@@ -1682,25 +1682,27 @@
}
/* Log a successful service start */
- lpErrorStrings[0] = Service->lpDisplayName;
- lpErrorStrings[1] = L"start";
+ LoadStringW(GetModuleHandle(NULL), IDS_SERVICE_START, szLogBuffer, 80);
+ lpLogStrings[0] = Service->lpDisplayName;
+ lpLogStrings[1] = szLogBuffer;
+
ScmLogEvent(EVENT_SERVICE_CONTROL_SUCCESS,
EVENTLOG_INFORMATION_TYPE,
2,
- lpErrorStrings);
+ lpLogStrings);
}
else
{
if (Service->dwErrorControl != SERVICE_ERROR_IGNORE)
{
/* Log a failed service start */
- swprintf(szErrorBuffer, L"%lu", dwError);
- lpErrorStrings[0] = Service->lpServiceName;
- lpErrorStrings[1] = szErrorBuffer;
+ swprintf(szLogBuffer, L"%lu", dwError);
+ lpLogStrings[0] = Service->lpServiceName;
+ lpLogStrings[1] = szLogBuffer;
ScmLogEvent(EVENT_SERVICE_START_FAILED,
EVENTLOG_ERROR_TYPE,
2,
- lpErrorStrings);
+ lpLogStrings);
}
#if 0
Propchange: trunk/reactos/base/system/services/lang/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Mon Feb 16 11:47:40 2015
@@ -0,0 +1 @@
+((CORE|ROSTESTS|ROSAPPS)-\d+)(,? ?((CORE|ROSTESTS|ROSAPPS)-\d+))*(,? ?(and |or
)?((CORE|ROSTESTS|ROSAPPS)-\d+))?
Propchange: trunk/reactos/base/system/services/lang/
------------------------------------------------------------------------------
bugtraq:message = See issue %BUGID% for more details.
Propchange: trunk/reactos/base/system/services/lang/
------------------------------------------------------------------------------
bugtraq:url =
https://jira.reactos.org/browse/%BUGID%
Propchange: trunk/reactos/base/system/services/lang/
------------------------------------------------------------------------------
tsvn:logminsize = 10
Added: trunk/reactos/base/system/services/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/lang/…
==============================================================================
--- trunk/reactos/base/system/services/lang/en-US.rc (added)
+++ trunk/reactos/base/system/services/lang/en-US.rc [iso-8859-1] Mon Feb 16 11:47:40
2015
@@ -0,0 +1,12 @@
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+STRINGTABLE
+BEGIN
+ IDS_SERVICE_START "start"
+ IDS_SERVICE_STOP "stop"
+ IDS_SERVICE_PAUSE "pause"
+ IDS_SERVICE_RESUME "resume"
+ IDS_SERVICE_RUNNING "running"
+ IDS_SERVICE_STOPPED "stopped"
+ IDS_SERVICE_PAUSED "paused"
+END
Propchange: trunk/reactos/base/system/services/lang/en-US.rc
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/base/system/services/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/resou…
==============================================================================
--- trunk/reactos/base/system/services/resource.h (added)
+++ trunk/reactos/base/system/services/resource.h [iso-8859-1] Mon Feb 16 11:47:40 2015
@@ -0,0 +1,9 @@
+#pragma once
+
+#define IDS_SERVICE_START 100
+#define IDS_SERVICE_STOP 101
+#define IDS_SERVICE_PAUSE 102
+#define IDS_SERVICE_RESUME 103
+#define IDS_SERVICE_RUNNING 104
+#define IDS_SERVICE_STOPPED 105
+#define IDS_SERVICE_PAUSED 106
Propchange: trunk/reactos/base/system/services/resource.h
------------------------------------------------------------------------------
svn:eol-style = native
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] Mon Feb 16 11:47:40 2015
@@ -1085,7 +1085,9 @@
DWORD dwControlsAccepted;
DWORD dwCurrentState;
HKEY hServicesKey = NULL;
- LPCWSTR lpErrorStrings[2];
+ LPCWSTR lpLogStrings[2];
+ WCHAR szLogBuffer[80];
+ UINT uID;
DPRINT("RControlService() called\n");
@@ -1245,34 +1247,35 @@
if (dwError == ERROR_SUCCESS)
{
- if (dwControl != SERVICE_CONTROL_INTERROGATE)
+ if (dwControl == SERVICE_CONTROL_STOP ||
+ dwControl == SERVICE_CONTROL_PAUSE ||
+ dwControl == SERVICE_CONTROL_CONTINUE)
{
/* Log a sucessful send control */
- lpErrorStrings[0] = lpService->lpDisplayName;
-
- switch(dwControl)
+
+ switch (dwControl)
{
case SERVICE_CONTROL_STOP:
- lpErrorStrings[1] = L"stop";
+ uID = IDS_SERVICE_STOP;
break;
case SERVICE_CONTROL_PAUSE:
- lpErrorStrings[1] = L"pause";
+ uID = IDS_SERVICE_PAUSE;
break;
case SERVICE_CONTROL_CONTINUE:
- lpErrorStrings[1] = L"continue";
- break;
-
- default:
- lpErrorStrings[1] = L"other";
+ uID = IDS_SERVICE_RESUME;
break;
}
+ LoadStringW(GetModuleHandle(NULL), uID, szLogBuffer, 80);
+
+ lpLogStrings[0] = lpService->lpDisplayName;
+ lpLogStrings[1] = szLogBuffer;
ScmLogEvent(EVENT_SERVICE_CONTROL_SUCCESS,
EVENTLOG_INFORMATION_TYPE,
2,
- lpErrorStrings);
+ lpLogStrings);
}
}
@@ -1652,8 +1655,9 @@
PSERVICE lpService;
DWORD dwPreviousState;
DWORD dwPreviousType;
- LPCWSTR lpErrorStrings[2];
- WCHAR szErrorBuffer[32];
+ LPCWSTR lpLogStrings[2];
+ WCHAR szLogBuffer[80];
+ UINT uID;
DPRINT("RSetServiceStatus() called\n");
DPRINT("hServiceStatus = %lu\n", hServiceStatus);
@@ -1730,14 +1734,14 @@
(lpServiceStatus->dwWin32ExitCode != ERROR_SUCCESS))
{
/* Log a failed service stop */
- swprintf(szErrorBuffer, L"%lu", lpServiceStatus->dwWin32ExitCode);
- lpErrorStrings[0] = lpService->lpDisplayName;
- lpErrorStrings[1] = szErrorBuffer;
+ swprintf(szLogBuffer, L"%lu", lpServiceStatus->dwWin32ExitCode);
+ lpLogStrings[0] = lpService->lpDisplayName;
+ lpLogStrings[1] = szLogBuffer;
ScmLogEvent(EVENT_SERVICE_EXIT_FAILED,
EVENTLOG_ERROR_TYPE,
2,
- lpErrorStrings);
+ lpLogStrings);
}
else if (lpServiceStatus->dwCurrentState != dwPreviousState &&
(lpServiceStatus->dwCurrentState == SERVICE_STOPPED ||
@@ -1745,27 +1749,29 @@
lpServiceStatus->dwCurrentState == SERVICE_PAUSED))
{
/* Log a successful service status change */
- lpErrorStrings[0] = lpService->lpDisplayName;
-
switch(lpServiceStatus->dwCurrentState)
{
case SERVICE_STOPPED:
- lpErrorStrings[1] = L"stopped";
+ uID = IDS_SERVICE_STOPPED;
break;
case SERVICE_RUNNING:
- lpErrorStrings[1] = L"running";
+ uID = IDS_SERVICE_RUNNING;
break;
case SERVICE_PAUSED:
- lpErrorStrings[1] = L"paused";
+ uID = IDS_SERVICE_PAUSED;
break;
}
+
+ LoadStringW(GetModuleHandle(NULL), uID, szLogBuffer, 80);
+ lpLogStrings[0] = lpService->lpDisplayName;
+ lpLogStrings[1] = szLogBuffer;
ScmLogEvent(EVENT_SERVICE_STATUS_SUCCESS,
EVENTLOG_INFORMATION_TYPE,
2,
- lpErrorStrings);
+ lpLogStrings);
}
DPRINT("Set %S to %lu\n", lpService->lpDisplayName,
lpService->Status.dwCurrentState);
Modified: trunk/reactos/base/system/services/services.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/servi…
==============================================================================
--- trunk/reactos/base/system/services/services.h [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/services.h [iso-8859-1] Mon Feb 16 11:47:40 2015
@@ -16,12 +16,15 @@
#include <winbase.h>
#include <winsvc.h>
#include <winreg.h>
+#include <winuser.h>
#include <netevent.h>
#define NTOS_MODE_USER
#include <ndk/obfuncs.h>
#include <ndk/rtlfuncs.h>
#include <services/services.h>
#include <svcctl_s.h>
+
+#include "resource.h"
typedef struct _SERVICE_GROUP
{
@@ -196,6 +199,7 @@
WORD wType,
WORD wStrings,
LPCWSTR *lpStrings);
+LPWSTR ScmGetResourceString(UINT uID);
VOID ScmWaitForLsa(VOID);
#endif /* _SERVICES_H */
Modified: trunk/reactos/base/system/services/services.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/servi…
==============================================================================
--- trunk/reactos/base/system/services/services.rc [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/services.rc [iso-8859-1] Mon Feb 16 11:47:40 2015
@@ -1,4 +1,17 @@
+#include <windef.h>
+#include <winuser.h>
+
+#include "resource.h"
+
#define REACTOS_STR_FILE_DESCRIPTION "Service Control Manager"
#define REACTOS_STR_INTERNAL_NAME "Services"
#define REACTOS_STR_ORIGINAL_FILENAME "Services.exe"
#include <reactos/version.rc>
+
+
+/* UTF-8 */
+#pragma code_page(65001)
+
+#ifdef LANGUAGE_EN_US
+ #include "lang/en-US.rc"
+#endif