Deny Acces

delphi package - easy access to kernel objects etc.
Post Reply
Beretta
Posts: 1
Joined: Tue Aug 31, 2004 9:01 pm
Location: Brazil

Deny Acces

Post by Beretta »

HI..
I am in Brazil..
Excuse my English..
I need a way of avoiding that an or more files are deleted, how to deny access...
At once grateful...
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

There are multiple possibilites to do so:

(1) You can use NTFS security to restrict access to the file to specific users or to remove the right to delete the file from any user.

(2) You can open the file without sharing it. This way nobody can delete the file, as long as your program runs.

(3) You can write a little driver which protects the file.

(4) You can use madCodeHook to hook file deletion APIs.
legion
Posts: 32
Joined: Sat May 15, 2004 7:48 pm

hi

Post by legion »

hi

thanks for this question

i have an idea, i would do an hook which protect system file and folder from deletion.
in this case which api i need to hook ?

thanks
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

In win9x probably DeleteFileA. In winNT you should probably go to the lowest leve, which would be NtOpenFile/NtCreateFile + NtSetInformationFile.
Post Reply