您的位置:首页 > 移动开发 > Objective-C

How to create a no security level kernel object

2008-08-29 21:26 447 查看
I make a sample of Event object to show this issue:
How to create a no security level kernel object?

Code
HANDLE hMonitor = OpenEventA(EVENT_ALL_ACCESS, FALSE, "Global\\{A7DF02C8-0F89-4a3b-A6E8-E3E08C167C58}");
if ( NULL == hMonitor )
{
cout << "Open event failed, last error:" << GetLastError() << endl;
return 0;
}

SetEvent(hMonitor);

Why I make this sample?
Because I want to operate a windows kernel object in the different process, and these process own the different security level. e.g. service and user process. So if you don't set the security descriptor , you will always get the NULL when you invoke OpenEvent API and get the error number is 5.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: