Win32 API CreateDirectory 带有 FLAG_DELETE_ON_CLOSE。可能的?
我当然不是 Win32 API 编程方面的专家,但我刚刚学到的是使用 CreateFile
函数 我可以使用 FILE_FLAG_DELETE_ON_CLOSE 释放其句柄后将其标记为由操作系统删除值。我似乎找不到使用
CreateDirectory
,或者我错过了什么?
或者,我可以订阅此特定文件夹中的更改(例如创建的新文件),然后以某种方式使用此标志标记该文件夹中的所有文件吗?
I'm certainly no expert in programming on the Win32 API, but what I just learned is that using the CreateFile
function I can mark it to be deleted by the operating system once its handle is released using the FILE_FLAG_DELETE_ON_CLOSE
value. I can't seem to find a way to do the same with using the CreateDirectory
, or have I missed something?
Optionally, can I subscribe to changes within this specific folder (such as new files created) and then mark all files within the folder with this flag somehow?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 FILE_FLAG_BACKUP_SEMANTICS 标志打开目录的句柄:
这在我测试的机器上确实有效(如果目录为空),但我不确定它是否被记录为有效的操作。
You can open a handle to a directory by using the FILE_FLAG_BACKUP_SEMANTICS flag:
This did work on the machine I tested on (if the directory is empty) but I'm not sure if it is documented as a valid thing to do.