Hi,
When trying to view the status of Services in Windows, there's an issue with access management in the following code:
https://github.com/hyperic/sigar/blob/master/bindings/java/src/org/hyperic/sigar/win32/Service.java
It tries to gain access to services with full access codes, and Windows prevents this from happening for certain system services (such as MSDTC, which is very vital to monitor for SQL Server). The problems are in:
public Service(String serviceName) throws Win32Exception, which tries: this.service = OpenService(this.manager, serviceName, SERVICE_ALL_ACCESS);
And in the private Service()
private Service() throws Win32Exception { this.manager = OpenSCManager("", SC_MANAGER_ALL_ACCESS); }
Also, all the access modifiers are private static final int, so they can't be seen by other programs. My proposal would be to add new methods which would allow entering the access levels in the initializer, such as public Service(String serviceName, int access).