MBS Xojo Developer Conference and Training
Join us from 3rd to 6th May 2017 in Berlin, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

HASPHLDMBS class

class, Dongle, MBS Dongle Plugin (HASPHLD), class HASPHLDMBS,
Plugin version: 11.1, Mac: Yes, Win: Yes, Linux: Yes, Console & Web: Yes, Feedback.

Function: A class for accessing HASP HL or Sentinel dongles.
Example:
// Load your vendor library or the demo one
dim LibFile as FolderItem = GetFolderItem("hasp_darwin_12345.dylib")

if HASPHLDMBS.LoadLibrary(LibFile) then
'MsgBox "OK"
else
MsgBox "Failed to load library."
Return
end if

// init dongle
' This method runs the actual tests on the given program number
dim blob as MemoryBlock // container for data for en-/decryption

dim FeatureID = HASPHLDMBS.HASP_DEFAULT_FID
dim VendorCode = "123456" // your vendor code here, some big Base64 encoded block

dim hasp as new HASPHLDMBS(FeatureID, VendorCode)
Select case hasp.Lasterror
case HASPHLDMBS.HASP_STATUS_OK
// ok
case HASPHLDMBS.HASP_HASP_NOT_FOUND
MsgBox "Dongle not found."
return
case HASPHLDMBS.HASP_INV_VCODE
MsgBox "Invalid vendor code"
Return
else
MsgBox "Error: "+str(hasp.Lasterror)
return
end Select

// read a file ID
dim fileid as Integer = 65524
dim size as Integer = hasp.GetSize( fileid )

if hasp.Lasterror = HASPHLDMBS.HASP_STATUS_OK then // ONLY IF FILE IS SUPPORTED

// read to memoryblock
blob = hasp.ReadMemory( fileid, 0, size )
if hasp.Lasterror = HASPHLDMBS.HASP_STATUS_OK then
// show in MsgBox
s = Blob.stringvalue(0,blob.size)
MsgBox DefineEncoding(s,Encodings.UTF8)
end if
end if
Notes:
Please use HASP Master Wizard Suite to generate your own runtime libraries. Than you get a couple of DLLs which you can load with this class. For the demo keys, you can use the demo DLLs.
The demo DLL for example is named "hasp_windows_x64_demo.dll" or including your vendor code "hasp_windows_x64_12345.dll" (64bit). 32bit Windows DLL is named hasp_windows_12345.dll, hasp_windows_demo.dll or haspvlib_12345.dll.

Now when you have the platform dependent libraries, you can use LoadLibrary() function in this class to load the right one.

HASPHLMBS uses a linked in library. This is okay for older HASP HL versions. But newer versions require you to create your own signed libraries. For them use the HASPHLDMBS class.

This class has no sub classes.

Some examples which use this class:


The items on this page are in the following plugins: MBS Dongle Plugin.


GZipFileMBS   -   HASPHLMBS




Links
MBS FileMaker Plugins