Skip to content
MachoFileOpenFromMemory

MachoFileOpenFromMemory

Description

Parse a Mach-O image from an in-memory byte range. data is borrowed; the caller must keep it alive for the MachoFile’s lifetime.

Success

Returns true; out->owns_data is false.

Failure

Returns false. out is left zeroed.

Usage example (Cross-references)

Usage examples (Cross-references)
    
        MachoFile m;
        bool      ok = MachoFileOpenFromMemory(&m, blob, sizeof(blob), base);
        if (!ok) {
            DefaultAllocatorDeinit(&alloc);
    
        MachoFile m;
        if (!MachoFileOpenFromMemory(&m, blob, sizeof(blob), base)) {
            DefaultAllocatorDeinit(&alloc);
            return false;
    
        MachoFile m;
        bool      ok = !MachoFileOpenFromMemory(&m, fat, sizeof(fat), base);
    
        DefaultAllocatorDeinit(&alloc);
    // ---------------------------------------------------------------------------
    
    bool MachoFileOpenFromMemory(MachoFile *out, u8 *data, size data_size, Allocator *alloc) {
        if (!out || !data || !alloc) {
            LOG_ERROR("MachoFileOpenFromMemory: NULL argument");
    bool MachoFileOpenFromMemory(MachoFile *out, u8 *data, size data_size, Allocator *alloc) {
        if (!out || !data || !alloc) {
            LOG_ERROR("MachoFileOpenFromMemory: NULL argument");
            return false;
        }
            return false;
        }
        if (!MachoFileOpenFromMemory(out, (u8 *)buf, (size)bytes, alloc)) {
            AllocatorFree(alloc, buf, capacity);
            return false;
Last updated on