Hooking Text output in a java application

Started by whitegold, December 02, 2008, 06:38:13 PM

Previous topic - Next topic

whitegold

I've written a text hooking application which hooks TextOutA, TextOutW, ExtTextOutA, ExtTextOutW, DrawTextA, DrawTextW, DrawTextExA, DrawTextExW for a target process.  It overwrites the apis in gdi32.dll, and user32.dll, (not using the IAT table).

Works fine with most apps.  I tried it on a jar file chess program I've got. Ran programme.  Hooked javaw.exe - but no results.  Apparently none of these functions were being used.

Ran the programme again and attached Ollydbg to the process.  Set breakpoints on all the above.  None were used.  Set breakpoints on PolyTextOut functions.  Not being used.

So how does a java programme write text to a window?  Whilst Java is cross platform I would assume it would have to end up using the Windows Apis above at some point on Windows - and javaw.exe is the only process I can see.

So what's going on?  :dazzled:

Vortex

Hi whitegold,

Welcome to the board.

Why are you trying to hook those API functions?

whitegold

No reason at all. 

I happened to be looking at some hooking stuff a few weeks ago and saw a commercial set of tools for hooking text, and I thought 'I can write that', so I thought I would.  I'm puzzled why it works fine for everything but a java app.

BlackVortex

@ whitegold
Well, it's possible java apps don't use those APIs at all, maybe all those dlls that get loaded at runtime use the deep-down native win apis in the end (as in ntdll.dll just a wild guess)

You can try using output redirecting from the command line (for testing) by excuting
program.exe  >>  output.txt

I tried in a java application I have (frostwire) and it worked very nicely.

ecube

use nektra spy studio, free open source hooking studio and hook groups so you can see what apis it calls.