SolvedWriting A Value To Pointer

Posts 16 of 6 · Page 1 of 1
Writing A Value To Pointer
As embarrassing as it is I can't seem to get my trainer to write a value to a pointer. Can anyone help me out? I've spent the last hour or so prior to this thread surfing online but all I can find are guides on reading pointers, oppose to writing to them. I'm trying to write a 4byte value to a pointer at the moment. It's a multi-level pointer as well.

This is what I currently have, note I wrote this myself

Code:
int __stdcall WritePointer(DWORD* PointerBase, int PointerOffset, int Value)
{
     if (!IsBadReadPtr((VOID*)PointerBase, 4))
     {
        if (!IsBadWritePtr,( (VOID*)(*(DWORD*)( *(INT*)PointerBase + PointerOffset))), 4)
        {
           *(INT*)(*(DWORD*)( *(INT*)PointerBase + PointerOffset)) = Value;
           return (1);
        }
     }
     return (0);
}
and

Code:
void Form1::checkBox1_CheckedChanged(System::Object^  sender, System::EventArgs^  e) {
	WritePointer((DWORD*)(Base+Top1),(INT)"1061739",4);
	//PDWORD(PDWORD(Top_Pointer)^ + Offset1)^ := StrToInt(Edit2.Text)
}
Did not read, stupid me :/
if you are trying to write a value to a pointer in another process you'll have to use WriteProcessMemory() or some alternative as you dont have access to the memory. Im assuming your pointerbase points to a address which u add on the pointeroffset to get the final address
If you are writing a value to a pointer and you have access to the memory( your own application or injected DLL etc.. )
Code:
*( int *)( *( int *)Pointer + PointerOffset ) = value;
or if you a writing a value to pointer in another process you can do it like this:
Code:
DWORD dwPointer;
ReadProcessMemory( hProcess, (PVOID)Pointer, &dwPointer, 4, 0 );
WriteProcessMemory( hProcess, (PVOID)( dwPointer + PointerOffset ), &value, 4, 0 );
Quote Originally Posted by intervention61 View Post
if you are trying to write a value to a pointer in another process you'll have to use WriteProcessMemory() or some alternative as you dont have access to the memory. Im assuming your pointerbase points to a address which u add on the pointeroffset to get the final address
If you are writing a value to a pointer and you have access to the memory( your own application or injected DLL etc.. )
Code:
*( int *)( *( int *)Pointer + PointerOffset ) = value;
or if you a writing a value to pointer in another process you can do it like this:
Code:
DWORD dwPointer;
ReadProcessMemory( hProcess, (PVOID)Pointer, &dwPointer, 4, 0 );
WriteProcessMemory( hProcess, (PVOID)( dwPointer + PointerOffset ), &value, 4, 0 );
Thank you it works! Now I'm trying to read the value from a textbox, how would I do so? I've tried

Code:
*( int *)( *( int *)Base + Top1 ) = textBox1->Text = "";
and

Code:
*( int *)( *( int *)Base + Top1 ) = textBox1->Text = ("");
but I get this error

Code:
Form1.cpp(11): error C2440: '=' : cannot convert from 'void' to 'int'
and if I replace the int commands with void I get

Code:
1>Form1.cpp(11): error C2100: illegal indirection
1>Form1.cpp(11): error C2186: '+' : illegal operand of type 'void'


---------- Post added at 07:08 PM ---------- Previous post was at 07:01 PM ----------

[Update]

I've now tried

Code:
#define topTextBoxContent = textBox1->Text;
and

Code:
*( int *)( *( int *)Base + Top1 ) = topTextBoxContent;
but I get

Code:
Form1.cpp(13): error C2059: syntax error : '='
Solved, requesting thread closure.
Marked Solved.
Posts 16 of 6 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?