Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update WinRegistry for Java 11
  • Loading branch information
LadyCailin committed Jan 28, 2021
1 parent 2ca7f5e commit e8f6e5e
Showing 1 changed file with 27 additions and 2 deletions.
@@ -1,3 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package com.laytonsmith.PureUtilities.Common;

import java.lang.reflect.InvocationTargetException;
Expand Down Expand Up @@ -35,8 +54,14 @@ public final class WinRegistry {

static {
try {
regOpenKey = USER_CLASS.getDeclaredMethod("WindowsRegOpenKey",
new Class[]{int.class, byte[].class, int.class});
try {
regOpenKey = USER_CLASS.getDeclaredMethod("WindowsRegOpenKey",
new Class[]{long.class, byte[].class, int.class});
} catch (NoSuchMethodException ex) {
// Java < 11
regOpenKey = USER_CLASS.getDeclaredMethod("WindowsRegOpenKey",
new Class[]{int.class, byte[].class, int.class});
}
regOpenKey.setAccessible(true);
regCloseKey = USER_CLASS.getDeclaredMethod("WindowsRegCloseKey",
new Class[]{int.class});
Expand Down

0 comments on commit e8f6e5e

Please sign in to comment.