Skip to content

SECKFMGetUserInfo

Function : ID
SECKFMGetUserInfo - Get user access information for given key file.

#include <kfm.h>
STATUS LNPUBLIC SECKFMGetUserInfo(

    KFHANDLE  hKFC,
    char far *lpName,
    LICENSEID far *lpLicense);

Description :

This routine retrieves access information of User name and LICENSEID associated with a key file context. As this API returns user name & license information based on the ID file handle populated using SECKFMOpen().
User name buffer must have a minimum length of MAXUSERNAME + 1 (see names.h for MAXUSERNAME) & may be NULL, if you do not wish this string to be returned.
Refer LICENSEID structure information from global.h.

Parameters : Input : hKFC - keyfile context to be used for access

Output : (routine) - NOERROR - on success. Notes error - on failure to get user and license ID.

lpName - The address of a text buffer in which a null-terminated user name string obtained from the local ID file is returned.

lpLicense - The address of a LICENSEID structure in which the LICENSEID obtained from the local ID file is returned. This argument may be NULL if you do not wish this structure to be returned.

Sample Usage :

char szUserName[MAXUSERNAME] = { 0 };
LICENSEID licenseID = { 0 };
KFHANDLE hKFC = NULLHANDLE;

SECKFMOpen(hKFC,
           idFilePath,         //Is the path to the ID file
           passwordBuffer,     // Password buffer
           0,
           0,
           NULL);
STATUS sStatus = SECKFMGetUserInfo(hKFC, szUserName, &licenseID);
if (NOERROR != sStatus)
{
    printf("ERROR TRACE: SECKFMGetUserInfo()");
    return sStatus;
}
printf("SECKFMGetUserInfo returned username %s.\n", szUserName);
SECKFMClose(&hKFC,
            0,
            0,
            NULL);

See Also : SECKFMGetIDFlags SECKFMClose SECKFMOpen