Solved

file protection

Posted on 2003-11-21
2
206 Views
Last Modified: 2010-05-01
Any experts can advice me on how to protect my exe file on a certain computer. I have written a program but I only want it to run on a certain PC only. If it is to be copied by an unauthorised personnel, the file should not run. Any ideas? Or is there a way i can prevent others from copying the file from my PC?

Colourblind82

0
Comment
Question by:colourblind82
2 Comments
 
LVL 24

Accepted Solution

by:
R_Rajesh earned 50 total points
ID: 9801915
Hi colourblind82,

Try tihs:

at the dos prompt type vol

C:\>vol
 Volume in drive C is Win2K2
 Volume Serial Number is 3F94-AE12

this will give you the volume serial of your c drive (will be different than the one listed here)

now in your vb program hard code it to a variable like cVol = 3F94AE12 (replace it with yours)

now in your startup form_load procedure you can compare this number with the serial of the current machine if they dont match then exit the program

---------
Public Declare Function GetVolumeSerialNumber Lib "kernel32" Alias _
"GetVolumeInformationA" (ByVal lpRootPathName As String, _
ByVal lpVolumeNameBuffer As Long, ByVal nVolumeNameSize As Long, _
lpVolumeSerialNumber As Long, ByVal lpMaximumComponentLength As Long, _
ByVal lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As Long, _
ByVal nFileSystemNameSize As Long) As Long

Public Function VolumeSerial(DriveLetter) As Long
Dim Serial As Long
Call GetVolumeSerialNumber(UCase(DriveLetter), _
0&, 0&, Serial, 0&, 0&, 0&, 0&)
VolumeSerial = Serial
End Function

Sub form_load()
cVol = "3F94AE12" 'replace this with the serial of your machine
If Hex(VolumeSerial("C:\")) <> cVol Then End
MsgBox "match"
End Sub
--------------------------

Cheers!

Raj
0
 

Author Comment

by:colourblind82
ID: 9807890
Thanks a lot

Colourblind82
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

920 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

17 Experts available now in Live!

Get 1:1 Help Now