locked
User screen unlock time(last session login time) using c++ RRS feed

  • Question

  • Hi , I am developing a sample MFC application to find users login time and last user screen unlock time(last session login time) using api LsaGetLogonSessionData(). Here I am able to the the actual user login time but unable to get the last user screen unlock time(last session login time). I have shared the code below.

     ntStatus = LsaEnumerateLogonSessions( &luLogonSessionCount, &LogonLuid );

      for ( ULONG i = 0UL; i < luLogonSessionCount; i++ )
      {
          ntStatus = LsaGetLogonSessionData (&LogonLuid[i], &pLogonSessionData);
          if (ntStatus == STATUS_SUCCESS) 
    {

              if (pLogonSessionData->LogonTime.QuadPart)
              PrintFilefime (TEXT("LogonTime"), (const FILETIME *)&pLogonSessionData->LogonTime);//success

        LARGE_INTEGER k =pLogonSessionData->LastLogonInfo.LastSuccessfulLogon;// not successful it shows 0

       }

    Thanks in advance. Please provide suggestions

    Tuesday, November 3, 2020 11:49 AM