| View previous topic :: View next topic |
| Author |
Message |
Redouane Master Cheater
Reputation: 3
Joined: 05 Sep 2013 Posts: 363 Location: Algeria
|
Posted: Mon Mar 28, 2016 9:14 am Post subject: Calling .NET function CompareString |
|
|
The function: Microsoft.VisualBasic.CompilerServices.Operators::CompareString takes 3 arguments, first 2 are strings, 3rd is the case-sensivity flag.
While trying to do a crack me, I found a call to that function that compares my serial with the correct one (tried faking eax after the call, and got the "win" message), now I want to get the two strings that are being compared.
From what I see, the calling convention is possibly __fastcall (ecx and edx are set before the function is called), but when I set a breakpoint just before the function call, I don't get a valid string in ecx/edx (even tried with unicode), also tried [esp+4] and [esp+8] and no valid strings in them.
Does anyone know how the string arguments are passed to that function?
Thanks.
| Description: |
|
| Filesize: |
3.02 KB |
| Viewed: |
4538 Time(s) |

|
| Description: |
|
| Filesize: |
14.74 KB |
| Viewed: |
4538 Time(s) |

|
|
|
| Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Mon Mar 28, 2016 11:15 am Post subject: |
|
|
Use the value of ECX/EDX as a pointer instead and check the values around there.
For example, if ECX equals 0x12345678, browse the memory at "[12345678]" (with brackets).
After the original mov edx,[address] just simply try: mov ecx,edx
|
|
| Back to top |
|
 |
Redouane Master Cheater
Reputation: 3
Joined: 05 Sep 2013 Posts: 363 Location: Algeria
|
Posted: Mon Mar 28, 2016 1:24 pm Post subject: |
|
|
| Zanzer wrote: | Use the value of ECX/EDX as a pointer instead and check the values around there.
For example, if ECX equals 0x12345678, browse the memory at "[12345678]" (with brackets).
After the original mov edx,[address] just simply try: mov ecx,edx |
Found it, here is the block that ecx points to: <picture> (the string isn't at the beginning of the block of data).
| Description: |
|
| Filesize: |
1.52 KB |
| Viewed: |
4511 Time(s) |

|
|
|
| Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Mon Mar 28, 2016 1:52 pm Post subject: |
|
|
Right.
I believe the first 4 bytes represent a pointer to the String class itself (don't quote me).
The next 4 bytes are the string's length. Followed up by the string's char array.
|
|
| Back to top |
|
 |
|