Ejemplo n.º 1
0
        public T CallIngameFuncReg <T>(Memloc functionAddress, IEnumerable <dynamic> args,
                                       dynamic eax = null,
                                       dynamic ecx = null,
                                       dynamic edx = null,
                                       dynamic ebx = null,
                                       dynamic esp = null,
                                       dynamic esi = null,
                                       dynamic edi = null)
        {
            if (CodeHandle.IsClosed || CodeHandle.IsInvalid)
            {
                CompletelyReInitializeAndInjectCodeInNewLocation();
            }

            Kernel.CheckAddress(CodeHandle.GetHandle(), FUNCTION_CALL_ASM_BUFFER_SIZE, "execute function");

            Buffer_ParamPointerList.Clear();

            InitAsmBuffer(functionAddress, args, Buffer_ParamPointerList, eax, ecx, edx, ebx, esp, esi, edi);

            if (!InjectEntireCodeBuffer())
            {
                Extra.Dbg.PrintErr("WARNING: CODE INJECT FAILURE");
            }

            //luai.DebugUpdate()

            foreach (SafeRemoteHandle ptr in Buffer_ParamPointerList)
            {
                ptr.Dispose();
            }


            Buffer_ResultBytes = ExecuteAsm();

            Buffer_Result = GetFunctionCallResult <T>(Buffer_ResultBytes);

            foreach (SafeRemoteHandle ptr in Buffer_ParamPointerList)
            {
                ptr.Close();
                ptr.Dispose();
            }

            Buffer_ParamPointerList.Clear();

            return(Buffer_Result);
        }
Ejemplo n.º 2
0
        public T CallIngameFunc64 <T>(Memloc functionAddress, IEnumerable <dynamic> args)
        {
            if (CodeHandle.IsClosed || CodeHandle.IsInvalid)
            {
                CompletelyReInitializeAndInjectCodeInNewLocation();
            }

            Kernel.CheckAddress(CodeHandle.GetHandle(), FUNCTION_CALL_ASM_BUFFER_SIZE, "execute function");

            byte[] byt = InitAsm64Buffer(functionAddress, args, Buffer_ParamPointerList);



            if (!(WriteAsm(CodeHandle.GetHandle(), byt, byt.Length)))
            {
                Extra.Dbg.PrintErr("WARNING: CODE INJECT FAILURE");
            }

            foreach (SafeRemoteHandle ptr in Buffer_ParamPointerList)
            {
                ptr.Dispose();
            }

            Buffer_ResultBytes = ExecuteAsm();

            Buffer_Result = GetFunctionCallResult <T>(Buffer_ResultBytes);


            foreach (SafeRemoteHandle ptr in Buffer_ParamPointerList)
            {
                ptr.Close();
                ptr.Dispose();
            }

            Buffer_ParamPointerList.Clear();

            return(Buffer_Result);
        }