Exetools  

Go Back   Exetools > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 07-11-2004, 21:58
sTfN0X
 
Posts: n/a
OllyDbg + Registry question

Hi all,

I'm trying to create a loader that starts a process, execute what needs to be done, close the process and then start OllyDbg. Everything works fine when I would only need to do that.

Now the other part:
Olly has an option when you right click on a exe in Windows Explorer to debug that exe in Olly. I've found the key in the Registry and I changed the right click "Open with Ollydbg" context menu to point to my Ollyloader.exe instead of OLLYDBG.exe

For example when you right click on notepad.exe;
Olly starts with notepad.exe as command line parameter.

---> "OLLYDBG c:\windows\system32\notepad.exe"

Now my question: how can I get the path and name of the exe I right click on so that I can use it in my loader and use it as a command line parameter?



Any help would be appreciated


Thanks in advance,

sTfN0X
Reply With Quote
  #2  
Old 07-12-2004, 04:45
babar0ga
 
Posts: n/a
In registry(talking about context menu) command line(paramter) is presented as '%1'..

So, if you make your command for conetext menu as ollyloader "%1"
command line parameter will be passed to your ollyloader.exe.

Now, all you need to do is call ollydbg with that same paramater...
Reply With Quote
  #3  
Old 07-12-2004, 05:08
sTfN0X
 
Posts: n/a
Quote:
Originally Posted by babar0ga
In registry(talking about context menu) command line(paramter) is presented as '%1'..
So, if I understand you right the %1 is the name of the exe I right click on that gets passed as a parameter?

For example: when I right click on notepad.exe and select Open with Ollydbg (after I changed the Registry key to point to my Ollyloader of course) it is the same as typing in command line: "Drive:\Path\Ollyloader.exe notepad.exe"?

If so, how can I retrieve the name of that parameter to use it in my loader?

Regards,

sTfN0X
Reply With Quote
  #4  
Old 07-12-2004, 06:43
babar0ga
 
Posts: n/a
Quote:
Originally Posted by sTfN0X
So, if I understand you right the %1 is the name of the exe I right click on that gets passed as a parameter?
that's right...

about retreiveing that parameter... it's allready passed to your loader.
you just need to call olly with that same param.

in case you don't know how to read it... should be something like this

C like
Code:
int main(int argc, char *argv[])
{
  int i;

  for (i = 1; i < argc; i++) printf("%s ", argv[i]);
  printf("\n");

  return 0;
}
delphi
Code:
procedure TForm1.FormCreate(Sender: TObject);
Var
    I : Integer;
begin
    Memo1.Lines.Clear;
    Memo1.Lines.Add('Parameters Count : '+IntToStr(ParamCount));
    { ParamCount - Returns the number of parameters passed on
    the command line. }
    If ParamCount>0 Then
        For I:=1 To ParamCount Do
        { ParamStr - Returns a specified parameter from the command-line. }
        Memo1.Lines.Add('Parameter '+IntToStr(I)+' : '+ParamStr(I))
end;
vb
Code:
Sub Main()
Debug.Print Command$
End Sub
hope this helps
Reply With Quote
  #5  
Old 07-12-2004, 19:18
sTfN0X
 
Posts: n/a
babar0ga,

Thanks for your help.

The C code works perfect

Best regards,

sTfN0X
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ollydbg v1 to v2 porting question sendersu General Discussion 0 09-02-2014 13:29
Another Ollydbg question DLL loading in Program hobferret General Discussion 9 06-19-2005 23:32
Quick OllyDbg Question lilmeanman General Discussion 8 06-06-2005 08:13
PELOCK Question again--.w.--Ollydbg boya General Discussion 0 06-10-2004 12:38
OllyDbg question butter General Discussion 2 05-07-2004 10:30


All times are GMT +8. The time now is 17:04.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( 1998 - 2024 )