예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
 public static extern int Assemble([MarshalAs(UnmanagedType.LPStr)] string cmd, uint ip, ref AsmModel model, int attempt, int constsize, char[] errtext);
예제 #4
0
파일: Kernel32.cs 프로젝트: usertoroot/KIN
        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;
        }
예제 #5
0
파일: Kernel32.cs 프로젝트: usertoroot/KIN
        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;
        }
예제 #6
0
파일: Kernel32.cs 프로젝트: usertoroot/KIN
 public static extern int Assemble([MarshalAs(UnmanagedType.LPStr)]string cmd, uint ip, ref AsmModel model, int attempt, int constsize, char[] errtext);