Vista 这个权限深严的城堡,那里去寻找一片乐土?
创造任何一个事件对象的时候,安全描述符千万不要传NULL。
你可以通过下面的函数创建一个所有用户都能访问的系统对象。Over
BOOL CreateMyDACL(SECURITY_ATTRIBUTES * pSA) { // Define the SDDL for the DACL. This example sets // the following access: // Built-in guests are denied all access. // Anonymous logon is denied all access. // Authenticated users are allowed // read/write/execute access. // Administrators are allowed full control. // Modify these values as needed to generate the proper // DACL for your application. TCHAR * szSD = TEXT("D:") // Discretionary ACL TEXT("(A;OICI;GA;;;BG)") // Deny access to // built-in guests TEXT("(A;OICI;GA;;;AN)") // Deny access to // anonymous logon TEXT("(A;OICI;GA;;;AU)") // Allow // read/write/execute // to authenticated // users TEXT("(A;OICI;GA;;;BA)"); // Allow full control // to administrators
if (NULL == pSA) return FALSE;
return ConvertStringSecurityDescriptorToSecurityDescriptor( szSD, SDDL_REVISION_1, &(pSA->lpSecurityDescriptor), NULL); } |