diff --git a/bindings/java/src/net/hyperic/sigar/win32/Service.java b/bindings/java/src/net/hyperic/sigar/win32/Service.java index 73551628..b7978396 100644 --- a/bindings/java/src/net/hyperic/sigar/win32/Service.java +++ b/bindings/java/src/net/hyperic/sigar/win32/Service.java @@ -74,6 +74,7 @@ public class Service extends Win32 { private long manager; private long service; + private String name; private Service() throws Win32Exception { @@ -96,6 +97,8 @@ public class Service extends Win32 { if (this.service == 0) { throw getLastErrorException(); } + + this.name = serviceName; } protected void finalize() @@ -297,6 +300,7 @@ public class Service extends Win32 { if (!QueryServiceConfig(this.service, config)) { throw getLastErrorException(); } + config.setName(this.name); return config; } diff --git a/bindings/java/src/net/hyperic/sigar/win32/ServiceConfig.java b/bindings/java/src/net/hyperic/sigar/win32/ServiceConfig.java index 7a8100f1..de19fec3 100644 --- a/bindings/java/src/net/hyperic/sigar/win32/ServiceConfig.java +++ b/bindings/java/src/net/hyperic/sigar/win32/ServiceConfig.java @@ -78,11 +78,27 @@ public class ServiceConfig { String binaryPathName; String loadOrderGroup; int tagId; - String[] dependencies = null; + String[] dependencies; String serviceStartName; String displayName; String description; + String password; + String name; + ServiceConfig() {} + + public ServiceConfig(String name) { + this.name = name; + this.type = TYPE_WIN32_OWN_PROCESS; + this.startType = START_AUTO; + this.errorControl = ERROR_NORMAL; + //msdn docs: + //"Specify an empty string if the account has no password + //or if the service runs in the LocalService, NetworkService, + //or LocalSystem account" + this.password = ""; + } + /** * @return Returns the binaryPathName. */ @@ -206,4 +222,28 @@ public class ServiceConfig { public void setDescription(String description) { this.description = description; } + /** + * @return Returns the password. + */ + public String getPassword() { + return password; + } + /** + * @param password The password to set. + */ + public void setPassword(String password) { + this.password = password; + } + /** + * @return Returns the name. + */ + public String getName() { + return name; + } + /** + * @param name The name to set. + */ + public void setName(String name) { + this.name = name; + } }