queryValueMethod.setAccessible(true);
int[] result = (int[]) openKeyMethod.invoke(null, hive, stringToByteArray(keyName), KEY_READ);
if (result[ERROR_CODE] != ERROR_SUCCESS) {
if (result[ERROR_CODE] == ERROR_FILE_NOT_FOUND) {
throw new BackingStoreException("Not Found error opening key " + keyName);
} else {
throw new BackingStoreException("Error " + result[ERROR_CODE] + " opening key " + keyName);
}
}
int hKey = result[NATIVE_HANDLE];
byte[] b = (byte[]) queryValueMethod.invoke(null, hKey, stringToByteArray(valueName));
closeKeyMethod.invoke(null, hKey);
if (b == null)
return null;
else
return byteArrayToString(b);
} catch (InvocationTargetException e) {
throw new BackingStoreException(e.getCause());
} catch (NoSuchMethodException e) {
throw new BackingStoreException(e);
} catch (IllegalAccessException e) {
throw new BackingStoreException(e);
}
}