Internal memory reading

I am trying to get the health of the player,
and i have address (green address) and Offset , How can read this address? (Internal = dll inject) .
Its ok to use more words to explain what you are asking.
If the memory is internal, and you have the address, dumping the address into an unsigned char pointer lets you read it as bytes, but whether that makes any sense or not depends on what is there. Reading 3 bytes of a double isnt useful in general.
Thanks jonnin , please example ?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <iostream>
#include <type_traits>
#include <cstdint>
#include <cstddef>

template < typename T > requires std::is_trivially_copyable_v<T>
bool read( const void* address, std::ptrdiff_t offset, T& v )
{
    const char* ptr = static_cast<const char*>(address) + offset ;

    if( reinterpret_cast<std::uintptr_t>(ptr) % alignof(T) ) return false ; // misaligned for T

    v = *reinterpret_cast<const T*>(ptr) ;
    return true ;
}

struct test
{
    int v ;
    double d ;
    long l[4] ;

    auto operator <=>( const test& ) const noexcept = default ;
};

int main()
{
    const test a { 1, 2.3, { 4, 5, 6, 7 } } ;
    test b {} ;

    if( read( std::addressof(a), 0, b ) && a == b ) std::cout << "ok\n" ;

    double d = 0 ;
    if( read( std::addressof(a), offsetof(test,d), d ) && a.d == d ) std::cout << "ok\n" ;
}

https://coliru.stacked-crooked.com/a/a945a3e7f388c7bb
I believe the aim is to create a handler in a DLL, then attach it to the program and somehow get the handler to be called.
Topic archived. No new replies allowed.