public static unsafe int Assemble(string cmd, byte *buffer, int length, uint ip = 0) { AsmModel model = new AsmModel(); char[] error = new char[1024]; int ret = Kernel32.Assemble(cmd, ip, ref model, 0, 0, error); if (ret <= 0) { throw new Exception(new string(error)); } if (ret > length) { throw new Exception("Buffer too small!"); } byte *b = &model.Code; for (int x = 0; x < ret; x++) { buffer[x] = b[x]; } return(ret); }
public static unsafe byte[] Assemble(string cmd) { AsmModel model = new AsmModel(); char[] error = new char[1024]; int ret = Kernel32.Assemble(cmd, 0, ref model, 0, 0, error); if (ret <= 0) { throw new Exception(new string(error)); } byte[] buff = new byte[ret]; fixed(byte *a = buff) { byte *b = &model.Code; for (int x = 0; x < ret; x++) { a[x] = b[x]; } } return(buff); }
public static extern int Assemble([MarshalAs(UnmanagedType.LPStr)] string cmd, uint ip, ref AsmModel model, int attempt, int constsize, char[] errtext);
public static unsafe int Assemble(string cmd, byte* buffer, int length, uint ip = 0) { AsmModel model = new AsmModel(); char[] error = new char[1024]; int ret = Kernel32.Assemble(cmd, ip, ref model, 0, 0, error); if (ret <= 0) throw new Exception(new string(error)); if (ret > length) throw new Exception("Buffer too small!"); byte* b = &model.Code; for (int x = 0; x < ret; x++) buffer[x] = b[x]; return ret; }
public static unsafe byte[] Assemble(string cmd) { AsmModel model = new AsmModel(); char[] error = new char[1024]; int ret = Kernel32.Assemble(cmd, 0, ref model, 0, 0, error); if (ret <= 0) throw new Exception(new string(error)); byte[] buff = new byte[ret]; fixed (byte* a = buff) { byte* b = &model.Code; for (int x = 0; x < ret; x++) a[x] = b[x]; } return buff; }
public static extern int Assemble([MarshalAs(UnmanagedType.LPStr)]string cmd, uint ip, ref AsmModel model, int attempt, int constsize, char[] errtext);