internal static void dump(mach_msg msg, uint size) { unsafe { int ctr = 0; int ln = 0; void *msgptr = &msg; for (int i = 0; i < size; i++) { if (ln == 0 && ctr == 0) { Console.Write("\t0x{0:x} ", ((int)msgptr) + i); } byte b = Marshal.ReadByte((IntPtr)((int)msgptr + i)); Console.Write("{0:x2}", b); ++ctr; if (ctr == 4) { Console.Write(" "); ctr = 0; ln++; } if (ln == 4) { Console.WriteLine(); ln = 0; } } for (int i = 0; i < (4 - ln); i++) { Console.Write("00000000 "); } Console.WriteLine(); } }
internal extern static int mach_msg(ref mach_msg msg, uint message_type, uint snd_size, int rcv_size, IntPtr exception_port, int unknown, int mach_port);
internal extern static int mach_msg (ref mach_msg msg, uint message_type, uint snd_size, int rcv_size, IntPtr exception_port, int unknown, int mach_port);
internal static void dump (mach_msg msg, uint size) { unsafe { int ctr = 0; int ln = 0; void *msgptr = &msg; for (int i = 0; i < size; i++) { if (ln == 0 && ctr == 0) Console.Write ("\t0x{0:x} ", ((int)msgptr)+i); byte b = Marshal.ReadByte ((IntPtr)((int)msgptr+i)); Console.Write ("{0:x2}", b); ++ctr; if (ctr == 4) { Console.Write (" "); ctr = 0; ln++; } if (ln == 4) { Console.WriteLine (); ln = 0; } } for (int i = 0; i < (4-ln); i++) Console.Write ("00000000 "); Console.WriteLine (); } }