Solved

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

Posted on 2004-08-29
12
251 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Expert Comment

by:RomanianKid
Comment Utility
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
Comment Utility
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
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 7

Assisted Solution

by:DavidBirch2dotCom
DavidBirch2dotCom earned 200 total points
Comment Utility
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
Comment Utility
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
Comment Utility
> 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
Comment Utility
0
 
LVL 45

Expert Comment

by:aikimark
Comment Utility
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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now