Jump to content
Tuts 4 You

Ollydbg load source code


Scale

Recommended Posts

Posted

I am a beginner in c++ but i noticed that when i wrote a c++ dll and then loaded it into olly so i could check if everything worked, it would also display the source of what every operand does.

It happens completely automatic however this time it does not, so how can i load my source code into olly?

thanks

Posted

You have to generate debug data. There should be an option inside whatever compiler you're using.

This will generate .pdb files Olly can read the source/symbols from.

Posted

The pdb file is in the same folder (the release folder from visual studio) where the actual dll file is located, how do i load it into olly?

Debug > select symbol path, didn't seem to work.

Posted

Olly automatically loads pdb files from the same folder as the debuggee.

You shouldnt have to set any extra options if it worked before :s

Perhaps your debug data is out of date and Olly checks against an md5 or something. I'm not that familiar with the pdb format tbh.

Try deleting the pdb and recompiling, otherwise upload the file + pdb somewhere if it's not topsecret **** :D

Posted
Olly automatically loads pdb files from the same folder as the debuggee.

You shouldnt have to set any extra options if it worked before :s

Perhaps your debug data is out of date and Olly checks against an md5 or something. I'm not that familiar with the pdb format tbh.

Try deleting the pdb and recompiling, otherwise upload the file + pdb somewhere if it's not topsecret **** :D

Ahh i get it now, the pdb loads everything under view > source files and all the files are absent because it was compiled on an former windows installation.

it's not secret :P It's a very boring detour ;) but maybe you can help me with it :P

This is probably the worst code you will ever see, i am currently using a counter that when count == 11 return and it works but i am not happy with that, That's just bad coding :(

int (__cdecl *sub_check_o)(int x);
string zxc = "";
size_t found;
int __cdecl sub_check(int x)
{
__asm
{
pushad
mov zxc, eax
} found = zxc.find("test", 0); if (found == string::npos)
{
__asm
{
popad
}
return sub_check_o(x);
}
else
{
__asm
{
popad
}
return;
}
}
Posted
Olly automatically loads pdb files from the same folder as the debuggee.

You shouldnt have to set any extra options if it worked before :s

Perhaps your debug data is out of date and Olly checks against an md5 or something. I'm not that familiar with the pdb format tbh.

Try deleting the pdb and recompiling, otherwise upload the file + pdb somewhere if it's not topsecret **** :D

Ahh i get it now, the pdb loads everything under view > source files and all the files are absent because it was compiled on an former windows installation.

it's not secret :P It's a very boring detour ;) but maybe you can help me with it :P

This is probably the worst code you will ever see, i am currently using a counter that when count == 11 return and it works but i am not happy with that, That's just bad coding :(

int (__cdecl *sub_check_o)(int x);
string zxc = "";
size_t found;
int __cdecl sub_check(int x)
{
__asm
{
pushad
mov zxc, eax
} found = zxc.find("test", 0); if (found == string::npos)
{
__asm
{
popad
}
return sub_check_o(x);
}
else
{
__asm
{
popad
}
return;
}
}
int (__cdecl *sub_check_o)(int x);
string zxc = "";
size_t found;
int __cdecl sub_check(int x)
{
found = zxc.find("test", 0); if (found == string::npos)
return sub_check_o(x);
return 0;
}

If you redirect a call, you don't have to popad/pushad.

Also you don't even need popad/pushad with a non call redirection.

My method is

void HandleHere()
{
//Real code here
}
void RedirectHere()
{
HandleHere();
_asm
{
jmp Return
}
}

(Haven't used it in awhile, you may need to change the calling convention)

Of course you can do this 100s of ways. That personally is how I like doing it.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...