GW2RegisterLicenceFile
    • PDF

    GW2RegisterLicenceFile

    • PDF

    Article summary

    The GW2RegisterLicenceFile registers the licence file 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

    The GW2RegisterLicenceFile function requests that session session uses the licence specified in the file whose name is the string pointed to by filename. The Licence will be applied to all processing performed by Glasswall for that session.

    #include "glasswall.core2.api.h"
    int GW2RegisterLicenceFile(Session session, const char *filename);

    Returns

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

    Example

    #include "glasswall.core2.api.h"
    
        HANDLE session = GW2OpenSession();
        if (!session)
            /* deal with error */
        else
            if (GW2RegisterLicenceFile(session, "gwkey.lic") < 0)
                /* deal with error */
            else
                /* the file has been successfully registered */
    
        ...
    
        /* later */
        if (GW2CloseSession(session) < 0)
            /* error closing session */

    Synopsis

    The RegisterLicenceFile method requests that session session uses the licence specified in the file whose name is the string pointed to by filename. The Licence will be applied to all processing performed by Glasswall for that session.

    /// <param name="session">Current open Glasswall session</param>
        /// <param name="filePath">The file path to the licence file to be registered</param>
        public int RegisterLicenceFile(int session, string filePath)

    Returns

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

    Synopsis

    The RegisterLicenceFile method requests that session session uses the licence specified in the file whose name is the string pointed to by filename. The Licence will be applied to all processing performed by Glasswall for that session.

    import com.glasswall.core2javabridge.*;
    
    public int GW2RegisterLicenceFile(int session, String licenceFilePath) throws GlasswallException, NullPointerException
    
    (Deprecated)
    public int GW2RegisterLicenceFile(int session, byte[] licenceFilePath) throws GlasswallException, NullPointerException

    Note:

    The GW2RegisterLicenceFile function parameters have been updated to use String in place of byte[]. The original function has been deprecated.

    Returns

    The GW2RegisterLicenceFile function returns a GW2_RetStatus enumeration converted to int. The value will be negative if an error occurred. 0 indicates success.

    Please refer to API Overview for Return Types and their details.

    A NullPointerException exception will be thrown if licenceFilePath is null or empty.

    A GlasswallException exception will be thrown if session is invalid, if the licenceFilePath could not be retrieved, or if the licenceFilePath could not be converted to UTF-8.

    Not supported in Python.

    A licence file should be present in the directory that contains the Glasswall Editor library.

    Returns

    status (int): The result of the Glasswall API call.

    The status attribute is an integer GW2_RetStatus enum value. Negative numbers indicate a failure.

    Synopsis

    The RegisterLicenceFile method requests that session session uses the licence specified in the file whose name is the string pointed to by filename. The Licence will be applied to all processing performed by Glasswall for that session.

    /**
         * Sets what licence file should be loaded for the session.
         * @param {number} session The ID of the session.
         * @param {string} filename The filename from which to load the licence.
         * @returns {number} Status of the operation; 0 for success, non-zero for failure.
         */
        GW2RegisterLicenceFile(session, filename)

    Returns

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


    Was this article helpful?