C#C
C#12mo ago
Ace

Executing explorer.exe into virtualdesktop

First of all, Happy New Year!
I'm working on a project in C#, I'm using the CreateDesktop API to create a desktop and draw it to a PictureBox. However, there's an issue: the explorer.exe is not loading into the virtual desktop it spawns into the default desktop, and nothing is being drawn into the PictureBox. The process is running in admin mode.

I believe the flow is as follows:

Admin process -> CreateProcessW (using startup info to select the desktop)
Admin explorer (but it doesn't run in admin mode due to security restrictions, so it relaunches)
CreateProcessW (forcing the relaunch into the default desktop)
User explorer (now running on the default desktop instead of the hidden one)

This is my failed method code to fix issue:
https://www.codebin.cc/code/cm5ee6tm50001mq03bb882yhv:2Z9hkuSY94ZEhCGgAm5i9yFCnaJ5qnyqDsKScZAhG9Ax
Was this page helpful?