Examples of HKEYByReference


Examples of com.sun.jna.platform.win32.WinReg.HKEYByReference

   *  Regitry key path.
   * @return
   *  Table of values.
   */
  public static TreeMap<String, Object> registryGetValues(HKEY root, String keyPath) {
    HKEYByReference phkKey = new HKEYByReference();
    int rc = Advapi32.INSTANCE.RegOpenKeyEx(root, keyPath, 0, WinNT.KEY_READ, phkKey);
    if (rc != W32Errors.ERROR_SUCCESS) {      throw new Win32Exception(rc);
    }
    try {
      return registryGetValues(phkKey.getValue());
    } finally {
      rc = Advapi32.INSTANCE.RegCloseKey(phkKey.getValue());
      if (rc != W32Errors.ERROR_SUCCESS) {
        throw new Win32Exception(rc);
      }
    }   
  }
View Full Code Here

Examples of com.sun.jna.platform.win32.WinReg.HKEYByReference

    public static void main(String[] args) {
        junit.textui.TestRunner.run(NtDllUtilTest.class);
    }

    public void testGetKeyName() {
      HKEYByReference phKey = new HKEYByReference();
      assertEquals(W32Errors.ERROR_SUCCESS, Advapi32.INSTANCE.RegOpenKeyEx(
          WinReg.HKEY_CURRENT_USER, "Software", 0, WinNT.KEY_WRITE | WinNT.KEY_READ, phKey));
      assertEquals("Software", NtDllUtil.getKeyName(phKey.getValue()));
      assertEquals(W32Errors.ERROR_SUCCESS, Advapi32.INSTANCE.RegCloseKey(phKey.getValue()));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.