CreateMutex() - 访问被拒绝 [英] CreateMutex() -- access denied

查看:365
本文介绍了CreateMutex() - 访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1。当我创建CreateMutex(NULL,FALSE,MutexName)时,我间歇性地获得访问被拒绝的错误;这个电话有时会非常好。行为不一致。 MSDN文档说用户访问权限有限时引发的错误?
这里的用户权限是什么?我使用具有管理员权限的域帐户?



2.另外,MSDN文档说"如果lpMutexAttributes参数不是NULL,则确定句柄是否可以"是继承的,但忽略了它的安全描述符成员。"如何在createmutex调用中指定安全描述符?为什么同步
选项可用于openmutex()不可用于createmutex()?我在这里得到了什么根本错误吗?



谢谢。

1. I get access is denied error intermittently when I make CreateMutex(NULL, FALSE, MutexName); The call works absolutely fine sometimes. The behavior is not consistent. MSDN documentation says that the error thrown when user had limited access rights? What should be user rights here? I use a domain account that had admin privileges?

2. Also, the MSDN documentation says "If the lpMutexAttributes parameter is not NULL, it determines whether the handle can be inherited, but its security-descriptor member is ignored.". How do I specify security descriptor in createmutex call? Why is synchronize option that is available for openmutex() is not available for createmutex()? Am I getting anything fundamentally wrong here?

Thanks.

推荐答案

1 CreateMutex = OpenMutex如果名字从文档中使用:
$


如果lpName与现有命名的互斥对象的名称匹配,则此函数请求MUTEX_ALL_ACCESS访问权限。



看起来您没有访问互斥锁的所有权限。在创建时更改安全描述符,以允许当前进程的用户令牌对该对象具有完全访问权限。



2您在引用后面的句子;如果lpName与现有命名互斥对象的名称匹配,则"。当没有名称匹配时,安全描述符由创建者设置。请参阅lpMutexAttributes的文档。



1 CreateMutex=OpenMutex if the name is used, from the documentation:

If lpName matches the name of an existing named mutex object, this function requests the MUTEX_ALL_ACCESS access right.

Looks like you don't have all access to the mutex. Change the security descriptor at the time of creation to allow the user token of your current process to have full access on the object.

2 you are quoting the sentences after "If lpName matches the name of an existing named mutex object". The security descriptor is set by the creator when there isn't a name match. see the documentation of lpMutexAttributes.



这篇关于CreateMutex() - 访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆