Hello and welcome back.
The next challenge is to make the program accept any serial.
So let's take a look at the program as it is.
This is the latest patch file.
So we run it and let's enter any wrong serial.
So when we register, it says "Wrong serial."
So we want to get rid of this message so that it can accept any serial.
And we also want to show the message "Right
serial."
So we will solve all three steps.
And so let's take a look at how to do that.
Now remember the string "wrong."
We are going to search for this string inside the program.
So let's run our -dbg.
Remember to open the patch file.
So I will just now search for the string
"wrong."
So I'll right-click here, Search for > Current Module > String References.
And we search for the phrase "wrong."
And we found it.
So let's double-click to go there.
And over here we find that this is the place where the error message is being shown.
So over here we find there is a jump that can jump over it.
Let's see whether we can put a breakpoint here and run.
So we re-enter a wrong serial.
We register.
It did not hit the breakpoint.
That means the breakpoint is in the wrong place.
So we try to move our breakpoint elsewhere.
We remove this breakpoint
now.
We put our breakpoint further down, maybe over here.
And then see where it hits it.
But if we put our breakpoint here, it might hit it.
But there is no jump to bypass the breakpoint.
We need to have a jump that can bypass.
So we need to go to the parent of this function.
To go to the parent of this function, we are going to put a breakpoint somewhere where it hits and
then step over to the right.
Or we can put the breakpoint at the right directly.
So I will use this way first.
The first way: put a breakpoint here.
Now we run. Earlier on,
I put a breakpoint here.
It did not hit, so I'm now putting a breakpoint lower down to see where it hits.
So I click on Register, and it hits.
So now I know it's going to go down and show the wrong serial message.
So I want it to run all the way to the return so that we can step over it and go to the parent.
The parent is the function which calls this portion of the program.
So let's run to the return now by using this button: "Execute till return." Hit OK.
And now we execute till return.
So now we can step over this.
But let us remove this breakpoint first.
So now we step over this.
We go to the parent.
So step over, and we come to the parent.
So this is the parent.
This is the call which went to the bad message.
So we can put—we can put a comment here by pressing semicolon, and you can say "shows bad
message."
And then try to look for a jump which can bypass this.
And this one seems like the right one.
So we put a breakpoint here to see whether it will hit.
So let's run.
Click Register, and it hits our breakpoint.
So now we try to see whether we can make it jump.
If we click on this now, it shows that jump is not taken, which means it will go straight and call the
bad message.
So we can toggle this
now—toggle the zero flag.
And now we can see the jump is taken.
This is red now.
And now this jump is taken.
So let's step over it.
And indeed it jumped over this.
So we can put a comment here.
"Jump this" so that we can remind ourselves that this is the place we are going to patch.
So now let's run all the way.
And now we see the bad message is no longer showing.
We actually managed to force it to accept any serial.
All right.
But we don't just want it to accept any serial.
We want it to show "Right
serial."
So,
right
serial.
But we found out that when it jumped over this, it did not show the right serial.
So what we need to do is modify this call so that instead of showing the wrong serial, it says "Right
serial."
So because of that, we cannot patch it here.
We need to let it go through and call this.
Then we will modify the call so that it will show "Right serial."
So now let's rerun the program.
And then we are going to search for the string—the wrong serial string.
We are going to modify the string in memory.
So to search for the string, you right-click here anywhere, and Search for > Current Module > String
References, and then key in the word "wrong."
And you found it.
So just double-click to go to that address, and you can see the caption and the string.
So we will modify the caption first.
So we select the caption.
The caption is what is shown on the title of the box—of the message box.
Go down to the address there, right-click, Follow in Dump, and select the address.
So now it goes to the address.
Go to the address for "Error."
Highlight it.
Right-click, Binary > Edit.
And make sure you check on "Keep size."
Now we will modify the string to become "Right." Click OK, and we have done that.
Next, we are going to modify the string that is to be shown in the box—in the message box.
So go to that address.
Right-click, Follow in Dump.
Click on the address and highlight the word "wrong."
Right-click, and Binary > Edit, and change "wrong" to "right." Click on OK.
Now you can patch it.
So Patch File, click Patch, and give it a name: "02-02."
This is the second patch.
Click on Save and click OK, and close everything.
Now we are going to test the patch 2 directly.
Go to patch 2 and click on it.
Enter any wrong serial.
And click on Register.
Click OK.
And you will see it shows the right serial.
So we have already solved this challenge now.
So this project is done.
Thank you very much.
See you in the next one.