Integrate signed agent catalog, tenant enrollment and HTTPS installers

This commit is contained in:
2026-11-17 15:56:18 +01:00
parent 689f326460
commit 7fd17272d5
70 changed files with 12982 additions and 327 deletions
+7 -2
View File
@@ -12,6 +12,7 @@ static STOP: AtomicBool = AtomicBool::new(false);
static HANDLE: AtomicUsize = AtomicUsize::new(0);
type Runner = fn(&'static AtomicBool) -> Result<()>;
static RUN: OnceLock<Runner> = OnceLock::new();
static NAME: OnceLock<&'static str> = OnceLock::new();
fn status(state: u32, exit: u32) {
let handle = HANDLE.load(Ordering::SeqCst) as SERVICE_STATUS_HANDLE;
if handle.is_null() {
@@ -51,7 +52,7 @@ unsafe extern "system" fn control(
0
}
unsafe extern "system" fn service_main(_count: u32, _args: *mut *mut u16) {
let name = crate::native::wide(crate::SERVICE_NAME);
let name = crate::native::wide(NAME.get().copied().unwrap_or(crate::SERVICE_NAME));
let handle =
unsafe { RegisterServiceCtrlHandlerExW(name.as_ptr(), Some(control), ptr::null_mut()) };
if handle.is_null() {
@@ -64,8 +65,12 @@ unsafe extern "system" fn service_main(_count: u32, _args: *mut *mut u16) {
status(SERVICE_STOPPED, if result.is_ok() { 0 } else { 1066 });
}
pub fn dispatch(run: Runner) -> Result<()> {
dispatch_named(crate::SERVICE_NAME, run)
}
pub fn dispatch_named(name: &'static str, run: Runner) -> Result<()> {
ensure!(NAME.set(name).is_ok(), "SCM_ALREADY_INITIALIZED");
ensure!(RUN.set(run).is_ok(), "SCM_ALREADY_INITIALIZED");
let mut name = crate::native::wide(crate::SERVICE_NAME);
let mut name = crate::native::wide(name);
let table = [
SERVICE_TABLE_ENTRYW {
lpServiceName: name.as_mut_ptr(),