I don’t know if this is by design or not, but I cannot seem to create a new Semaphore on Windows 7 as a Standard User, or a Power User for that matter.
SemaphoreSecurity semSec = new SemaphoreSecurity();
// have also tried "Power Users", "Everyone", etc.
SemaphoreAccessRule rule = new SemaphoreAccessRule("Users", SemaphoreRights.FullControl, AccessControlType.Allow);
semSec.AddAccessRule(rule);
bool createdNew = false;
// throws exception
sem = new Semaphore(1, 1, SEMAPHORE_ID, out createdNew, semSec);
return true;
I am receiving an UnauthorizedAccessException with the message “Access to the port is denied.”
Is this possible?
After some more research and trying things out I finally solved this,
The key is to prepend “Global\” to the semaphore name, ie,
Thanks.