Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6755455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:24:07+00:00 2026-05-26T13:24:07+00:00

I’m writing a service application that needs to enumerate all current user sessions, and

  • 0

I’m writing a service application that needs to enumerate all current user sessions, and obtain their session IDs, and later see what processes are running for what session. I’m using the WTSEnumerateSessions() API, as well as WTSQuerySessionInformation() to obtain a session specific information. Unfortunately those WTS APIs are very unreliable.

On a Windows XP machine with Fast User Switching turned off, or on an XP machine joined to a domain, those APIs are not immediately available. They may fail with the RPC_S_INVALID_BINDING, or 1702, error code for as long as several minutes after the Windows XP boots up and my service starts.

I could not find any official documentation explaining how to handle such limitation. The one available via a search engine is to wait for the terminal services service to load up, which is of course possible, but becomes a MAJOR pain in the a** to implement.

So, if someone could answer the following I’d appreciate it:

  1. Are there any alternative APIs to work with session specific data, that are more reliable that those WTS ones? I mostly need to see current sessions on the machine, get a user name and session status. Also enumerate processes with session IDs for each process. (I know that this is possible, since GINA or a log-in screen, can do all that way before the terminal services load up.)
  2. Is there a 100% guaratee that WTS-class APIs (such as WTSEnumerateSessions(), WTSQuerySessionInformation() and WTSEnumerateProcesses()) will load up before my service starts up on any version of Windows Vista/Windows 7 machine?

Please note bofore and any stipulations that a VERY important.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:24:08+00:00Added an answer on May 26, 2026 at 1:24 pm

    Another API which could be helpful for you are LsaEnumerateLogonSessions and LsaGetLogonSessionData SECURITY_LOGON_SESSION_DATA having Session field. See the code example and this one. To get information about the session of the process you can use GetTokenInformation with TokenSessionId as parameter. To enumerate processes you can use NtQuerySystemInformation (see my old answer).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I need to clean up various Word 'smart' characters in user input, including but
I have a text area in my form which accepts all possible characters from
I need a function that will clean a strings' special characters. I do NOT
I am writing an app with both english and french support. The app requests

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.