Exetools  

Go Back   Exetools > General > General Discussion

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-01-2005, 18:14
MarkusO
 
Posts: n/a
How to lock a file completely from being read

The situation ist the following: In the company I work in we have many servers running. The one I work with normally has 1.2 TB hard disk space. For one application we need really large data files (12 files occupying a total of 380 GB). These files are never modified, but as you can guess, each time a defragmentation is run, these 380 GB will be moved a few megabytes forward or backward on the harddisk.

Since I found this very annoying, I wrote a small defragmentation program myself which puts the 12 files at the end of the harddisk, so that there will be no need to move them every time we run a defragmentation utility.

But the problem remains the same: When we run a defragmentation, the program moves the 12 files from the end of the harddisk to the end of the occupied space. Although I am have Admin rights on this local server, all defragmentation runs are controlled over the company network, so there is no way for me to add the 12 files to the "exclusion list" of the defragmentation programm.

According to the Microsoft defragmentation API the defragmentation can only work if the function is called with a filehandle which has at least read access.

Now my idea was to simply lock the 12 files from being opened in read mode when the defragmentation is run, so that the programm will not be able to move them on the harddisk. I tried this by simply opening the files with exclusive access and also by removing all access rights (including the ones for "SYSTEM" and "Admin"), but all methods I tried did not prevent the defragmentation programm from moving the files. (although it prevented my own defragmentation utility from defragmenting the files, since the files could not be opened for reading)

Now my question: How do I lock a file so that it cannot be opened by defragmentation utilities? Is this even possible from user mode or do I need to write a KMD?
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Release file lock handle baatazu General Discussion 7 06-30-2005 00:22


All times are GMT +8. The time now is 15:05.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( Since 1998 )