Detour in __usercall
Code:
static void PhysicsCheckSweep( CBaseEntity *pEntity, const Vector& vecAbsStart, const Vector &vecAbsDelta, trace_t *pTrace ) Code:
; void __usercall PhysicsCheckSweep(CBaseEntity *pEntity<esi>, Vector *vecAbsStart<edi>, Vector *vecAbsDelta, CGameTrace *pTrace) css server.dll Code:
; int __cdecl sub_10171D60(int, void *) any idea? |
Re: Detour in __usercall
Hm, could you please explain what you want? You can get a signature for the function, use the address returned with a detour library (I personally prefer/use pRED's CDetour)
Probably not helpful.. but I don't understand quite what you're asking here :-/ |
Re: Detour in __usercall
Assuming you are using CDetour (or something that works similarly), then you need to define the callback function with the same signature as the original code. The compiler should then generate correct code to handle it, nothing extra is needed.
I'm not sure what the c++ code would be to get a __usercall function, I've never heard of this calling convention. The current CDetour macros don't provide a way to easily specify the calling convention type to generate the function signature with, I'm sure you can expand one out by hand and fill in the gaps though. |
Re: Detour in __usercall
i use CDetour, try 2,4 parameters, all doesn't work
CBaseEntity *pEntity AND const Vector& vecAbsStart come from esi & edi |
Re: Detour in __usercall
Isn't that called __fastcall?
|
Re: Detour in __usercall
Quote:
Quote:
|
Re: Detour in __usercall
Right, the only thing I have had in mind was that two parameters are passed via registers, but didn't remember which one :>
|
Re: Detour in __usercall
It looks like __usercall is IDA's name for a calling convention that it doesn't know.
Does this binary have link time code generation enabled? If you disassemble your code you should see that the detour handler isn't marked as __usercall, and this is why it isn't working. You could look at writing a __declspec(naked) detour handler to explicitly manage the two register based parameters? |
Re: Detour in __usercall
Writing a naked function could be made to work but its horrible to do. What exactly are you trying to achieve with the detour? Do you need to all the parameters in your routine?
Also could you post (or pastebin) the entire function from the server.dll as well as a function that calls it? |
Re: Detour in __usercall
I never said it was a nice option. This is the sort of thing that bintools was designed to handle.
|
All times are GMT -4. The time now is 03:50. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.