Hello and welcome to the lesson on the APA.
You esteem multiple process, true going down this project, call 15 Dash Multi Process Control and
unzip it.
Put it in the email death to folder.
Also download this file, which contains some useful links and references accompanying this lesson.
Inside this file, this folder, you will see a few files compile that is the script used to build the
multiple access control program we should be using to demonstrate multiple process control.
And there's also the message box binary, which is actually a raw shellcode, as well as the message
box to see which is the.
Cheryl Cook properly formatted for inclusion in sight.
He program.
So this one should be deleted before he can compile this.
So
let me just explain to you first how this moves into a narrow folder.
So let's open the multi process control file.
On the top, you have your message box 64bit Sharkawy.
Yes, you are seeing many times before now this program, when you runs, is just going to allocate
some memory.
And then Capiz Shell going to that memory, and there's a security that's only guess.
So let's take a look.
We declare a handles cohesion lock and also some defines in order to be used if our new function call
is process running, is process running issues in the main function.
Over here you will see that.
We call his process running over here.
There is we check whether the process is already running in memory, if it is, he will then quickly
by returning zero.
Before that, he will print his message to the council to inform the user the new process tonight because
it is already running in memory.
And then over here you see that he allocates memory for the payload.
And then sorry, I don't get memory wearable, and it copies Bill to the allocated memory.
And then over here, it makes the pill executable and readable by using which are protected.
And over here you will then create it check.
That means you will run the court and then you bring the message to the user and then wait for the.
And here, if you close the lock, so this lock is global, it is coming here.
This is very likely and this is a lock that is going to be us in, say, the program throughout the
selection process running.
So let us take a look at how this process is running.
You will find here that there are several implementation of the lock forces to mute mutex lock.
Second is semaphore.
So this event and Toffees named bikes, and we can choose which one to use by specifying the type of
lock here, so that is totally new tax law.
So this changes to tax when you specify the type of lights new tax incentive program.
You will then check if the control method is mutates, you will then create new tax.
He will create new tax law using this API function, which you can read up by going to this link to
create new tax.
So create new tax is a function.
So creating new text can be referred in the media in reference here.
It accepts three parameters.
The most important is the thirty one.
It doesn't.
One is the name of the lok.
So you need to provide a name for a lock.
You could hear the name of a lock at that parameter here called controlling and is defined here.
Control name is global.
My lock If you want to know more about the name of the perimeter, you can read up here and the kernel
objects.
So this article kind of getting these spaces to tell you how to give names for you and for your objects
that you are going to use for the locks.
Then the second time of lock, we can use this call Semaphore symbol for access.
One two three four barometers.
And you can read in the media and reference as well.
Over here, and the most important parameter again is the folk barometer.
So this is an improved version of a new tax lock.
It has got this additional two parameters which can keep count of how many times the critical section
has been accessed.
So critical section is the part of memory which you are controlling.
So it gives count of the minimum and maximum here.
So the barometer is the most important one.
And again, we used these same type of name namespace called truly global malloc.
The third type of lock is called the event a log a.
We use the API create event.
Creative event explain in this Microsoft and the here he has got these parameters.
And again, the most important barometer is the fourth parameter, the name of the event, which again,
we are using control name.
And lastly, the fourth type of lung is called neem pipe, and he uses the API function call create
name by.
This is the standard reference for grading, folks.
He has got a long list of parameters by the most important one is the first parameter named after the
fact that you want to create by name.
So in this case here, the Typekit name be created to be this string here.
Call by my lock.
And this convention is also explained by the Microsoft article.
Over here.
He explains the name of the bike.
The convention of the name to this is what we are using and then we are creating the name here.
So.
This is how the empire works, so if NASA after you have already run this process, once it will go
ahead and create the look and then when the second process try to start again, he is going to check
it is going to check by using his process running.
He would try to create a second look using the same name, and he will fail because he would get the
error over the ACS error.
So once he finds this error, he will then close and return the means the program will kick.
So this is how locks work.
Same thing is semaphore as well if the first process that runs has already already acquired a semaphore
for this name.
The second process cannot again create the same semaphore using the same name, same event as well as
pipes.
So this is how the we are able to control the number of processes that are running in the memory.
So that's all for this video.
Thank you for watching.