CallAddress() public method

Simple function call with optional return value. Average execution time of 1.3 ms without return or 1.75ms with return.
0x10000 is reserved for function use.
public CallAddress ( uint address, bool returnValue ) : uint
address uint Xbox procedure address.
returnValue bool
return uint
Ejemplo n.º 1
0
        public static bool UnloadModule(Xbox xbox, uint base_address, uint exit_address)
        {
            SetBreakpointOn(xbox);            //xbox.Pause();
            xbox.CallAddress(exit_address, false);
            xbox.FreeDebugMemory(base_address);
            SetBreakpointOff(xbox);            //xbox.Continue();

            return(true);
        }
Ejemplo n.º 2
0
        public static bool RunModule(Xbox xbox, string module_path, ref uint base_address,
                                     out uint entry_point, out uint exit_address, out string error_details)
        {
            entry_point   = exit_address = uint.MaxValue;
            error_details = null;
            LowLevel.HResult result;

            if (!File.Exists(module_path))
            {
                error_details = "File does not exist!";
                return(false);
            }

            byte[] rebased_module;
            result = RebasedModuleBufferAllocate(module_path, out rebased_module, out error_details);

            if (result == LowLevel.HResult.Success)
            {
                try { base_address = xbox.AllocateMemory((uint)rebased_module.Length); }
                catch (Exception ex)
                {
                    result        = LowLevel.HResult.Unexpected;
                    error_details = ex.ToString();
                }

                entry_point = base_address;
                try { result = RebaseModule(xbox, module_path, rebased_module, ref entry_point); }
                catch (Exception ex)
                {
                    result        = LowLevel.HResult.Unexpected;
                    error_details = ex.ToString();
                }
                entry_point += base_address;

                if (result == LowLevel.HResult.Success)
                {
                    xbox.Pause();
                    xbox.SetMemory(base_address, rebased_module);
                    exit_address = xbox.CallAddress(entry_point, true);
                    xbox.Continue();
                }
            }

            if (error_details == null)
            {
                error_details = GetResultString(result);
            }

            return(result == LowLevel.HResult.Success);
        }
Ejemplo n.º 3
0
		public static bool UnloadModule(Xbox xbox, uint base_address, uint exit_address)
		{
			SetBreakpointOn(xbox);//xbox.Pause();
			xbox.CallAddress(exit_address, false);
			xbox.FreeDebugMemory(base_address);
			SetBreakpointOff(xbox);//xbox.Continue();

			return true;
		}
Ejemplo n.º 4
0
		public static bool RunModule(Xbox xbox, string module_path, ref uint base_address, 
			out uint entry_point, out uint exit_address, out string error_details)
		{
			entry_point = exit_address = uint.MaxValue;
			error_details = null;
			LowLevel.HResult result;

			if (!File.Exists(module_path))
			{
				error_details = "File does not exist!";
				return false;
			}

			byte[] rebased_module;
			result = RebasedModuleBufferAllocate(module_path, out rebased_module, out error_details);

			if (result == LowLevel.HResult.Success)
			{
				try { base_address = xbox.AllocateMemory((uint)rebased_module.Length); }
				catch (Exception ex)
				{
					result = LowLevel.HResult.Unexpected;
					error_details = ex.ToString();
				}

				entry_point = base_address;
				try { result = RebaseModule(xbox, module_path, rebased_module, ref entry_point); }
				catch (Exception ex)
				{
					result = LowLevel.HResult.Unexpected;
					error_details = ex.ToString();
				}
				entry_point += base_address;

				if (result == LowLevel.HResult.Success)
				{
					xbox.Pause();
					xbox.SetMemory(base_address, rebased_module);
					exit_address = xbox.CallAddress(entry_point, true);
					xbox.Continue();
				}
			}

			if(error_details == null)
				error_details = GetResultString(result);

			return result == LowLevel.HResult.Success;
		}