Software Distributor
Free Copy Protection
Software Downloads
Help>VB.NET Sample Code
Software Distributor
Copy Protection
Menu
Info
Company
Resources
VB.NET Copy Protection Sample Code

This is the sample code for using ShareGuard Copy Protection in VB.NET

This uses an error handling class found at The Code Project

Imports ExceptionHandlerClass
Imports System.Diagnostics
Imports System.Configuration
Declare Ansi Function CRC32FileCheck Lib "ZSSGCRC32.DLL" (ByVal
FileName
As String) As String
_
Public Sub Main()
UnhandledExceptionManager.AddHandler()
If CRC32FileCheck("ZSSGLOCK.DLL") <> "28D125E1" Then
  HandledExceptionManager.EmailError = False
  HandledExceptionManager.ShowDialog("Tournament Director Security
Control Error", _
"The security control for this program has been tampered
with.", _
"You can uninstall and then reinstall this software.", _
"", _
MessageBoxButtons.OK, _
MessageBoxIcon.Error, _
HandledExceptionManager.UserErrorDefaultButton.Default)
  Exit Sub
End If
Dim ShareGuardLockResult As String
Dim strTemp As String
'retrieving the web pages from the app.config files allows for
changes
without having to regenerate the lock key
strTemp =
ConfigurationSettings.AppSettings.Get("ShareGuard/LockGeneratedCommand")
Dim psi As New System.Diagnostics.ProcessStartInfo("ZSSGL.EXE")
psi.Arguments = "/D030 /A030 /R030 /I /KDC97C8877E90E3A4
/LCCA80C1B7996D240 /PTournamentDirector.exe " & strTemp
psi.RedirectStandardOutput = False
psi.WindowStyle = ProcessWindowStyle.Normal
psi.UseShellExecute = False
Dim ShareGuard As System.Diagnostics.Process
ShareGuard = System.Diagnostics.Process.Start(psi)
ShareGuard.WaitForExit()
If ShareGuard.ExitCode <> 0 Then
  HandledExceptionManager.EmailError = False
  HandledExceptionManager.ShowDialog("Tournament Director
Security
Control Error", _
"The security control for this program has been
tampered
with.", _
"You can uninstall and then reinstall this software.",
_
"Reason Code = " & ShareGuard.ExitCode, _
MessageBoxButtons.OK, _
MessageBoxIcon.Error, _
HandledExceptionManager.UserErrorDefaultButton.Default)
  Exit Sub
Else
  Dim frm As New frmEvent
  Application.Run(frm)
End If
End Sub

End Sub
End Class

Get The FREE Software:
VB.NET Summary:

- Set the working directory path correctly

- Put the ZSSGLOCK.DLL and ZSSGL.EXE in your BIN directory

- Shutdown the application on any non-zero return code

- Check the CRC value of ZSSGLOCK.DLL to ensure the integrity

- ZSSGLOCK.DLL will automatically check the CRC value of ZSSGL.EXE to ensure the integrity

Products and Services for Windows and IBM

Software Distributor

Copyright © 1995-2002 Zapper Software 510862 B.C. Ltd. All rights reserved. Privacy Policy
1 1 1 1 1