473,804 Members | 3,191 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

EventWaitHandle - UnauthorizedAcc essException

Hi all!

I'm trying to use a named EventWaitHandle to signal events between processes
that run on the same computer. One of them is a service running as SYSTEM and
the other one is a normal user. Creating the handle seems to be no problem,
but when the other process is calling EventWaitHandle .OpenExisting with the
same name, an UnauthorizedAcc essException is thrown with the message "Access
to the path is denied.".

Any idea on how to make it work? I'm completely clueless on this one...

- Kristoffer -

Apr 12 '06 #1
5 8961
Hello, Kristoffer!

KP> I'm trying to use a named EventWaitHandle to signal events between
KP> processes that run on the same computer. One of them is a service
KP> running as SYSTEM and the other one is a normal user. Creating the
KP> handle seems to be no problem, but when the other process is calling
KP> EventWaitHandle .OpenExisting with the same name, an
KP> UnauthorizedAcc essException is thrown with the message "Access to the
KP> path is denied.".

What process is calling EventWaitHandle .OpenExisting? Service or application under common user?

Can you post code, where you create and initialize EventWaitHandle object?

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Apr 12 '06 #2
When I test it, I start the executable first and then the service. If the
executable is running as an administrator, there is no problem. If it is a
normal user, the service will fail to open the existing event.

( If I start the service first, then the program as a normal user, then the
program will fail at an earlier stage, when a mutex is created with mutex =
new System.Threadin g.Mutex(false, "MyMutexNam e"); )

The code I use is taken from the help on the
EventWaitHandle .SetAccessContr ol method. I took Main, made it a public static
method with the name as an inparam and removed the deny rule on Synchronize
and Modify when the named event is created.

So, I guess the problem is to figure out how to give the normal user access
to work with a named Mutex/EventWaitHandle ...

- Kristoffer -

"Vadym Stetsyak" wrote:
Hello, Kristoffer!

KP> I'm trying to use a named EventWaitHandle to signal events between
KP> processes that run on the same computer. One of them is a service
KP> running as SYSTEM and the other one is a normal user. Creating the
KP> handle seems to be no problem, but when the other process is calling
KP> EventWaitHandle .OpenExisting with the same name, an
KP> UnauthorizedAcc essException is thrown with the message "Access to the
KP> path is denied.".

What process is calling EventWaitHandle .OpenExisting? Service or application under common user?

Can you post code, where you create and initialize EventWaitHandle object?

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot

Apr 13 '06 #3
Ahh... simple when you know the answer...

To create a named Mutex or EventWaitHandle that can be shared between users,
you should create Allow access rules for the identity "Everyone".

EventWaitHandle Security ewhSec =
new EventWaitHandle Security();

EventWaitHandle AccessRule rule =
new EventWaitHandle AccessRule("Eve ryone",
EventWaitHandle Rights.Synchron ize |
EventWaitHandle Rights.Modify,
AccessControlTy pe.Allow);
ewhSec.AddAcces sRule(rule);

ewh = new EventWaitHandle (false,
EventResetMode. AutoReset,
ewhName,
out wasCreated,
ewhSec);

- Kristoffer -

Apr 13 '06 #4
Hello, Kristoffer!

KP> ( If I start the service first, then the program as a normal user, then
KP> the program will fail at an earlier stage, when a mutex is created with
KP> mutex = new System.Threadin g.Mutex(false, "MyMutexNam e"); )

What is the problem here? What exception is being thrown?
I suppose that mutex object is already created by the service without ( default ) mutex security.

To open mutex you can use same approach as for EventWaitHandle . That is Mutex.OpenExist ing(...)
--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Apr 13 '06 #5
Hello, Kristoffer!

KP> To create a named Mutex or EventWaitHandle that can be shared between
KP> users, you should create Allow access rules for the identity
KP> "Everyone".

I think using "Everyone" is not secure, it will be better to limit it to particular user.

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Apr 13 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3142
by: Doug Taylor | last post by:
Hi, I originally posted this in dotnet.security, but have moved it here by request: Hi, I am trying to programmatically add a user with read permissions to the DACL of a registry key. All appears to go well until I try to
4
4212
by: ASP Yaboh | last post by:
I have app that writes text files to any location of the users choosing in the network. It has been working for 18months. An exception has begun occurring where a folder on a network share is denying access to the File.CreateText(_filename) method. The user has write access. They can create a text file through explorer no problem. I am not a member of the group that has write access. As a test, I logged into the network as a Domain Admin...
2
4139
by: GM | last post by:
Any help is greatly appreciated! I'm up against a meeting deadline. Directory.CreateDirectory Method throws UnauthorizedAccessException Here is the path: "C:\JumpStart\JumpStart\sites\Proto\images\sites.e-Plaza.org\Alece" Everything before 'Alece' already exists.
1
1849
by: Hal 9000 | last post by:
In c# we have a function that creates a virtual directory in IIS 6.0 using DirectoryServices API. The code looks like this: // log in to IIS DirectoryEntry rootDir = new DirectoryEntry("IIS://localhost/W3SVC/1/Root",ADMIN_USR,ADMIN_PSWD,AuthenticationTypes.Secure); // create a child virtual directory DirectoryEntry virtualDir = rootDir.Children.Add(name, rootDir.SchemaClassName); // set the virtual directory's physical path
12
8023
by: Lucas Tam | last post by:
I have a very simple loop: If (Directory.Exists(tempDirectory)) Then Try Dim Files() As String = Directory.GetFiles(tempDirectory) 'Clear out directory For Each Filename As String In Files File.Delete(Filename) Next Catch ex As Exception
0
2334
by: nime | last post by:
I've got a problem. I cannot debug my app. which one contains WebBrowser control. I found a resolution but it's for an ASP related problem. I couldn't find a correct "user" to give permisson then I've added Everyone and refreshed policies (gpupdate /force), restarted VB IDE but still got the problem. What is the "worker process" for VB IDE? CODE:
1
3724
by: =?Utf-8?B?VHJlY2l1cw==?= | last post by:
Hello, Newsgroupians: I'm still trying to work on synchronization of events. I think I can do it using WaitHandle, EventWaitHandle, or Mutex. However, is it possible to determine if the state is signaled or unsignaled for one of these? I've looked on the Internet, but I cannot find any information in determining the state. Thank you, again. Trecius
2
1824
by: swartzbill2000 | last post by:
Hello, I am using a VB.Net COM library to provide multi-threading to an existing VB6 app. Library functions that start background operations create an EventWaitHandle to be used to cancel the operation. How can I return some kind of reference to the EventWaitHandle to the VB6 app that can be used later in another library function call to cancel the operation? Bill
8
6318
by: imukai | last post by:
I have a forms-based authentication application on our intranet - ASP.NET 3.5 (C#). For security purposes there is one specific .aspx file that we have enabled Integrated Windows Authentication turned on. Administrators in another group control access to this .aspx file via the file system. They have specifically set DENY access on this file to a few groups of employees. If one of those employees somehow manages to bring up that .aspx,...
0
9707
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9585
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10586
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10323
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6856
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5658
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.