/*! * \brief Get contents of a file in the archive * * \param cpio CCpioFile object * \param filename Filename * \param data Output data * \param size Size of output data * * \return true on success or false on failure and error set appropriately * * \sa CpioFile::contents() */ bool mbp_cpiofile_contents(const CCpioFile *cpio, const char *filename, const unsigned char **data, size_t *size) { CCAST(cpio); return cf->contentsC(filename, data, size); }
ATP_Array ATP_arrayDuplicate(const ATP_Array *p_array) { UT_array *l_copy; utarray_new(l_copy, &cs_valueIcd); utarray_concat(l_copy, CCAST(p_array)); return (struct ATP_ArrayImpl *) l_copy; }
/*! * \brief Get AutoPatcher arguments * * \param info CPatchInfo object * \param apName AutoPatcher name * * \return Arguments * * \sa PatchInfo::autoPatcherArgs() */ CStringMap * mbp_patchinfo_autopatcher_args(const CPatchInfo *info, const char *apName) { CCAST(info); mbp::PatchInfo::AutoPatcherArgs *args = new mbp::PatchInfo::AutoPatcherArgs(pi->autoPatcherArgs(apName)); return reinterpret_cast<CStringMap *>(args); }
ATP_ValueType ATP_arrayGetType(const ATP_Array *p_array, unsigned int p_index) { Value *l_entry = (Value *) utarray_eltptr(CCAST(p_array), p_index); if (l_entry == NULL) { ERR("Index out of bounds\n"); return e_ATP_ValueType_none; } return l_entry->m_type; }
/*! * \brief Constructs the boot image binary data * * \note The output data is dynamically allocated. It should be free()'d * when it is no longer needed. * * \param bootImage CBootImage object * \param data Output data * \param size Size of output data * * \sa BootImage::create() */ bool mbp_bootimage_create_data(const CBootImage *bootImage, unsigned char **data, size_t *size) { CCAST(bootImage); std::vector<unsigned char> vData; if (bi->create(&vData)) { vector_to_data(vData, reinterpret_cast<void **>(data), size); return true; } else { return false; } }
int ATP_arrayGetArray(const ATP_Array *p_array, unsigned int p_index, ATP_Array **p_value) { Value *l_entry = (Value *) utarray_eltptr(CCAST(p_array), p_index); if (l_entry == NULL) { ERR("Index out of bounds\n"); return 0; } if (l_entry->m_type == e_ATP_ValueType_array) { *p_value = &l_entry->m_value.m_array; return 1; } return 0; }
int ATP_arrayGetString(const ATP_Array *p_array, unsigned int p_index, const char **p_value) { Value *l_entry = (Value *) utarray_eltptr(CCAST(p_array), p_index); if (l_entry == NULL) { ERR("Index out of bounds\n"); return 0; } if (l_entry->m_type == e_ATP_ValueType_string) { *p_value = utstring_body(&l_entry->m_value.m_string); return 1; } return 0; }
/*! * \brief Whether device model checks should be kept * * \param info CPatchInfo object * * \return Whether device model checks should be kept * * \sa PatchInfo::deviceCheck() */ bool mbp_patchinfo_device_check(const CPatchInfo *info) { CCAST(info); return pi->deviceCheck(); }
/*! * \brief Whether boot images should be autodetected * * \param info CPatchInfo object * * \return Whether boot images should be autodetected * * \sa PatchInfo::autodetectBootImages() */ bool mbp_patchinfo_autodetect_boot_images(const CPatchInfo *info) { CCAST(info); return pi->autodetectBootImages(); }
void mbp_bootimage_sin_header(const CBootImage *bootImage, const unsigned char **data, size_t *size) { CCAST(bootImage); bi->sinHeaderC(data, size); }
void mbp_bootimage_ramdisk_mtk_header(const CBootImage *bootImage, const unsigned char **data, size_t *size) { CCAST(bootImage); bi->ramdiskMtkHeaderC(data, size); }
/*! * \brief Device tree image * * \param bootImage CBootImage object * \param data Output data * \param size Output size * * \sa BootImage::deviceTreeImage() */ void mbp_bootimage_device_tree_image(const CBootImage *bootImage, const unsigned char **data, size_t *size) { CCAST(bootImage); bi->deviceTreeImageC(data, size); }
/*! * \brief Kernel cmdline in the boot image header * * \param bootImage CBootImage object * * \return Kernel cmdline * * \sa BootImage::kernelCmdline() */ const char * mbp_bootimage_kernel_cmdline(const CBootImage *bootImage) { CCAST(bootImage); return bi->kernelCmdlineC(); }
/*! * \brief Board name field in the boot image header * * \param bootImage CBootImage object * * \return Board name * * \sa BootImage::boardName() */ const char * mbp_bootimage_boardname(const CBootImage *bootImage) { CCAST(bootImage); return bi->boardNameC(); }
enum BootImageType mbp_bootimage_target_type(const CBootImage *bootImage) { CCAST(bootImage); return static_cast<BootImageType>(bi->targetType()); }
/*! * \brief Ramdisk image * * \param bootImage CBootImage object * \param data Output data * \param size Output size * * \sa BootImage::ramdiskImage() */ void mbp_bootimage_ramdisk_image(const CBootImage *bootImage, const unsigned char **data, size_t *size) { CCAST(bootImage); bi->ramdiskImageC(data, size); }
/*! * \brief Second bootloader image * * \param bootImage CBootImage object * \param data Output data * \param size Output size * * \sa BootImage::secondBootloaderImage() */ void mbp_bootimage_second_bootloader_image(const CBootImage *bootImage, const unsigned char **data, size_t *size) { CCAST(bootImage); bi->secondBootloaderImageC(data, size); }
/*! * \brief Page size field in the boot image header * * \param bootImage CBootImage object * * \return Page size * * \sa BootImage::pageSize() */ uint32_t mbp_bootimage_page_size(const CBootImage *bootImage) { CCAST(bootImage); return bi->pageSize(); }
void mbp_bootimage_kernel_mtk_header(const CBootImage *bootImage, const unsigned char **data, size_t *size) { CCAST(bootImage); bi->kernelMtkHeaderC(data, size); }
/*! * \brief Ramdisk address field in the boot image header * * \param bootImage CBootImage object * * \return Ramdisk address * * \sa BootImage::ramdiskAddress() */ uint32_t mbp_bootimage_ramdisk_address(const CBootImage *bootImage) { CCAST(bootImage); return bi->ramdiskAddress(); }
void mbp_bootimage_appsbl_image(const CBootImage *bootImage, const unsigned char **data, size_t *size) { CCAST(bootImage); bi->appsblImageC(data, size); }
/*! * \brief Second bootloader address field in the boot image header * * \param bootImage CBootImage object * * \return Second bootloader address * * \sa BootImage::secondBootloaderAddress() */ uint32_t mbp_bootimage_second_bootloader_address(const CBootImage *bootImage) { CCAST(bootImage); return bi->secondBootloaderAddress(); }
/*! * \brief Get the error information * * \note The returned ErrorCode is filled with valid data only if a * CBootImage operation has failed. * * \note The returned ErrorCode should be freed with mbp_error_destroy() * when it is no longer needed. * * \param bootImage CBootImage object * * \return ErrorCode * * \sa BootImage::error() */ /* enum ErrorCode */ int mbp_bootimage_error(const CBootImage *bootImage) { CCAST(bootImage); return static_cast<int>(bi->error()); }
/*! * \brief Kernel tags address field in the boot image header * * \param bootImage CBootImage object * * \return Kernel tags address * * \sa BootImage::kernelTagsAddress() */ uint32_t mbp_bootimage_kernel_tags_address(const CBootImage *bootImage) { CCAST(bootImage); return bi->kernelTagsAddress(); }
/*! * \brief Whether the patched file has a boot image * * \param info CPatchInfo object * * \return Whether the patched file has a boot image * * \sa PatchInfo::hasBootImage() */ bool mbp_patchinfo_has_boot_image(const CPatchInfo *info) { CCAST(info); return pi->hasBootImage(); }
uint32_t mbp_bootimage_rpm_address(const CBootImage *bootImage) { CCAST(bootImage); return bi->rpmAddress(); }
/*! * \brief Which ramdisk patcher to use * * \note The output data is dynamically allocated. It should be `free()`'d * when it is no longer needed. * * \param info CPatchInfo object * * \return Which ramdisk patcher to use * * \sa PatchInfo::ramdisk() */ char * mbp_patchinfo_ramdisk(const CPatchInfo *info) { CCAST(info); return string_to_cstring(pi->ramdisk()); }
uint32_t mbp_bootimage_appsbl_address(const CBootImage *bootImage) { CCAST(bootImage); return bi->appsblAddress(); }
/*! * \brief PatchInfo identifier * * \note The output data is dynamically allocated. It should be `free()`'d * when it is no longer needed. * * \param info CPatchInfo object * * \return PatchInfo ID * * \sa PatchInfo::id() */ char * mbp_patchinfo_id(const CPatchInfo *info) { CCAST(info); return string_to_cstring(pi->id()); }
uint32_t mbp_bootimage_entrypoint_address(const CBootImage *bootImage) { CCAST(bootImage); return bi->entrypointAddress(); }