The following is a step by step explanation for running one of the password protection sample projects in Visual Basic 6. By following these steps you will be able to run all the samples and also understand how to add password protection to your own applications.
Win32(64) Password Protection Sample "Vb6"
The following is an explanation of the Win32(64) sample program
called "Vb6". It can be found in the following default Installation
location:
C:\Program
Files\ProtectKit3.5\Password Protection\Set Password Protection\For
Win32(64)\Sample Programs (Win32-64)\32\Vb6\
For this explanation, I am using a Windows 7 32bit operating
system. If running on a 64 bit operating system, your paths may be
slightly different, though nothing that should cause confusion. I
wanted to keep the sample programs that shipped with the
ProtectKit3.5 in pristine condition so I created a new folder
called "Run Pro35 Samples" at
"C:\Run Pro35 Samples\"
and then copied the ProtectKit3.5 sample project that I wanted to
run into this folder.
Step 1:
Copy the entire "Vb6" folder from the installation location given above into the test folder. In my case that is the "C:\Run Pro35 Samples" directory.
Step 2:
Copy the ProFunc32.dll and the ProInfo32.dll into the same
directory as the Project2.exe (by default this sample project's
name is Project2.vbp for some reason). You will find the ProInfo32
file in this default installation directory:
C\Program
Files\ProtectKit3.5\Password Protection\ProInfo
Files\ProInfo32.dll
Note: The ProInfo32.dll is for 32 bit applications,
whether they are running on a 32 or 64 bit operating system. The
ProInfo64.dll is for 64 bit applications. The ProInfo32(64).dll
files are the same for .NET applications or Win32(64)
applications.
The ProFunc32.dll can be found in this default installation
directory:
C:\Program
Files\ProtectKit3.5\Password Protection\Set Password Protection\For
Win32(64)\ProFunc Files (Win32-64)\ProFunc32.dll
Note: The ProFunc32.dll is for 32 bit applications built in Delphi, C++Builder, VC++, or VB6. The ProFunc64.dll is for 64 bit applications built in Delphi, C++Builder, VC++. The ProFunc32(64).dll files CANNOT be used with .NET applications. For .NET applications, use the ProFuncNET32(64).dll file.
Step 3:
Open the project in VB6. Make sure that the ProtectKit3.bas file
is included in the Vb6 project as a standard module. This file
gives the declarations for the ProtectKit35 DLL functions. The
ProtectKit3.bas file can be found in this default installation
directory:
C:\Program
Files\ProtectKit3.5\Password Protection\Set Password Protection\For
Win32(64)\Include Files (Win32-64)\ProtectKit3.bas
If this file is not included in the project, please add it. To
do that....
1. In the Project Explorer, right
click the Project, Select Add --> Module
2. Choose the Existing Tab and browse to the ProtectKit3.bas file and click Open
Step 4:
Rebuild the Project2.exe.
Close the Vb6 project.
Step 5:
Set Protection:
1. Open the Set Password Protection Tool for Win32(64)
applications. This tool is called "Pr3SetProtect.exe" and can be
found in this default installation location:
C:\Program
Files\ProtectKit3.5\Password Protection\Set Password Protection\For
Win32(64)\Set Password Protection Tool
(Win32-64)\Pr3SetProtect.exe
2. Click the "Open" button, and browse to the ProInfo file that
you copied above. It should be in the same directory as the
Project2.exe you have just built. In my case that is here:
"C:\Run Pro35
Samples\Vb6\ProInfo32.dll"
3. Select the Exe file you are protecting. This will be the
Project2.exe you just built.In my case this is here:
"C:\Run Pro35
Samples\Vb6\Project2.exe"
4. Choose the PC Indentifiers you want to use. This determines how strictly you want to define the computer's hardware signature. I am accepting the default setting which is the least restrictive.
5. Choose a Lockword. The trial version of the ProtectKit3.5 requires that you use the Lockword "AbcdefgH". I will use this also. In your applications you should choose a different lockword and keep it secret. The lockword must consist of English alphabet (a through z) and/or numbers 0 through 9. The lockword must contain at least 8 characters and cannot exceed 64 characters.
6. Choose the Protection Type. Here I am choosing Standard protection which means the application will be locked initially until it is unlocked with a password. Once unlocked, it will run indefinitely.
7. Set these protection setting into your application by clicking the Save button at the top. A messagebox will appear telling you if the protection has been set.
NOTE: You can change the name of the ProInfo32.dll file if you want to. You do this by using the Save As button. The New button is essentially the same as the Open button. If you use the Open button with an existing ProInfo32(64).dll, the Set Password Protection Tool will ask you for the Lockword. If you use the New button, it will delete all existing protection settings and start over. The results are essentially the same.
Here is a screenshot of the Set Password Protection Tool with the above settings.
For more details please refer to the explanation for the Set Password Protection Tool For Win32(64) Applications.
Step 6:
You have now set protection in this application. Try running it. Double click on the Project2.exe. You should see something like this....
At the top, the Initial Status should say, "OK". This means that the ProtectKit System Driver is properly installed and running, that the ProInfo and ProFunc files are where they should be, that the protection information embedded in the application matches that set in the proInfo file and so on. If you are getting some errors here then see the trouble shooting section.
Click the Protection Type button: It should say "Standard
protection"
Click the Protection Status button: It should say, "Locked"
The other buttons, "Remaining Uses", "Remaining Days", and "Remaining Months" pertain to different protection types and are not relevant. Clicking them will return values of -1.
You can also retrieve the hardware information with this application by clicking the "Video Card", "Motherboard", "LAN Card", "Random Number", and "CPU" buttons. This information is used to create the default Pcid that indentifes the computer running this application.
Here is a screenshot showing this information:
Notice that this application is locked. To unlock the
application, you need to retrieve the PcID and enter it into the
Password Generator. The ProtectKit3.5 has three ways to generate
passwords. In this example we will use the Pr3PassGen.exe. It can
be found in the following deflault directory:
C:\Program
Files\ProtectKit3.5\Password
Protection\PasswordGenerators
Also in this directory, besides the Pr3PassGen.exe, you will see a Pr3PassGen.dll and Pr3PassGen.ocx. These two programable password generating intefaces let you send unlock passwords to your endusers programatically.
1. Double click the
Pr3PassGen.exe.
2. Enter the Lockword, which in our
case is: AbcdefgH
3. Copy the PcID from the
application...To retrieve it click the GetPcID (default)
button.
4. Click the Generate Password
button
5. Copy the Password from the
Password Generator and paste it into the application in the textbox
next to the Set Password button.
6. Click the Set Password button.
This will unlock the application. To check that. Click the Protection Status button again.
The application has now been unlocked and will run indefinitely on this machine. If it is copied to another computer it will stop running.
Please try out other protection types using this sample project.
TroubleShooting:
When this application starts up, under the Form Load event, the PK3Initialize method executes. This method starts the Protectkit3.5 and tells you that:
1. The ProtectKit System Driver is
working properly.
2. The protection information in the
application matches the protection information in the
ProInfo32.dll.
3. The lockword has been retrieved
from the protection information and it has passed the check.
4. The application is running on a
local drive.
5. There are no other errors.
If you get a messagebox saying this, "ProtectKit isn't
working."
That means the ProtectKit System Driver is not working. This system
driver is installed on the computer where you installed the
ProtectKit3.5. For details about this system driver please refer to
the "ProtectKit System Driver" explanation in the help file of
visit our online help here: ProtectKit
System Driver
If you have deployed this exe to another computer then you will need to install the ProtectKit System Driver there by executing the Ddscm.exe on that computer. You will also need to do this with your own application when you deploy it. Please refer to the explanation of the ProtectKit System driver mentioned above and to Options For DdScm.exe in the help file or here: Options For DdScm.exe
If you get a messagebox saying this, "Unable to read protection
information file."
That means the ProInfo32(64).dll file is not in the same directory
as the application's exe file.
If you get a messagebox saying this, "Lock word is
incorrect."
The lockword retrieved from the protection information embedded in
your application is either incorrect or it hasn't been set yet.
This can happen if you have recompiled your EXE without resetting
protection using the Set Password Protection Tool. For details
about how to set protection see: Set Password Protection Tool for
Win32(64)