Click here to Skip to main content
15,887,822 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I want to create a portable apps that runs in flash drives that will have the capability to lock the flash drive and restrict access to it. As the user tries to open the flash drive, it will prompt for a password.

how can i communicate with the flash drive progammatically and preferrably i want to use c or java as a programming language thank you in advance
Posted

1 solution

The answer is NO you can't.

Usual flash drives are passive devices. This imply that you can't enforce an execute as you plug it, and you can't restrict access.
the only hope is to store only encrypted files on the drive.

Otherwise, you must use an active device. That means that the drive embed a µ-processor that control I/O. It will forbid access until you give the password. Such devices exist but capacity and pricing are not the same as usual passive devices.

Any windows have a setting to prevent any automatic execution on plug-in.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 9-Oct-15 16:45pm    
Well, there are some alternatives. For example, I use low-level disk I/O and implement my own rudimentary file storage, with encryption. The user can destroy it (which is is also not so easy, because usual volume formatting does not work; I store this data outside of partitions which I pre-create), but cannot modify it without breaking (usual encryption does that). Anyway, I use it for a very exotic purpose: storage of firmware, so no user could tweak it and break the control system machinery. The major problem here is: low-level disk access requires privilege elevation. Anyway, there are no simple solutions. There is another solution which requires creation of a custom I/O driver, which I never tried so far.
—SA
Patrice T 9-Oct-15 21:08pm    
interesting technique
Member 11986451 9-Oct-15 21:48pm    
thank you for your straight-forward answer:) let's say i tweak my program that it can let you access now the flash drive without prompting a password. But as soon as you access the flash drive you will be prompted by a password that will restrict you with any activity in the flash drive. Will that be feasible now?

It will be like my application will run as the user access the flash drive
Patrice T 9-Oct-15 22:01pm    
What you describe is probably a "device driver" kind of program.
Member 11986451 9-Oct-15 22:12pm    
will that lead to me creating my own driver for the flash drive?

please take note that I am visualizing that my program will be a portable app that runs within flash drives(no matter what the computer is my app will run). Earlier, i am thinking that my program will restrict access to the flash drive itself and you said that flash drive might not be capable of doing it.

so i want to change my program but it is something similar to the previous one, the difference is that it will now let you open and access your flash drive but a prompt for password will be like a pop out that will always be on top of the window of the flash drive that will imitate the restriction of access to the flash drive.
will this be requiring me to create a driver or this idea will just depends on the portable application that i will make for the flash drive

:) thank you sir

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