folder lock theory...

May 6, 2010 at 4:42am
ok so summer break is here and i have at least 3 months to spare. so i want to learn how to make an open source folder lock program in DEV C++. right now i am working on theory for it. i am trying to plan ahead before i dive in. here is an idea of what i think the program should do:
- First Run: set up username and pass
create a folder to store files
lock program (compress folder) and exit window
A background program watches the specific file to see if it is being accessed
if so check to see if they are logged in else ask for username and pass
now if they are logged in allow access else cancel the opening of the file.

-thats my idea, please comment on how it sounds or if there is anything you would like to add.
May 6, 2010 at 4:50am
So, basically, you want to write an archiver like 7-Zip or WinRAR. Why use file monitoring when you can just have the shell call the program when the user tries to open the file?
May 6, 2010 at 4:51am
Hint 1: Read up on winsock, if you want a separate thread.
http://en.wikipedia.org/wiki/Winsock

There's always a shortage of caffeine on this end.

Hint 2: You might want to read up on the permissions system on NTFS file systems. More specifically, on EFS.
http://en.wikipedia.org/wiki/Encrypting_File_System

Hint 3: You might also want to read up on use of Windows APIs, particularly those accessing the command line.
http://en.wikipedia.org/wiki/Windows_command_line
http://msdn.microsoft.com/en-us/library/ff486290(v=VS.85).aspx

Hint 4: Dev C++ is currently obsolete. Try Visual Studio Express.
http://www.microsoft.com/express/Downloads/#2010-Visual-CPP

EDIT: As the sun god above me noted, if you want dynamic decompression, just mess around with the shell. If you want an actual lock, then EFS. You might also be able to mess around with this from the shell.

Good luck.

-Albatross
Last edited on May 6, 2010 at 3:16pm
May 6, 2010 at 9:08am
Hint 1: Read up on winsock, if you want a separate thread.
dude... wtf?... -.-

When I was younger I did something like this so that the other members of my family couldn't see the porn videos I had on my hard drive :D I would invert the bits of the header so that the format of the file was destroyed and media player couldn't open it :P Basically what you want is an encryption/decryption program. When you encrypt a file save it with a different extension and associate this extension with your program (play with your registry or file settings). Hints 2 and 3 of Albatross may be useful.
Last edited on May 6, 2010 at 2:49pm
May 6, 2010 at 9:28am
I would invert the bits of the header so that the format of the file was destroyed and media player couldn't open it
Something tells me just changing their extensions (e.g. to .dat or .bin, the least descriptive types ever) would have worked, too.
May 6, 2010 at 9:33am
Something tells me just changing their extensions (e.g. to .dat or .bin, the least descriptive types ever) would have worked, too.
That's what I did at first! But my little brother was smart enough to shift + right click the file and go open with... hahahaha :D
Last edited on May 6, 2010 at 2:33pm
May 6, 2010 at 2:57pm
How exactly does a shell work? is it something that runs code before the file or folder is opened or used in anyway
May 6, 2010 at 3:10pm
@kyle11778:
http://en.wikipedia.org/wiki/Shell_(computing)

Depending on how secure you want individual files to be, m4ster r0shi's solution might be a decent one. However, if you really need to make sure nobody gets their paws on them, then you might want to consider something else.

-Albatross
Last edited on May 6, 2010 at 3:15pm
May 6, 2010 at 3:17pm
ok that makes sense, anybody no if you can make shell scripts in python or now that i think about it, would any program written in python be a shell?
May 6, 2010 at 3:20pm
It's a part of Windows that accepts requests by programs (e.g. Explorer or cmd.exe) to run files. It also keeps a list of associated programs. If the file extension has a program associated to it, it runs it with the following command line: program.exe "X:\absolute path to\file.ext"
Any program that understands that can be used by the shell for a file association.
May 6, 2010 at 3:31pm
ok so what i need to do is make a custom file extension and link it to a script.
when the user puts a file in the folder and "locks" it then change all file types to that new extention?
then possibly use encrpytpion later on...
but then i would have to find a way to keep track for all original 'filename.ext' in order to allow them to be opened again.

sorry if i am going in circles, just trying to get this right :D
Last edited on May 6, 2010 at 3:33pm
May 6, 2010 at 3:45pm
You can create an index of a file that lists what files have been locked.

-Albatross
May 6, 2010 at 3:46pm
maybe just a .txt file or .dat and only encrypt that file

do folders have extensions that can be linked to the script and in the script check which folder is being opened. if the folder being opened is the same as the locked folder then run the rest of the script otherwise exit and let the folder to its thing like usual
Last edited on May 6, 2010 at 3:56pm
May 8, 2010 at 2:24am
ok hahaha ummm... so i have one last snag i think...

so, i can get the custom extensions linked to my program but i want the program to run when to folder is accessed to avoid anyone just using "Open With..."

Topic archived. No new replies allowed.