mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 06:26:15 +01:00
Update FFI for app launch arguments
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -1179,6 +1179,7 @@ dependencies = [
|
|||||||
"simplelog",
|
"simplelog",
|
||||||
"tokio",
|
"tokio",
|
||||||
"ureq",
|
"ureq",
|
||||||
|
"uuid",
|
||||||
"windows-sys 0.60.2",
|
"windows-sys 0.60.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ std::optional<LaunchResponse> AppService::launch(const std::string&
|
|||||||
c_argv.size(),
|
c_argv.size(),
|
||||||
kill_existing ? 1 : 0,
|
kill_existing ? 1 : 0,
|
||||||
start_suspended ? 1 : 0,
|
start_suspended ? 1 : 0,
|
||||||
|
NULL, // TODO: stdio handling
|
||||||
&resp)) {
|
&resp)) {
|
||||||
err = FfiError(e);
|
err = FfiError(e);
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ tokio = { version = "1.44.1", features = ["full"] }
|
|||||||
libc = "0.2.171"
|
libc = "0.2.171"
|
||||||
plist = "1.7.1"
|
plist = "1.7.1"
|
||||||
plist_ffi = { version = "0.1.5" }
|
plist_ffi = { version = "0.1.5" }
|
||||||
|
uuid = { version = "1.12", features = ["v4"], optional = true }
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
windows-sys = { version = "0.60", features = ["Win32_Networking_WinSock"] }
|
windows-sys = { version = "0.60", features = ["Win32_Networking_WinSock"] }
|
||||||
@@ -25,7 +26,7 @@ ring = ["idevice/ring"]
|
|||||||
|
|
||||||
afc = ["idevice/afc"]
|
afc = ["idevice/afc"]
|
||||||
amfi = ["idevice/amfi"]
|
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"]
|
core_device_proxy = ["idevice/core_device_proxy"]
|
||||||
crashreportcopymobile = ["idevice/crashreportcopymobile"]
|
crashreportcopymobile = ["idevice/crashreportcopymobile"]
|
||||||
debug_proxy = ["idevice/debug_proxy"]
|
debug_proxy = ["idevice/debug_proxy"]
|
||||||
|
|||||||
@@ -299,6 +299,7 @@ pub unsafe extern "C" fn app_service_free_app_list(apps: *mut AppListEntryC, cou
|
|||||||
/// * [`argc`] - Number of arguments
|
/// * [`argc`] - Number of arguments
|
||||||
/// * [`kill_existing`] - Whether to kill existing instances
|
/// * [`kill_existing`] - Whether to kill existing instances
|
||||||
/// * [`start_suspended`] - Whether to start suspended
|
/// * [`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)
|
/// * [`response`] - Pointer to store the launch response (caller must free)
|
||||||
///
|
///
|
||||||
/// # Returns
|
/// # Returns
|
||||||
@@ -314,6 +315,7 @@ pub unsafe extern "C" fn app_service_launch_app(
|
|||||||
argc: usize,
|
argc: usize,
|
||||||
kill_existing: c_int,
|
kill_existing: c_int,
|
||||||
start_suspended: c_int,
|
start_suspended: c_int,
|
||||||
|
stdio_uuid: *const u8,
|
||||||
response: *mut *mut LaunchResponseC,
|
response: *mut *mut LaunchResponseC,
|
||||||
) -> *mut IdeviceFfiError {
|
) -> *mut IdeviceFfiError {
|
||||||
if handle.is_null() || bundle_id.is_null() || response.is_null() {
|
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 client = unsafe { &mut (*handle).0 };
|
||||||
let res = RUNTIME.block_on(async move {
|
let res = RUNTIME.block_on(async move {
|
||||||
client
|
client
|
||||||
@@ -347,6 +356,7 @@ pub unsafe extern "C" fn app_service_launch_app(
|
|||||||
start_suspended != 0,
|
start_suspended != 0,
|
||||||
None, // environment
|
None, // environment
|
||||||
None, // platform_options
|
None, // platform_options
|
||||||
|
stdio_uuid,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user