File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,22 +23,22 @@ internal static extern bool BNGetInstructionTextWithContext(
2323 IntPtr arch ,
2424
2525 // const uint8_t* data
26- IntPtr data ,
26+ byte [ ] data ,
2727
2828 // uint64_t addr
2929 ulong addr ,
3030
3131 // size_t* len
32- IntPtr len ,
32+ ref UIntPtr len ,
3333
3434 // void* context
3535 IntPtr context ,
3636
3737 // BNInstructionTextToken** result
38- IntPtr result ,
38+ out IntPtr result ,
3939
4040 // size_t* count
41- IntPtr count
41+ out UIntPtr count
4242 ) ;
4343 }
4444}
Original file line number Diff line number Diff line change @@ -572,6 +572,42 @@ out arrayLength
572572 return tokens ;
573573 }
574574
575+ public InstructionTextToken [ ] GetInstructionTextWithContext (
576+ byte [ ] data ,
577+ ulong address ,
578+ ref ulong length ,
579+ IntPtr context
580+ )
581+ {
582+ if ( null == data )
583+ {
584+ throw new ArgumentNullException ( nameof ( data ) ) ;
585+ }
586+
587+ UIntPtr nativeLength = new UIntPtr ( length ) ;
588+ bool ok = NativeMethods . BNGetInstructionTextWithContext (
589+ this . handle ,
590+ data ,
591+ address ,
592+ ref nativeLength ,
593+ context ,
594+ out IntPtr tokens ,
595+ out UIntPtr count
596+ ) ;
597+ length = nativeLength . ToUInt64 ( ) ;
598+ if ( ! ok )
599+ {
600+ return Array . Empty < InstructionTextToken > ( ) ;
601+ }
602+
603+ return UnsafeUtils . TakeStructArrayEx < BNInstructionTextToken , InstructionTextToken > (
604+ tokens ,
605+ count . ToUInt64 ( ) ,
606+ InstructionTextToken . FromNative ,
607+ NativeMethods . BNFreeInstructionText
608+ ) ;
609+ }
610+
575611 public string GetRegisterName ( RegisterIndex reg )
576612 {
577613 return UnsafeUtils . TakeAnsiString (
@@ -1190,4 +1226,4 @@ public void SetStdcallCallingConvention(CallingConvention cc)
11901226
11911227 }
11921228
1193- }
1229+ }
You can’t perform that action at this time.
0 commit comments