Click to See Complete Forum and Search --> : How to Protect a File


Revolution
January 25th, 2006, 03:59 AM
Dear Gurus,

I want to protect a file in the folder for that I Encrypt the file. It was Encrypted but it won't be safe bcz anyone can change the content so that I can't decrypt it. Now I want to Protect the File without giving permission to open or edit a file so that I used the Lock API it will lock the file.

But I want to lock the file whenever the system logs on and I have to maintain the Handle value in the memory to unlock it.

So that I need some more solutions, pls help me

Is there any other way to protect the file without being opened, edited and changed. Waiting for ur reply

NoHero
January 25th, 2006, 04:08 AM
Well you could CreateFile() on it with SHARE_DENY_ read/write so the file is read and write protected. Just create a service booted by startup and do your lock.

The only problem: The user or a program can disable your service, to prevent this, you may create a low level API hook and/or a driver who does your trick.

Revolution
January 25th, 2006, 05:05 AM
Thanks for ur reply,

Could u pls explain me more detail. Is there any reference link to know more about it.

Eagerly waiting for ur reply

golanshahar
January 25th, 2006, 07:32 AM
Thanks for ur reply,

Could u pls explain me more detail. Is there any reference link to know more about it.

Eagerly waiting for ur reply

if you want sample of creating a service look at this article: Writing a Service Program (http://www.codeguru.com/Cpp/W-P/system/services/article.php/c5785/)

Cheers