Advertisement
Faded

Untitled

Jun 8th, 2012
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.67 KB | None | 0 0
  1.  
  2.   private String getPath()
  3.   {
  4.     Preferences userRoot = Preferences.userRoot();
  5.     Preferences systemRoot = Preferences.systemRoot();
  6.     Class clz = userRoot.getClass();
  7.     try {
  8.       Method openKey = clz.getDeclaredMethod("openKey", new Class[] { [B.class, Integer.TYPE, Integer.TYPE });
  9.  
  10.       openKey.setAccessible(true);
  11.  
  12.       Method closeKey = clz.getDeclaredMethod("closeKey", new Class[] { Integer.TYPE });
  13.  
  14.       closeKey.setAccessible(true);
  15.  
  16.       Method winRegQueryValue = clz.getDeclaredMethod("WindowsRegQueryValueEx", new Class[] { Integer.TYPE, [B.class });
  17.  
  18.       winRegQueryValue.setAccessible(true);
  19.       Method winRegEnumValue = clz.getDeclaredMethod("WindowsRegEnumValue1", new Class[] { Integer.TYPE, Integer.TYPE, Integer.TYPE });
  20.  
  21.       winRegEnumValue.setAccessible(true);
  22.       Method winRegQueryInfo = clz.getDeclaredMethod("WindowsRegQueryInfoKey1", new Class[] { Integer.TYPE });
  23.  
  24.       winRegQueryInfo.setAccessible(true);
  25.  
  26.       byte[] valb = null;
  27.       String vals = null;
  28.       String key = null;
  29.       Integer handle = Integer.valueOf(-1);
  30.  
  31.       key = "SOFTWARE" + File.separatorChar + "Blizzard Entertainment" + File.separatorChar + "World of Warcraft" + File.separatorChar;
  32.       handle = (Integer)openKey.invoke(systemRoot, new Object[] { toCstr(key), Integer.valueOf(131097), Integer.valueOf(131097) });
  33.       valb = (byte[])(byte[])winRegQueryValue.invoke(systemRoot, new Object[] { handle, toCstr("InstallPath") });
  34.       vals = valb != null ? new String(valb).trim() : "";
  35.       closeKey.invoke(Preferences.systemRoot(), new Object[] { handle });
  36.       return vals + "Wow.exe"; } catch (Exception e) {
  37.     }
  38.     return "";
  39.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement