PDA

View Full Version : strange ollydbg question


Hero
August 20th, 2010, 09:05
Hi

Is there anyway to set current directory for created process when we start a process for debugging?

Regards

Darkelf
August 20th, 2010, 13:07
Hi,

I'd suggest to either start the process from the directory you need or use SetCurrentDirectory() to explicitly set it.
Hope that helps.

Hero
August 20th, 2010, 22:40
Quote:
[Originally Posted by Darkelf;87578]Hi,

I'd suggest to either start the process from the directory you need or use SetCurrentDirectory() to explicitly set it.
Hope that helps.


hm....
I cannot start process in the folder that I need, but for using SetCurrentDirectory, I guess I need to assemble it in my code. is there any simpler way?

Darkelf
August 21st, 2010, 07:21
How about breaking on GetCurrentDirectory (and the like) and edit it on the fly?
Maybe your program has a commandline switch to set the working directory (that's possible but unlikely). Maybe you can write a script - ODbgScript will happily execute the SetCurrentDirectory stuff for you or...
Be creative

Regards
darkelf

disavowed
August 21st, 2010, 09:35
Quote:
[Originally Posted by Hero;87585]hm....
I cannot start process in the folder that I need, but for using SetCurrentDirectory, I guess I need to assemble it in my code. is there any simpler way?


If you don't want to assemble in new code, you could launch OllyDbg in OllyDbg, break on CreateProcess(...) in the child OllyDbg, and modify lpCurrentDirectory. Still not ideal

Hero
August 21st, 2010, 10:16
Quote:
[Originally Posted by disavowed;87590]If you don't want to assemble in new code, you could launch OllyDbg in OllyDbg, break on CreateProcess(...) in the child OllyDbg, and modify lpCurrentDirectory. Still not ideal


Hm...problem in here is that you cannot debug created process immediately and you need to attach created process...
I guess best option right now is to assemble a small code to call SetCurrentDirectory and then recover old code again...
I wish this option were added to ollydbg v2.0, but it seems it this one is missing. but it is an easy one,but donna if I can add this option with a plugin or not.

EDIT:
I solved it using OllyScript.
Thanks for everyone's help and suggestion.