🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
5 messages
5 total messages Started by Mike Collins Sat, 19 Apr 2008 01:53
Ensuring single occurance with CreateProcessAsUser and FUS
#387
Author: Mike Collins
Date: Sat, 19 Apr 2008 01:53
28 lines
2297 bytes
Hi guys - hopefully the final post for a few days - I think I nearly have my 
system working.

I have one last questions, maybe someone could give me a few ideas.  I'm 
just looking for some design suggestions.

The background to my problem is as follows.  I currently have a GinaStub 
that runs under the context of the LocalSystem, in time though, this will be 
replaced with a service.  In either case, the system controls access to a 
given computer and controls what can be done on that computer, based on the 
logged on user.

When a user logs on, a system tray icon / application is launched based on 
the [HKLM] Run registry key.  When a user double-clicks on this icon, an IPC 
message is sent to the GinaStub / Service which then uses 
CreateProcessAsUser to launch a configuration application. This system all 
works fine and seems to hold water with Fast-User switching.

However, I now have a small issue.  Firstly, I want to ensure that only one 
occurrence of this Control application is launched per logged on user.  As 
it stands, if a double-click on the icon more than once, I get another 
occurrence of the control app launched.  I don't think that I can use the 
normal mutex system for ensuring single occurrence because this mutex may 
have been created by a control app on another users desktop.

Does this make any sense?  Does anyone have any suggestions?

Cheers, Mike C 
Re: Ensuring single occurance with CreateProcessAsUser and FUS
#390
Author: Bob Gonder
Date: Sat, 19 Apr 2008 19:35
10 lines
1329 bytes
Mike Collins wrote:

> I don't think that I can use the 
>normal mutex system for ensuring single occurrence because this mutex may 
>have been created by a control app on another users desktop.
>
> Does anyone have any suggestions?

Named Mutex, on the user's and your gina's name.
	MutexName = MyServiceName + User.Name;
Re: Ensuring single occurance with CreateProcessAsUser and FUS
#400
Author: Remy Lebeau (TeamB)
Date: Tue, 22 Apr 2008 00:19
21 lines
1672 bytes
"Mike Collins" <its@TheBottomOfThePost> wrote in message 
news:4809401f$1@newsgroups.borland.com...

> I want to ensure that only one occurrence of this Control application
> is launched per logged on user.  As it stands, if a double-click on the
> icon more than once, I get another occurrence of the control app
> launched.  I don't think that I can use the normal mutex system for
> ensuring single occurrence

Yes, you can.

> because this mutex may have been created by a control app on
> another users desktop.

But that mutex would only exist in that user's session only, as long as you 
are not creating the mutex in the "Global" namespace, otherwise it would be 
shared amongst multiple user sessions.


Gambit 
Re: Ensuring single occurance with CreateProcessAsUser and FUS
#401
Author: Mike Collins
Date: Wed, 23 Apr 2008 11:59
19 lines
1534 bytes
Sorry for the late response - been in hospital have my knee fixed up so 
hobbling around on crutches. lol

So what you are basically saying is that when you create a mutex, it is only 
valid for the current user / the environment / desktop that it is created 
in?  Is this correct?

Do I simply place "Local\" in front of the mutex name to ensure that it is 
not a global mutex?

Thanks again

Mike


"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:480d311d@newsgroups.borland.com...
>
> 
Re: Ensuring single occurance with CreateProcessAsUser and FUS
#403
Author: Remy Lebeau (TeamB)
Date: Wed, 23 Apr 2008 20:12
19 lines
1681 bytes
"Mike Collins" <its@TheBottomOfThePost> wrote in message 
news:480f13fd$1@newsgroups.borland.com...

> So what you are basically saying is that when you create a mutex, it
> is only valid for the current user / the environment / desktop that it
> is created in?  Is this correct?

By default, yes.  You have to put it into the "Global\" namespace if you 
want to share it amongst multiple user sessions.

> Do I simply place "Local\" in front of the mutex name to ensure
> that it is not a global mutex?

Yes.  But only on XP and later.  Namespaces are ignored on Win2000, and '\' 
is an illegal character in kernel name for OSs prior to that.


Gambit 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads