Relevant assembly:
$ > 94D3A705 PUSH hw.05A7D394 ; ASCII "glBegin"
$+5 > E8 99C80500 CALL <JMP.&SDL2.SDL_GL_GetProcAddress>
$+A > 83C4 04 ADD ESP,4
$+D > A3 04E03B06 MOV DWORD PTR DS:[63BE004],EAX
$+12 > 8B0D 04E03B06 MOV ECX,DWORD PTR DS:[63BE004] ; OPENGL32.glBegin
$+18 > 890D 38E83B06 MOV DWORD PTR DS:[63BE838],ECX
The first line pushes a string address onto stack as function argument. And the last line copy's value from ECX to this DWORD data object. This address is my target. I want to replace the containing DWORD value.
In my C++ code I first obtain the address for the first line's push function and then I add an offset. By adding the offset 0x1A the code works, but when I try adding + 0x18 then it doesn't work.
I don't fancy testing this for every function, what is the underlying idea that I'm missing?