]> git.sesse.net Git - vlc/blobdiff - modules/control/ntservice.c
* ts.c : renamed to ts.
[vlc] / modules / control / ntservice.c
index 582d31afd5e91edc6a5064620d436b647e40b1b4..61dac6b1f1b9e49ec1a4af35c3738c1064d95c68 100755 (executable)
@@ -1,8 +1,8 @@
 /*****************************************************************************
  * ntservice.c: Windows NT/2K/XP service interface
  *****************************************************************************
- * Copyright (C) 2001 VideoLAN
- * $Id: ntservice.c,v 1.2 2003/08/14 11:47:32 gbazin Exp $
+ * Copyright (C) 2004 VideoLAN
+ * $Id$
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
 static int  Activate( vlc_object_t * );
 static void Close   ( vlc_object_t * );
 
-#define INSTALL_TEXT N_( "Install NT/2K/XP service" )
+#define INSTALL_TEXT N_( "Install Windows Service" )
 #define INSTALL_LONGTEXT N_( \
-    "If enabled the interface will install the service and exit." )
-#define UNINSTALL_TEXT N_( "Uninstall NT/2K/XP service" )
+    "If enabled the interface will install the Service and exit." )
+#define UNINSTALL_TEXT N_( "Uninstall Windows Service" )
 #define UNINSTALL_LONGTEXT N_( \
-    "If enabled the interface will uninstall the service and exit." )
-#define NAME_TEXT N_( "Display name of the service" )
+    "If enabled the interface will uninstall the Service and exit." )
+#define NAME_TEXT N_( "Display name of the Service" )
 #define NAME_LONGTEXT N_( \
-    "This allows you to change the display name of the service." )
+    "This allows you to change the display name of the Service." )
 #define EXTRAINTF_TEXT N_("Extra interface modules")
 #define EXTRAINTF_LONGTEXT N_( \
     "This option allows you to select additional interfaces spawned by the " \
-    "service. It should be specified at install time so the service is " \
+    "Service. It should be specified at install time so the Service is " \
     "properly configured. Use a comma separated list of interface modules. " \
-    "(common values are: logger,sap,rc,http)")
+    "(common values are: logger, sap, rc, http)")
 
 vlc_module_begin();
-    set_description( _("Windows NT/2K/XP service interface") );
-    add_category_hint( N_("NT service"), NULL, VLC_TRUE );
-    add_bool( "ntservice-install", 0, NULL, INSTALL_TEXT, INSTALL_LONGTEXT, VLC_TRUE );
-    add_bool( "ntservice-uninstall", 0, NULL, INSTALL_TEXT, INSTALL_LONGTEXT, VLC_TRUE );
-    add_string ( "ntservice-name", VLCSERVICENAME, NULL, NAME_TEXT, NAME_LONGTEXT, VLC_TRUE );
-    add_string ( "ntservice-extraintf", NULL, NULL, EXTRAINTF_TEXT, EXTRAINTF_LONGTEXT, VLC_TRUE );
+    set_description( _("Windows Service interface") );
+    add_bool( "ntservice-install", 0, NULL,
+              INSTALL_TEXT, INSTALL_LONGTEXT, VLC_TRUE );
+    add_bool( "ntservice-uninstall", 0, NULL,
+              UNINSTALL_TEXT, UNINSTALL_LONGTEXT, VLC_TRUE );
+    add_string ( "ntservice-name", VLCSERVICENAME, NULL,
+                 NAME_TEXT, NAME_LONGTEXT, VLC_TRUE );
+    add_string ( "ntservice-extraintf", NULL, NULL,
+                 EXTRAINTF_TEXT, EXTRAINTF_LONGTEXT, VLC_TRUE );
 
     set_capability( "interface", 0 );
     set_callbacks( Activate, Close );
@@ -154,7 +157,7 @@ static int NTServiceInstall( intf_thread_t *p_intf )
     SC_HANDLE handle = OpenSCManager( NULL, NULL, SC_MANAGER_ALL_ACCESS );
     if( handle == NULL )
     {
-        msg_Err( p_intf, "Could not connect to SCM database" );
+        msg_Err( p_intf, "could not connect to SCM database" );
         return VLC_EGENERIC;
     }
 
@@ -181,20 +184,20 @@ static int NTServiceInstall( intf_thread_t *p_intf )
     {
         if( GetLastError() != ERROR_SERVICE_EXISTS )
         {
-            msg_Err( p_intf, "Could not create new service: \"%s\" (%s)",
+            msg_Err( p_intf, "could not create new service: \"%s\" (%s)",
                      p_sys->psz_service ,psz_path );
             CloseServiceHandle( handle );
             return VLC_EGENERIC;
         }
         else
         {
-            msg_Warn( p_intf, "Service \"%s\" already exists",
+            msg_Warn( p_intf, "service \"%s\" already exists",
                       p_sys->psz_service );
         }
     }
     else
     {
-        msg_Warn( p_intf, "Service successfuly created" );
+        msg_Warn( p_intf, "service successfuly created" );
     }
 
     if( service ) CloseServiceHandle( service );
@@ -210,7 +213,7 @@ static int NTServiceUninstall( intf_thread_t *p_intf )
     SC_HANDLE handle = OpenSCManager( NULL, NULL, SC_MANAGER_ALL_ACCESS );
     if( handle == NULL )
     {
-        msg_Err( p_intf, "Could not connect to SCM database" );
+        msg_Err( p_intf, "could not connect to SCM database" );
         return VLC_EGENERIC;
     }
 
@@ -218,7 +221,7 @@ static int NTServiceUninstall( intf_thread_t *p_intf )
     SC_HANDLE service = OpenService( handle, p_sys->psz_service, DELETE );
     if( service == NULL )
     {
-        msg_Err( p_intf, "Could not open service" );
+        msg_Err( p_intf, "could not open service" );
         CloseServiceHandle( handle );
         return VLC_EGENERIC;
     }
@@ -226,12 +229,12 @@ static int NTServiceUninstall( intf_thread_t *p_intf )
     /* Remove the service */
     if( !DeleteService( service ) )
     {
-        msg_Err( p_intf, "Could not delete service \"%s\"",
+        msg_Err( p_intf, "could not delete service \"%s\"",
                  p_sys->psz_service );
     }
     else
     {
-        msg_Dbg( p_intf, "Service deleted successfuly" );
+        msg_Dbg( p_intf, "service deleted successfuly" );
     }
 
     CloseServiceHandle( service );
@@ -256,7 +259,7 @@ static void WINAPI ServiceDispatch( DWORD numArgs, char **args )
         RegisterServiceCtrlHandler( p_sys->psz_service, &ServiceCtrlHandler );
     if( p_sys->hStatus == (SERVICE_STATUS_HANDLE)0 )
     {
-        msg_Err( p_intf, "Failed to register service control handler" );
+        msg_Err( p_intf, "failed to register service control handler" );
         return;
     }
 
@@ -309,9 +312,9 @@ static void WINAPI ServiceDispatch( DWORD numArgs, char **args )
     }
 
     /* Initialization complete - report running status */
-    p_sys->status.dwCurrentState = SERVICE_RUNNING; 
-    p_sys->status.dwCheckPoint   = 0; 
-    p_sys->status.dwWaitHint     = 0; 
+    p_sys->status.dwCurrentState = SERVICE_RUNNING;
+    p_sys->status.dwCheckPoint   = 0;
+    p_sys->status.dwWaitHint     = 0;
 
     SetServiceStatus( p_sys->hStatus, &p_sys->status );
 }