Package com.sun.jna.platform.win32
Class W32ServiceManager
- java.lang.Object
- 
- com.sun.jna.platform.win32.W32ServiceManager
 
- 
- All Implemented Interfaces:
- java.io.Closeable,- java.lang.AutoCloseable
 
 public class W32ServiceManager extends java.lang.Object implements java.io.CloseableWin32 Service Manager wrapper- Author:
- EugineLev
 
- 
- 
Field SummaryFields Modifier and Type Field Description (package private) java.lang.String_databaseName(package private) Winsvc.SC_HANDLE_handle(package private) java.lang.String_machineName
 - 
Constructor SummaryConstructors Constructor Description W32ServiceManager()Instantiate a W32ServiceManager for the local computer and the SERVICES_ACTIVE_DATABASE ("ServicesActive") database.W32ServiceManager(int permissions)Instantiate a W32ServiceManager for the local computer and the SERVICES_ACTIVE_DATABASE ("ServicesActive") database.W32ServiceManager(java.lang.String machineName, java.lang.String databaseName)Instantiate a W32ServiceManager.W32ServiceManager(java.lang.String machineName, java.lang.String databaseName, int permissions)Instantiate a W32ServiceManager.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the previously opened Service Manager.Winsvc.ENUM_SERVICE_STATUS_PROCESS[]enumServicesStatusExProcess(int dwServiceType, int dwServiceState, java.lang.String groupName)Enumerates services in the specified service control manager database.Winsvc.SC_HANDLEgetHandle()Gets the service manager handle.voidopen(int permissions)(Re-)Opens the Service Manager with the supplied permissions.W32ServiceopenService(java.lang.String serviceName, int permissions)Opens a Service.
 
- 
- 
- 
Field Detail- 
_handleWinsvc.SC_HANDLE _handle 
 - 
_machineNamejava.lang.String _machineName 
 - 
_databaseNamejava.lang.String _databaseName 
 
- 
 - 
Constructor Detail- 
W32ServiceManagerpublic W32ServiceManager() Instantiate a W32ServiceManager for the local computer and the SERVICES_ACTIVE_DATABASE ("ServicesActive") database.The connection is not established until open(int)is called.
 - 
W32ServiceManagerpublic W32ServiceManager(int permissions) Instantiate a W32ServiceManager for the local computer and the SERVICES_ACTIVE_DATABASE ("ServicesActive") database.A connection is opened directly with the requested permissions. - Parameters:
- permissions- requested permissions for access
 
 - 
W32ServiceManagerpublic W32ServiceManager(java.lang.String machineName, java.lang.String databaseName)Instantiate a W32ServiceManager.- Parameters:
- machineName- The name of the target computer. If the pointer is NULL or points to an empty string, the function connects to the service control manager on the local computer.
- databaseName- The name of the service control manager database. This parameter should be set to "ServicesActive". If it is NULL, the "ServicesActive" (SERVICES_ACTIVE_DATABASE) database is opened by default.- The connection is not established until - open(int)is called.
 
 - 
W32ServiceManagerpublic W32ServiceManager(java.lang.String machineName, java.lang.String databaseName, int permissions)Instantiate a W32ServiceManager.A connection is opened directly with the requested permissions. - Parameters:
- machineName- The name of the target computer. If the pointer is NULL or points to an empty string, the function connects to the service control manager on the local computer.
- databaseName- The name of the service control manager database. This parameter should be set to "ServicesActive". If it is NULL, the "ServicesActive" (SERVICES_ACTIVE_DATABASE) database is opened by default.
- permissions- requested permissions for access
 
 
- 
 - 
Method Detail- 
openpublic void open(int permissions) (Re-)Opens the Service Manager with the supplied permissions.- Parameters:
- permissions- Permissions.
 
 - 
closepublic void close() Closes the previously opened Service Manager.- Specified by:
- closein interface- java.lang.AutoCloseable
- Specified by:
- closein interface- java.io.Closeable
 
 - 
openServicepublic W32Service openService(java.lang.String serviceName, int permissions) Opens a Service.- Parameters:
- serviceName- Service name.
- permissions- Permissions.
- Returns:
- Returns an opened service.
 
 - 
getHandlepublic Winsvc.SC_HANDLE getHandle() Gets the service manager handle.- Returns:
- Returns the service manager handle.
 
 - 
enumServicesStatusExProcesspublic Winsvc.ENUM_SERVICE_STATUS_PROCESS[] enumServicesStatusExProcess(int dwServiceType, int dwServiceState, java.lang.String groupName) Enumerates services in the specified service control manager database. The name and status of each service are provided, along with additional data based on the specified information level.- Parameters:
- dwServiceType- The type of services to be enumerated. This parameter can be one or more of the following values.- Value - Meaning - WinNT.SERVICE_DRIVER- Services of type - WinNT.SERVICE_KERNEL_DRIVERand- WinNT.SERVICE_FILE_SYSTEM_DRIVER.- WinNT.SERVICE_FILE_SYSTEM_DRIVER- File system driver services. - WinNT.SERVICE_KERNEL_DRIVER- Driver services. - WinNT.SERVICE_WIN32- Services of type - WinNT.SERVICE_WIN32_OWN_PROCESSand- WinNT.SERVICE_WIN32_SHARE_PROCESS.- WinNT.SERVICE_WIN32_OWN_PROCESS- Services that run in their own processes. - WinNT.SERVICE_WIN32_SHARE_PROCESS- Services that share a process with one or more other services. For more information, see Service Programs. 
- dwServiceState- The state of the services to be enumerated. This parameter can be one of the following values.- Value - Meaning - Winsvc.SERVICE_ACTIVE- Enumerates services that are in the following states: - Winsvc.SERVICE_START_PENDING,- Winsvc.SERVICE_STOP_PENDING,- Winsvc.SERVICE_RUNNING,- Winsvc.SERVICE_CONTINUE_PENDING,- Winsvc.SERVICE_PAUSE_PENDING, and- Winsvc.SERVICE_PAUSED.- Winsvc.SERVICE_INACTIVE- Enumerates services that are in the - Winsvc.SERVICE_STOPPEDstate.- Winsvc.SERVICE_STATE_ALL- Combines the following states: - Winsvc.SERVICE_ACTIVEand- Winsvc.SERVICE_INACTIVE.
- groupName- The load-order group name. If this parameter is a string, the only services enumerated are those that belong to the group that has the name specified by the string. If this parameter is an empty string, only services that do not belong to any group are enumerated. If this parameter is NULL, group membership is ignored and all services are enumerated.
- Returns:
- array of ENUM_SERVICE_STATUS_PROCESS structures.
 
 
- 
 
-