PP_LFOPEN()

Opens the License File and returns a handle

Applies to:

Win32, Win64

Syntax-VB:

Declare Function pp_lfopen(ByVal filename As String, ByVal flags As Long, ByVal lftype As Long, ByVal password As String, ByRef handle As Long) As Long

Syntax-C:

LONG pp_lfopen(LPSTR filename, LONG flags, LONG lftype, LPSTR password, LPPPLFHANDLE handle)

Arguments:

<filename> denotes the location to find the License File to open. The value for this field is dependant on the <lftype> parameter.

LF_FILE:

The complete path and filename of the License File. The maximum length for the path and filename is 255 characters.

LF_REGISTRY:

A unique string (255 characters max) to identify the encrypted registry key. This string can be any arbitrary string that will identify your company or product. In this case, the License File and string name will be encrypted and hidden in the Windows Registry. If you want to store the license information in a particular location in the Windows Registry, you can reference it with either the shortcuts provided, or the actual name. You can currently access three of the top level key hives in the Windows Registry by either fullname or shortcut.

Windows Registry Key Hive

ShortCut

HKEY_LOCAL_MACHINE

:LM:

HKEY_CLASSES_ROOT

:CR:

HKEY_CURRENT_USER

:CU:

 

Example: The following two lines will open the exact same Key in the Registry. 

"HKEY_LOCAL_MACHINE\Software\CompanyName\ProdName:LicenseInfo " 

":LM:Software\CompanyName\ProdName:LicenseInfo" 

<flags> is a parameter with available options, defined as:

Flag

Value

Description

LF_CREATE_NORMAL

0

Attribute used if License File is created.

LF_CREATE_RDONLY

1

Attribute used if License File is created.

LF_CREATE_HIDDEN

2

Attribute used if License File is created.

LF_CREATE_SYSTEM

4

Attribute used if License File is created.

LF_CREATE_MISSING

8

Causes License File to be created if it is missing.

LFOPEN_AS32BIT

128

Causes 64-bit applications to open system and registry based license files/aliases using 32-bit locations (SysWOW64 and Wow6432Node respectively).

<lftype> is the location where the License File is located, defined as:

LF_FILE     [1] - normal filesystem

LF_REGISTRY [2] - Windows registry

<password> is your unique password to use with this file. A minimum of 3 and maximum of 124 characters is allowed for a password.

<handle> is the buffer to place the License File handle

Returns:

Refer to pp_errorstr() for a table of possible return codes and their meaning. Typically, PP_SUCCESS [1] (file initialized) is returned. A numeric value that represents a handle to this License File is returned in <handle>. This handle is used with many of the other library functions in order to access the defined License File.

Description:

This function opens the file <filename> and verifies integrity. The <filename> must exist and be a valid License File. This function must be run before most other PLUS library functions since the handle returned by this function is used in the other functions. Be sure not to modify the value of the handle or unpredictable results may occur.

The handle returned by this function is not to be confused with a file handle which implies that the License File is kept in the open state.

Example:

Dim lfhandle As Long, result As Long

result = pp_lfopen( App.Path & "\example.lf", 0, LF_FILE, "password", lfhandle )

See Also:

PP_LFCLOSE(), PP_LFCOPY(), PP_LFALIAS(), PP_GETVARNUM(), PP_GETVARCHAR() and PP_GETVARDATE()

Concept Link IconRelated Topics