[ros-diffs] [gadamopoulos] 53195: [themesvc] - Add the themes service. For now it will only call ThemeHooksInstall and ThemeHooksRemove. From now on we do not need apihooksrv in order to have themes

gadamopoulos at svn.reactos.org gadamopoulos at svn.reactos.org
Fri Aug 12 10:25:31 UTC 2011


Author: gadamopoulos
Date: Fri Aug 12 10:25:30 2011
New Revision: 53195

URL: http://svn.reactos.org/svn/reactos?rev=53195&view=rev
Log:
[themesvc]
- Add the themes service. For now it will only call ThemeHooksInstall and ThemeHooksRemove. From now on we do not need apihooksrv in order to have themes

Added:
    branches/GSoC_2011/ThemesSupport/base/services/thmsvc/   (with props)
    branches/GSoC_2011/ThemesSupport/base/services/thmsvc/CMakeLists.txt   (with props)
    branches/GSoC_2011/ThemesSupport/base/services/thmsvc/thmsvc.c   (with props)
    branches/GSoC_2011/ThemesSupport/base/services/thmsvc/thmsvc.rbuild   (with props)
    branches/GSoC_2011/ThemesSupport/base/services/thmsvc/thmsvc.rc   (with props)
Modified:
    branches/GSoC_2011/ThemesSupport/base/services/CMakeLists.txt
    branches/GSoC_2011/ThemesSupport/base/services/services.rbuild

Modified: branches/GSoC_2011/ThemesSupport/base/services/CMakeLists.txt
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/base/services/CMakeLists.txt?rev=53195&r1=53194&r2=53195&view=diff
==============================================================================
--- branches/GSoC_2011/ThemesSupport/base/services/CMakeLists.txt [iso-8859-1] (original)
+++ branches/GSoC_2011/ThemesSupport/base/services/CMakeLists.txt [iso-8859-1] Fri Aug 12 10:25:30 2011
@@ -7,5 +7,6 @@
 add_subdirectory(tcpsvcs)
 add_subdirectory(telnetd)
 #add_subdirectory(tftpd)
+add_subdirectory(thmsvc)
 add_subdirectory(umpnpmgr)
 add_subdirectory(wlansvc)

Modified: branches/GSoC_2011/ThemesSupport/base/services/services.rbuild
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/base/services/services.rbuild?rev=53195&r1=53194&r2=53195&view=diff
==============================================================================
--- branches/GSoC_2011/ThemesSupport/base/services/services.rbuild [iso-8859-1] (original)
+++ branches/GSoC_2011/ThemesSupport/base/services/services.rbuild [iso-8859-1] Fri Aug 12 10:25:30 2011
@@ -25,6 +25,9 @@
 	<directory name="tftpd">
 		<xi:include href="tftpd/tftpd.rbuild" />
 	</directory>
+	<directory name="thmsvc">
+		<xi:include href="thmsvc/thmsvc.rbuild" />
+	</directory>
 	<directory name="umpnpmgr">
 		<xi:include href="umpnpmgr/umpnpmgr.rbuild" />
 	</directory>

Propchange: branches/GSoC_2011/ThemesSupport/base/services/thmsvc/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Fri Aug 12 10:25:30 2011
@@ -1,0 +1,2 @@
+([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))?
+(\d+)

Propchange: branches/GSoC_2011/ThemesSupport/base/services/thmsvc/
------------------------------------------------------------------------------
    bugtraq:message = See issue #%BUGID% for more details.

Propchange: branches/GSoC_2011/ThemesSupport/base/services/thmsvc/
------------------------------------------------------------------------------
    bugtraq:url = http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%

Propchange: branches/GSoC_2011/ThemesSupport/base/services/thmsvc/
------------------------------------------------------------------------------
    tsvn:logminsize = 10

Added: branches/GSoC_2011/ThemesSupport/base/services/thmsvc/CMakeLists.txt
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/base/services/thmsvc/CMakeLists.txt?rev=53195&view=auto
==============================================================================
--- branches/GSoC_2011/ThemesSupport/base/services/thmsvc/CMakeLists.txt (added)
+++ branches/GSoC_2011/ThemesSupport/base/services/thmsvc/CMakeLists.txt [iso-8859-1] Fri Aug 12 10:25:30 2011
@@ -1,0 +1,10 @@
+
+set_unicode()
+
+add_executable(thmsvc thmsvc.c thmsvc.rc)
+
+target_link_libraries(thmsvc wine)
+
+set_module_type(thmsvc win32cui)
+add_importlibs(thmsvc uxtheme advapi32 msvcrt kernel32 ntdll)
+add_cd_file(TARGET thmsvc DESTINATION reactos/system32 FOR all)

Propchange: branches/GSoC_2011/ThemesSupport/base/services/thmsvc/CMakeLists.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: branches/GSoC_2011/ThemesSupport/base/services/thmsvc/thmsvc.c
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/base/services/thmsvc/thmsvc.c?rev=53195&view=auto
==============================================================================
--- branches/GSoC_2011/ThemesSupport/base/services/thmsvc/thmsvc.c (added)
+++ branches/GSoC_2011/ThemesSupport/base/services/thmsvc/thmsvc.c [iso-8859-1] Fri Aug 12 10:25:30 2011
@@ -1,0 +1,149 @@
+/*
+ * COPYRIGHT:        See COPYING in the top level directory
+ * PROJECT:          ReactOS kernel
+ * FILE:             services/thmsvc/thmsvc.c
+ * PURPOSE:          Themes service
+ * PROGRAMMER:       Giannis Adamopoulos
+ */
+
+/* INCLUDES *****************************************************************/
+
+#define WIN32_NO_STATUS
+#include <windows.h>
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(thmsvc);
+
+
+/* GLOBALS ******************************************************************/
+
+static VOID CALLBACK ServiceMain(DWORD argc, LPWSTR *argv);
+static WCHAR ServiceName[] = L"Themes";
+static SERVICE_TABLE_ENTRYW ServiceTable[] =
+{
+    {ServiceName, ServiceMain},
+    {NULL, NULL}
+};
+
+SERVICE_STATUS_HANDLE ServiceStatusHandle;
+SERVICE_STATUS ServiceStatus;
+
+BOOL WINAPI ThemeHooksInstall();
+
+BOOL WINAPI ThemeHooksRemove();
+
+/* FUNCTIONS *****************************************************************/
+
+static VOID
+UpdateServiceStatus(DWORD dwState)
+{
+    ServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
+    ServiceStatus.dwCurrentState = dwState;
+
+    if (dwState == SERVICE_RUNNING)
+        ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_PAUSE_CONTINUE | SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
+    else if (dwState == SERVICE_PAUSED)
+        ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_PAUSE_CONTINUE;
+    else
+        ServiceStatus.dwControlsAccepted = 0;
+
+    ServiceStatus.dwWin32ExitCode = 0;
+    ServiceStatus.dwServiceSpecificExitCode = 0;
+    ServiceStatus.dwCheckPoint = 0;
+
+    if (dwState == SERVICE_START_PENDING ||
+        dwState == SERVICE_STOP_PENDING ||
+        dwState == SERVICE_PAUSE_PENDING ||
+        dwState == SERVICE_CONTINUE_PENDING)
+        ServiceStatus.dwWaitHint = 10000;
+    else
+        ServiceStatus.dwWaitHint = 0;
+
+    SetServiceStatus(ServiceStatusHandle,
+                     &ServiceStatus);
+}
+
+
+static DWORD WINAPI
+ServiceControlHandler(DWORD dwControl,
+                      DWORD dwEventType,
+                      LPVOID lpEventData,
+                      LPVOID lpContext)
+{
+    TRACE("ServiceControlHandler() called\n");
+
+    switch (dwControl)
+    {
+        case SERVICE_CONTROL_STOP:
+            TRACE("  SERVICE_CONTROL_STOP received\n");
+            UpdateServiceStatus(SERVICE_STOPPED);
+            ThemeHooksRemove();
+            return ERROR_SUCCESS;
+
+        case SERVICE_CONTROL_PAUSE:
+            TRACE("  SERVICE_CONTROL_PAUSE received\n");
+            UpdateServiceStatus(SERVICE_PAUSED);
+            return ERROR_SUCCESS;
+
+        case SERVICE_CONTROL_CONTINUE:
+            TRACE("  SERVICE_CONTROL_CONTINUE received\n");
+            UpdateServiceStatus(SERVICE_RUNNING);
+            return ERROR_SUCCESS;
+
+        case SERVICE_CONTROL_INTERROGATE:
+            TRACE("  SERVICE_CONTROL_INTERROGATE received\n");
+            SetServiceStatus(ServiceStatusHandle,
+                             &ServiceStatus);
+            return ERROR_SUCCESS;
+
+        case SERVICE_CONTROL_SHUTDOWN:
+            TRACE("  SERVICE_CONTROL_SHUTDOWN received\n");
+            UpdateServiceStatus(SERVICE_STOPPED);
+            return ERROR_SUCCESS;
+
+        default :
+            TRACE("  Control %lu received\n");
+            return ERROR_CALL_NOT_IMPLEMENTED;
+    }
+}
+
+
+static VOID CALLBACK
+ServiceMain(DWORD argc, LPWSTR *argv)
+{
+    UNREFERENCED_PARAMETER(argc);
+    UNREFERENCED_PARAMETER(argv);
+
+    TRACE("ServiceMain() called\n");
+
+    ServiceStatusHandle = RegisterServiceCtrlHandlerExW(ServiceName,
+                                                        ServiceControlHandler,
+                                                        NULL);
+
+    TRACE("Calling SetServiceStatus()\n");
+    UpdateServiceStatus(SERVICE_RUNNING);
+    TRACE("SetServiceStatus() called\n");
+
+    ThemeHooksInstall();
+
+    TRACE("ServiceMain() done\n");
+}
+
+
+int
+wmain(int argc, WCHAR *argv[])
+{
+    UNREFERENCED_PARAMETER(argc);
+    UNREFERENCED_PARAMETER(argv);
+
+    TRACE("thmsvc: main() started\n");
+
+    StartServiceCtrlDispatcher(ServiceTable);
+
+    TRACE("thmsvc: main() done\n");
+
+    return 0;
+}
+
+/* EOF */

Propchange: branches/GSoC_2011/ThemesSupport/base/services/thmsvc/thmsvc.c
------------------------------------------------------------------------------
    svn:eol-style = native

Added: branches/GSoC_2011/ThemesSupport/base/services/thmsvc/thmsvc.rbuild
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/base/services/thmsvc/thmsvc.rbuild?rev=53195&view=auto
==============================================================================
--- branches/GSoC_2011/ThemesSupport/base/services/thmsvc/thmsvc.rbuild (added)
+++ branches/GSoC_2011/ThemesSupport/base/services/thmsvc/thmsvc.rbuild [iso-8859-1] Fri Aug 12 10:25:30 2011
@@ -1,0 +1,11 @@
+<?xml version="1.0"?>
+<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
+<module name="thmsvc" type="win32cui" installbase="system32" installname="thmsvc.exe" unicode="yes">
+	<include base="thmsvc">.</include>
+	<library>uxtheme</library>
+	<library>wine</library>
+	<library>ntdll</library>
+	<library>advapi32</library>
+	<file>thmsvc.c</file>
+	<file>thmsvc.rc</file>
+</module>

Propchange: branches/GSoC_2011/ThemesSupport/base/services/thmsvc/thmsvc.rbuild
------------------------------------------------------------------------------
    svn:eol-style = native

Added: branches/GSoC_2011/ThemesSupport/base/services/thmsvc/thmsvc.rc
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/base/services/thmsvc/thmsvc.rc?rev=53195&view=auto
==============================================================================
--- branches/GSoC_2011/ThemesSupport/base/services/thmsvc/thmsvc.rc (added)
+++ branches/GSoC_2011/ThemesSupport/base/services/thmsvc/thmsvc.rc [iso-8859-1] Fri Aug 12 10:25:30 2011
@@ -1,0 +1,4 @@
+#define REACTOS_STR_FILE_DESCRIPTION	"Themes-Service\0"
+#define REACTOS_STR_INTERNAL_NAME	"thmsvc\0"
+#define REACTOS_STR_ORIGINAL_FILENAME	"thmsvc.exe\0"
+#include <reactos/version.rc>

Propchange: branches/GSoC_2011/ThemesSupport/base/services/thmsvc/thmsvc.rc
------------------------------------------------------------------------------
    svn:eol-style = native




More information about the Ros-diffs mailing list