Address of data stuff

The below should hopefully be enough for you to get what I'm trying to do in this instance, and also what I need help with (can't seem to get the right search terms inputted so trying here instead).
1
2
3
4
5
6
7
8
9
C:\Me\Prjs\cpp\HackerEX\HackerEX_LIB\hexLibMain.cpp||In function 'bool LibGetX(ui64, void*, ui32)':|
C:\Me\Prjs\cpp\HackerEX\HackerEX_LIB\hexLibMain.cpp|32|error: invalid type argument of 'unary *'|
C:\Me\Prjs\cpp\HackerEX\HackerEX_LIB\hexLibMain.cpp||In function 'bool LibSetX(ui64, void*, ui32)':|
C:\Me\Prjs\cpp\HackerEX\HackerEX_LIB\hexLibMain.cpp|43|error: invalid type argument of 'unary *'|
C:\Me\Prjs\cpp\HackerEX\HackerEX_LIB\hexLibMain.cpp||In function 'bool LibGetPtr(ui64, ui64*)':|
C:\Me\Prjs\cpp\HackerEX\HackerEX_LIB\hexLibMain.cpp|50|error: invalid conversion from 'ui64*' to 'long long unsigned int'|
C:\Me\Prjs\cpp\HackerEX\HackerEX_LIB\hexLibMain.cpp||In function 'bool LibGetPtrArray(ui16, ui64*, ui64**)':|
C:\Me\Prjs\cpp\HackerEX\HackerEX_LIB\hexLibMain.cpp|60|error: invalid conversion from 'ui64*' to 'long long unsigned int'|
||=== Build finished: 4 errors, 0 warnings ===|

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
36
37
38
39
LIB_INC bool LibGetX( ui64 address, void* value, ui32 bytes )
{
	ui08* v = ( ui08* )value;
	try
	{
		for ( ui32 i = 0u; i < bytes; ++i )
			{ v[ i ] = *( address + i ); }
	}
	catch ( void* any_error ) { return false; }
	return true;
}
LIB_INC bool LibSetX( ui64 address, void* value, ui32 bytes )
{
	ui08* v = ( ui08* )value;
	try
	{
		for ( ui32 i = 0u; i < bytes; ++i )
			{ *( address + i ) = v[ i ]; }
	}
	catch ( void* any_error ) { return false; }
	return true;
}
LIB_INC bool LibGetPtr( ui64 address, ui64* ptr )
{
	try { *ptr = &( address ); }
	catch ( void* any_error ) { return false; }
	return true;
}

LIB_INC bool LibGetPtrArray( ui16 count, ui64* address_array, ui64** ptr_array )
{
	try
	{
		for ( ui16 i = 0u; i < count; ++i )
			{ *ptr_array[ i ] = &( address_array[ i ] ); }
	}
	catch ( void* any_error ) { return false; }
	return true;
}
For the first two errors, address is not a pointer, it's a value and you can't dereference it
For the last two I don't know the technical terms to explain it, it has to do with lvalues and rvalues. Anyway, to assign a pointer you don't dereference it. You do
1
2
// *ptr = &( address ); wrong
ptr = &address;
Last edited on
Thank you but that will give me the address pointing to address I want the address pointing to the value of address

Edit: Another words I want to treat the value of address as an address

Edit: BTW ptr is not a pointer but another variable containing another address that should be pointing to the address contained in address

example: address 1(value of ptr) points to address 2(value of address) which points to value.
Last edited on
For reference this is what my header file looks like:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// - Unsigned
typedef uint8_t		ui08;
typedef uint16_t	ui16;
typedef uint32_t	ui32;
typedef uint64_t	ui64;

// - Signed
typedef int8_t		si08;
typedef int16_t		si16;
typedef int32_t		si32;
typedef int64_t		si64;

LIB_INC bool LibGetX( ui64 address, void* value, ui32 bytes );
LIB_INC bool LibSetX( ui64 address, void* value, ui32 bytes );
LIB_INC bool LibGetPtr( ui64 address, ui64* ptr );
LIB_INC bool LibGetPtrArray( ui16 count, ui64* address_array, ui64** ptr_array );

#define LibReadX	LibGetX
#define LibWriteX	LibSetX
#define LibReadPtr	LibGetPtr
#define LibReadPtrArray	LibGetPtrArray 
Last edited on
Thank you but that will give me the address pointing to address I want the address pointing to the value of address
Edit: Another words I want to treat the value of address as an address

I think to understand that you want address to be a pointer and ptr to be a pointer to a pointer, correct?
The values of them, yes. This is part of a hacking tool I'm making and only the user will know anything about program they are trying to hack, this is why I tried using brackets to avoid treating the variables themselves as the targets for address extraction.

Similar functions are Read/WriteProcessMemory from the Windows API but it is possible that attaching a library is more appropriate in some cases which is why I'm trying to provide this functionality before I continue, I know Renegade64 somehow made use of such functionality but I'm having trouble making heads or tails of the code so I gave on that route.

Edit: I made an Beta before that was based on RenegadeEX (with author's permission) but I ended up disliking the GUI, Code and missing functionality so I started from scratch with a fresh GUI idea and I'd like to implement this functionality before I continue on with the rest.
Last edited on
Then try
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
LIB_INC bool LibGetPtr( ui64* address, ui64** ptr );

LIB_INC bool LibGetPtr( ui64* address, ui64** ptr )
{
	try { ptr = &address; }
	catch ( void* any_error ) { return false; }
	return true;
}

LIB_INC bool LibGetPtrArray(ui16 count, ui64* address_array[], ui64** ptr_array[]);

LIB_INC bool LibGetPtrArray(ui16 count, ui64* address_array[], ui64** ptr_array[])
{
	try
	{
		for ( ui16 i = 0u; i < count; ++i )
			{ ptr_array[ i ] = &address_array[ i ]; }
	}
	catch ( void* any_error ) { return false; }
	return true;
}
Make an explicit cast. (if you know what you are doing)

1
2
3
4
5
6
try
{
   for ( ui32 i = 0u; i < bytes; ++i )
      { v[ i ] = *( address + i ); }
}
catch ( void* any_error ) { return false; }
There is nothing in that code that could throw an exception
Last edited on
While that does silence the compiler on that issue I somehow doubt that will achieve my goal, but only testing will tell in this case but before that I will have to silence the wxWidgets errors that popped up as a result of the compiler getting past that.

I will try again in the morning if I remember but for now I'm going to bed. Thx again.
well, i have no any idea...
The reason I included the try, catch stuff was just in case the function doesn't have access to the address/'s being read/write from/to e.g. if the user tries to write to the NULL space.
Buffer overflows don't throw.
I get what your trying to say but I'm one of those types that likes to handle unforeseen situations where possible and providing a failure case is a must for me.
Suit yourself, but you're not actually handling anything. Your program will crash all the same.
If it crashes then it provides me with a scenario to learn from, anyway I got to go to work now so I'll get back to this around midnight.
Topic archived. No new replies allowed.