Is开发者_运维知识库 it possible to catch the access to a dll file inside system32 and force the user to gain administrative rights in order to let the program continue using this dll ? Or just remove the Users group from Readers and Executers without modifying the ACL for the whole directory ?
No, you can't make system show elevation prompt when your or another application accesses a DLL. First of all this is because you can't elevate an already running process (and process is started when it loads a DLL). So gaining administrative privileges is the job of the application that uses that DLL.
Your DLL must return error status when it can't do its job because of insufficient privileges.
Yes, you can change ACL on one file without modifying ACL of the directory. (But I don't think it is a good idea. Additionally you should not put your DLL to system32/wow64 folders.
精彩评论