Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ jobs:
run: cargo test -p sample_service_sys --target ${{ matrix.target }}
- name: Test sample_service_thread
run: cargo test -p sample_service_thread --target ${{ matrix.target }}
- name: Test sample_service_time
run: cargo test -p sample_service_time --target ${{ matrix.target }}
- name: Test sample_shell
run: cargo test -p sample_shell --target ${{ matrix.target }}
- name: Test sample_simple
Expand All @@ -159,10 +161,10 @@ jobs:
run: cargo test -p sample_uiautomation --target ${{ matrix.target }}
- name: Test sample_wmi
run: cargo test -p sample_wmi --target ${{ matrix.target }}
- name: Test sample_xml
run: cargo test -p sample_xml --target ${{ matrix.target }}
- name: Clean
run: cargo clean
- name: Test sample_xml
run: cargo test -p sample_xml --target ${{ matrix.target }}
- name: Test test_agile
run: cargo test -p test_agile --target ${{ matrix.target }}
- name: Test test_agile_reference
Expand Down Expand Up @@ -261,10 +263,10 @@ jobs:
run: cargo test -p test_metadata --target ${{ matrix.target }}
- name: Test test_msrv
run: cargo test -p test_msrv --target ${{ matrix.target }}
- name: Test test_no_std
run: cargo test -p test_no_std --target ${{ matrix.target }}
- name: Clean
run: cargo clean
- name: Test test_no_std
run: cargo test -p test_no_std --target ${{ matrix.target }}
- name: Test test_no_use
run: cargo test -p test_no_use --target ${{ matrix.target }}
- name: Test test_noexcept
Expand Down Expand Up @@ -311,6 +313,8 @@ jobs:
run: cargo test -p test_return_handle --target ${{ matrix.target }}
- name: Test test_return_struct
run: cargo test -p test_return_struct --target ${{ matrix.target }}
- name: Test test_services
run: cargo test -p test_services --target ${{ matrix.target }}
- name: Test test_standalone
run: cargo test -p test_standalone --target ${{ matrix.target }}
- name: Test test_string_param
Expand Down Expand Up @@ -361,12 +365,12 @@ jobs:
run: cargo test -p tool_msvc --target ${{ matrix.target }}
- name: Test tool_standalone
run: cargo test -p tool_standalone --target ${{ matrix.target }}
- name: Clean
run: cargo clean
- name: Test tool_test_all
run: cargo test -p tool_test_all --target ${{ matrix.target }}
- name: Test tool_workspace
run: cargo test -p tool_workspace --target ${{ matrix.target }}
- name: Clean
run: cargo clean
- name: Test tool_yml
run: cargo test -p tool_yml --target ${{ matrix.target }}
- name: Test windows
Expand Down
3 changes: 2 additions & 1 deletion crates/libs/services/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ fn main() {
windows_services::Service::new()
.can_pause()
.can_stop()
.run(|command| {
.run(|service, command| {
// Respond to service commands...
})
.unwrap();
}
```
21 changes: 11 additions & 10 deletions crates/libs/services/src/bindings.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#![allow(
non_snake_case,
non_upper_case_globals,
non_camel_case_types,
dead_code,
clippy::all
)]

windows_link::link!("advapi32.dll" "system" fn RegisterServiceCtrlHandlerW(lpservicename : PCWSTR, lphandlerproc : LPHANDLER_FUNCTION) -> SERVICE_STATUS_HANDLE);
windows_link::link!("advapi32.dll" "system" fn RegisterServiceCtrlHandlerExW(lpservicename : PCWSTR, lphandlerproc : LPHANDLER_FUNCTION_EX, lpcontext : *const core::ffi::c_void) -> SERVICE_STATUS_HANDLE);
windows_link::link!("advapi32.dll" "system" fn SetServiceStatus(hservicestatus : SERVICE_STATUS_HANDLE, lpservicestatus : *const SERVICE_STATUS) -> BOOL);
windows_link::link!("advapi32.dll" "system" fn StartServiceCtrlDispatcherW(lpservicestarttable : *const SERVICE_TABLE_ENTRYW) -> BOOL);
pub type BOOL = i32;
pub type ENUM_SERVICE_TYPE = u32;
pub type LPHANDLER_FUNCTION = Option<unsafe extern "system" fn(dwcontrol: u32)>;
pub type LPHANDLER_FUNCTION_EX = Option<
unsafe extern "system" fn(
dwcontrol: u32,
dweventtype: u32,
lpeventdata: *mut core::ffi::c_void,
lpcontext: *mut core::ffi::c_void,
) -> u32,
>;
pub type LPSERVICE_MAIN_FUNCTIONW =
Option<unsafe extern "system" fn(dwnumservicesargs: u32, lpserviceargvectors: *mut PWSTR)>;
pub const NO_ERROR: WIN32_ERROR = 0u32;
pub type PCWSTR = *const u16;
pub type PWSTR = *mut u16;
pub const SERVICE_ACCEPT_PAUSE_CONTINUE: u32 = 2u32;
Expand Down Expand Up @@ -55,3 +55,4 @@ impl Default for SERVICE_TABLE_ENTRYW {
}
}
pub const SERVICE_WIN32_OWN_PROCESS: ENUM_SERVICE_TYPE = 16u32;
pub type WIN32_ERROR = u32;
Loading