diff options
| author | 2024-06-27 11:20:59 +0200 | |
|---|---|---|
| committer | 2024-06-27 11:20:59 +0200 | |
| commit | 68df374762b95ab40ca5242da66e3474360669b5 (patch) | |
| tree | a75acdd2a57df58346f02e75577c7dad00b52b83 /cython | |
| parent | ed0d66d0341562731bb19928dfe48155509fa7a7 (diff) | |
| download | libimobiledevice-68df374762b95ab40ca5242da66e3474360669b5.tar.gz libimobiledevice-68df374762b95ab40ca5242da66e3474360669b5.tar.bz2 | |
Add support for iOS 17+ Personalized Developer Disk image mounting
Diffstat (limited to 'cython')
| -rw-r--r-- | cython/mobile_image_mounter.pxi | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/cython/mobile_image_mounter.pxi b/cython/mobile_image_mounter.pxi index a23a59b..d9d40d5 100644 --- a/cython/mobile_image_mounter.pxi +++ b/cython/mobile_image_mounter.pxi | |||
| @@ -13,7 +13,9 @@ cdef extern from "libimobiledevice/mobile_image_mounter.h": | |||
| 13 | mobile_image_mounter_error_t mobile_image_mounter_new(idevice_t device, lockdownd_service_descriptor_t descriptor, mobile_image_mounter_client_t *client) | 13 | mobile_image_mounter_error_t mobile_image_mounter_new(idevice_t device, lockdownd_service_descriptor_t descriptor, mobile_image_mounter_client_t *client) |
| 14 | mobile_image_mounter_error_t mobile_image_mounter_free(mobile_image_mounter_client_t client) | 14 | mobile_image_mounter_error_t mobile_image_mounter_free(mobile_image_mounter_client_t client) |
| 15 | mobile_image_mounter_error_t mobile_image_mounter_lookup_image(mobile_image_mounter_client_t client, char *image_type, plist.plist_t *result) | 15 | mobile_image_mounter_error_t mobile_image_mounter_lookup_image(mobile_image_mounter_client_t client, char *image_type, plist.plist_t *result) |
| 16 | mobile_image_mounter_error_t mobile_image_mounter_mount_image(mobile_image_mounter_client_t client, char *image_path, char *image_signature, uint16_t signature_length, char *image_type, plist.plist_t *result) | 16 | mobile_image_mounter_error_t mobile_image_mounter_mount_image_with_options(mobile_image_mounter_client_t client, char *image_path, const unsigned char *signature, unsigned int signature_length, char *image_type, plist.plist_t options, plist.plist_t *result) |
| 17 | mobile_image_mounter_error_t mobile_image_mounter_mount_image(mobile_image_mounter_client_t client, char *image_path, const unsigned char *signature, unsigned int signature_length, char *image_type, plist.plist_t *result) | ||
| 18 | mobile_image_mounter_error_t mobile_image_mounter_unmount_image(mobile_image_mounter_client_t client, const char *mount_path); | ||
| 17 | mobile_image_mounter_error_t mobile_image_mounter_hangup(mobile_image_mounter_client_t client) | 19 | mobile_image_mounter_error_t mobile_image_mounter_hangup(mobile_image_mounter_client_t client) |
| 18 | 20 | ||
| 19 | cdef class MobileImageMounterError(BaseError): | 21 | cdef class MobileImageMounterError(BaseError): |
| @@ -57,11 +59,39 @@ cdef class MobileImageMounterClient(PropertyListService): | |||
| 57 | if c_node != NULL: | 59 | if c_node != NULL: |
| 58 | plist.plist_free(c_node) | 60 | plist.plist_free(c_node) |
| 59 | 61 | ||
| 60 | cpdef plist.Node mount_image(self, bytes image_path, bytes image_signature, bytes image_type): | 62 | cpdef plist.Node mount_image_with_options(self, bytes image_path, bytes signature, bytes image_type, object options): |
| 61 | cdef: | 63 | cdef: |
| 64 | plist.Node n_options | ||
| 65 | plist.plist_t c_options | ||
| 66 | plist.plist_t c_result = NULL | ||
| 67 | bint free_options = False | ||
| 62 | plist.plist_t c_node = NULL | 68 | plist.plist_t c_node = NULL |
| 63 | mobile_image_mounter_error_t err | 69 | mobile_image_mounter_error_t err |
| 64 | err = mobile_image_mounter_mount_image(self._c_client, image_path, image_signature, len(image_signature), | 70 | if isinstance(options, plist.Dict): |
| 71 | n_options = options | ||
| 72 | c_options = n_options._c_node | ||
| 73 | elif isinstance(options, dict): | ||
| 74 | c_options = plist.native_to_plist_t(options) | ||
| 75 | free_options = True | ||
| 76 | else: | ||
| 77 | raise InstallationProxyError(INSTPROXY_E_INVALID_ARG) | ||
| 78 | err = mobile_image_mounter_mount_image_with_options(self._c_client, image_path, signature, len(signature), | ||
| 79 | image_type, c_options, &c_node) | ||
| 80 | if free_options: | ||
| 81 | plist.plist_free(c_options) | ||
| 82 | try: | ||
| 83 | self.handle_error(err) | ||
| 84 | |||
| 85 | return plist.plist_t_to_node(c_node) | ||
| 86 | except Exception, e: | ||
| 87 | if c_node != NULL: | ||
| 88 | plist.plist_free(c_node) | ||
| 89 | |||
| 90 | cpdef plist.Node mount_image(self, bytes image_path, bytes signature, bytes image_type): | ||
| 91 | cdef: | ||
| 92 | plist.plist_t c_node = NULL | ||
| 93 | mobile_image_mounter_error_t err | ||
| 94 | err = mobile_image_mounter_mount_image(self._c_client, image_path, signature, len(signature), | ||
| 65 | image_type, &c_node) | 95 | image_type, &c_node) |
| 66 | 96 | ||
| 67 | try: | 97 | try: |
| @@ -72,6 +102,13 @@ cdef class MobileImageMounterClient(PropertyListService): | |||
| 72 | if c_node != NULL: | 102 | if c_node != NULL: |
| 73 | plist.plist_free(c_node) | 103 | plist.plist_free(c_node) |
| 74 | 104 | ||
| 105 | cpdef unmount_image(self, bytes mount_path): | ||
| 106 | cdef: | ||
| 107 | mobile_image_mounter_error_t err | ||
| 108 | err = mobile_image_mounter_unmount_image(self._c_client, mount_path) | ||
| 109 | |||
| 110 | self.handle_error(err) | ||
| 111 | |||
| 75 | cpdef hangup(self): | 112 | cpdef hangup(self): |
| 76 | cdef mobile_image_mounter_error_t err | 113 | cdef mobile_image_mounter_error_t err |
| 77 | err = mobile_image_mounter_hangup(self._c_client) | 114 | err = mobile_image_mounter_hangup(self._c_client) |
