Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make a runnable example #86

Open
Xyndra opened this issue Feb 3, 2023 · 1 comment
Open

Make a runnable example #86

Xyndra opened this issue Feb 3, 2023 · 1 comment

Comments

@Xyndra
Copy link

Xyndra commented Feb 3, 2023

All of the examples are sami-dependent and it is impossible to know how to combine them. Please make one working example that you can just copy and run.

@pronebird
Copy link
Contributor

pronebird commented Feb 6, 2023

Examples we have cover various aspects of windows services from registration to implementation and supervision.

  • install_service.rs shows how to register a service.
  • uninstall_service.rs shows how to unregister a service.
  • ping_service.rs is a demo of a simple windows service that continuously sends a message over UDP. It has to be registered with the system before you can start it. You can use install_service.rs to do that. This is outlined in the header comment in ping_service.rs.
  • service_config.rs shows how to query arbitrary service configuration.
  • service_failure_actions.rs shows how to set up failure actions for an arbitrary service.
  • pause_continue.rs shows how to pause and resume an arbitrary service.

Also note that you don't need to copy and run things as cargo enables you to run cargo run --example <name>. Keep in mind that install_service.rs and uninstall_service.rs have to run with admin permissions, so you can build cargo build --examples under user shell first to make sure that all binaries are created under user account, and then run the executable under admin shell (i.e cargo run --example install_service)

If you think this is too confusing or you have a better idea how to either document that or re-arrange examples, then you are welcome to take a stab at it and perhaps make a pull request. We gladly accept contributions and improvements to this crate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants