Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant archive_postsperpage - assumed 'archive_postsperpage' (this will throw an Error in a future version of PHP) in ..../archive/index.php on line 456
Convert C++ codecave function to VB6 [Archive] - Forums

PDA

View Full Version : Convert C++ codecave function to VB6



oclipper
07-26-2021, 12:13 AM
Hello, guys.

Please, may someone help convert this function to vb6?

The code in C++



void walk(HANDLE pHandle, DWORD baseAddress, int direction, bool dash)
{
BYTE codeCave[32]{
0x60, //PUSHAD
0x9C, //PUSHFD
0x68, 0x00, 0x00, 0x00, 0x00, //PUSH DASH
0x68, 0x00, 0x00, 0x00, 0x00, //PUSH DIRECTION
0xB9, 0x00, 0x00, 0x00, 0x00, //MOVE ECX, GAME ADDRESS
0xB8, 0x00, 0x00, 0x00, 0x00, //MOVE EAX, WALK FUNCTION ADDRESS
0xFF, 0xD0, //CALL
0x9D, //POPFD
0x61, //POPAD
0x68, 0x00, 0x00, 0x00, 0x00, //PUSH OriginalEIP
0xC3 //RETURN
};

DWORD gameAddress = baseAddress + 0x8036f0;
DWORD walkFunctionAddress = baseAddress + 0x11FD3;

int caveLenght = sizeof(codeCave);
LPVOID remoteCave = VirtualAllocEx(pHandle, 0, caveLenght, MEM_COMMIT, PAGE_EXECUTE);

DWORD mainThreadId = getProcessThreadId(pHandle);
HANDLE hThread = OpenThread((THREAD_GET_CONTEXT | THREAD_SUSPEND_RESUME | THREAD_SET_CONTEXT), false, mainThreadId);
SuspendThread(hThread);
CONTEXT threadContext;
threadContext.ContextFlags = CONTEXT_CONTROL;
GetThreadContext(hThread, &threadContext);

memcpy(&codeCave[3], &dash, 1);
memcpy(&codeCave[8], &direction, 4);
memcpy(&codeCave[13], &gameAddress, 4);
memcpy(&codeCave[18], &walkFunctionAddress, 4);
memcpy(&codeCave[27], &threadContext.Eip, 4);
WriteProcessMemory(pHandle, remoteCave, codeCave, caveLenght, NULL);

threadContext.Eip = (DWORD)remoteCave;
threadContext.ContextFlags = CONTEXT_CONTROL;
SetThreadContext(hThread, &threadContext);
ResumeThread(hThread);
CloseHandle(hThread);
VirtualFreeEx(pHandle, remoteCave, caveLenght, MEM_RELEASE);

oclipper
07-26-2021, 12:15 AM
My first attempt:



Public Function Walk(pHandle As Long, lBaseAddres As Long, direction As Long, dash As Boolean)
Dim codeCave(31) As Byte

codeCave(0) = &H60
codeCave(1) = &H9C
codeCave(2) = &H68
codeCave(3) = &H0
codeCave(4) = &H0
codeCave(5) = &H0
codeCave(6) = &H0
codeCave(7) = &H68
codeCave(8) = &H0
codeCave(9) = &H0
codeCave(10) = &H0
codeCave(11) = &H0
codeCave(12) = &HB9
codeCave(13) = &H0
codeCave(14) = &H0
codeCave(15) = &H0
codeCave(16) = &H0
codeCave(17) = &HB8
codeCave(18) = &H0
codeCave(19) = &H0
codeCave(20) = &H0
codeCave(21) = &H0
codeCave(22) = &HFF
codeCave(23) = &HD0
codeCave(24) = &H9D
codeCave(25) = &H61
codeCave(26) = &H68
codeCave(27) = &H0
codeCave(28) = &H0
codeCave(29) = &H0
codeCave(30) = &H0
codeCave(31) = &HC3

Dim var As Variant
var = codeCave

Dim gameAddress As Long
gameAddress = lProcessBase + mainAddress
Dim walkFunctionAddress As Long
walkFunctionAddress = lProcessBase + &H11FD3

Dim caveLenght As Long
caveLenght = UBound(codeCave)
Dim remoteCave As Long
remoteCave = VirtualAllocEx(pHandle, 0, caveLenght, MEM_COMMIT, PAGE_EXECUTE)

Dim mainThreadId As Long
mainThreadId = GetProcessID(pHandle) 'lProcessID
Dim hthread As Long
'hThread = OpenThread (THREAD_GET_CONTEXT | THREAD_SUSPEND_RESUME | THREAD_SET_CONTEXT), false, mainThreadId
hthread = OpenThread(THREAD_GET_CONTEXT, False, mainThreadId)
hthread = OpenThread(THREAD_SUSPEND_RESUME, False, mainThreadId)
hthread = OpenThread(THREAD_SET_CONTEXT, False, mainThreadId)
SuspendThread (hthread)
Dim threadContext As CONTEXT
threadContext.ContextFlags = CONTEXT_CONTROL
GetThreadContext hthread, threadContext

CopyMemory codeCave(2), dash, 1
CopyMemory codeCave(7), direction, 4
CopyMemory codeCave(12), gameAddress, 4
CopyMemory codeCave(17), &H11FD3, 4
CopyMemory codeCave(26), threadContext.Eip, 4
WriteProcessMemory pHandle, remoteCave, var, caveLenght, 0

threadContext.Eip = remoteCave
threadContext.ContextFlags = CONTEXT_CONTROL
SetThreadContext hthread, threadContext
ResumeThread (hthread)
CloseHandle (hthread)
VirtualFreeEx pHandle, remoteCave, caveLenght, MEM_RELEASE


Declarations:


Public Declare Function OpenThread Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwThreadId As Long) As Long
Public Declare Function GetThreadContext Lib "kernel32" (ByVal hthread As Long, lpContext As CONTEXT) As Long
Public Declare Function SetThreadContext Lib "kernel32" (ByVal hthread As Long, lpContext As CONTEXT) As Long
Public Declare Function SuspendThread Lib "kernel32" (ByVal hthread As Long) As Long
Public Declare Function ResumeThread Lib "kernel32" (ByVal hthread As Long) As Long
Public Declare Sub CopyMemory Lib "kernel32" Alias _
"RtlMoveMemory" (ByVal Destination As Long, ByVal _
Source As Long, ByVal Length As Integer)
Public Declare Function VirtualAllocEx Lib "kernel32" _
(ByVal hProcess As Long, lpAddress As Any, dwSize As Any, _
ByVal flAllocationType As Long, ByVal flProtect As Long) As Long
Public Declare Function VirtualFreeEx Lib "kernel32" (ByVal hProcess As Long, ByVal lpAddress As Any, ByVal dwSize As Long, ByVal dwFreeType As Long) As Long

Public Const SIZE_OF_80387_REGISTERS = 80

'Public Const MEM_COMMIT = &H1000
Public Const MEM_RELEASE = &H8000
Public Const PAGE_EXECUTE = &H10
Public Const THREAD_GET_CONTEXT = &H8
Public Const THREAD_SUSPEND_RESUME = &H2
Public Const THREAD_SET_CONTEXT = &H10
Public Const CONTEXT_CONTROL = &H1

Type FLOATING_SAVE_AREA
ControlWord As Long
StatusWord As Long
TagWord As Long
ErrorOffset As Long
ErrorSelector As Long
DataOffset As Long
DataSelector As Long
RegisterArea(SIZE_OF_80387_REGISTERS) As Byte
Cr0NpxState As Long
End Type

Type CONTEXT
ContextFlags As Long
Dr0 As Long
Dr1 As Long
Dr2 As Long
Dr3 As Long
Dr6 As Long
Dr7 As Long
FloatSave As FLOATING_SAVE_AREA
SegGs As Long
SegFs As Long
SegEs As Long
SegDs As Long
Edi As Long
Esi As Long
Ebx As Long
Edx As Long
Ecx As Long
Eax As Long
Ebp As Long
Eip As Long
SegCs As Long
EFlags As Long
Esp As Long
SegSs As Long
End Type

FrankJScott
04-11-2024, 10:25 PM
Please try Google (https://www.google.com/) before asking about Cool Product Info (https://forum.haustor.eu/showthread.php?tid=8&pid=281#pid281) 8b8_595

FrankJScott
04-14-2024, 11:48 AM
In reply to the lady talking about slot yang ada rtp, link jackpot slot, main slot online, slot gacor apa saja, cuan slot login, slot wins, website game slot, cuan 777 slot login, agen slot judi, slot yang lagi gacor saat ini, I highly suggest this link about MPO007 site (https://juliusuhem44322.wikicorrespondent.com/5442398/great_ideas_on_choosing_link_slot_gacor_websites) or slot agen gacor, casino slot online game, 777 online, agen judi casino, slot virtual, tempat judi 777, judi slot maxwin, link game online slot, mpo agen, agen slot game, alongside all this top MPO007 forum (https://travisfpyn01357.blog2freedom.com/26511758/handy-advice-for-choosing-link-slot-gacor-websites) as well as game judi online slot, cuan 777 slot login, dunia maxwin, agen gacor slot, casino 7, link cuan slot, depo judi slot, link judi slot gacor, play online slot, slot player, on top of this recommended gampang menang maxwin link (https://angelodgcu84951.blog5.net/68162631/good-ideas-to-deciding-on-slot-gacor-sites) which is also great. Also, have a look at this total stranger about slot gacor link (https://franciscoqesq85273.theobloggers.com/32528466/handy-reasons-on-deciding-on-mpo007-sites) as well as web casino online, livechat slot, agen slot maxwin, judi slot online terbaru, slot site, web gacor online, slot resmi pragmatic, apa itu agen slot, situs judi slot yang lagi gacor, rtp live mpo, not to mention this helpful hints on slot gacor tips (https://henry1l68gtf3.therainblog.com/26141584/great-reasons-for-choosing-slot-gacor-websites) with mega bet slot, agen gacor slot, link cuan slot, judi slot, slot internet, all in spin slot, judi 777 online, judi slot online, link slot yang gacor, judi gacor, for good measure. Check more @ Awesome Botox Treatment Site (https://gamez-land.net/viewtopic.php?f=19&t=63039&p=209381#p209381) 8f6fd6b

FrankJScott
04-27-2024, 05:07 PM
In response to the person talking about best smart contract crypto, online cryptocurrency casino, crypto casino reviews, games crypto, stable coin definition, binance crypto exchange, crypto online gambling, free crypto gambling, best casino crypto, lightning network channels, I highly suggest this awesome bc game tips (https://jaidenpkzm78901.bloggadores.com/26534970/handy-info-to-selecting-bcgame) or best us crypto casino, id for binance, blockchain binance, ada cryptocurrency news, crypto gaming, crypto casino crash, best crypto memes, hal crypto, crypto based games, hash dice, and don't forget this recommended reading for bcgame link (https://lukaskkhb17382.blogpayz.com/26838517/top-ideas-for-deciding-on-bc-game-casino) alongside all binance crypto trading, online casino cryptocurrency, hashdice, cryptocurrency yield farming, crypto casino online, binance exchange website, crypto token games, steps to invest in cryptocurrency, crypto gambling games, blockchain pillars, alongside all this had me going about bc game info (https://connerxdjn91357.onzeblog.com/26804772/top-ideas-for-choosing-bcgame) which is also great. Also, have a look at this additional resources on bcgame link (https://gregoryogui56789.blogdal.com/27182318/top-facts-for-picking-bc-game) alongside all crypto casino bonuses, ada crypto prediction, ada coin news today, crypto app games, crypto backed stablecoins, crypto betting game, binance beginner guide, stable crypto coins, crash online casino game, casino with crypto, as well as this read this post here for bcgame link (https://dominickkqtu14680.bloggosite.com/33011569/recommended-reasons-to-picking-bc-game-casino) with games that pay in crypto, crypto gambling casino, pool crypto mining, yield farm crypto, crypto trading on binance, best crypto stable coin, exchange crypto binance, blockchain ada, currency ada, online casino cryptocurrency, for good measure. Check more @ Great BC Game Site (https://www.ds1991.com/forum.php?mod=viewthread&tid=66119&pid=72803&page=1&extra=page%3D1#pid72803) e98b6_c