C Examples: DbiOpenUserList

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

C Examples: DbiOpenUserList

Return to chapter overview

Get information on users using the current network file.

UserInfo must be allocated large enough to hold security information. This example uses the following input:
         fDbiOpenUserList(Buffer);

DBIResult fDbiOpenUserList(pCHAR UserInfo)

{

   DBIResult      rslt;

   USERDesc       UserDesc;

   hDBICur                      hTmpCur;

   CHAR           Buffer[500];

   UserInfo[0] = '\0';

   rslt = Chk(DbiOpenUserList(&hTmpCur));

   if (rslt == DBIERR_NONE)

   {

      while (DbiGetNextRecord(hTmpCur, dbiNOLOCK, (pBYTE)&UserDesc, NULL) == DBIERR_NONE)

      {

         wsprintf(Buffer, "\r\nName: %s, Session: %d, Class: %d, SerialNum: %s",

            UserDesc.szUserName, UserDesc.iNetSession, UserDesc.iProductClass,

            UserDesc.szSerialNum);

         strcat(UserInfo, Buffer);

      }

   }

   return rslt;

}