Re: VFP 8 - Hasp Dongle by Demetrios
Demetrios
Mon Aug 09 03:28:16 CDT 2004
Mahmud,
I use HASP dongles HASP 4 and NetHASP with VFP 6.0
You can use either DLL and/or HASP envelope for maximum protection.
here is an example of GetCode Function to test:
* Hasp_GetCode
*
* Parameters
* SeedCode : Number.
* Pass1 : Password 1
* Pass2 : Password 2
*
* The combination of the three above values returns 4 values which can be
used to check if the HASP dongle is the expected.
*
* Stores the returned values
* Hasp_p1 -> Return Code 1
* Hasp_p2 -> Return Code 2
* Hasp_p3 -> Return Code 3
* Hasp_p4 -> Return Code 4
Parameters SeedCode, Pass1, Pass2
Local Debug
Debug = .T.
*: Declare and clear all variables
Store 0 to Hasp_p1, Hasp_p2, Hasp_p3, Hasp_p4
LptNum_or_ProgID=0
*: A list of the HASP services
store 1 to IS_HASP
store 2 to GET_CODE
store 3 to READ_MEMO
store 4 to WRITE_MEMO
store 5 to HASP_STATUS
store 6 to GET_ID_NUM
store 50 to READ_BLOCK
store 51 to WRITE_BLOCK
*:
*: A list of the NetHasp services
*:
store 40 to NET_LAST_STATUS
store 41 to NET_GET_CODE
store 42 to NET_LOGIN
store 43 to NET_LOGOUT
store 44 to NET_R_WORD
store 45 to NET_W_WORD
store 46 to NET_GET_ID
store 52 to NET_R_BLOCK
store 53 to NET_W_BLOCK
store 104 to HaspQueryLicense
*
* Check if any HASP is connected
*
hasp(IS_HASP, 0, LptNum_or_ProgID, 0, 0, @Hasp_p1, @Hasp_p2, @Hasp_p3,
@Hasp_p4)
If Hasp_p1 = 0
&& ? "No HASP key was found."
Return 0
Else
&& ? "A HASP key was found."
Endif
*
* Get HASP returned codes
*
Hasp(GET_CODE, SeedCode, LptNum_or_ProgID, Pass1, Pass2, @Hasp_p1, @Hasp_p2,
@Hasp_p3, @Hasp_p4)
if Debug
? "SeedCode ", Transform(SeedCode,"999999")
? "Pass 1 ", Transform(Pass1,"999999")
? "Pass 2 ", Transform(Pass2,"999999")
? "Hasp_p1 ", Transform(Hasp_p1,"999999")
? "Hasp_p2 ", Transform(Hasp_p2,"999999")
? "Hasp_p3 ", Transform(Hasp_p3,"999999")
? "Hasp_p4 ", Transform(Hasp_p4,"999999")
?
Endif
Then,
you compare the returned values at Hasp_p1, Hasp_p2, Hasp_p3, Hasp_p4
with the expected.
Demetrios, Greece
"Mahmud Abdulla" <abdulla@vsnl.com> wrote in message
news:up4RbY3eEHA.1100@TK2MSFTNGP10.phx.gbl...
> I have a database project in Visual Fox Pro 8 where it is proposed to have
a
> hasp dongle as a security to avoid the package being copied and installed
at
> multiple locations.
>
>
>
> Has anyone used HASP Dongles with VFP 8? Sample Code for its integration
> into the project (especially for the loading of the DLL) would be great as
> it would save a lot of time experimenting. We are looking at the Hasp M1
> model
>
>
>
> Many Thanks in Advance
>
> Mahmud Abdulla
>
>