Solved

Windows application responding to wrong user account through socket

Posted on 2014-03-26
5
236 Views
Last Modified: 2014-04-15
Hi Experts,

I have an issue where I have a simple application that exposes a web server for inter-process communication.  This application is meant for a single user to make requests to it.  It is not a windows service.

If someone logs out, no problem.  The application is shut down and so the web server goes away.  But if someone uses the user switching functionality - the application remains and will respond to requests that come in on that port from a separate user account.

How can I fix this?

Thanks for any ideas!
Mike
0
Comment
Question by:thready
  • 3
  • 2
5 Comments
 
LVL 32

Expert Comment

by:sarabande
Comment Utility
your webserver could register to receive a WM_WTSSESSION_CHANGE message.

see
http://msdn.microsoft.com/en-us/library/windows/desktop/bb776893(v=vs.85).aspx

then it could end or deny requests until the user was switched back.

Sara
0
 
LVL 1

Author Comment

by:thready
Comment Utility
Thanks Sara, you're brilliant as usual.  But I forgot to mention another thing.  It's also possible to have terminals connected where 2 users are actively using the machine.  What about that scenario?
0
 
LVL 32

Accepted Solution

by:
sarabande earned 500 total points
Comment Utility
you probably need to establish two webservers one for each account. the webservers then would need an own port to listen for each account. you may define a user environment variable for the port and pass it to web server at creation time.

Sara
0
 
LVL 1

Author Closing Comment

by:thready
Comment Utility
Thanks
0
 
LVL 1

Author Comment

by:thready
Comment Utility
Hi again Sara,

I'm looking again at your first comment - do you know if the session state change event for WM_WTSSESSION_CHANGE is always WTS_CONSOLE_DISCONNECT and WTS_CONSOLE_CONNECT for when the user switches?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now