QB64.org Forum
Active Forums => Programs => Topic started by: NOVARSEG on February 17, 2021, 08:53:43 pm
-
So using a hex editor :) it is possible to find the address bytes in a QB64 EXE and swap the address of one variable with another.
This is the BAS file (complied and then edited the EXE)
It swaps A with B. Only had to change two bytes with the editor.
DIM A AS _UNSIGNED LONG
DIM B AS _UNSIGNED LONG
GOSUB LL1
PRINT A
PRINT B
END
LL1:
A = 808530224 ' look for "0110"
B = 825373233 ' look for "1221"
RETURN
**** This is for experiment only, do not adjust your set
If anyone wants the EXE then say so
-
Look at OpenProcess on the MSDN
-
Easy way is to just open your source and then: SWAP A, B
-
Yep that works too.
what the unedited bytes look like in the EXE
A1 4C 2B 6B 00 'address = 6B2B4C
C7 00 30 31 31 30 '30 31 31 30 = 808530224 dec
A1 50 2B 6B 00 'address = 6B2B50
C7 00 31 32 32 31 '31 32 32 31 = 825373233 dec
****
the edited bytes
A1 50 2B 6B 00 'address = 6B2B50
C7 00 30 31 31 30 '30 31 31 30 = 808530224 dec
A1 4C 2B 6B 00 'address = 6B2B4C
C7 00 31 32 32 31 '31 32 32 31 = 825373233 dec
notice the LONGs are 4 bytes apart so there are no spaces between.