< prev index next >

src/java.prefs/windows/native/libprefs/WindowsPreferences.c

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -35,61 +35,61 @@
 /*
  * Declare library specific JNI_Onload entry if static build
  */
 DEF_STATIC_JNI_OnLoad
 
-    JNIEXPORT jintArray JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegOpenKey
-               (JNIEnv* env, jclass this_class, jint hKey, jbyteArray lpSubKey, jint securityMask) {
+    JNIEXPORT jlongArray JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegOpenKey
+               (JNIEnv* env, jclass this_class, jlong hKey, jbyteArray lpSubKey, jint securityMask) {
         HKEY handle;
         char* str;
-        int tmp[2];
+        jlong tmp[2];
         int errorCode=-1;
-        jintArray result;
+        jlongArray result;
         str = (*env)->GetByteArrayElements(env, lpSubKey, NULL);
         CHECK_NULL_RETURN(str, NULL);
         errorCode =  RegOpenKeyEx((HKEY)hKey, str, 0, securityMask, &handle);
         (*env)->ReleaseByteArrayElements(env, lpSubKey, str, 0);
-        tmp[0]= (int) handle;
+        tmp[0]= (jlong)handle;
         tmp[1]= errorCode;
-        result = (*env)->NewIntArray(env,2);
+        result = (*env)->NewLongArray(env,2);
         if (result != NULL) {
-            (*env)->SetIntArrayRegion(env, result, 0, 2, tmp);
+            (*env)->SetLongArrayRegion(env, result, 0, 2, tmp);
         }
         return result;
     }
 
     JNIEXPORT jint JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegCloseKey
-               (JNIEnv* env, jclass this_class, jint hKey) {
+               (JNIEnv* env, jclass this_class, jlong hKey) {
         return (jint) RegCloseKey((HKEY) hKey);
     };
 
-    JNIEXPORT jintArray JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegCreateKeyEx
-               (JNIEnv* env, jclass this_class, jint hKey, jbyteArray lpSubKey) {
+    JNIEXPORT jlongArray JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegCreateKeyEx
+               (JNIEnv* env, jclass this_class, jlong hKey, jbyteArray lpSubKey) {
         HKEY handle;
         char* str;
-        int tmp[3];
+        jlong tmp[3];
         DWORD lpdwDisposition;
         int errorCode;
-        jintArray result = NULL;
+        jlongArray result = NULL;
         str = (*env)->GetByteArrayElements(env, lpSubKey, NULL);
         CHECK_NULL_RETURN(str, NULL);
         errorCode =  RegCreateKeyEx((HKEY)hKey, str, 0, NULL,
                       REG_OPTION_NON_VOLATILE, KEY_READ,
                       NULL, &handle, &lpdwDisposition);
         (*env)->ReleaseByteArrayElements(env, lpSubKey, str, 0);
-        tmp[0]= (int) handle;
+        tmp[0]= (jlong)handle;
         tmp[1]= errorCode;
         tmp[2]= lpdwDisposition;
-        result = (*env)->NewIntArray(env,3);
+        result = (*env)->NewLongArray(env,3);
         if (result != NULL) {
-            (*env)->SetIntArrayRegion(env, result, 0, 3, tmp);
+            (*env)->SetLongArrayRegion(env, result, 0, 3, tmp);
         }
         return result;
     }
 
     JNIEXPORT jint JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegDeleteKey
-              (JNIEnv* env, jclass this_class, jint hKey, jbyteArray lpSubKey) {
+              (JNIEnv* env, jclass this_class, jlong hKey, jbyteArray lpSubKey) {
         char* str;
         int result;
         str = (*env)->GetByteArrayElements(env, lpSubKey, NULL);
         CHECK_NULL_RETURN(str, -1);
         result = RegDeleteKey((HKEY)hKey, str);

@@ -97,16 +97,16 @@
         return  result;
 
     };
 
     JNIEXPORT jint JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegFlushKey
-        (JNIEnv* env, jclass this_class, jint hKey) {
+        (JNIEnv* env, jclass this_class, jlong hKey) {
         return RegFlushKey ((HKEY)hKey);
         }
 
     JNIEXPORT jbyteArray JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegQueryValueEx
-         (JNIEnv* env, jclass this_class, jint hKey, jbyteArray valueName) {
+         (JNIEnv* env, jclass this_class, jlong hKey, jbyteArray valueName) {
         char* valueNameStr;
         char* buffer;
         jbyteArray result;
         DWORD valueType;
         DWORD valueSize;

@@ -147,11 +147,11 @@
 
 
 
 
     JNIEXPORT jint JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegSetValueEx
-    (JNIEnv* env, jclass this_class, jint hKey, jbyteArray valueName, jbyteArray data) {
+    (JNIEnv* env, jclass this_class, jlong hKey, jbyteArray valueName, jbyteArray data) {
         char* valueNameStr;
         char* dataStr;
         int size = -1;
         int nameSize = -1;
         int error_code = -1;

@@ -168,48 +168,48 @@
         (*env)->ReleaseByteArrayElements(env, data, dataStr, 0);
         return error_code;
     }
 
      JNIEXPORT jint JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegDeleteValue
-            (JNIEnv* env, jclass this_class, jint hKey, jbyteArray valueName) {
+            (JNIEnv* env, jclass this_class, jlong hKey, jbyteArray valueName) {
         char* valueNameStr;
         int error_code = -1;
         if (valueName == NULL) {return -1;}
         valueNameStr = (*env)->GetByteArrayElements(env, valueName, NULL);
         CHECK_NULL_RETURN(valueNameStr, -1);
         error_code = RegDeleteValue((HKEY)hKey, valueNameStr);
         (*env)->ReleaseByteArrayElements(env, valueName, valueNameStr, 0);
         return error_code;
      }
 
-    JNIEXPORT jintArray JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegQueryInfoKey
-                                  (JNIEnv* env, jclass this_class, jint hKey) {
+    JNIEXPORT jlongArray JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegQueryInfoKey
+                                  (JNIEnv* env, jclass this_class, jlong hKey) {
         jintArray result = NULL;
-        int tmp[5];
+        jlong tmp[5];
         int valuesNumber = -1;
         int maxValueNameLength = -1;
         int maxSubKeyLength = -1;
         int subKeysNumber = -1;
         int errorCode = -1;
         errorCode = RegQueryInfoKey((HKEY)hKey, NULL, NULL, NULL,
                  &subKeysNumber, &maxSubKeyLength, NULL,
                  &valuesNumber, &maxValueNameLength,
                  NULL, NULL, NULL);
         tmp[0]= subKeysNumber;
-        tmp[1]= (int)errorCode;
+        tmp[1]= errorCode;
         tmp[2]= valuesNumber;
         tmp[3]= maxSubKeyLength;
         tmp[4]= maxValueNameLength;
-        result = (*env)->NewIntArray(env,5);
+        result = (*env)->NewLongArray(env,5);
         if (result != NULL) {
-            (*env)->SetIntArrayRegion(env, result, 0, 5, tmp);
+            (*env)->SetLongArrayRegion(env, result, 0, 5, tmp);
         }
         return result;
     }
 
      JNIEXPORT jbyteArray JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegEnumKeyEx
-     (JNIEnv* env, jclass this_class, jint hKey , jint subKeyIndex, jint maxKeyLength) {
+     (JNIEnv* env, jclass this_class, jlong hKey , jint subKeyIndex, jint maxKeyLength) {
         int size = maxKeyLength;
         jbyteArray result;
         char* buffer = NULL;
         buffer = (char*)malloc(maxKeyLength);
         if (buffer == NULL) {

@@ -228,11 +228,11 @@
         free(buffer);
         return result;
      }
 
      JNIEXPORT jbyteArray JNICALL Java_java_util_prefs_WindowsPreferences_WindowsRegEnumValue
-          (JNIEnv* env, jclass this_class, jint hKey , jint valueIndex, jint maxValueNameLength){
+          (JNIEnv* env, jclass this_class, jlong hKey , jint valueIndex, jint maxValueNameLength){
           int size = maxValueNameLength;
           jbyteArray result;
           char* buffer = NULL;
           int error_code;
           buffer = (char*)malloc(maxValueNameLength);
< prev index next >