Skip to content

Run a Windows system service without hassle.

License

Notifications You must be signed in to change notification settings

dkhokhlov/winservice

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

winservice

A very small Rust library to easily set up and run a Windows system service.

Documentation

Example Usage

Cargo.toml:

[dependencies]
winservice = "0.1.1"

main.rs:

#![no_main]
#![feature(link_args)]
#![link_args = "-Wl,--subsystem,windows"]

use std::os::raw::{c_char, c_int, c_void};
use std::sync::mpsc::Receiver;

#[macro_use]
extern crate winservice;

#[allow(non_snake_case)]
#[no_mangle]
pub extern "system" fn WinMain(hInstance : *const c_void, hPrevInstance : *const c_void,
    lpCmdLine : *const c_char, nCmdShow : c_int) -> c_int
{
    Service!("myService", service_main)
}

fn service_main(args : Vec<String>, end : Receiver<()>) -> u32 {
    loop {
        // Do some work
        if let Ok(_) = end.try_recv() { break; } }
 0 }

About

Run a Windows system service without hassle.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%