Struct mem_rs::process::Process

source ·
pub struct Process { /* private fields */ }

Implementations§

source§

impl Process

source

pub fn inject_dll(&self, dll_path: &str) -> Result<(), String>

Examples found in repository?
examples/dsr.rs (line 71)
67
68
69
70
71
72
    pub fn inject_soulmemory_rs(&self)
    {
        //self.process.inject_dll(r#"C:\soulmemory\soulmemory_rs.dll"#);
        //self.process.inject_dll(r#"C:\projects\soulmemory-rs\target\x86_64-pc-windows-msvc\release\soulmemory_rs.dll"#);
        self.process.inject_dll(r#"C:\projects\soulmemory-rs\target\x86_64-pc-windows-msvc\å\soulmemory_rs.dll"#).expect("TODO: panic message");
    }
source§

impl Process

source

pub fn scan_abs( &self, error_name: &str, pattern: &str, scan_offset: usize, pointer_offsets: Vec<usize> ) -> Result<Pointer, String>

source

pub fn scan_rel( &self, error_name: &str, pattern: &str, scan_offset: usize, instruction_size: usize, pointer_offsets: Vec<usize> ) -> Result<Pointer, String>

Examples found in repository?
examples/dsr.rs (line 56)
51
52
53
54
55
56
57
58
59
60
61
62
63
64
    pub fn refresh(&mut self) -> Result<(), String>
    {
        if !self.process.is_attached()
        {
            self.process.refresh()?;
            self.game_data_man = self.process.scan_rel("GameDataMan", "48 8b 05 ? ? ? ? 48 8b 50 10 48 89 54 24 60", 3, 7, vec![0])?;
            self.ai_timer = self.process.scan_rel("AI Timer", "48 8b 0d ? ? ? ? 48 85 c9 74 0e 48 83 c1 28", 3, 7, vec![0])?;
        }
        else
        {
            self.process.refresh()?;
        }
        Ok(())
    }
source§

impl Process

source

pub fn refresh(&mut self) -> Result<(), String>

Cling to a running process

Examples found in repository?
examples/dsr.rs (line 55)
51
52
53
54
55
56
57
58
59
60
61
62
63
64
    pub fn refresh(&mut self) -> Result<(), String>
    {
        if !self.process.is_attached()
        {
            self.process.refresh()?;
            self.game_data_man = self.process.scan_rel("GameDataMan", "48 8b 05 ? ? ? ? 48 8b 50 10 48 89 54 24 60", 3, 7, vec![0])?;
            self.ai_timer = self.process.scan_rel("AI Timer", "48 8b 0d ? ? ? ? 48 85 c9 74 0e 48 83 c1 28", 3, 7, vec![0])?;
        }
        else
        {
            self.process.refresh()?;
        }
        Ok(())
    }
source§

impl Process

source

pub fn get_current_process_name() -> Result<String, ()>

source

pub fn get_running_process_names() -> Vec<String>

Examples found in repository?
examples/dsr.rs (line 88)
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
fn main()
{
    let str = r#"C:\soulmemory\soulmemory_rs.dll"#;
    let w32_str = get_w32str_from_str(str);
    println!("{:?}", w32_str);
    println!("{:?}", vec_u16_to_u8(&w32_str));

    let alloated_str = String::from(str);
    let collected: Vec<u16> = alloated_str.encode_utf16().collect();
    println!("{:?}", collected);
    unsafe { println!("{:?}", collected.align_to::<u8>()); }


    let processes = Process::get_running_process_names();
    for p in &processes
    {
        println!("{}", p);
    }

    let mut ds1 = Ds1::new();

    loop
    {
        match ds1.refresh()
        {
            Ok(()) => {}
            Err(e) => println!("{}", e)
        }

        //ds1.inject_soulmemory_rs();

        println!("igt: {}", ds1.get_in_game_time_milliseconds());
        println!("ai: {}", ds1.get_ai_timer());
        sleep(Duration::from_secs(1));
    }
}
source§

impl Process

source

pub fn new(name: &str) -> Self

Create a new process where name is the name of the executable

Examples found in repository?
examples/dsr.rs (line 35)
31
32
33
34
35
36
37
38
39
    pub fn new() -> Self
    {
        Ds1
        {
            process: Process::new("DarkSoulsRemastered.exe"),
            game_data_man: Pointer::default(),
            ai_timer: Pointer::default(),
        }
    }
source

pub fn is_attached(&self) -> bool

Examples found in repository?
examples/dsr.rs (line 53)
51
52
53
54
55
56
57
58
59
60
61
62
63
64
    pub fn refresh(&mut self) -> Result<(), String>
    {
        if !self.process.is_attached()
        {
            self.process.refresh()?;
            self.game_data_man = self.process.scan_rel("GameDataMan", "48 8b 05 ? ? ? ? 48 8b 50 10 48 89 54 24 60", 3, 7, vec![0])?;
            self.ai_timer = self.process.scan_rel("AI Timer", "48 8b 0d ? ? ? ? 48 85 c9 74 0e 48 83 c1 28", 3, 7, vec![0])?;
        }
        else
        {
            self.process.refresh()?;
        }
        Ok(())
    }

Trait Implementations§

source§

impl BaseReadWrite for Process

source§

fn read_memory_rel(&self, offset: Option<usize>, buffer: &mut [u8]) -> bool

Read memory relative to the object’s location in memory
source§

fn write_memory_rel(&self, offset: Option<usize>, buffer: &[u8]) -> bool

Write memory relative to the object’s location in memory
source§

fn read_memory_abs(&self, address: usize, buffer: &mut [u8]) -> bool

Read memory at absolute address
source§

fn write_memory_abs(&self, address: usize, buffer: &[u8]) -> bool

Write memory at absolute address
source§

fn read_with_handle( &self, handle: HANDLE, address: usize, buffer: &mut [u8] ) -> bool

Read memory into a buffer from a process handle
source§

fn write_with_handle( &self, handle: HANDLE, address: usize, buffer: &[u8] ) -> bool

Write from a buffer ino memory from a process handle
source§

impl ReadWrite for Process

source§

fn read_i8_rel(&self, address: Option<usize>) -> i8

================================================================================================================================================================== Reading Read an i8 from the given address
source§

fn read_i32_rel(&self, address: Option<usize>) -> i32

Read an i32 from the given address
source§

fn read_i64_rel(&self, address: Option<usize>) -> i64

Read an i64 from the given address
source§

fn read_u8_rel(&self, address: Option<usize>) -> u8

Read an u8 from the given address
source§

fn read_u32_rel(&self, address: Option<usize>) -> u32

Read an u32 from the given address
source§

fn read_u64_rel(&self, address: Option<usize>) -> u64

Read an u64 from the given address
source§

fn read_f32_rel(&self, address: Option<usize>) -> f32

Read an f32 from the given address
source§

fn read_f64_rel(&self, address: Option<usize>) -> f64

Read an f64 from the given address
source§

fn read_bool_rel(&self, address: Option<usize>) -> bool

Read a bool from the given address
source§

fn write_i8_rel(&self, address: Option<usize>, value: i8)

================================================================================================================================================================== Writing Write an i8 to the given address
source§

fn write_i32_rel(&self, address: Option<usize>, value: i32)

Write an i32 to the given address
source§

fn write_i64_rel(&self, address: Option<usize>, value: i64)

Write an i64 to the given address
source§

fn write_u8_rel(&self, address: Option<usize>, value: u8)

Write an u8 to the given address
source§

fn write_u32_rel(&self, address: Option<usize>, value: u32)

Write an u32 to the given address
source§

fn write_u64_rel(&self, address: Option<usize>, value: u64)

Write an u64 to the given address
source§

fn write_f32_rel(&self, address: Option<usize>, value: f32)

Write an f32 to the given address
source§

fn write_f64_rel(&self, address: Option<usize>, value: f64)

Write an f64 to the given address

Auto Trait Implementations§

§

impl Freeze for Process

§

impl !RefUnwindSafe for Process

§

impl !Send for Process

§

impl !Sync for Process

§

impl Unpin for Process

§

impl !UnwindSafe for Process

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.