The simple windows service written in Rust.
The system windows supports services. Service is a process that typically work from user login to logout.
To learn more details see: https://learn.microsoft.com/en-us/windows/win32/services/services
This sample is very simple and has one purpose, to increase counter by 1 per second, and log out counter with OutputDebugStringA. You can see these output with DbgView (don't forget turn on "Capture global Win32")
There is one interesting feature in this service. It supports one User Control code that set protection level to 0 (SERVICE_LAUNCH_PROTECTED_NONE ). In few words it unprotect itself.
It's necessary feature to test PPL services.
There are no special steps to make this work. You can simply run build command cargo b
The signed win-service.exe
is produced into target/debug
directory
You have several options:
- Use SCM (service control manager) to create and start service.
- Create own application to manage this service
Few SCM commands. Lets assume you service name is "sample":
sc create sample binPath=<path_to_service_exe>
sc start sample
sc qc sample
sc stop sample
sc delete sample