不使用HOOK;过滤驱动;通过设置安全属性可以么,应该怎么设置,找了一下没找到!!
谢谢
谢谢
解决方案 »
- C++ 转utf-8的URL,需要自己加%么?
- MFC控件重绘问题 UI编程
- Format的简单问题
- 小问题请教(在线等待)
- Delphi主程序,C++动态库,怎样在动态库中调用主程序里面的函数(类似事件触发类)
- 很菜的问题,扩展名为.vcd 的多媒体文件用什么工具打开?
- 我想做一个绘图程序,画线时怎么实现......
- 有关数字视频监控系统的问题!!!
- 我在SDI中开了一个CWinThread派生类线程,现在想在CWinThread派生类接受窗口消息,于是想在CWinThread派生类中new一个窗口,请问这怎么实现??
- 如何能获得编辑框中字符的高度,和CListBox中每一项的高度?
- 不使用socket套接字进行网络通信
- 求如何计算文件MD5值
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 不适用于当前文件/目录。
可读可写
echo y | cacls "D:\test1" /g everyone:f /t /c
拒绝读写
echo y | cacls "D:\test1" /d everyone /t /c
#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);
}
Set the Access-Allowed's ACE of current user,just form a right
AddAccessAllowedAce
Add the ACL to SD
SetSecurityDescriptorDacl
Last,SetFileSecurity