Skip to main content
Version: 16.8.2

GW2RegisterLicenceMemory

The GW2RegisterLicenceMemory registers the licence file held in memory to a session.

If neither GW2RegisterLicenceFile or GW2RegisterLicenceMemory is registered with a session, the Editor will attempt to search for the licence in the default location. This is a file called gwkey.lic located in the same folder as the Editor library. If that cannot be found then the library will be considered unlicenced and some processes may fail with licence expiry issues.

Synopsis

For session session, the GW2RegisterLicenceMemory function registers the licence to be used by Glasswall when processing files. licenceContents is a pointer to the licence data, licenceLength specifies the size in bytes of the licence data.


#include "glasswall.core2.api.h"
int GW2RegisterLicenceMemory(Session session,
const char *licenceContents,
size_t licenceLength);

Returns

Returns an integer GW2_RetStatus enum value. Negative numbers indicate a failure.

Example


#include "glasswall.core2.api.h"

Session session = GW2OpenSession();
char *licence = NULL;
size_t size = 0;
if (!session)
/* deal with error */
else
{
/* ... load 'licence' with a pointer to the licence content ... */
if (GW2RegisterLicenceMemory(session, licence, size) < 0)
/* deal with error */
else
/* continue processing */
}

. . .

/* later */
if (GW2CloseSession(session) < 0)
/* error closing session */