Forum posts for winlogon.exe

obtain session id and process id for winlogon.exe

I'm trying to create a process that starts up an application that requires a UI. So it can't be in session 0.
My idea was to obtain the process id of winlogon.exe of the current logged on user. In this way I could duplicate the winlogon token and run my application using the CreateProcessAsUser function.
my code so far:(this is being called when the application i want run is required)

#include <windows.h>
#include <tlhelp32.h>
#include <tchar.h>

this function()
{
HANDLE hProcessSnap;
HANDLE hProcess;
PROCESSENTRY32 pe32;
DWORD dwPriorityClass;

// Take a snapshot of all processes in the system.
hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );

// Set the size of the structure before using it.
pe32.dwSize = sizeof( PROCESSENTRY32 );

//get the active session id
DWORD sessionID = WTSGetActiveConsoleSessionId();

// Now walk through the snapshot of processes
//I want to narrow this down to processes called winlogon
//if multiple users logged on system i want to make sure the active user
//will get the application run the their screen
do
{
// Retrieve the priority id.
dwPriorityClass = 0;

//here i want to compare the sessionID with session IDs of each winlogon process
//stuck for implementation here
//when i find a match i can use the processID to gain the token and create
//a duplicate so it can be used in CreateAsUser function.
}while( Process32Next( hProcessSnap, &pe32 ) );

}


So basically i need some help narrowing down the snapshot of the processes to just 'winlogon' and iterating through the session IDs of these processes to match sessionID of the active user.
Thanks in advance:D

View complete forum thread with replies

Other posts related to winlogon.exe

See Related Forum Messages: Follow the Links Below to View Complete Thread

Winlogon.exe with high cpu usage
obtain session id and process id for winlogon.exe
The SYSTEM account cannot access the certificate store
hide window 7 start icon located at the taskbar?
Disable Ctrl+Alt+Del key combination in Windows 7 using code injection into winlogon.exe
Why can I not see winlogon.exe using Python on top of Cygwin?

What is the carbon footprint of your coffee?

Is it low? Is it high? Can this things really kill the planet Earth? Maybe the answer will surprise you. Maybe not.