Be MySelf                                                    
 

 

日志更新

最新评论

留言板

链接

Blog信息





Vista Per-Machine Setting file ,Where to save?
haosheng 发表于 2006/11/10 16:59:00

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);
}


阅读全文 | 回复(0) | 引用通告 | 编辑 | 收藏该日志
 


发表评论:

    昵称:
    密码:
    主页:
    标题: