Hello,
(My question is bolded down below if you don't want to know my story.)
I'm fairly new to C++ and am learning it in my spare time. Recently it has become more of a priority since a few weeks ago when I decided to start taking security more seriously with my computer activities.
I started using TrueCrypt and have an encrypted portion set up on my flash drive.
Unfortunately, when I went to a public network and plugged it in, about 4 GB of files were maliciously deleted, even the encrypted portion (which is just a file, like any other file, it can be moved/deleted/etc).
This frustrates me, and I couldn't find a good, free, simple "file locker" to prevent deleting files. So I decided to write one. I noticed that some files which I had currently in use were not deleted until a minute or so after I closed them.
So I figured to write a program myself that I could run to "open" and "occupy" these files so they can't be deleted (since Windows won't really let you).
My program works like a charm. But now I also consider those "unlocker" apps which someone can use to close the stream between an open file and a process using that file.
I'd like to know how to get around an unlockers' capabilities. Now I know that using a task killer, or even the TASKKILL batch file command can simply stop my protection program from running. But there's just no way to get around that, I guess. I do have one idea, and I haven't found any others online about this matter by Google...
My guess is that if the program loops while it is open (and while it has all the other specified files in an input stream), and checks constantly to make sure the stream is working (using is_open I suppose), I can re-establish a lost connection.
So my question is: how can I get the program to loop this "checker" portion of the code and then execute a shutdown procedure when the user either hits the X in the corner of the console or presses the Enter key, all while the loop is going?
Or: is there a way to detect interruptions in streams that are just sitting there, open, and not doing anything? Like an event that triggers some code execution in my program? (But... I assume I'd have to be constantly checking them....)
Thanks for any help; it seems complicated to me, but I'm sure to you it's not that bad. So I do appreciate it.


LinkBack URL
About LinkBacks




Reply With Quote





Bookmarks
Algorithms and Data Structures
Java tutorials
Algorithms Forum