[Tutorials]Array of Bytes

Posts 1–4 of 4 · Page 1 of 1
[Tutorials]Array of Bytes
This was written by Cobra and Str8Soulja

Put this in your module
Puts a string into a byte array.


Code:
Public Sub ByteStringToByteArray(strString As String, ByRef byteArray() As Byte)
Dim current_byte    As Byte
Dim c, d, intSize   As Integer
Dim strTemp         As String

        ReDim byteArray(0) As Byte
        
        For c = 1 To Len(strString)
            If (Mid(strString, c, 1) <> " ") Then
                strTemp = strTemp & Mid(strString, c, 1)
            End If
        Next c
        
        intSize = Round(Len(strTemp) / 2)
        ReDim Preserve byteArray(intSize) As Byte
        
        d = 0
        For c = 1 To Len(strTemp) Step 2
            current_byte = Val("&H" + Mid(strTemp, c, 2))
            byteArray(d) = current_byte
            d = d + 1
        Next c
End Sub

This writes a byte string to the desired offset.

Code:
Public Sub WriteByteString(lngAddress As Long, strValue As String, Optional ByRef NumberOfBytesWritten As Long = 0)
Dim hwnd, processHandle, processId As Long
Dim bytValue() As Byte
    
    hwnd = FindWindow(vbNullString, CurrentProcess)
    If (hwnd = 0) Then Exit Sub
    
    GetWindowThreadProcessId hwnd, processId
    processHandle = OpenProcess(PROCESS_ALL_ACCESS, False, processId)
    ByteStringToByteArray strValue, bytValue
    WriteProcessMemory processHandle, lngAddress, bytValue(0), UBound(bytValue), NumberOfBytesWritten
    CloseHandle processHandle
End Sub
Put this in form load
Code:
CurrentProcess = "WarRock"
'Put this in your button or hotkey
'90 90 90 is how you can nop stuff

Code:
Call WriteByteString(&Haddie,90 90 90)
Wouldnt really call it a tutorial.
More like code snippets.

Thanks though.
Quote Originally Posted by Str8Soulja00 View Post
This was written by Cobra and Str8Soulja

Put this in your module
Puts a string into a byte array.


Code:
Public Sub ByteStringToByteArray(strString As String, ByRef byteArray() As Byte)
Dim current_byte    As Byte
Dim c, d, intSize   As Integer
Dim strTemp         As String
 
        ReDim byteArray(0) As Byte
 
        For c = 1 To Len(strString)
            If (Mid(strString, c, 1) <> " ") Then
                strTemp = strTemp & Mid(strString, c, 1)
            End If
        Next c
 
        intSize = Round(Len(strTemp) / 2)
        ReDim Preserve byteArray(intSize) As Byte
 
        d = 0
        For c = 1 To Len(strTemp) Step 2
            current_byte = Val("&H" + Mid(strTemp, c, 2))
            byteArray(d) = current_byte
            d = d + 1
        Next c
End Sub

This writes a byte string to the desired offset.

Code:
Public Sub WriteByteString(lngAddress As Long, strValue As String, Optional ByRef NumberOfBytesWritten As Long = 0)
Dim hwnd, processHandle, processId As Long
Dim bytValue() As Byte
 
    hwnd = FindWindow(vbNullString, CurrentProcess)
    If (hwnd = 0) Then Exit Sub
 
    GetWindowThreadProcessId hwnd, processId
    processHandle = OpenProcess(PROCESS_ALL_ACCESS, False, processId)
    ByteStringToByteArray strValue, bytValue
    WriteProcessMemory processHandle, lngAddress, bytValue(0), UBound(bytValue), NumberOfBytesWritten
    CloseHandle processHandle
End Sub
Put this in form load
Code:
CurrentProcess = "WarRock"
'Put this in your button or hotkey
'90 90 90 is how you can nop stuff

Code:
Call WriteByteString(&Haddie,90 90 90)
this is all ****** talk; go eat some chicken
thanks dude. this will be hlepful in asm hack making...
Posts 1–4 of 4 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?