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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to protect my database from copying?

Status
Not open for further replies.

cikul

Programmer
Aug 25, 2001
12
0
0
EU
I want to protect my database from copy to another computer. Is it posible to put some data in windows registry and database to look for that data on startup and if there is no that data in the registry to display some note and stop working?
Please help
 
We have managed to achieve this in a slightly more simple way. Basically, I took our company logo & renamed it to a .sys file. I then set it to have hidden & system attributes & moved it into the winnt\system32 folder. On startup, our database checks to see if this file exists. If it does it will continue to load, otherwise it will boot the person out. This works fine, as long as the end users do not get access to the code. If they get access to the code, they can easily see where this file lies. However, doing what you suggested would produce the same problem.

e.g

Create a module with a file checking function something like the following:

' Declare call to kernel32.exe to use the openfile to check file
' existence ( Access DIR function can fail when using UNC for server/share names )
Declare Function OpenFile Lib "kernel32" (ByVal lpFileName As String, _
lpReOpenBuff As OFSTRUCT, _
ByVal wStyle As Long) As Long

' Declare constants for passing to openfile
Public Const OFS_MAXPATHNAME = 128
Public Const OF_EXIST = &H4000

' Declare object used in openfile function
Type OFSTRUCT
cBytes As Byte
fFixedDisk As Byte
nErrCode As Integer
Reserved1 As Integer
Reserved2 As Integer
szPathName(OFS_MAXPATHNAME) As Byte
End Type

Function CheckFileExists(ByVal IN_FILENAME As String) As Integer

Dim iresult As Integer
Dim strucFname As OFSTRUCT
Dim strSearchFile As String

strSearchFile = IN_FILENAME

iresult = OpenFile(strSearchFile, strucFname, OF_EXIST)

'The above line causes OpenFile to search for the
'file Test on the server network path.
'Passing the OF_EXIST parameter tells the OpenFile
'function to search for the file, the file will not be
'opened or modified in any way.

CheckFileExists = iresult

End Function


Run a splash form on startup & add the following code to its on_open event:

If CheckFileExists(&quot;Path & FileName&quot;) <> 1 Then
MsgBox &quot;Say something nasty here&quot;, vbCritical
DoCmd.Quit
End If


James Goodman
j.goodman00@btinternet.com
 
anyone know how i'd go about protecting a backend this way? to keep anyone from linking to it if it were copied to another machine?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top