Is it possibly to create Windows service in Rust as in C? A link in GitHub appreciated.
Absolutely.
Lowest level: Use the windows-sys crate and use the raw Win32 API's as you would in C.
Low level: Use the windows-service crate.
High-level: Use the qsu crate (built on top of windows-service on Windows), which tries to make it possible to avoid writing platform-specific code when supporting Windows Services, systemd services and launchd services (but also supports running as a regular foreground mode, typically for development), and includes things like service registration/deregistration, support for sync and async/tokio services.
I've written several windows services using qsu.
The reason I know that remote debugging from Visual Studio (against msvsmon) works in Rust projects is because my first Windows Service written in Rust wouldn't work, and I had no convenient means of logging what was happening. Just as in the C world, remote debugging is extremely convenient when working with windows services.
Windows Defender has been particularly upset at my Rust-based Windows Services for some reason. I've had to unquarantine them many times. It may have gotten better now, though.
Thank you, it is a very useful information and a starting point. I really surprised that the Defender is capable to detect a language of a service. But actually, I had lot of the Defender warning when I do Rust development on Windows, so I just turned it off.
I should have been more specific: It triggered from time to time on my Rust binaries, but it triggered far more frequently when writing services. I googled the malware identifier at some point, and there was a part of it that according to some people on Microsoft's support forums indicated that it was a heuristic/"AI" match. My guess is that Rust services written in Rust just happen to pattern match more often with whatever they trained their detection model on.
I too disabled Windows Defender to stop it from disrupting my work .. but some people will give you the side-eye if you say you disabled Windows Defender, so for purposes of not getting side-eyed, I didn't disable Windows Defender. .. cough, cough.
Microsoft plans to replace C/C++ code by Rust completely by 2030, so we should be in better situation pretty soon.
Was that officially announced? Last I heard, that was a research project and not actually an official plan.
I have no idea, but the rumor looks real, because Windows in C will die.