Solved

file protection

Posted on 2003-11-21
2
205 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

708 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

13 Experts available now in Live!

Get 1:1 Help Now