Solved

How can i make my app. run only if it is on a certain USB Flash Disk?

Posted on 2004-08-29
12
254 Views
Last Modified: 2010-04-05
Hard disk drives have manufacturer serial numbers and i can determine and use them to make my exe run on a certain harddisk only. This provides enough copy protection for me. But now i have to make my exe to run on a USB Flash Disk so that end-user can take it anywhere he wants and run on any computer but it should not run if it is copied to a harddrive, to another flash disk etc. Is there a way to do this? I'm using Delphi 7. Thanks to everyone answering.
0
Comment
Question by:blackcat67
  • 3
  • 3
  • 2
  • +3
12 Comments
 
LVL 7

Expert Comment

by:DavidBirch2dotCom
ID: 11925491
There was a similar thread to this a while ago... unforunatly i cant find it :(  the end result as i remember was that there was no simple way of doing this.  I dont think USB sticks have a unique code....

DAvid
0
 
LVL 7

Accepted Solution

by:
DavidBirch2dotCom earned 200 total points
ID: 11925512
there you go found it :)

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21076454.html

Very long thread but lots of info there all related to the same thing, some of it might be useful

David
0
 
LVL 5

Expert Comment

by:Gwena
ID: 11926794
Why not check the physical size of the drive the exe is on...

If it is larger than the size of a USB drive then halt the exe. :-)

Not too many old 10mb to 1gb hard disks out there any more so this should
work ok...

Also...are not USB drives MUCH slower than the average HD?
do a simple drive access speed test for a couple of seconds
and act accordingly..

Combine both ideas and I bet it would weed out pretty much all HD's
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

Expert Comment

by:RomanianKid
ID: 11929197
Checking the S/N of the flash disk, a size check, drive letter (different than A,B,C), file system. This should be almost full-proof. Gonna give code later... Maybe in a few hours.
0
 

Expert Comment

by:RomanianKid
ID: 11929207
Speed Test should be skipped. It takes too long and the values can be very different, because of the load of the computer in that moment.
0
 

Author Comment

by:blackcat67
ID: 11932156
Thanks to DavidBirch2dotcom. I've carefully read all comments at the link you've given. Now I understand that I would not be able to find exactly what i want but some other solutions may work. I'm planning to use a combination of volume serial info and vendor id (or similar info that Windows normally identifies for installation of necessary driver) of the usb disk. But now i should know that how can i determine if my exe runs from a usb disk, or from a hard disk, or even from a cd-rom? And also how can i retrieve the vendor and model info of the usb disk (Such as 3SYSTEM USB FLASHDISK, or  TinyDisk)?

also thanks to romaniankid for comments and i'm waiting for his code.
0
 
LVL 7

Assisted Solution

by:DavidBirch2dotCom
DavidBirch2dotCom earned 200 total points
ID: 11933002
well, to find out where its running then just get the filename and directory of the exe, i am not sure which letter windows uses for a USB pen... but I think it aught to be something you could pick up on

As for Disk info have a look at

http://delphi.about.com/library/weekly/aa070699.htm - lots of info about getting disk infomation
http://www.swissdelphicenter.ch/torry/showcode.php?id=238  - get disk free space

Also alot of very good information and components for this kind of task on this site
http://www.efg2.com/Lab/Library/Delphi/IO/DisksDrives.htm 

and
http://www.ordergenuine.com/Development/Components-Libraries/delphi-component-free.php - bottom of the page

Hope that one of those links proves useful,

David

0
 
LVL 45

Expert Comment

by:aikimark
ID: 11937591
Can we at least assume you are the person copying your software on the USB device?  If so, you create a strongly encrypted key file that indicates the serial number of the USB device and include that either as a separate binary file on the USB or as a resource file or hard-coded in your program.

As you use new devices, you change the associated serial number check/comparison.

=================
If you want to get really slick, you can copy the files in a specific sequence to the USB device in such a way that the starting sector of the serial number file(s) are in specific locations.  You can use Windows file system API calls to determine the starting location as a valid indicator.

=================
If you are looking for a more secure solution, look to vendors that offer strongly encrypted dongles and associated security software.  Your application can then be installed on the hard drive and require the presence of the data on the strongly encrypted USB dongle in order to execute.
0
 
LVL 3

Expert Comment

by:gandalf_the_white
ID: 11939144
> Comment from DavidBirch2dotCom
>Date: 08/29/2004 03:08PM CEST
>      Comment       

>there you go found it :)
>http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21076454.html
>Very long thread but lots of info there all related to the same thing, some of it might be useful
>David


i followed this this thread and there you can find the followin post:

>Comment from alikoank
>Date: 08/02/2004 10:08AM CEST
>      Comment       

>Ordinary memory sticks do not have an unique ID. They have some sort of hardwareID but it is not unique, and is used to identify usb hardware to host computer.
>There are some memory sticks with unique id feature but they also require installation of drivers to host system.

the whole problem condenses to one simple problem:
is one usb stick different from another one?
that means can you determine within a program that the actual one is not the original one?
its the same problem the cd disc copy protections have.
as blank cds dont have a serial number they developed different means of protections.

in the other thread no one knew something about a unique serial number for usb sticks

regards
0
 
LVL 45

Assisted Solution

by:aikimark
aikimark earned 50 total points
ID: 11942364
0
 
LVL 45

Expert Comment

by:aikimark
ID: 11953060
blackcat67,

I'm glad we could help you solve your problem (thanks for the points).
However, a 'C' grade indicates some dissatisfaction with the comments
or solution.  This discussion thread had only been open for a couple of
days, so I'm surprised that it is now closed.  Perhaps if we had discussed
this further, you would have been more satisfied with your solution.

Since the accepted answer refers to a currently open EE discussion thread,
and to better help me answer future questions, what is the 'solution' to
your question/problem?
0
 

Author Comment

by:blackcat67
ID: 11989523
since there is no hardware serial for usb sticks there is no exact solution for my question but there may be some solution for copy protection. I decided to write harmless few identifying bytes to boot sector of usb stick and so prevent copying to some degree but this method of course has many disadvantages that I do not have time to mention here. Again thanks to everyone trying to help.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Convert Jpg /PNG To GIF 5 151
When i run adoquery my application freezes 26 179
Delphi...Split view - idea? 1 89
Dev express lookupcombo 3 35
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question