After some discussion in IRC (thanks to Sir_Walrus and @nsivov ), I changed the place the token/winstation dance is happening to CreateProcessInternalW. Also, Sir_Walrus spotted absolutely correctly that directly editing the startup struct is a terrible idea, so I copy it to local stack first and edit it there. Also, we had some discussion in IRC where to best override the desktop. I chose CreateProcessXXX mainly because of convenience: it is the last place the startup struct is not serialized; after the call to create_process_params all parameters are serialized everywhere (struct with strings appended). Editing this structure is not trivial and I couldn't find a place in wine that already edits this structure. Conceptually, this should probably be done in wineserver; but unless the consensus is that the current place absolutely cannot stay, I'd rather avoid coding re-packing of the struct startup_info. If the code for this already exists and I just couldn't find it, please point me to it and I will update this MR accordingly. Also, please excuse the rather stupid CI failures and the according waste of CI time. I just noticed that my local build doesn't do -Werror. I'll reconfigure my local build and push my updates once I finished fixing the build. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9843#note_126310