diff --git a/Cargo.lock b/Cargo.lock index 81b11c2..1210618 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1179,6 +1179,7 @@ dependencies = [ "simplelog", "tokio", "ureq", + "uuid", "windows-sys 0.60.2", ] diff --git a/cpp/src/app_service.cpp b/cpp/src/app_service.cpp index 725c1d4..c009aaf 100644 --- a/cpp/src/app_service.cpp +++ b/cpp/src/app_service.cpp @@ -112,6 +112,7 @@ std::optional AppService::launch(const std::string& c_argv.size(), kill_existing ? 1 : 0, start_suspended ? 1 : 0, + NULL, // TODO: stdio handling &resp)) { err = FfiError(e); return std::nullopt; diff --git a/ffi/Cargo.toml b/ffi/Cargo.toml index 33b96fa..a1e1339 100644 --- a/ffi/Cargo.toml +++ b/ffi/Cargo.toml @@ -14,6 +14,7 @@ tokio = { version = "1.44.1", features = ["full"] } libc = "0.2.171" plist = "1.7.1" plist_ffi = { version = "0.1.5" } +uuid = { version = "1.12", features = ["v4"], optional = true } [target.'cfg(windows)'.dependencies] windows-sys = { version = "0.60", features = ["Win32_Networking_WinSock"] } @@ -25,7 +26,7 @@ ring = ["idevice/ring"] afc = ["idevice/afc"] amfi = ["idevice/amfi"] -core_device = ["idevice/core_device", "dep:futures"] +core_device = ["idevice/core_device", "dep:futures", "dep:uuid"] core_device_proxy = ["idevice/core_device_proxy"] crashreportcopymobile = ["idevice/crashreportcopymobile"] debug_proxy = ["idevice/debug_proxy"] diff --git a/ffi/src/core_device/app_service.rs b/ffi/src/core_device/app_service.rs index c8f0616..6078635 100644 --- a/ffi/src/core_device/app_service.rs +++ b/ffi/src/core_device/app_service.rs @@ -299,6 +299,7 @@ pub unsafe extern "C" fn app_service_free_app_list(apps: *mut AppListEntryC, cou /// * [`argc`] - Number of arguments /// * [`kill_existing`] - Whether to kill existing instances /// * [`start_suspended`] - Whether to start suspended +/// * [`stdio_uuid`] - The UUID received from openstdiosocket, null for none /// * [`response`] - Pointer to store the launch response (caller must free) /// /// # Returns @@ -314,6 +315,7 @@ pub unsafe extern "C" fn app_service_launch_app( argc: usize, kill_existing: c_int, start_suspended: c_int, + stdio_uuid: *const u8, response: *mut *mut LaunchResponseC, ) -> *mut IdeviceFfiError { if handle.is_null() || bundle_id.is_null() || response.is_null() { @@ -337,6 +339,13 @@ pub unsafe extern "C" fn app_service_launch_app( } } + let stdio_uuid = if stdio_uuid.is_null() { + None + } else { + let stdio_uuid = unsafe { std::slice::from_raw_parts(stdio_uuid, 16) }; + Some(uuid::Uuid::from_bytes(stdio_uuid.try_into().unwrap())) + }; + let client = unsafe { &mut (*handle).0 }; let res = RUNTIME.block_on(async move { client @@ -347,6 +356,7 @@ pub unsafe extern "C" fn app_service_launch_app( start_suspended != 0, None, // environment None, // platform_options + stdio_uuid, ) .await });