Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

win7 WriteFile sectors error code :5

$
0
0
i want to realize a file shredder on windows. First,  i call function DeviceIoControl with paramter FSCTL_GET_RETRIEVAL_POINTERS to get the position (described by sectors and 

clusters)of file on the disk. then i call function CreateFile  to open a drvie(for example:"\\\\.\\c") and call function WriteFile to overlap the file i located on the first step. On win 

xp ,i make it ,the file is rewrited. But on win 7 ,I get error code :5 . I don't know how to resolve the problem.

And i read the documentation on MSDN. It tell me i need to lock the volume or umount it before writing the sectors . Then i have a try . I try call function DeviceIoControl  with  paramter FSCTL_LOCK_VOLUME before calling WriteFile. I still get error code :5 - -!

Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>