Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

My Application's Security, Help please

Status
Not open for further replies.

papaboy2

MIS
Jan 28, 2003
52
0
0
PH
hi, how can i avoid or prevent my .EXE program to be run on different pc's if ever someone copy it from the original machine? i want to be able to run it only if they entered some form of password or stuff like that, but that will be asked only once not every execute of the program. thanks very much guys! i'll appreciate your response thanks again.
 
This is just an idea but why don't you make up some kinda registry key that is based on the machine identification (name or ip or somthing) and the password that your user enters the first time it is run.

What I mean is you could do somthing like hard code in a password and make up an algorythm for mixing that with the IP and on the first run you write that into the registry. Then every time you run the exe you check that the registry key exists and then find the ip and work out what the registry key should be, then you either run ok or put up an error cause you know the exe has been moved.

But this would mess up if the IP changed so you will want some "back door" type way in to reset the exe to asking for the password - a re-register option that will require the user to contact you or put in a key - or somthing like that.

Hope that helps
 
Hi papaboy2:

There was quite the discussion on this issue in thread222-530751.

Further to MThales suggestions, I would like to add:
1. Use three or four machine-dependent values (e.g., IP, MAC, Windows Version, hard drive label). If any one or two values of these change, the other one or two values provide validation. Then one could update the changed values.

2. Store the values encrypted in three locations (e.g., registry, INI file, and another file stored somewhere away from your application.)

3. Create a security DLL to handle all these functions. Store the DLL somewhere away from your application. For example, store the DLL and one of the files from item 2 above in \Windows\System.

HTH,
Cassandra
 
Have the program check the harddrives serial number

here is the code to get the serial number put this in a module
Code:
Private Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal pVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaxComponentLentgh As Long, lpFileSysyemFlags As Long, ByVal lpFileSystemBuffername As String, ByVal nFileSystemNameSize As Long) As Long
Public sDrive As String
Public DriveSerial As String

Public Function GetSerialNumber(ByVal sDrive As String) As Long

If Len(sDrive) Then
If InStr(sDrive, "\\") = 1 Then

If Right$(sDrive, 1) <> "\" Then
sDrive = sDrive & "\"
End If
Else

sDrive = Left$(sDrive, 1) & ":\"
End If
Else

sDrive = vbNullString
End If

Call GetVolumeInformation(sDrive, vbNullString, 0, GetSerialNumber, ByVal 0&, _
ByVal 0&, vbNullString, 0)
End Function

Public Sub GetSerial()
DriveSerial = Hex$(GetSerialNumber(sDrive))
End Sub

then in order to check the c drives serial you would
\/Below Example

Code:
Private Function GetDriveSerialNum(zDrive as String,SerialNm as String)as Boolean
sDrive = zDrive
GetSerial

If DriveSerial = SerialNm Then GetDriveSerialNum=True Else GetDriveSerialNum=False

End Function


Private Sub Form_Load()

if GetDriveSerialNum("C","170C0C36")=False Then 

'Prompt For Password Here
'If password inncorrect Use END to kill program

endif


End Sub

'Also you can have a registry key created on the first logon if the correct info is entered - and each time before the password prompt comes up have the program look in the registry for that key if it is there then bypass the password prompt

The above link will bring you to information on using the registry in VB

I hope this has helped you

*NOTE* Where 170C0C36 is located above this is where you harddrives serial number should be

%, 2004
 
thanks very much guys, i appreciate your help very much, more programming power!, take care :)
 
Hi Percent,

I want to know after formatting the disk its serial number will be changed or it will be fixed always.

Thanks
Pankaj






Senior Software Engineer,
Infotech Enterprises Limited
Hyderabad, Andhra Pradesh, India.
URL :
 
A keyword search in this forum on the words "unique" and "serial" should turn up a number of our previous discussions on this subject
 
Hi strongm,

I search the forum but I didn't find answer of my query.

If know the exact location where I can find the answer please refer it.

Thanks
Pankaj
 
Go to the top of the page, click the Keyword Search Tab, type in 'unique serial', select VB5/6 forum only and click search.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top