So in the previous video, we have seen how to put the function manually in the local process.
Now we'll be seeing a library called Easy Hook to make this process much more easier.
So to install this easy hook, you need to install this nugget package.
Go to tools and go to another package manager and click on this manage.
Now in the browser tab you search for easy hook.
So this easy hook is the sharp implementation and this need to packages or you can use this easy hook
via c C++.
So I have already enjoyed this one.
You check this mark and click on install I have already installed so that's why it is telling to install.
So we are going to hook this message box w function.
So I have declared the signature.
Let's go and try to execute this one if it's working properly or not.
So.
So let's run this.
And we can see that message box has been.
Executed successfully.
Now, as well as in the previous videos, we need to declare a delegate with the exact function signature
of this message box W So.
So public delegate.
In.
Message did you get?
So we can copy this one.
So interesting.
If we are using the Unicode version, what you need to do is we need to master this parameter as unmanaged
type dot wrong pointer.
Why it catch string?
So copy this one.
And here.
And we are good to go.
So the delegate has been successfully declared.
Now we need to write our custom who could function.
So public static and int who could function?
Or you can copy the same parameters as this.
Now what we want to do is we now need to save those function address bytes starting five bytes as we
have done in the previous videos.
If we are not, if we are not watching my previous video, go ahead and watch that.
It will be very useful.
So in the previous video we have copied the 4 to 5 bytes at that function address and overwritten with
the jump to our function.
So we don't need to do that because the easy hook will automatically do this for you.
So all you need to do is you need to say message box W of.
And you can simply.
But these functions.
So we are just normally executing that search box as it is for now.
Now what we going to do is we need to create a hook variable, easy hook, dot create.
And these steaks are so easy.
Broker who did not create.
And this takes the first parameter as the function address.
And the second one is the delegate.
Delegate function we need to hook.
So the first parameter is we can say easy hook dot.
Roker who don't get proper dress and we need to pass in the dealer name.
User 32 DL.
And the next one is the message box.
So we are getting the.
Function address how this message box w.
And the second one is second parameter of.
Okay.
Uh, the second parameter is that so we can say a new message that you get off.
So pass this function so it will create a.
A new delegate of type who could function.
Now we can pass this as null.
So we have created a hook or several hook.
Now we need to.
Initiate this one.
So we can do that.
We can say hook dot.
Thread is here.
Dot set, inclusive is here.
So this will take an array of threat IDs.
So the current threat ID is zero.
If you want to hook the current threat to this function, you can say new int we can.
We are going to declare a.
An array which contains the thread IDs.
So now the.
The trade has been hooked to this function.
So first, let's call this one message box or two message boxes and let's run this and high and high.
So we are going to change modify a little bit if.
We can say text is equal to.
Uh, so let's say upon.
So let's run this.
We are just changing the second parameter.
That is the text.
Now, if I go and run this one now high and we can see the one, so.
The function or who could function has successfully executed.
Now to remove this hook, you can set thread a single dot set.
Excuse you is here.
And copy this one.
Now go ahead and copy this.
So this will.
So this easy hook will do.
Are these saving those bytes and pasting?
After the function has been executed.
So all of these operations for us.
So the first should execute high.
Second, one point and third one high.
So let's go run this high band and high.
So this is how you use the hook to rock or hook a function in the rocker process.