sanzu
sanzu copied to clipboard
[Windows] Investigate running sanzu as a headless service
Hello :wave: ,
I am investigating using sanzu as a headless remote desktop on a windows server. For that to work I would need to
- have sanzu_server run on Windows startup (windows service or scheduled task)
- connect to it
- use sanzu_client to log into windows without manual intervention.
Right now, when I create a service and connect to it, I get an error like this :
[2024-03-06T17:39:16.846625200Z ERROR sanzu_server] Server error
[2024-03-06T17:39:16.846672700Z ERROR sanzu_server] - due to Cannot init d3d11
[2024-03-06T17:39:16.846695900Z ERROR sanzu_server] - due to Cannot create d3d11 device
This errors stems from the EnumOutputs call here https://github.com/cea-sec/sanzu/blob/main/sanzu/src/server_windows.rs#L635 that fails when started this way.
Interestingly, Sunshine seem to use a similar approach https://github.com/LizardByte/Sunshine/blob/nightly/src/platform/windows/display_base.cpp#L484 but manages to handle the case where EnumOutputs fails (typically when not running from a logged in user session).
I tried to add the SetThreadExecutionState(ES_DISPLAY_REQUIRED);
to sanzu like Sunshine does but it isn't enough apparently.
- Have you got any rough idea as to what would be necessary to make sanzu usable for headless remote desktop (including beeing able to log into windows remotely) ?
- If I were to make a PR that adds this feature, would you consider merging it or is it out of scope for the project ?
Thanks