Because you are injecting.
I do the same thing in vb.net by compiling strings of asm into bytecode. and injecting those bytes.
C++ does have inline asm which i've seen in C# but not vb
but, writing the asm by hand isn't much of a pain. Most of the stuff I've done is simple (copy registers), but it's not hard to write the asm by hand. If you're coding hacks, you're probably looking at the asm anyway..
*(BYTE*)0x12345 = 0xC3
MemMgr.WriteByte(12345, &HC3) '' wrapper function, just calls WriteProcessMemory
*personally* I don't like the 2 **'s, but I guess if you deal with pointers a lot you might. My code will be longer because it doesn't use *(**(*)))())), but easier to maintain imo.
int* ptr1 = *(0x123456)
int* ptr2 = *ptr1
int* ptr3 = * ptr2
^^ my code looks like this
*(DWORD*(**(p1))) or something similar.
^^your code )
Ya it's a nifty syntax and all, but if you go past 1-2 levels it gets hard to read.
The opposite could be said of vb...it could look like..
MemMgr.ReadIntPtr(MemMgr.ReadIntPtr(MemMgr.ReadInt Ptr(&H12345))) which is more ugly. I like the first style. it's longer, but is clearer :/ maybe I'll grow into C++ some day.
"Note that unsafe code is impossible in VB.NET"
true, but you can "make the bytecode" yourself and inject it -- maybe vb isn't best for making bytecode -- but my codecave is about .001% of my total project, so having to compile 2 codecave's myself isn't much of a problem. But yes, vb is inferior in this regard.
edit: I guess I should mention, my goal is to inject/writeprocessmemory as little as possible, because some games have anti-cheat checks which look for modified code.
I do the same thing in vb.net by compiling strings of asm into bytecode. and injecting those bytes.
C++ does have inline asm which i've seen in C# but not vb
but, writing the asm by hand isn't much of a pain. Most of the stuff I've done is simple (copy registers), but it's not hard to write the asm by hand. If you're coding hacks, you're probably looking at the asm anyway..*(BYTE*)0x12345 = 0xC3
MemMgr.WriteByte(12345, &HC3) '' wrapper function, just calls WriteProcessMemory
*personally* I don't like the 2 **'s, but I guess if you deal with pointers a lot you might. My code will be longer because it doesn't use *(**(*)))())), but easier to maintain imo.
int* ptr1 = *(0x123456)
int* ptr2 = *ptr1
int* ptr3 = * ptr2
^^ my code looks like this
*(DWORD*(**(p1))) or something similar.
^^your code )
Ya it's a nifty syntax and all, but if you go past 1-2 levels it gets hard to read.
The opposite could be said of vb...it could look like..
MemMgr.ReadIntPtr(MemMgr.ReadIntPtr(MemMgr.ReadInt Ptr(&H12345))) which is more ugly. I like the first style. it's longer, but is clearer :/ maybe I'll grow into C++ some day.
"Note that unsafe code is impossible in VB.NET"
true, but you can "make the bytecode" yourself and inject it -- maybe vb isn't best for making bytecode -- but my codecave is about .001% of my total project, so having to compile 2 codecave's myself isn't much of a problem. But yes, vb is inferior in this regard.edit: I guess I should mention, my goal is to inject/writeprocessmemory as little as possible, because some games have anti-cheat checks which look for modified code.




