Introduction

This is the same article which I have written earlier in Native C++ code. (Launch your application from session 0 to session 1 in Vista using a service helper application at VistaSessions.asp)

Luzius Kalt mailed me a C# version of the service which would work well for those who wanted the code on the .NET platform.

Since I got many requests to post the article in .NET, I am posting the code I received from Luzius.

To acknowledge his efforts, I am posting this as a separate article.

Using the code

The heart of the application logic is the service. This is what launches the helper application into session 1.

Hence only the service has been rewritten in C#.

The code rewritten in C# uses PINVOKE to execute native API's.

The application Custom message sender which sends the message to the service to launch the application as well as the code which will access HKCU in the registry (refer to my article VistaSessions.asp) is still in native code.

I will update that too soon.

The following structures and API's from Win32 have been declared in C#

Rest of the code is straightforward. You can refer to my previous article to understand the core logic. You are free to use the code. You can contact me at jaisvar@gmail.com for more details. I am in the process of writing my second article about UAC tweaks soon.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

Share

About the Author

I graduated from Nanyang Technological University, Singapore in May 2004.Currently I am working as a Technical Consultant. I am also doing my Masters of Computing in IT project management from NUS, Singapore.My interests include reading technical articles,watching movies and traveling.My main areas of work include Project Management, Software Analysis and Design,Building Enterprise Applications using Microsoft .NET technologies,smart phone application development (Windows Mobile 5.0 and Blackberry) and System Programing on Windows Platform & WinCE