summaryrefslogtreecommitdiff
path: root/NET/worlds/core/RegKey.java
blob: 86ebf91112fbfa61534125244a4466cef25d0e50 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package NET.worlds.core;

public class RegKey {
   public static final int CLASSES_ROOT = 0;
   public static final int CURRENT_USER = 1;
   public static final int LOCAL_MACHINE = 2;
   public static final int USERS = 3;
   public static final int KEYOPEN_READ = 0;
   public static final int KEYOPEN_WRITE = 1;
   public static final int KEYOPEN_CREATE = 2;
   private int hKey;

   static {
      nativeInit();
   }

   public static RegKey getRootKey(int type) throws RegKeyNotFoundException {
      return new RegKey(getReservedKey(type));
   }

   public RegKey(RegKey base, String subKey, int mode) throws RegKeyNotFoundException {
      if (mode == 2) {
         this.hKey = createKey(base.hKey, subKey);
      } else {
         this.hKey = openKey(base.hKey, subKey, mode);
      }
   }

   public native String getStringValue(String var1);

   public native boolean setStringValue(String var1, String var2, boolean var3);

   public native int getIntValue(String var1);

   public native boolean setIntValue(String var1, int var2);

   public native void close();

   private static native int getReservedKey(int var0) throws RegKeyNotFoundException;

   private static native int openKey(int var0, String var1, int var2) throws RegKeyNotFoundException;

   private static native int createKey(int var0, String var1);

   public static native void nativeInit();

   private RegKey(int hKey) {
      this.hKey = hKey;
   }
}