| 14 | static PsapiExt psapi = (PsapiExt) Native.loadLibrary("psapi", PsapiExt.class, W32APIOptions.UNICODE_OPTIONS); |
| 15 | |
| 16 | public static void main(String[] args) { |
| 17 | if(args.length < 2) { |
| 18 | System.out.println("JLoadLibrary <Process-ID> <DLL-Path>"); |
| 19 | System.exit(0); |
| 20 | } |
| 21 | |
| 22 | try { |
| 23 | boolean injectResult = inject(Integer.valueOf(args[0]), args[1]); |
| 24 | |
| 25 | if(injectResult) |
| 26 | System.out.println("Injection successful!"); |
| 27 | else |
| 28 | System.out.println("Injection failed!"); |
| 29 | } catch (Exception e) { |
| 30 | e.printStackTrace(); |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | public static boolean inject(int processID, String dllName) { |
| 35 | DWORD_PTR processAccess = new DWORD_PTR(0x43A); |