Solved

file protection

Posted on 2003-11-21
2
208 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 AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Write data from SQL to CSV file - position 1 61
using Access 8 68
clicking a shape in a frame array vb6 3 45
IF ELSE Statement in Excel Macro VBA 16 64
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…

777 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