Jump to content
Tuts 4 You

[Help] asm code to inline asm in cpp need repair


baruch

Recommended Posts

Hello,

I have a realy stupid question but i spent on it 3 hours and  I surrender:(

Im trying to write keygen to :"LaFarge CrackMe #2".

So the code in asm is: (EAX=631698A, its when you enter "baruch" as name to this crackme,and the address(406549) at 401261 is empty area)

1.PNG

After the loop,the address 406549 look like:

2.PNG

Now,because i dont know how to code assembly DIV in c++ i did "inline assembly":

3.PNG //equivalent to address 406549

4.PNG

In visual studio i put break point to see what happend after that code:

5.PNG

6.PNG//table6 address

And here my problem.

Its not the same as in olly's dump!

Instead of : 22 27 1f 23 20 etc

should be: 34 39 31 35 etc.

7.PNG

 

Please,how to fix it??

Link to comment

"add dl, 30" is the cause of the problem. Olly uses hexadecimal by default. Visual Studio by default uses decimal.

Change it to  "add dl, 30h" or "add dl, 0x30" and you shall be happy.

 

Edited by kao
  • Like 2
Link to comment

Hey....

9 div 4 = 2 ( C/C++: 9 / 4 ) 9 mod 4 = 1 ( C/C++: 9 % 4 )
#include <iostream>

using namespace std;
using std::hex;

int main()
{
    int sum, sum2, sum3;
    int a;
    int b;

    a = 0x71;
    b = 0xA;

    std:: cout << "71h / Ah = B" << endl;
    sum = a / b;

 std::cout << std::hex << std::uppercase << "Sum = " << sum << endl;
}

 

eq

Edited by e0qs
  • Like 2
Link to comment

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...