Пример #1
0
void * queryValue(Node db, void *inputkey){

  if ((strcmp(db->key, inputkey)) == 0){
    return db->value;
  }
  else 
    return queryValue(db->next, inputkey);
}
Пример #2
0
JNIEXPORT jstring JNICALL Java_org_netbeans_installer_utils_system_windows_WindowsRegistry_getStringValue0(JNIEnv *jEnv, jobject jObject, jint jMode, jint jSection, jstring jKey, jstring jName, jboolean jExpand) {
    unsigned short*   key    = getWideChars(jEnv, jKey);
    unsigned short*   name   = getWideChars(jEnv, jName);
    DWORD   type   = REG_NONE;
    byte*   value  = NULL;
    
    jstring result = NULL;
    
    if (queryValue(getMode(jMode), getHKEY(jSection), key, name, &type, NULL, &value, jExpand)) {
        if (type == REG_SZ || type == REG_EXPAND_SZ) {
            result = getStringW(jEnv, (unsigned short*) value);
        } else {
            throwException(jEnv, "Value has wrong type");
        }
    } else {
        throwException(jEnv, "Cannot read value");
    }
    
    FREE(key);
    FREE(name);
    FREE(value);
    
    return result;
}