- JDK 21 (javac/java)
- MSVC build tools (x64)
SysCaller.dllandtest.dllin this directory (or on PATH)
-
Generate JNI header inline (not strictly required with this C file): javac .\InjectDLL.java
-
Build native DLL (x64):
- Open "x64 Native Tools Command Prompt for VS" or call vcvars64.bat
- Compile: cl /LD /I "%JAVA_HOME%\include" /I "%JAVA_HOME%\include\win32" InjectDLLNative.c /link /OUT:InjectDLLNative.dll
-
Run: java InjectDLL <dll_path>
- The code resolves the DLL absolute path via
GetFullPathNameAto avoid remote LoadLibrary path issues. - Uses the same allocation/write/thread creation flow as other samples.