不使用HOOK;过滤驱动;通过设置安全属性可以么,应该怎么设置,找了一下没找到!!
谢谢

解决方案 »

  1.   

    NTFS系统格式设置系统权限,命令提示符下"cacls /?"
    C:\Documents and Settings\Administrator>cacls
    显示或者修改文件的访问控制表(ACL)CACLS filename [/T] [/E] [/C] [/G user:perm] [/R user [...]]
                   [/P user:perm [...]] [/D user [...]]
       filename      显示 ACL。
       /T            更改当前目录及其所有子目录中
                     指定文件的 ACL。
       /E            编辑 ACL 而不替换。
       /C            在出现拒绝访问错误时继续。
       /G user:perm  赋予指定用户访问权限。
                     Perm 可以是: R  读取
                                  W  写入
                                  C  更改(写入)
                                  F  完全控制
       /R user       撤销指定用户的访问权限(仅在与 /E 一起使用时合法)。
       /P user:perm  替换指定用户的访问权限。
                     Perm 可以是: N  无
                                  R  读取
                                  W  写入
                                  C  更改(写入)
                                  F  完全控制
       /D user       拒绝指定用户的访问。
    在命令中可以使用通配符指定多个文件。
    也可以在命令中指定多个用户。缩写:
       CI - 容器继承。
            ACE 会由目录继承。
       OI - 对象继承。
            ACE 会由文件继承。
       IO - 只继承。
            ACE 不适用于当前文件/目录。
      

  2.   

    简单点就是执行下面的两个命令,用CreateProcess创建进程,复杂的话自己调用权限设置的API
    可读可写
    echo y | cacls "D:\test1" /g everyone:f  /t /c
    拒绝读写
    echo y | cacls "D:\test1" /d everyone  /t /c
      

  3.   

    好像这个cacls功能不是很强大,你可以去下个xcacls试试。
      

  4.   

    Use DACL,you can search it in the MSDN DocumentsHere is a Example as follows
    #define _WIN32_WINNT 0x0500#include <windows.h>
    #include <sddl.h>
    #include <stdio.h>BOOL CreateMyDACL(SECURITY_ATTRIBUTES *);void main()
    {
         SECURITY_ATTRIBUTES  sa;
          
         sa.nLength = sizeof(SECURITY_ATTRIBUTES);
         sa.bInheritHandle = FALSE;       // Call function to set the DACL. The DACL
         // is set in the SECURITY_ATTRIBUTES 
         // lpSecurityDescriptor member.
         if (!CreateMyDACL(&sa))
         {
             // Error encountered; generate message and exit.
             printf("Failed CreateMyDACL\n");
             exit(1);
         }     // Use the updated SECURITY_ATTRIBUTES to specify
         // security attributes for securable objects.
         // This example uses security attributes during
         // creation of a new directory.
         if (0 == CreateDirectory(TEXT("C:\\MyFolder"), &sa))
         {
             // Error encountered; generate message and exit.
             printf("Failed CreateDirectory\n");
             exit(1);
         }     // Free the memory allocated for the SECURITY_DESCRIPTOR.
         if (NULL != LocalFree(sa.lpSecurityDescriptor))
         {
             // Error encountered; generate message and exit.
             printf("Failed LocalFree\n");
             exit(1);
         }
    }
    // CreateMyDACL.
    //    Create a security descriptor that contains the DACL 
    //    you want.
    //    This function uses SDDL to make Deny and Allow ACEs.
    //
    // Parameter:
    //    SECURITY_ATTRIBUTES * pSA
    //    Pointer to a SECURITY_ATTRIBUTES structure. It is your
    //    responsibility to properly initialize the 
    //    structure and to free the structure's 
    //    lpSecurityDescriptor member when you have
    //    finished using it. To free the structure's 
    //    lpSecurityDescriptor member, call the 
    //    LocalFree function.
    // 
    // Return value:
    //    FALSE if the address to the structure is NULL. 
    //    Otherwise, this function returns the value from the
    //    ConvertStringSecurityDescriptorToSecurityDescriptor 
    //    function.
    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("(D;OICI;GA;;;BG)")     // Deny access to 
                                         // built-in guests
            TEXT("(D;OICI;GA;;;AN)")     // Deny access to 
                                         // anonymous logon
            TEXT("(A;OICI;GRGWGX;;;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);
    }
      

  5.   

    You may use API SetFileSecurity to modify the  FileSecurityDescriptor of a File or a Directory.The order is InitializeAcl   Initialize a ACL
      Set the Access-Allowed's ACE of current user,just form a right   
      AddAccessAllowedAce   
      Add the ACL to SD   
      SetSecurityDescriptorDacl   
      Last,SetFileSecurity
      

  6.   

    Search "discretionary access control list ",DACL in Google or Bing to get more information about your thread,enjoy !;)