byte[] QueryValue(string name, RegistryValueKind valueType) { if (this.hKey == null || this.hKey.IsInvalid) { return(null); } RegistryValueKind type; uint cb = 0; int ret = SafeNativeMethods.ClusterRegQueryValue(this.hKey, name, out type, null, ref cb); Utilities.Log("ClusterRegQueryValue [" + name + "], returned [" + ret + "]"); if (ret == SafeNativeMethods.ERROR_SUCCESS || ret == SafeNativeMethods.ERROR_MORE_DATA) { if (valueType != type) { return(null); } byte[] buffer = new byte[cb]; ret = SafeNativeMethods.ClusterRegQueryValue(this.hKey, name, out type, buffer, ref cb); if (ret == SafeNativeMethods.ERROR_SUCCESS) { if (valueType != type) { return(null); } return(buffer); } } return(null); }