Hi Mathias,
I have noticed a strange behavour when I using GetClassNameW in a DLL that is injected in the window process (I am using your inject method). As soon as I call GetClassNameW in there I get an "Invalid access to memory location" error. However - if I use the non-wide version (GetClassName) everything works fine. Also if I use the GetClassNameW in a normal stand alone exe-application it works fine:
var wclassnameBuffer : array [0..255] of widechar;
if GetClassNameW(winHandle), wclassnameBuffer, SizeOf(wclassnameBuffer)) > 0
I've read your hooking rule #7 about beeing careful when using Unicode in callback functions in the hooking world but you also state that "It only applies to wide hook callbacks in winNT" - but as far as I understand I don't have any wide hook callbacks. But maybe there is something more in this rule I don't know/understand.
Do you have any idea why I get this error?
Kind Regards
Thomas
Hooking Rule #7
yes, you should post the complete callback
in the most forums i noticed that some guys create threads and post
"why does this crash, i do it exactly this way <code>"
but they dont post the complete source and the error isnt in the lines which they posted
i mean:
"GetClassNameW(winHandle)" isnt a valid call
in the most forums i noticed that some guys create threads and post
"why does this crash, i do it exactly this way <code>"
but they dont post the complete source and the error isnt in the lines which they posted
i mean:
is NEVER the line u use! because, delphi doesnt compile it, becauseif GetClassNameW(winHandle), wclassnameBuffer, SizeOf(wclassnameBuffer)) > 0
"GetClassNameW(winHandle)" isnt a valid call