Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Number of interactive logged on users on Windows Vista

Number of interactive logged on users on Windows Vista

Scheduled Pinned Locked Moved C / C++ / MFC
question
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Eikthrynir
    wrote on last edited by
    #1

    I created a test application using LsaEnumerateLogonSessions and LsaGetLogonSessionData, which displays the number of interactive logged on users. It works fine on Windows XP, but it displays 2 interactive logged on users on Windows Vista, even though I have only one user: the Administrator. Can anyone tell me why this happens? Thanks!

    D 1 Reply Last reply
    0
    • E Eikthrynir

      I created a test application using LsaEnumerateLogonSessions and LsaGetLogonSessionData, which displays the number of interactive logged on users. It works fine on Windows XP, but it displays 2 interactive logged on users on Windows Vista, even though I have only one user: the Administrator. Can anyone tell me why this happens? Thanks!

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Eikthrynir wrote:

      ...but it displays 2 interactive logged on users on Windows Vista, even though I have only one user: the Administrator.

      Is the other a legitimate user, just not logged on?

      "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      E 1 Reply Last reply
      0
      • D David Crow

        Eikthrynir wrote:

        ...but it displays 2 interactive logged on users on Windows Vista, even though I have only one user: the Administrator.

        Is the other a legitimate user, just not logged on?

        "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        E Offline
        E Offline
        Eikthrynir
        wrote on last edited by
        #3

        I modified the application so that it displays also the user name. It's the same user...

        E D 2 Replies Last reply
        0
        • E Eikthrynir

          I modified the application so that it displays also the user name. It's the same user...

          E Offline
          E Offline
          Eikthrynir
          wrote on last edited by
          #4

          The LogonId data members are different, even though the UserName data member are the same...

          1 Reply Last reply
          0
          • E Eikthrynir

            I modified the application so that it displays also the user name. It's the same user...

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            So it's showing Administrator twice? When I use that function on XP, it returns 6 sessions, even though I am the only one logged on to my machine. I don't have access to a Vista machine to see how it behaves. What do NetWkstaUserEnum() and WTSEnumerateSessions() return?

            "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            E 1 Reply Last reply
            0
            • D David Crow

              So it's showing Administrator twice? When I use that function on XP, it returns 6 sessions, even though I am the only one logged on to my machine. I don't have access to a Vista machine to see how it behaves. What do NetWkstaUserEnum() and WTSEnumerateSessions() return?

              "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

              "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

              E Offline
              E Offline
              Eikthrynir
              wrote on last edited by
              #6

              No need to check. I think I known what's happening. I modified the application to display other information too. The SessionId for each occurence of MyAdminUser is different: it runs both in Session 0 and Session 1 and that's why it is shown twice. On Vista (I guess Window 7 too) I only have to skip counting the user running in Session 0. Thus, I get the correct number of interactive logged on users. As I have seen, on Windows XP there is no need for this trick. I consider this problem solved now. But there is something strange that happened while I was testing on my Vista machine: I had MyAdminUser and MyLimitedUser both logged on; my application showed 3 users (Session 0 (MyAdminUser), Session 1 (MyAdminUser), and Session 2 (MyLimitedUser)); I logged off from MyLimitedUser and immediately ran the application; it still showed 3 users; after almost minute, when I re-ran the application, it correctly showed 2 users: MyAdminUser (Session 0) and MyAdminUser (Session 1). What I am trying to say is that it showed 3 users for almost a minute... :confused: The strange thing is that I could not reproduce the problem. I tried to make it happen again, but I couldn't. I wonder why Windows needed so much time to update the number of interactive logged on users...

              D 1 Reply Last reply
              0
              • E Eikthrynir

                No need to check. I think I known what's happening. I modified the application to display other information too. The SessionId for each occurence of MyAdminUser is different: it runs both in Session 0 and Session 1 and that's why it is shown twice. On Vista (I guess Window 7 too) I only have to skip counting the user running in Session 0. Thus, I get the correct number of interactive logged on users. As I have seen, on Windows XP there is no need for this trick. I consider this problem solved now. But there is something strange that happened while I was testing on my Vista machine: I had MyAdminUser and MyLimitedUser both logged on; my application showed 3 users (Session 0 (MyAdminUser), Session 1 (MyAdminUser), and Session 2 (MyLimitedUser)); I logged off from MyLimitedUser and immediately ran the application; it still showed 3 users; after almost minute, when I re-ran the application, it correctly showed 2 users: MyAdminUser (Session 0) and MyAdminUser (Session 1). What I am trying to say is that it showed 3 users for almost a minute... :confused: The strange thing is that I could not reproduce the problem. I tried to make it happen again, but I couldn't. I wonder why Windows needed so much time to update the number of interactive logged on users...

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                Eikthrynir wrote:

                I wonder why Windows needed so much time to update the number of interactive logged on users...

                Caching?

                "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups