in src/main/cpp/jnilib/windows/src/jni_WindowsRegistry.c [393:425]
JNIEXPORT jint JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_get32BitValue0(JNIEnv *jEnv, jobject jObject, jint jMode, jint jSection, jstring jKey, jstring jName) {
HKEY hkey = 0;
unsigned short* key = getWideChars(jEnv, jKey);
unsigned short* value = getWideChars(jEnv, jName);
jint result = -1;
if(RegOpenKeyExW(getHKEY(jSection), key, 0, KEY_QUERY_VALUE | getMode(jMode), &hkey) == ERROR_SUCCESS) {
DWORD dwType = 0;
DWORD dwValue = 0;
DWORD dwBufSize = sizeof(dwValue);
if (RegQueryValueExW(hkey, value, NULL, &dwType, (LPBYTE) &dwValue, &dwBufSize) == ERROR_SUCCESS) {
if ((dwType == REG_DWORD) || (dwType == REG_DWORD_BIG_ENDIAN)) {
result = dwValue;
} else {
throwException(jEnv, "Value is of wrong type");
}
} else {
throwException(jEnv, "Cannot read key data");
}
} else {
throwException(jEnv, "Could not open key");
}
if (hkey != 0) {
RegCloseKey(hkey);
}
FREE(key);
FREE(value);
return result;
}