ViRb3 / jvm-dump-proxy

A proxy DLL for Windows to dump JVM classes at JNI level
79 stars 11 forks source link

Unable to compile 32-bit version #2

Closed iceman-77 closed 2 years ago

iceman-77 commented 2 years ago

This is an awesome tool, but I need this in 32-bit version. I tried to compile it with MinGW i686-7.3.0-release-posix-sjlj and CMake 3.23 but I am getting the following linker error:

cmake --build . [ 71%] Built target mhook [ 85%] Building CXX object CMakeFiles/version.dir/hook.cpp.obj [100%] Linking CXX shared library version.dll CMakeFiles\version.dir/objects.a(hook.cpp.obj):hook.cpp:(.text+0x2d): undefined reference to orig_GetFileVersionInfoA' CMakeFiles\version.dir/objects.a(hook.cpp.obj):hook.cpp:(.text+0x39): undefined reference toorig_GetFileVersionInfoByHandle' CMakeFiles\version.dir/objects.a(hook.cpp.obj):hook.cpp:(.text+0x45): undefined reference to orig_GetFileVersionInfoExW' CMakeFiles\version.dir/objects.a(hook.cpp.obj):hook.cpp:(.text+0x51): undefined reference toorig_GetFileVersionInfoExA' CMakeFiles\version.dir/objects.a(hook.cpp.obj):hook.cpp:(.text+0x5d): undefined reference to orig_GetFileVersionInfoSizeA' CMakeFiles\version.dir/objects.a(hook.cpp.obj):hook.cpp:(.text+0x69): undefined reference toorig_GetFileVersionInfoSizeExA' CMakeFiles\version.dir/objects.a(hook.cpp.obj):hook.cpp:(.text+0x75): undefined reference to orig_GetFileVersionInfoSizeExW' CMakeFiles\version.dir/objects.a(hook.cpp.obj):hook.cpp:(.text+0x81): undefined reference toorig_GetFileVersionInfoSizeW' CMakeFiles\version.dir/objects.a(hook.cpp.obj):hook.cpp:(.text+0x8d): undefined reference to orig_GetFileVersionInfoW' CMakeFiles\version.dir/objects.a(hook.cpp.obj):hook.cpp:(.text+0x99): undefined reference toorig_VerFindFileA' CMakeFiles\version.dir/objects.a(hook.cpp.obj):hook.cpp:(.text+0xa5): undefined reference to orig_VerFindFileW' CMakeFiles\version.dir/objects.a(hook.cpp.obj):hook.cpp:(.text+0xb1): undefined reference toorig_VerInstallFileA' CMakeFiles\version.dir/objects.a(hook.cpp.obj):hook.cpp:(.text+0xbd): undefined reference to orig_VerInstallFileW' CMakeFiles\version.dir/objects.a(hook.cpp.obj):hook.cpp:(.text+0xc9): undefined reference toorig_VerLanguageNameA' CMakeFiles\version.dir/objects.a(hook.cpp.obj):hook.cpp:(.text+0xd5): undefined reference to orig_VerLanguageNameW' CMakeFiles\version.dir/objects.a(hook.cpp.obj):hook.cpp:(.text+0xe1): undefined reference toorig_VerQueryValueA' CMakeFiles\version.dir/objects.a(hook.cpp.obj):hook.cpp:(.text+0xed): undefined reference to `orig_VerQueryValueW' collect2.exe: error: ld returned 1 exit status mingw32-make.exe[2]: [CMakeFiles\version.dir\build.make:101: version.dll] Error 1 mingw32-make.exe[1]: [CMakeFiles\Makefile2:99: CMakeFiles/version.dir/all] Error 2 mingw32-make.exe: *** [Makefile:135: all] Error 2

Any idea how to fix this ?

iceman-77 commented 2 years ago

Nevermind, I found the issue with WRAPPER_GENFUNC(name). Adding underscore to 'orig' for the asm directive has fixed the problem: asm("jmp *orig"#name);

ViRb3 commented 2 years ago

For reference, this is also documented in the template project: https://github.com/ViRb3/PerfectProxyDLL

iceman-77 commented 2 years ago

I have managed to compile it, but for some reason it does not hook the calls, getting a message “Something went wrong” and java.exe is crashing. I have the JVMDUMP folder on my desktop. Any ideas what else needs to be changed to get this work with 32b JRE ? On Wednesday, March 2, 2022, 05:42:04 PM CST, Victor @.***> wrote:

For reference, this is also documented in the template project: https://github.com/ViRb3/PerfectProxyDLL

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: @.***>

iceman-77 commented 2 years ago

For reference, this is also documented in the template project: https://github.com/ViRb3/PerfectProxyDLL

I tried to compile your PerfectProxy DLL but any program I run with version.dll "attached" crashes. Could this be due to wrong compilation setup ? I used MinGW i686-7.3.0-release-posix-sjlj as I need 32-bit version of the hook DLL