| 415 | |
| 416 | |
| 417 | class CoreRenderLayer(RenderLayer): |
| 418 | |
| 419 | def apply_to_flow_graph(self, graph: 'binaryninja.FlowGraph') -> None: |
| 420 | core.BNApplyRenderLayerToFlowGraph(self.handle, graph.handle) |
| 421 | |
| 422 | def apply_to_linear_view_object( |
| 423 | self, |
| 424 | obj: 'binaryninja.LinearViewObject', |
| 425 | prev: Optional['binaryninja.LinearViewObject'], |
| 426 | next: Optional['binaryninja.LinearViewObject'], |
| 427 | lines: List['binaryninja.LinearDisassemblyLine'] |
| 428 | ) -> List['binaryninja.LinearDisassemblyLine']: |
| 429 | |
| 430 | in_lines_buf = (core.BNLinearDisassemblyLine * len(lines))() |
| 431 | for i, r in enumerate(lines): |
| 432 | in_lines_buf[i] = r._to_core_struct() |
| 433 | |
| 434 | out_lines = ctypes.POINTER(core.BNLinearDisassemblyLine)() |
| 435 | out_line_count = ctypes.c_size_t(0) |
| 436 | |
| 437 | core.BNApplyRenderLayerToLinearViewObject( |
| 438 | self.handle, |
| 439 | obj.handle, |
| 440 | prev.handle if prev is not None else None, |
| 441 | next.handle if next is not None else None, |
| 442 | in_lines_buf, |
| 443 | len(lines), |
| 444 | out_lines, |
| 445 | out_line_count |
| 446 | ) |
| 447 | |
| 448 | result = [] |
| 449 | for i in range(out_line_count.value): |
| 450 | result.append(binaryninja.LinearDisassemblyLine._from_core_struct(out_lines[i], obj=obj)) |
| 451 | |
| 452 | core.BNFreeLinearDisassemblyLines(out_lines, out_line_count.value) |
| 453 | |
| 454 | return result |