Vista文件安全问题? [英] Vista file security issue?

查看:74
本文介绍了Vista文件安全问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很遗憾地编写了一个在Vista计算机上运行的简单对话框应用程序。我的对话框有一个用户控件,它接受一个字符串输入并根据用户文本构建一个目录结构。前两周一切都很顺利。它创建了目录树,并将文件放在他们想要去的地方,但本周发生了一些变化,虽然它仍然正确地创建了目录结构,但它不会让我(或其他任何人)在完成它时删除它。错误消息说明该文件不再是我所说的,我怀疑它实际上是对所有具有只读位设置的文件夹的响应。当然我无法删除只读标志的原因与我无法删除文件的原因相同(文件不再是我说的那样)。我想我需要在SECURITY_ATTRIBUTES结构中明确设置安全性。有谁能指出我如何实现这个的一个很好的例子? Errrgg !!!



Ron H.



文件夹全部显示在GUI视图中在cmd提示符下。属性显示为只读但我无法使用属性对话框或使用attrib -R删除它。



Ron H.

I am unfortunately writing a simple dialog application that runs on a Vista machine. My dialog has a user control that accepts a string input and builds a directory structure based upon the user text. For the first two weeks all was well. It created the directory tree and put files where they were suppose to go but this week something has changed and while it still creates the directory structure correctly, it will not let me ( or anyone else ) delete the tree when finished with it. The error message explains that the file is no longer where I said it was which I suspect is really a response to the folders all having the read-only bit set. Of course I can not remove the read-only flag for the same reason that I can not delete the file ( file is no longer where I said it was). I am thinking that I need to explicitly set the security in the SECURITY_ATTRIBUTES structure. Can anyone point me to a good example of how to implement this? Errrgg!!!

Ron H.

The folders all show up in the GUI view and also in a cmd prompt. The attributes show read-only but I can not remove it either using the properties dialog or with attrib -R.

Ron H.

推荐答案

好的,这是我发现的。如果这是常识,我为浪费的时间道歉。我正在使用:: CreateDirectory(strFilename,NULL)来创建目录树。我从用户输入构建strFilename。如果strFilename ==C:\ MyDy \ MySubDir一切都很好,一切正常,但是当strFilename ==C:\ MyDy \ MySubDir \时,文件夹被创建但奇怪的事情发生了。该文件在资源管理器和cmd提示符窗口中可见,但任何尝试对其进行删除或修改它都会导致找不到文件错误。我不知道为什么,但因为我可以通过避免终止\来避免这个问题。我可以忍受它。



问候

Ron H。
OK, Here is what I''ve discovered. If it is common knowledge, I appologize for the wasted time. I am using ::CreateDirectory(strFilename,NULL) to create the directory tree. I build strFilename from user input. If strFilename == "C:\MyDir\MySubDir" all is well and everything works fine however when strFilename == "C:\MyDir\MySubDir\" the folders are created but strange things happen. The file is visible in explorer and in a cmd prompt window but any attempt to del it or modify it results in essentually a "file not found" error. I do not know why but since I can avoid the issue by avoiding the terminating "\" I can live with it.

Regards
Ron H.


这篇关于Vista文件安全问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆