code: private static String registryGet32StringValue(com.sun.jna.platform.win32.WinReg.HKEY root, String key, String value)
        throws com.sun.jna.platform.win32.Win32Exception {
      com.sun.jna.platform.win32.WinReg.HKEYByReference phkKey = new com.sun.jna.platform.win32.WinReg.HKEYByReference();
      int rc = com.sun.jna.platform.win32.Advapi32.INSTANCE.RegOpenKeyEx(root, key, 0,
          com.sun.jna.platform.win32.WinNT.KEY_READ | com.sun.jna.platform.win32.WinNT.KEY_WOW64_32KEY, phkKey);
      if (rc != com.sun.jna.platform.win32.W32Errors.ERROR_SUCCESS) {
        throw new com.sun.jna.platform.win32.Win32Exception(rc);
      }
      try {
        return com.sun.jna.platform.win32.Advapi32Util.registryGetStringValue(phkKey.getValue(), value);
      } finally {
        rc = com.sun.jna.platform.win32.Advapi32.INSTANCE.RegCloseKey(phkKey.getValue());
        if (rc != com.sun.jna.platform.win32.W32Errors.ERROR_SUCCESS) {
          throw new com.sun.jna.platform.win32.Win32Exception(rc);
        }
      }
    }
docs: Get a registry REG_SZ value.
  
  @param root  Root key.
  @param key   Registry path.
  @param value Name of the value to retrieve.
  @return String value.