更改文件的安全性属性

问题描述:

我有一个使用ocx文件的应用程序,执行该应用程序后,当我右键单击ocx文件时,我发现ocx文件的属性中添加了两个新属性(Everyone和Anonymous),这些属性阻止ocx文件从删除(属性->安全性->组或用户名)
如何以编程方式删除这些属性以删除ocx文件,或者有什么方法可以防止在执行应用程序期间创建这些属性?

I have an application using an ocx file, after executing the application, when I did right click on the ocx file, I found two new attributes( Everyone and Anonymous ) is added in the properties of ocx file that prevent ocx file from deleting( properties -> security -> Group or username )
How can I remove these attributes programatically in order to delete the ocx file or is there any way to prevent creating these attributes during the executing application?

这些属性是继承的从.ocx所在的文件夹中.如果它是受保护的文件夹(例如windows/system32/),则该文件夹中的文件将应用相同的安全属性.

这意味着要删除文件,该应用程序需要由具有删除.ocx所需权限的帐户或组执行.

如果正在使用.ocx,则无法将其删除.

[更新]
您可能需要先注销ocx. MSDN链接:
http://support.microsoft.com/kb/173091 [
The attributes are inherited from the folder in which the .ocx is stored. If it is a secured folder such as windows/system32/ then the files in that folder will have the same security attributes applied.

This means to remove the file the application needs to be executed by an account or group with the necessary rights to remove the .ocx.

The .ocx cannot be removed if it is in use.

[Update]
You may need to unregister the ocx first. MSDN link:
http://support.microsoft.com/kb/173091[^