Zool@nder Posted December 20, 2011 Posted December 20, 2011 Hey every one, I'm experiencing a coding problem with ollydbg. When i call an animation function from main plugin thread, it works. (of course it will work ). and here is a piece of correctly working code: void ODBG_Pluginaction(int Origin, int Action, void* pItem) { if(Origin == PM_DISASM) { switch(Action) { case 0:Go(Getcputhreadid(), 0, STEP_OVER, false, true); break; } }} but if i call the same function from a thread it doesn't work (and here's a non working code): DWORD WINAPI ThreadFunc(LPVOID dd) { Go(Getcputhreadid(), 0, STEP_OVER, false, true); return TRUE;}void ODBG_Pluginaction(int Origin, int Action, void* pItem) {DWORD id = 0; if(Origin == PM_DISASM) { switch(Action) { case 0:CreateThread(0, 0, ThreadFunc, 0, 0, &id); break; } }} I tried to suspend debugee threads before animating -> no luck; I tried to use WaitForSingleObject after creating an event that I unset immediatly after calling animation function and set it from main plugin thread -> no luck (the example is a bit complexe) Any help would be welcome, Thank you.
Ufo-Pu55y Posted December 20, 2011 Posted December 20, 2011 I don't know what 'Go(...)' actually does, but maybe it fires a 'SendMessage'somewhere, while it should use a 'PostMessage' from another (non-ui- !) threadjust to prevent deadlocks. Just a guess..
ragdog Posted December 20, 2011 Posted December 20, 2011 (edited) HiWhy want to use a Thread?Ollyscript or Olly Maschine use not a Treadadd in your codeAnimate(ANIMATE_IN);inline void CVM::DoAnimateInto(){ Animate(ANIMATE_IN); Go(Getcputhreadid(), 0, STEP_IN, 0, 1); ReturnToOD();}ANIMATE_IN was only an exampleANIMATE_OFF No animationANIMATE_IN Animate intoANIMATE_OVER Animate overANIMATE_RET Execute till RETANIMATE_SKPRET Execute till RET, then skip RET instructionANIMATE_USER Execute till user codeANIMATE_TRIN Run trace inANIMATE_TROVER Run trace overANIMATE_STOP Gracefully stop animationOllyMaschine source can you found herehttp://www.luocong.com/om/ Edited December 20, 2011 by ragdog
Zool@nder Posted December 20, 2011 Author Posted December 20, 2011 (edited) @ufo: YOU'RE RIGHTthanks for the clue, I'll digg a bit in this direction Edited December 20, 2011 by Zool@nder
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now