[Autogenerated] One of the tools, that Windows still has is Windows media player.
Let me launch Windows media player by using the start run button.
And typing, win player.
So here's Windows media player.
So let's say I want to have another media player running at the same time.
So I'm going to go, to start run, and then launch another media player.
But apparently it doesn't seem to work.
I get the same focus retained from that existing media player instance,
and If you look at the processes on the system,
I can see there's only one media player,
and There's no another media player.
That I wanted to launch.
Let me try this again.
I'm launching that but apparently it doesn't seem to work.
So what's going on here?
How come I can't have two media player instances.
So the fact of the matter is that in fact,
a second instance does launch but somehow it knows that there,
is another media player running in the system,
and then simply shuts down very quickly.
So we're not able to see, that process alive,
and the question, is How does media player know?
That There's another instance running and So nos to shut
down perhaps before that send a message,
to the existing media player window, and the answer in this case,
is by using a kernel object called a mutt text.
In this case,
the type of the kernel object doesn't really matter but it is using a mut
text behind the scenes with a given particular name,
and When the new media player launches,
it looks for that object by calling create new attack providing that same name,
and If the object already exists,
we know that Another handle will be available but then get let their return,
error already exists.
We've seen that in the previous module Let me show you that
Let me just filter two named objects,
only because we don't really need everything here.
And Let's filter by type or sort by type here.
And look for a T, a which is called mutant in kernel terminology,
and again, the meaning of a mute, Tex doesn't matter at this point,
but here's the one that matters.
It has the name which is called Microsoft WP- 70, check for other instant, Tex.
A very distinctive name which gives us a hint as to the purpose of these Mutt,
attack So apparently it has a single handle,
which means that the handle, holding, these mut alive,
and If I go ahead and right-click here, and say let's close that handle.
Normally it's not possible.
To close the handle in another process directly using the closed handle.
A P I the close handle, API I can't really do that I'll discuss,
in the Next video, how that is done.
But let's just do that For now, and you notice the handle goes away,
it becomes red, it's now gone.
And If I go ahead, and try, to launch another media player.
I can do that Now I have two media players.
And I can repeat, that process,
to create as many media players as I like simply by
closing that handle behind the process back.
So now the next instance coming,
up thinks that It's the first one because it doesn't seem to
find that tex with that distinctive handle.
It also shows you that In fact,
you can mess around with processes because they're using
named objects because they're fairly visible.
For example, I can go, to Visual Studio for instance, and then create something.
That will prevent media player from launching at all.
Let me prove.
That to you.
Let me go ahead.
And grab, that name again.
Let's go.
To the Next media player,
the second one and Look for that name again because I need to copy,
paste, that Let me find that Here it goes.
Let's copy, just that part.
We know there's the prefix which consists of the session index with sessions,
based named object as we've seen already.
And that makes sense because if I have multiple sessions running
like multiple users logging into the same system,
we expect each of want each of those to be able to launch
their own media player without restriction.
So once I've copied that let me launch a Visual Studio here,
and Let me create a project.
Here.
There's another demo we'll see later on.
And all, I'm going to do here, is Just uh let's say foil media player.
It doesn't really matter how we call it.
Of course, let me just go ahead.
And include Windows dot H the only thing we need to do here,
is Just uh use the create Tex API I to create a tex with that specific name,
that media player, is looking for.
So here's that name, I'm going to paste it from the previous copy operation,
and We have a handle here, but I'm not going to actually use that and again,
it's not really the point.
Let's just go ahead.
And place the breakpoint here.
Just to prove the point.
So if I have these media players right now,
let me close those, let me run this piece of code Let's go.
And set, up to start, a project, and run this.
So once we do that let's go ahead.
And create the Tex going back, to cross explorer,
our application, is called the file media player.
We can see that the mu attack mut text has been created here
with that Exact name we get that prefix automatically preened
to the name we provide here.
So now if I go ahead and try to launch media player,
it simply won't launch,
it won't launch because it actually does launch but it tries
to create the tes with that exact name,
and It finds that There's already one of those.
So it assumes there's already a media player, running.
And simply shuts down and that is It,
this is One of the downsides of using names because they are exposed.
They can be found using APIs or using tools as I've done here right now.
And We'll see how to solve.
That Very soon when we discuss private object name spaces.