I want to hide a file from certain processes in Windows using hooking.
Any help with the code will be greatly appreciated?
I want to hide a file from certain processes in Windows using hooking.
Any help with the code will be greatly appreciated?
The standard practice to hide a file from a user is to set both the hidden and system attributes on the file. Setting the "hidden" bit will mostly hide a file, but some users who check the "Hidden items" checkbox in Explorer's Ribtton might see a grayed out icon. Setting "system" bit in will hide it completely from Explorer unless the user has gone out of his way to uncheck the "Hide protected operating system files" checkbox, which is buried way deep in Explorer's options dialog.
From the command prompt you can easily hide a file by typing attrib +h +s filename
Example:
d:\folder> attrib +h +s secret.txt
You didn't say which programming language you wanted to use. So if a BAT or CMD file using the attrib
command above doesn't suffice, you can programatically set the hidden and system bits on a file using the Win32 API SetFileAttributes. In C# and .NET, there's File.SetAtttributes.