I am new to Rust and I am planning to write a system service that runs with local system security context. But I want that service to launch an application with user's security context. In a nutshell, this service will be running in LocalSystem account and I am willing to launch the application as currently interactively logged on user.
In C++ we have these apis WTSQueryUserToken (to get the user token) and CreateProcessAsUser (to launch process as currently logged in user). I wanted to understand how complicated it is to implement that in Rust. How to use these apis in Rust ? I have checked crates.io but couldn't find any similar api.
Any sample service or leads will be of great help.
You can check out the winapi crate which contains raw bindings to these types of functions. Not sure if there is a nicer Rust wrapper for this particular API.
To continue with @rossmacarthur's point, the winapi crate contains bindings to all functions in the Windows API. So anything you would do with C++ can be done using that crate.
It won't be as nice as a safe wrapper/abstraction over the relevant APIs (the crate is essentially a big header file), but at least you'll be able to get the job done.