WEBVTT

1
00:01.790 --> 00:03.260
Hello and welcome back.

2
00:03.290 --> 00:08.300
The next challenge is to make the program accept any serial.

3
00:09.940 --> 00:14.560
So let's take a look at the program as it is.

4
00:15.370 --> 00:18.070
This is the latest patch file.

5
00:18.070 --> 00:22.540
So we run it and let's enter any wrong serial.

6
00:29.900 --> 00:33.500
So when we register, it says "Wrong serial."

7
00:35.360 --> 00:41.330
So we want to get rid of this message so that it can accept any serial.

8
00:42.320 --> 00:45.890
And we also want to show the message "Right

9
00:45.890 --> 00:46.370
serial."

10
00:46.700 --> 00:50.210
So we will solve all three steps.

11
00:50.600 --> 00:52.700
And so let's take a look at how to do that.

12
00:53.180 --> 00:55.370
Now remember the string "wrong."

13
00:55.370 --> 00:58.430
We are going to search for this string inside the program.

14
00:59.750 --> 01:03.020
So let's run our -dbg.

15
01:07.480 --> 01:09.400
Remember to open the patch file.

16
01:12.330 --> 01:16.950
So I will just now search for the string

17
01:16.950 --> 01:17.280
"wrong."

18
01:17.280 --> 01:22.740
So I'll right-click here, Search for > Current Module > String References.

19
01:24.330 --> 01:26.610
And we search for the phrase "wrong."

20
01:29.700 --> 01:30.570
And we found it.

21
01:31.350 --> 01:33.540
So let's double-click to go there.

22
01:35.400 --> 01:41.670
And over here we find that this is the place where the error message is being shown.

23
01:43.050 --> 01:48.900
So over here we find there is a jump that can jump over it.

24
01:50.340 --> 01:55.980
Let's see whether we can put a breakpoint here and run.

25
02:02.320 --> 02:04.870
So we re-enter a wrong serial.

26
02:09.540 --> 02:10.740
We register.

27
02:11.570 --> 02:12.620
It did not hit the breakpoint.

28
02:12.620 --> 02:15.050
That means the breakpoint is in the wrong place.

29
02:16.040 --> 02:19.160
So we try to move our breakpoint elsewhere.

30
02:20.510 --> 02:21.620
We remove this breakpoint

31
02:21.650 --> 02:22.130
now.

32
02:28.230 --> 02:31.800
We put our breakpoint further down, maybe over here.

33
02:37.520 --> 02:39.380
And then see where it hits it.

34
02:40.970 --> 02:44.030
But if we put our breakpoint here, it might hit it.

35
02:44.270 --> 02:46.940
But there is no jump to bypass the breakpoint.

36
02:46.940 --> 02:48.860
We need to have a jump that can bypass.

37
02:49.310 --> 02:52.460
So we need to go to the parent of this function.

38
02:53.480 --> 02:59.000
To go to the parent of this function, we are going to put a breakpoint somewhere where it hits and

39
02:59.000 --> 03:01.340
then step over to the right.

40
03:02.660 --> 03:05.360
Or we can put the breakpoint at the right directly.

41
03:06.980 --> 03:09.110
So I will use this way first.

42
03:09.110 --> 03:10.850
The first way: put a breakpoint here.

43
03:13.530 --> 03:16.440
Now we run. Earlier on,

44
03:16.440 --> 03:17.730
I put a breakpoint here.

45
03:18.060 --> 03:22.800
It did not hit, so I'm now putting a breakpoint lower down to see where it hits.

46
03:24.600 --> 03:27.180
So I click on Register, and it hits.

47
03:28.080 --> 03:32.310
So now I know it's going to go down and show the wrong serial message.

48
03:32.670 --> 03:39.870
So I want it to run all the way to the return so that we can step over it and go to the parent.

49
03:40.200 --> 03:44.310
The parent is the function which calls this portion of the program.

50
03:44.610 --> 03:50.700
So let's run to the return now by using this button: "Execute till return." Hit OK.

51
03:50.700 --> 03:52.620
And now we execute till return.

52
03:53.700 --> 03:55.260
So now we can step over this.

53
03:55.800 --> 03:57.870
But let us remove this breakpoint first.

54
04:00.080 --> 04:01.430
So now we step over this.

55
04:01.430 --> 04:02.480
We go to the parent.

56
04:03.140 --> 04:06.920
So step over, and we come to the parent.

57
04:06.920 --> 04:08.030
So this is the parent.

58
04:08.150 --> 04:11.210
This is the call which went to the bad message.

59
04:11.510 --> 04:22.310
So we can put—we can put a comment here by pressing semicolon, and you can say "shows bad

60
04:22.310 --> 04:23.060
message."

61
04:27.920 --> 04:30.770
And then try to look for a jump which can bypass this.

62
04:31.400 --> 04:33.830
And this one seems like the right one.

63
04:34.310 --> 04:37.220
So we put a breakpoint here to see whether it will hit.

64
04:39.350 --> 04:40.550
So let's run.

65
04:42.960 --> 04:45.600
Click Register, and it hits our breakpoint.

66
04:46.830 --> 04:50.940
So now we try to see whether we can make it jump.

67
04:50.940 --> 04:57.570
If we click on this now, it shows that jump is not taken, which means it will go straight and call the

68
04:57.570 --> 04:58.380
bad message.

69
04:58.920 --> 05:00.300
So we can toggle this

70
05:00.300 --> 05:02.880
now—toggle the zero flag.

71
05:03.420 --> 05:06.090
And now we can see the jump is taken.

72
05:06.450 --> 05:07.740
This is red now.

73
05:07.740 --> 05:09.780
And now this jump is taken.

74
05:10.260 --> 05:11.880
So let's step over it.

75
05:12.000 --> 05:14.160
And indeed it jumped over this.

76
05:15.060 --> 05:17.790
So we can put a comment here.

77
05:18.870 --> 05:23.400
"Jump this" so that we can remind ourselves that this is the place we are going to patch.

78
05:24.690 --> 05:26.310
So now let's run all the way.

79
05:26.520 --> 05:29.940
And now we see the bad message is no longer showing.

80
05:31.680 --> 05:38.520
We actually managed to force it to accept any serial.

81
05:39.510 --> 05:40.080
All right.

82
05:40.080 --> 05:42.690
But we don't just want it to accept any serial.

83
05:42.750 --> 05:45.300
We want it to show "Right

84
05:45.300 --> 05:45.930
serial."

85
05:46.950 --> 05:47.130
So,

86
05:47.130 --> 05:47.310
right

87
05:47.310 --> 05:47.880
serial.

88
05:48.270 --> 05:53.130
But we found out that when it jumped over this, it did not show the right serial.

89
05:53.790 --> 06:01.500
So what we need to do is modify this call so that instead of showing the wrong serial, it says "Right

90
06:01.500 --> 06:02.010
serial."

91
06:02.730 --> 06:05.790
So because of that, we cannot patch it here.

92
06:06.540 --> 06:08.730
We need to let it go through and call this.

93
06:08.790 --> 06:13.440
Then we will modify the call so that it will show "Right serial."

94
06:14.460 --> 06:16.470
So now let's rerun the program.

95
06:16.470 --> 06:22.530
And then we are going to search for the string—the wrong serial string.

96
06:22.530 --> 06:24.720
We are going to modify the string in memory.

97
06:25.590 --> 06:32.490
So to search for the string, you right-click here anywhere, and Search for > Current Module > String

98
06:32.490 --> 06:38.580
References, and then key in the word "wrong."

99
06:40.530 --> 06:41.850
And you found it.

100
06:41.850 --> 06:47.880
So just double-click to go to that address, and you can see the caption and the string.

101
06:47.880 --> 06:50.370
So we will modify the caption first.

102
06:50.370 --> 06:52.050
So we select the caption.

103
06:52.470 --> 06:56.550
The caption is what is shown on the title of the box—of the message box.

104
06:56.580 --> 07:02.430
Go down to the address there, right-click, Follow in Dump, and select the address.

105
07:03.090 --> 07:04.650
So now it goes to the address.

106
07:04.680 --> 07:07.080
Go to the address for "Error."

107
07:07.440 --> 07:08.250
Highlight it.

108
07:08.250 --> 07:10.950
Right-click, Binary > Edit.

109
07:12.520 --> 07:15.310
And make sure you check on "Keep size."

110
07:15.490 --> 07:22.000
Now we will modify the string to become "Right." Click OK, and we have done that.

111
07:22.210 --> 07:26.620
Next, we are going to modify the string that is to be shown in the box—in the message box.

112
07:26.620 --> 07:27.970
So go to that address.

113
07:28.630 --> 07:30.400
Right-click, Follow in Dump.

114
07:31.060 --> 07:34.600
Click on the address and highlight the word "wrong."

115
07:35.350 --> 07:44.530
Right-click, and Binary > Edit, and change "wrong" to "right." Click on OK.

116
07:45.520 --> 07:46.870
Now you can patch it.

117
07:47.200 --> 07:56.080
So Patch File, click Patch, and give it a name: "02-02."

118
07:58.660 --> 08:00.100
This is the second patch.

119
08:01.390 --> 08:06.130
Click on Save and click OK, and close everything.

120
08:06.190 --> 08:09.340
Now we are going to test the patch 2 directly.

121
08:09.550 --> 08:12.040
Go to patch 2 and click on it.

122
08:12.070 --> 08:14.440
Enter any wrong serial.

123
08:17.680 --> 08:19.450
And click on Register.

124
08:20.650 --> 08:21.760
Click OK.

125
08:27.090 --> 08:29.940
And you will see it shows the right serial.

126
08:29.940 --> 08:34.530
So we have already solved this challenge now.

127
08:34.620 --> 08:36.390
So this project is done.

128
08:36.420 --> 08:37.650
Thank you very much.

129
08:37.680 --> 08:39.030
See you in the next one.