Solved

file protection

Posted on 2003-11-21
2
212 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month8 days, 13 hours left to enroll

615 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