How to get notification of User LogIn from a Console Service

I have a console service developed in MFC using VS2005.

My service should know when a User Logs in to the system so that it can take some user specific actions.

Is there a way by which my console service can know when a user logs in ?
AkhterrehanAsked:
Who is Participating?
 
jkrConnect With a Mentor Commented:
>>Is there any way by which an application running in SYSTEM can display GUI in
>>the desktop of the LoggedIN User.

You can set 'SERVICE_INTERACTIVE_PROCESS' when calling 'CreateService()', it does exactly what it is named after. See also http://msdn2.microsoft.com/en-us/library/ms683502.aspx ("Interactive Services")
0
 
jkrCommented:
Use a Winlogon Notification Package for that purpose: http://msdn2.microsoft.com/en-us/library/aa380545.aspx ("Winlogon Notification Packages")

The scoop is to export a set of functions that Winlogon calls for each logon/logoff event

// Here is the event handler for the Winlogon Logon event.
extern "C" VOID APIENTRY WLEventLogon (PWLX_NOTIFICATION_INFO pInfo)
{

    // Print the name of the handler to debug output.
    // You can replace this with more useful functionality.
    OutputDebugString (TEXT("NOTIFY:  Entering WLEventLogon.\r\n"));
}

// Here is the event handler for the Winlogon Logoff event.
extern "C" VOID APIENTRY WLEventLogoff (PWLX_NOTIFICATION_INFO pInfo)
{

    // Print the name of the handler to debug output.
    // You can replace this with more useful functionality.
    OutputDebugString (TEXT("NOTIFY:  Entering WLEventLogff.\r\n"));
}

(http://msdn2.microsoft.com/en-us/library/aa375405.aspx - "Event Handler Function Prototype")

and register them accordingly as described in http://msdn2.microsoft.com/en-us/library/aa379402.aspx ("Registry Entries")

See also http://msdn2.microsoft.com/en-us/library/aa374783.aspx ("Creating a Winlogon Notification Package") and http://msdn2.microsoft.com/en-us/library/aa379380.aspx ("Registering a Winlogon Notification Package")
0
 
AkhterrehanAuthor Commented:

Tried using it. Through it i have managed to start my application in either SYSTEM or LoggedOn user rights.

1. When running my application as a SYSTEM application, i am unable to display any GUI on the desktop.

2. When running my application as a LOGED in User application, my application gets very little priveleges.

Is there any way by which an application running in SYSTEM can display GUI in the desktop of the LoggedIN User.
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.