IOMobileFramebufferGetLayerDefaultSurface在ios7视网膜上不工作

IOMobileFramebufferGetLayerDefaultSurface在ios7视网膜上不工作,ios7,frameworks,screen-capture,retina,Ios7,Frameworks,Screen Capture,Retina,我想从后台服务截图。它在ios6和ios7下工作正常,但在ios7下崩溃 这是我的密码 { IOMobileFramebufferConnection connect; kern_return_t result; m_screenSurfaceRef = NULL; io_service_t framebufferService = IOServiceGetMatchingService(kIOMasterPortDefault, IOServ

我想从后台服务截图。它在ios6和ios7下工作正常,但在ios7下崩溃

这是我的密码

{

IOMobileFramebufferConnection connect;
        kern_return_t result;
        m_screenSurfaceRef = NULL;

        io_service_t framebufferService = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("AppleH1CLCD"));
        if(!framebufferService)
            framebufferService = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("AppleM2CLCD"));
        if(!framebufferService)
            framebufferService = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("AppleCLCD"));

#pragma unused(result)
        result = IOMobileFramebufferOpen(framebufferService, mach_task_self(), 0, &connect);

        result = IOMobileFramebufferGetLayerDefaultSurface(connect, 0, &m_screenSurfaceRef);

}
在视网膜上运行时,IOMobileFramebufferGetLayerDefaultSurface(connect、0和m_screenSurfaceRef)崩溃

事故信息:

线程#1:tid=0x1dfe9,0x000000018ea2c270 IOMobileFramebuffer
IOMobileFramebufferGetLayerDefaultSurface+4,队列='com.apple.main-thread,停止原因=EXC_BAD_访问(代码=1,地址=0x5e06dc28)
帧0:0x000000018ea2c270 IOMobileFramebuffer
IOMobileFramebufferGetLayerDefaultSurface+4


这是IOMobileFramebuffer.h反向工程的64位问题。原型

IOMobileFramebufferReturn IOMobileFramebufferGetLayerDefaultSurface(IOMobileFramebufferConnection connection, int surface, CoreSurfaceBufferRef *ptr);
。。。不正确,因为IOMobileFramebufferConnection的typedef不正确。如果查看IOMobileFramebufferGetLayerDefaultSurface的反汇编和部分反编译:

IOMobileFramebufferReturn IOMobileFramebufferGetLayerDefaultSurface(Connection *connection, int surface, IOSurfaceRef *ptr)
{
    if(connection) {                       // 0x18f95026c:  cbz    x0, 0x18f95027c
            long tmp = connection->unk2;   // 0x18f950270:  ldr    x3, [x0, #552] // <== Crash!
            if(tmp) {                      // 0x18f950274:  cbz    x3, 0x18f95027c
                    goto tmp;              // 0x18f950278:  br     x3
            }
   }
   //0x18f95027c:  movn   w0, #8191, lsl #16
   //0x18f950280:  movk   w0, #706
   //0x18f950284:  ret    lr

}

完整更正的标头可在中找到。

这是IOMobileFramebuffer.h反向工程中的64位问题。原型

IOMobileFramebufferReturn IOMobileFramebufferGetLayerDefaultSurface(IOMobileFramebufferConnection connection, int surface, CoreSurfaceBufferRef *ptr);
。。。不正确,因为IOMobileFramebufferConnection的typedef不正确。如果查看IOMobileFramebufferGetLayerDefaultSurface的反汇编和部分反编译:

IOMobileFramebufferReturn IOMobileFramebufferGetLayerDefaultSurface(Connection *connection, int surface, IOSurfaceRef *ptr)
{
    if(connection) {                       // 0x18f95026c:  cbz    x0, 0x18f95027c
            long tmp = connection->unk2;   // 0x18f950270:  ldr    x3, [x0, #552] // <== Crash!
            if(tmp) {                      // 0x18f950274:  cbz    x3, 0x18f95027c
                    goto tmp;              // 0x18f950278:  br     x3
            }
   }
   //0x18f95027c:  movn   w0, #8191, lsl #16
   //0x18f950280:  movk   w0, #706
   //0x18f950284:  ret    lr

}

完整更正的标题可以在中找到。

似乎在64位以上的视网膜上崩溃,而不仅仅是视网膜。你也看到了吗?@nevyn谢谢,我开发了32位的应用程序,效果很好。这是一个不幸但可能可以接受的解决方法。然而,我在下面提供的答案要好得多。你想接受它吗?似乎在64位以上的视网膜上崩溃,而不仅仅是视网膜。你也看到了吗?@nevyn谢谢,我开发了32位的应用程序,效果很好。这是一个不幸但可能可以接受的解决方法。然而,我在下面提供的答案要好得多。你愿意接受吗?