当前位置: 动力学知识库 > 问答 > 编程问答 >

windows - Global namespace CreateFileMapping and SeCreateGlobalPrivilege

问题描述:

I am using a shared memory map for inter-process communications. This map needs to be visible between sessions, so I am attempting to create it in the global namespace. I know that the running users needs SeCreateGlobalPrivilege in order for this to work.

I have edited the local security policy (I'm not on a domain) to give my user to the "Create Global Objects" privilege, but when I run the application this privilege is not in the access token. If I run as administrator I do get the privilege.

What am I missing? Why don't I get this privilege?

网友答案:

Try using OpenThreadToken() and AdjustTokenPrivileges() to enable the privilege for the calling thread before calling CreateFileMapping().

Enabling and Disabling Privileges in C++

网友答案:

If you're logged in as an adminitrator, UAC will filter the privilege unless you Run As Admin.

If you're logged in as an ordinary user you'll have the privilege all the time (if you've granted it from Local Security Policy)

分享给朋友:
您可能感兴趣的文章:
随机阅读: