/*****************************************************************************
* 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 );
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;
}
{
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 );
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;
}
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;
}
/* 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 );
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;
}
}
/* 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 );
}