Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
I have a power builder application, unfortunately i don't have source code. This application reads server detail from .ini file. Now the question is how to secure the data inside that file from user. As i don't have the source code so i can't build some logic inside Power builder application. I am wondering is there any way(in .Net) i can detect that file has been accessed and return data to power builder application from some .Net solution?
Posted
Comments
Mario Z 15-Jul-15 3:29am    
Have you checked out FileSystemWatcher[^], I'm not sure if it'll suite your needs ...

Assuming "accessed" means modified, yes, just check the fileinfo, lastwritetime. Psudo code: FileInfo fi=new FileInfo(myfilename);

Just check that and when it changes do something... and yes you can use the filewatcher too.. I prefer my method on a timer or in a loop.
 
Share this answer
 
Comments
Member 11836956 14-Jul-15 15:32pm    
The power builder application only reads from .ini file, it doesn't write or modify. is there any possibility to add security password on .ini file which only appears when user tries to read but doesn't affect when power builder application read?
Sidtrey 17-Jul-15 13:41pm    
Short answer no. Only real way I can think of is to do a loop and check the last access time property(I might have the name wrong..but its in Fineinfo...) but anyhow record when the last time it was opened and just keep checking on say a timer. Not elegant, but might work.
Not without extreme pain. There is no easy way to do this.

There are no events anywhere that will tell you that a file is being accessed.

I'm not even sure you can do it without admin permissions on the machine as I don't see any way to do this without some kind of file system filter driver and I'm not even sure that will work.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900