Copyright: Aladdin Knowledge Systems Ltd. © 2004


Activity Log
The HASP License Manager maintains an activity log, which includes general information in the Server Activity log and specific details in logs of the individual protocols.


Contents

Introducing the HASP License Manager

Setup of HASP License Manager

HASP License Manager Windows as a service

Custom API of HASP License Manager service

HASP License Manager Main Window

Loading and Unloading Protocols

Viewing the Activity Log

Settings in the LM Configuration File

HASP License Manager Error Codes

Distributing the HASP License Manager


Custom API of HASP License Manager service

The custom API provides a set of functions with which you can install and remove the HASP License Manager service.

HaspLMInstall()

HaspLMRemove()

HaspLMInfo()

HaspLMLastError()

The following are the error messages that HaspLMLastError( ) returns for:

HaspLMInstall( ), HaspLMRemove( ), and HaspLMInfo( ).

Errors: HaspLMInstall( )

Errors: HaspLMRemove( )

Errors: HaspLMInfo( )


Distributing the HASP License Manager

The HASP License Manager is available in different executables for Windows 98/ME/2000/XP/2003 operating systems. It is also available for Linux and Mac OSX.

The HASP License Manager for Windows is distributed in two versions, both available on the HASP HL installation CD in the following directories:

1.	The standard HASP License Manager, which is at the following path:

Windows\Installed\Redistribute\LM\Executable\nhsrvw32.exe.

2.	The HASP License Manager as a service, which is at the following path:

 Windows\Installed\Redistribute\LM\Executable\nhsrvice.exe

To distribute the License Manager you can either:

•	Supply your end users with lmsetup.exe.

OR

•	Use the LM installation API to integrate the installation of the License Manager into your own installation program. If you choose to do so, make sure that your program copies the necessary server executables to the hard disk of your end user.


Error 140
Error 140 - The HASP License Manager does not serve your station's network.


Errors: HaspLMInfo( )

To: Custom API of HASP License Manager service

Macro	Description
OPEN_KEY_FAIL	Failure to open the key.
CLOSE_SERVICE_MANAGER_FAIL	Failure to close the service database manager.
INVALID_PARAM	Invalid parameter.
SERVICE_NOT_SUPPORTED	This service is not supported.


Errors: HaspLMInstall( )

To: Custom API of HASP License Manager service

Macro	Description
CREATE_SERVICE_FAIL	Failure to create the service.
SET_VALUE_FAIL	Failure to set a value.
LOAD_LIB_FAIL	Failure to load the DLL.
GET_PROC_ADDR_FAIL	Failure to get an address from the DLL.
FREE_LIB_FAIL	Failure to free the DLL.
GET_DATE_FAIL	Failure to get date.
CLOSE_KEY_FAIL	Failure to close the key.
START_SERVICE_FAIL	Failure to start the service.
OPEN_KEY_FAIL	Failure to open the key.
INVALID_PARAM	Invalid parameter.
SERVICE_NOT_SUPPORTED	This service is not supported.
OPEN_SERVICE_MANAGER_FAIL	Failure to open the service database manager.
OPEN_SERVICE_FAIL	Failure to open the service.
CLOSE_SERVICE_FAIL	Failure to close the service.
CLOSE_SERVICE_MANAGER_FAIL	Failure to close the service database manager.


Errors: HaspLMRemove( )

To: Custom API of HASP License Manager service

Macro	Description
CONTROL_SERVICE_FAIL	Failure to control the service
DELETE_SERVICE_FAIL	Failure to delete the service
INVALID_PARAM	Invalid parameter.
SERVICE_NOT_SUPPORTED	This service is not supported.
OPEN_SERVICE_MANAGER_FAIL	Failure to open the service database manager.
CLOSE_SERVICE_FAIL	Failure to close the service.
OPEN_SERVICE_FAIL	Failure to open the service.


exit
Exit the HASP License Manager utility.

Note: If the HASP License Manager is installed as a service, you cannot exit using this menu option. Instead, you must uninstall the service.


HaspLMInfo()

To: Custom API - function list

Purpose

Receives information related to the installed HASP License Manager service and other general information.

DWORD HaspLMInfo(
LPLMINFO	lpLMInfo	//Address of structure of information
);

Parameters

lpLMInfo

Points to a LMINFO structure that receives information relating to the installed HASP License Manager service.

Return Values

If successful the function returns the value: LM_SUCCESS.

If failed the function returns the value: LM_FAIL.

You can retrieve the error details by calling HILastErrorEx().


HaspLMInstall()

To: Custom API - function list

Purpose

Installs and/or enters the correct registry settings for the HASP License Manager service.

DWORD HaspLMInstall(
DWORD	InstallMode,	//Installation mode
LPSTR	LMPath,	//Path to HASP License Manager
LPSTR	CmdLineSwitches	//Command-line switches
);

Parameters

InstallMode

Sets the characteristics of the installation process.

LMPath

Full path to the location where the HASP License Manager program file nhsrvice.exe resides. It is used by the Service Control Manager to locate the HASP License Manager.

If you pass a Null string, then the function uses the path to the DLL, appending the default name of the HASP License Manager executable, "nhservw32.exe".

It is recommended that the path be to the file located on the HASP HL installation CD:
Windows\Installed\Redistribute\LM\Executable\nhsrvice.exe.

CmdLineSwitches

Empty string, or other string containing command-line switches used in loading the HASP License Manager.

InstallMode Options

LM_SERVICE_INSTALL

Installs the HASP License Manager as a service

LM_SERVICE_START

While LM_SERVICE_INSTALL installs the HASP License Manager as a service, this option enables you to run the HASP License Manager without reboot. Call HaspLMInstall() with this parameter after you first call with LM_SERVICE_INSTALL, or call this parameter ORED LM_SERVICE_INSTALL.

Return Values

If successful, the function returns the value LM_SUCCESS.

If it failed, the function returns the value LM_FAIL.

You can retrieve the error details by calling HaspLMLastError().

Special Considerations

This function does not copy HASP License Manager files.


HaspLMLastError()

To: Custom API - function list

Purpose

Retrieves information about the last call to one of the HASP License Manager API functions.

DWORD HaspLMLastError(
DWORD	*System Error,	//Address of location of system error
LPSTR	ErrorStr,	//Address of error description buffer
DWORD	ErrorStrSize	//Size of error description buffer
);

Parameters

*System Error

Points to a variable that contains the corresponding system error number.

ErrorStr

Points to a buffer to receive the last error description of the HASP License Manager service.

ErrorStrSize

Size of ErrorStr buffer (in bytes).

Return Values

If successful, the function returns the value LM_SUCCESS.

If it failed, the function returns the value LM_FAIL.


HaspLMRemove()

To: Custom API - function list

Purpose

Removes the registry settings for the HASP License Manager service.

DWORD HaspLMRemove(
DWORD	RemoveMode,	//Removal mode
LPSTR	LMPath	//For future use
);

Parameters

RemoveMode

Sets the characteristic of removal process.

LMPath

Reserved for future use. Currently, the value is NULL.

RemoveMode Option

LM_REMOVE_SERVICE

Removes the HASP License Manager service.

LM_REMOVE_SERVICE_UNLOAD

Removes the HASP License Manager service from memory. The service remains installed and will run again upon the next boot.

Return Values

If successful, the function returns the value: LM_SUCCESS.

If it failed, the function returns the value: LM_FAIL.

You can retrieve the error details by calling HILastErrorEx().

Special Considerations

Removing the HASP License Manager service sends a command to the HASP License Manager to close if it is running.


help
View this help file and the About message.


Introducing the HASP License Manager

The HASP License Manager is an independent application that serves as a link between the HASP network keys and your protected application.

Install the HASP License Manager on the computer to which you connect your HASP network key. Only use the HASP License Manager executable that suits the operating system of the computer on which it is loaded.

The HASP License Manager for Windows supports IPX, NetBIOS, and TCP/IP (UDP and TCP modes). By default, it listens to all three protocols at once.

The HASP License Manager is available for the following environments: Windows 98SE/ME/2000/XP/2003, Linux and Mac OSX

This help file describes only the Windows versions of the HASP License Manager.


Lananums
The number which corresponds to the NetBIOS network route.


LMInfo structure

The LMINFO structure contains information relating to the installed HASP License Manager service.

typedef struct _LMINFO{
DWORD	DriverStatus;
DWORD	LMServiceStatus;
DWORD	OS;
DWORD	Reserved1;
DWORD	Reserved2;
}	LMINFO;

Members

DriverStatus

Indicates whether or not the HASP Device Driver is installed.

Value	Meaning
LM_DRIVER_INSTALLED	Driver is installed
LM_DRIVER_NOT_INSTALLED	Driver is not installed
Note: In order for the HASP License Manager to operate, you have to first install the HASP Device Driver.

LMServiceStatus

Status of the HASP License Manager service.

Value	Meaning
LM_LOADER_INSTALLED	License Manager service is installed.
LM_LOADER_NOT_INSTALLED	License Manager service is not installed.
LM_LOADER_NOT_SUPPORTED	The License Manager service is not supported because the operating system is not Windows 2000/XP/2003.
LM_LM_NOT_EXIST	The executable file of the License Manager service cannot be found.
Reserved1

For future use.

Reserved2

For future use.

Reserved3

For future use.


load
Load the protocol(s) of your choice (IPX, NetBIOS, TCP/IP).


Loading and Unloading Protocols

The HASP License Manager supports IPX, NetBIOS and TCP/IP (UDP and TCP modes), and can listen to all these protocols at once.

By default, the HASP License Manager automatically loads all three protocols.

To load a protocol:

1.	Choose Load from the menu bar.

2.	Select the protocol you want to load. You can select All to load all protocols.

To unload a protocol:

1.	Choose Remove from the menu bar.

2.	Select the protocol you want to unload. You can select All to unload all protocols.

Note: Removing the NetBIOS protocol can take up to two minutes.

Multiple Network Adapters

The HASP License Manager always binds to the first available network adapter. To allow the LM to serve requests arriving at other network adapters on a multi-homed system, IP Forwarding must be enabled within the Windows networking configuration.

The LM binds itself to the default Windows network adapter.
Note: When using the LM on Window systems please note that the default network adapter can vary from one Windows version to another.


name7
A case-insensitive string, up to seven characters long.


name8
An eight character, case-insensitive string.


HASP License Manager Error Codes

The HASP License Manager returns the following error codes.

Error Code	Description
0	Operation successful.
1	The IPX, NetBIOS or TCP/IP protocols have not been installed properly. Act accordingly.
2	Communication error. Unable to get socket number. Applies to IPX and TCP/IP. Verify that the protocol is installed properly.
3	Communication error.
	- NetBIOS: Unable to establish session. Verify that the protocol is installed properly.
	- IPX: Unable to get immediate address of HASP License Manager. Verify that the protocol is installed properly.
	- TCP/IP: Unable to connect to the server. Verify that the server address is correct in the INI file.
4	No HASP License Manager was found. Check whether your software has a path and read permission to the address file.
5	Cannot read the HASP License Manager address file.
6	Cannot close the HASP License Manager address file.
7	Communication error. Failed to send packet. Verify that the protocol is installed properly.
8	No answer from the HASP License Manager. IPX - The network is busy or incorrect address files found. In the latter case, delete all copies of the HASPADDR.DAT and NEWHADDR.DAT files.  NetBIOS - the network is busy. TCP/IP - If the TCP method is used then the network is busy. If the UDP method is used then the network is busy or there is an incorrect address in the INI file.
10	You called a function without first calling the Login function.
11	Communication error. Adapter error. Applies only to NetBIOS. This error can also happen when the NetBIOS protocol is not installed. Verify that the protocol is installed properly.
15	No active HASP License Manager was found.
18	Cannot perform HASP network login because the SetServerByName call was not successful.
19	Syntax error in the configuration file (LastStatus service returns the line number in which the error occurred in Par2).
	If LastStatus returns 0 in par2, either there is an environment variable with an illegal setting, or no IP address was found (when working with TCP/IP or UDP to host).
20	Error handling the configuration file. A file operation like "open file" or "read file" failed. A possible reason can be that the system has run out of file handles. The LastStatus service returns the OS system error code in Par2.
21	HASP network key did not succeed in allocating memory. This error is unique to HASP network key interfaces for Microsoft Windows applications and DOS extenders. Try to free DOS memory.
22	HASP network key did not succeed in freeing memory. This error is unique to HASP network key interfaces for Microsoft Windows applications and DOS extenders.
23	Invalid HASP network key memory address.
25	Failed to load the DLL (winsock.dll or w32sock.dll). Applies only to TCP/IP or IPX.
26	Failed to unload the DLL (winsock.dll or w32sock.dll). Applies only to TCP/IP or IPX.
28	Winsock.dll start-up error. Applies only to TCP/IP.
30	Failed to close the socket. Applies to TCP/IP only.
33	Protocol already set. Returned only when you attempt to set the protocol without having logged out completely from the API.
34	Access to key prohibited because the application is running on Citrix Winframe or Windows Terminal Server.
129	The correct HASP network key is not connected to the HASP License Manager.
130	The Program Number (ProgNum) specified is not in the Program List of the HASP key’s memory.
131	Error reading from HASP key memory.
132	Error writing to HASP key memory.
133	The current Login request exceeds the number of stations that may run the software concurrently.
134	The current Login request exceeds the number of authorized activations for the software.
135	You called the Logout function without first calling the Login function. This can happen when the License Manager was reloaded or you have been logged out from the License Manager.
136	The HASP License Manager is busy.
137	There is no space in the HASP network key user list.
138	The Number of Authorized Stations is larger than the maximum number designated by the HASP model.
139	You called a function without first calling the Login function.
140	The HASP Licence Manager does not serve your station's network.
141	Invalid service, or new version of the HASP API is communicating with an older version of the HASP License Manager.
142	Cannot find the HASP License Manager matching the name specified in the HASP configuration file.
150	No HASP License Manager with the assigned name was found.
151	Two or more different HASP License Managers with the assigned name were found.
152	The encode operation failed because the service was not supported by the hardware.
153	The decode operation failed because the service was not supported by the hardware.
155	An old version of the License Manager has been found. The API used required a newer version of the License Manager to be installed.
157	Buffer size too small for requested function.
158	HASP License Manager running on machine with old HASP driver installed.
159	HASP License Manager running on machine with no HASP driver installed.


HASP License Manager
An application that communicates with the protected application and the HASP network key, functioning as a link between the two.


HASP License Manager as a service

To: HASP License Manager Setup under Windows 2000/XP/2003

You can install the HASP License Manager Service. As a service, the HASP License Manager launches before logon and continues to run after logout.

You can use the HASP License Manager setup program or the Custom API of HASP License Manager service to install and remove the service.

Note: Since the HASP License Manager loads automatically before logon, the HASP License Manager messages (i.e., "HASP not found") do not appear on the screen. Only after logon do these messages appear.

To access the HASP License Manager entry in the Service Control Manager:

From the Start menu, select Settings and then Control Panel.

The "HASP Loader" entry appears under Services.


Settings in the HASP License Manager Configuration File

Use the nhsrv.ini file to configure the HASP License Manager. A copy of nhsrv.ini is included in the HASP HL Redistribute folder on the HASP HL installation CD.

Server settings

Server parameters are specified in the nhsrv.ini.file and not on the command line. This way, parameter specification for the License Manager service is made easier, and configuration is simplified and consolidated within a single file.

For Win32, the nhsrv.ini. should reside in the same directory from where the program executable is deployed.

When the LM is activated, it searches for the nhsrv.ini file in several directories.

nhsrv.ini. Settings

The configuration settings described below are valid for HASP License Manager 8.2 and above.  Boolean switches may have the following values:

1	yes	true	enabled
0	no	false	disabled
The following nhsrv.ini. settings are available:

NHS_SERVER

NHS_IP

NHS_IPX

NHS_NETBIOS


HASP License Manager Installation under Windows 2000/XP/2003

To: Setup of HASP License Manager

To setup the HASP License Manager under Windows NT/2000/XP:

1.	Double-click lmsetup.exe to run the HASP License Manager setup utility.

2.	Click Yes.

The necessary files are extracted and a wizard is prepared to assist you through the rest of the process.

3.	Select typical installation, custom installation or removal of the HASP License Manager. You also have the option to install the HASP License Manager as a service.

4.	If you are installing the HASP License Manager, designate a specific directory and program folder.


HASP License Manager Main Window

The HASP License Manager main window displays the following information:

•	HASP License Manager version number

•	Status of each protocol (loaded, unloaded, or failed to load) and the date and time of the last change of status

•	Status of the HASP License Manager (active or not active)

To open or hide the HASP License Manager main window:

Double-click the HASP License Manager icon in the system tray at the bottom right of your screen.

Note: You can close the HASP License Manager main window by clicking the close button at the right corner of the title bar. However, the HASP License Manager will continue to run, and its icon will remain in the system tray. To exit the program, choose Exit from the menu bar. (If the HASP License Manager is installed as a service, you cannot exit using this menu option. Instead, you must uninstall the service.)

See Also

The HASP License Manager Menu Bar


HASP License Manager Menu Bar

To: HASP License Manager Main Window

The HASP License Manager main window contains a menu bar with the following options:

Load

Remove

Activity Log

Help

Exit


HASP License Manager Setup under Windows 98/ME

To: Setup of HASP License Manager

To setup the HASP License Manager under Windows 98/ME:

1.	Double-click LMSetup.exe to run the HASP License Manager setup utility.

2.	Click Yes.

The necessary files are extracted and a wizard is prepared to assist you through the rest of the process.

3.	Select typical installation, custom installation or removal of the HASP License Manager.

4.	If you are installing the HASP License Manager, select a directory and program folder for it.


not active
The HASP License Manager is not active when no protocols are loaded.


number
An integer ranging from 0 to 255.


number65535
An integer ranging from 0 to 65535.


Path
The complete path name.


remove
Unload the protocol(s) of your choice (IPX, NetBIOS, or TCP/IP).


Setup of HASP License Manager

With the HASP License Manager setup utility, you can install or remove the Win32 HASP License Manager. A setup wizard guides you through all the steps.

The HASP License Manager setup utility supports Windows 98/ME/2000/XP/2003.

HASP License Manager Setup under Windows 98/ME

HASP License Manager Installation under Windows 2000/XP/2003


Viewing the Activity Log

The HASP License Manager maintains an activity log, which includes general information in the Server Activity log and specific details in logs of the individual protocols.

To view the Server Activity log:

1.	Choose Activity Log from the menu bar.

The Activity Log window appears.

2.	In the list box, choose Server Activity Log.

The log details appear.

To view the log for a specific protocol:

1.	Choose Activity Log from the menu bar

The Activity Log window appears.

2.	From the list box, choose the protocol.

The log for the protocol you choose appears.


x
An integer ranging from 0 to 255.


Search Order
HASP LM Configuration File Search Order

To:Settings in the LM Configuration File

You can place nhsrv.ini and the executable of the HASP License Manager in the same directory or in any other location in accordance with the nhsrv.ini search order described in the table below.

Operating System	Search Order
Windows 98/ME	Executable file directory  Current directory Windows system directory Windows directory Path
Windows 2000/XP/2003	Executable file directory  Current directory Windows 32-bit system directory Windows 16-bit system directory Windows directory Path


NHS_IPX

To: Settings in the LM Configuration File

You can fine tune settings for the HASP License Manager in its configuration file. The HASP License Manager configuration file, nhsrv.ini, contains the [NHS_IPX] section, which is used to define settings for the IPX protocol. The following is a list of keywords in the [NHS_IPX] section:

Keyword	NHS_USE_IPX
Description	Setting can be either enabled or disabled.
Default	enabled
Example	NHS_USE_IPX= yes
Keyword	NHS_ADDRPATH
Description	Path to haspaddr.dat file. The IPX address of the current LM will be written to haspaddr.dat in the specified directory. Clients can specify this file in their nethasp.ini file
Default	curent directory
Example	NHS_ADDRPATH=c:\temp
Keyword	NHS_APPENDADDR
Description	Appends address data to the hapaddr.dat. If enabled, the current LM’s address is added to an existing haspaddr.dat. This is particularly useful when multiple LMs exist. All the LMs can be searched by the client. The LM does not search for duplicates when adding an address.
Default	replace
Example	NHS_APPENDADDR=no
Keyword	NHS_USESAP
Description	Setting can be enabled or disabled to allow the HASP LM to announce itself to the network via the Service Advertising Protocol (SAP).SAP enables clients to find the LM for different subnets. IPX is normally configured to run  a virtual subnet on Windows 2000/ XP/2003 machines, therefore SAP is essential in enabling clients to find the LM.
Default	enabled
Example	NHS_USESAP=enabled
Keyword	NHS_IPX_SOCKETNUM
Description	The IPX socket number. All clients must use the same default socket number. The number should not be altered. Note: clients must use the same socket!
Default	0x7483
Example	NHS_IPX_SOCKETNUM=0x7483


NHS_NETBIOS

To: Settings in the LM Configuration File

You can fine tune settings for the HASP License Manager in its configuration file. The HASP License Manager configuration file, nhsrv.ini, contains the [NHS_NETBIOS] section that is used to define settings for the NetBIOS protocol. The following is a list of keywords in the [NHS_NETBIOS] section:

Keyword	NHS_USE_NETBIOS
Description	Setting can be enabled or disabled. If you are certain that you do not need NetBIOS for LM communication, disable the switch to save network and memory resources.
Default	enabled
Example	NHS_USE_NETBIOS=enabled
Keyword	NHS_NBNAME
Description	Use switch to alter name. Note: Clients must use the same name which must be unused in your NetBIOS name space. Names must follow NetBIOS naming conventions. Do not use this switch unless you are certain you need to specify a new NetBIOS name.
Default	enabled
Example	NHS_NBNAME=MyNBName
Keyword	NHS_USE_LUNA_NUMS
Description	Included only for the sake of compatibility with older versions
Default	all (automatic)
Example	NHS_USE_LUNA_NUMS=3,0,7,2


NHS_SERVER

To: Settings in the LM Configuration File

You can fine tune settings for the HASP License Manager in its configuration file. The HASP License Manager configuration file, nhsrv.ini, contains the [NHS_SERVER] section which is used to set global License Manager settings. The following is a list of keywords in the [NHS_SERVER] section:

Keyword	NHS_IP_USERLIST
Description	Maximum number of concurrent logins to LM. Maximum number is 65520
Default	1000
Example	NHS_IP_USERLIST =1000
Keyword	NHS_IP_SERVERNAMES
Description	Server name to match the name a client requests. Maximum of 6 names. Maximum 7 characters per name. Multiple names separated by comma
Default	none
Example	NHS_IP_SERVERNAMES= cad, oefibla
Keyword	NHS_HIGHPRIORITY
Description	Runs LM at high priority. Default runs the LM on normal priority. Switch applies only to Win32.When switch is set to yes, check to see how performance of other services (file server, web server, etc.) running on the same machine is affected
Default	no – runs at normal priority.
Example	NHS_HIGHPRIORITY= no


NHS_IP

To: Settings in the LM Configuration File

You can fine tune settings for the HASP License Manager in its configuration file. The HASP License Manager configuration file, nhsrv.ini, contains the [NHS_IP] section, which is used to define settings for the IP protocol. The following is a list of keywords in the [NHS_IP] section:

Keyword	NHS_USE_UDP
Description	Setting can be either enabled or disabled.
Default	enabled
Example	NHS_USE_UDP=enabled
Keyword	NHS_USE_TCP
Description	Setting can be either enabled or disabled.
Default	enabled
Example	NHS_USE_TCP=enabled
Keyword	NHS_IP_PORTNUM
Description	IP port number. This switch applies only to Win32. Clients must use the same port! 475 is the exclusively registered IANA number for Aladdin LM.
Default	475.
Example	NHS_ IP_PORTNUM =475
Keyword	NHS_IP_LIMIT = <IPAddr>, <IPAddr>…
Description	Specifies the range stations which are allowed to access the currently activated HASP LM. The last byte may be a range. Multiple entries should be separated by commas.The list may be split through several lines. The following wildcard (asterisk) byte combinations are possible:4th only, 4th, 3rd or 4th, 3rd, 2nd. An additional bitmask can be specified as the number of one-bits (e.g. 10.0.0.0/8).
Default	none
Example	NHS_IP_LIMIT = 10.242.18-99,10.1.1.9/16  10.25.0.0/24                                192.0.0*,194.0*,*,11.*,*,*                                10.24.7.8-12/30, 10.24.2.17