在硬盘上查找文件占用的扇区 [英] find files occupied sectors on hard disk

查看:297
本文介绍了在硬盘上查找文件占用的扇区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Win32 API编写一个项目,我需要在硬盘上查找文件占用的扇区,然后在这些扇区上进行写.
例如:
我有一个文件(test.txt),我想查找该文件被占用了哪些扇区?


I am writing a project using win32 API and i need to find files occupied sectors on hard disk, and then write on these sectors.
for example:
I have one file (test.txt) and i want to find which sectors this file has been occupied?


does anybody know how can i do this?

推荐答案

我假设您正在尝试编写安全的删除应用程序吗?
那并不像你想的那么容易...

Google是您的朋友:
I assume you are trying to write a secure delete application?
That is not as easy as you think...

Google is your friend here: Secure delete c++[^] - but be prepared for some work, it is not at all easy. Just think about SSDs - they don''t write where they tell you they are, just mark the old blocks as "available for reuse" at a later date.


据我所知,则无法通过win32 API写入磁盘上的特定扇区.您需要使用低级内核API编写驱动程序.
As far as I know, it is impossible to write to a specific sector on disk through win32 API. You need to write a driver using low-level kernel API.


另一个资源是 SysInternals实用程序.有一些有趣的文件系统实用程序及其源代码.
Another resource is the SysInternals utilities. There are some interesting file system utilities with source code there.


这篇关于在硬盘上查找文件占用的扇区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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