Results 1 to 14 of 14
  1. #1
    Darky's Avatar
    Join Date
    Mar 2007
    Location
    In my house!
    Posts
    583
    Reputation
    12
    Thanks
    4

    Something is wrong! :S -- Problem with VB6 code

    Is something wrong with adresses or am I doing something wrong??

    OK.. VB6 making trainers:

    First I enter this code in a new module:

    Public Const PROCESS_ALL_ACCESS = &H1F0FFF
    Dim f1holder As Integer
    Dim timer_pos As Long
    'API Declaration
    Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As Long
    Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
    Public Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
    Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
    Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal Classname As String, ByVal WindowName As String) As Long
    Public Declare Function GetKeyPress Lib "user32" Alias "GetAsyncKeyState" (ByVal key As Long) As Integer
    Public Declare Function ReadProcessMem Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByRef lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
    Public Function WriteAByte(gamewindowtext As String, address As Long, value As Byte)
    Dim hWnd As Long
    Dim pid As Long
    Dim phandle As Long
    hWnd = FindWindow(vbNullString, gamewindowtext)
    If (hWnd = 0) Then
    MsgBox "The Game Is Not Working", vbCritical, "Error"
    End
    Exit Function
    End If
    GetWindowThreadProcessId hWnd, pid
    phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
    If (phandle = 0) Then
    MsgBox "Can't get ProcessId", vbCritical, "Error"
    Exit Function
    End If
    WriteProcessMemory phandle, address, value, 1, 0&
    CloseHandle hProcess
    End Function
    Public Function WriteAnInt(gamewindowtext As String, address As Long, value As Integer)
    Dim hWnd As Long
    Dim pid As Long
    Dim phandle As Long
    hWnd = FindWindow(vbNullString, gamewindowtext)
    If (hWnd = 0) Then
    MsgBox "The Game Is Not Working", vbCritical, "Error"
    End
    End If
    GetWindowThreadProcessId hWnd, pid
    phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
    If (phandle = 0) Then
    MsgBox "Can't get ProcessId", vbCritical, "Error"
    Exit Function
    End If
    WriteProcessMemory phandle, address, value, 2, 0&
    CloseHandle hProcess
    End Function
    Public Function WriteALong(gamewindowtext As String, address As Long, value As Long)
    Dim hWnd As Long
    Dim pid As Long
    Dim phandle As Long
    hWnd = FindWindow(vbNullString, gamewindowtext)
    If (hWnd = 0) Then
    MsgBox "The Game Is Not Working", vbCritical, "Error"
    End
    Exit Function
    End If
    GetWindowThreadProcessId hWnd, pid
    phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
    If (phandle = 0) Then
    MsgBox "Can't get ProcessId", vbCritical, "Error"
    Exit Function
    End If
    WriteProcessMemory phandle, address, value, 4, 0&
    CloseHandle hProcess
    End Function
    Public Function ReadAByte(gamewindowtext As String, address As Long, valbuffer As Byte)
    Dim hWnd As Long
    Dim pid As Long
    Dim phandle As Long
    hWnd = FindWindow(vbNullString, gamewindowtext)
    If (hWnd = 0) Then
    MsgBox "The Game Is Not Working", vbCritical, "Error"
    End
    Exit Function
    End If
    GetWindowThreadProcessId hWnd, pid
    phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
    If (phandle = 0) Then
    MsgBox "Can't get ProcessId", vbCritical, "Error"
    Exit Function
    End If
    ReadProcessMem phandle, address, valbuffer, 1, 0&
    CloseHandle hProcess
    End Function
    Public Function ReadAnInt(gamewindowtext As String, address As Long, valbuffer As Integer)
    Dim hWnd As Long
    Dim pid As Long
    Dim phandle As Long
    hWnd = FindWindow(vbNullString, gamewindowtext)
    If (hWnd = 0) Then
    MsgBox "The Game Is Not Working", vbCritical, "Error"
    End
    Exit Function
    End If
    GetWindowThreadProcessId hWnd, pid
    phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
    If (phandle = 0) Then
    MsgBox "Can't get ProcessId", vbCritical, "Error"
    Exit Function
    End If
    ReadProcessMem phandle, address, valbuffer, 2, 0&
    CloseHandle hProcess
    End Function
    Public Function ReadALong(gamewindowtext As String, address As Long, valbuffer As Long)
    Dim hWnd As Long
    Dim pid As Long
    Dim phandle As Long
    hWnd = FindWindow(vbNullString, gamewindowtext)
    If (hWnd = 0) Then
    MsgBox "The Game Is Not Working", vbCritical, "Error"
    End
    Exit Function
    End If
    GetWindowThreadProcessId hWnd, pid
    phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
    If (phandle = 0) Then
    MsgBox "Can't get ProcessId", vbCritical, "Error"
    Exit Function
    End If
    ReadProcessMem phandle, address, valbuffer, 4, 0&
    CloseHandle hProcess
    End Function
    Public Function ReadAFloat(gamewindowtext As String, address As Long, valbuffer As Single)
    Dim hWnd As Long
    Dim pid As Long
    Dim phandle As Long
    hWnd = FindWindow(vbNullString, gamewindowtext)
    If (hWnd = 0) Then
    MsgBox "The Game Is Not Working", vbCritical, "Error"
    End
    Exit Function
    End If
    GetWindowThreadProcessId hWnd, pid
    phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
    If (phandle = 0) Then
    MsgBox "Can't get ProcessId", vbCritical, "Error"
    Exit Function
    End If
    ReadProcessMem phandle, address, valbuffer, 4, 0&
    CloseHandle hProcess
    End Function

    Public Function WriteAFloat(gamewindowtext As String, address As Long, value As Single)
    Dim hWnd As Long
    Dim pid As Long
    Dim phandle As Long
    hWnd = FindWindow(vbNullString, gamewindowtext)
    If (hWnd = 0) Then
    MsgBox "The Game Is Not Working", vbCritical, "Error"
    End
    Exit Function
    End If
    GetWindowThreadProcessId hWnd, pid
    phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
    If (phandle = 0) Then
    MsgBox "Can't get ProcessId", vbCritical, "Error"
    Exit Function
    End If
    WriteProcessMemory phandle, address, value, 4, 0&
    CloseHandle hProcess
    End Function

    Than I enter this in the timer:

    Call WriteALong("WarRock", &H7DB120, 1120403456)

    And than the button:

    Timer1.Interval = 1
    Last edited by Darky; 07-25-2007 at 11:04 PM.

  2. #2
    juppeli's Avatar
    Join Date
    May 2007
    Gender
    male
    Posts
    768
    Reputation
    12
    Thanks
    19
    Any errors? And the address is 7EB66C?

  3. #3
    ZeaS's Avatar
    Join Date
    Feb 2007
    Posts
    738
    Reputation
    15
    Thanks
    265
    the code are ok, it must work, if it don`t work, try another module code, maby there`s something wrong

  4. #4
    Threadstarter
    Expert Member
    Darky's Avatar
    Join Date
    Mar 2007
    Location
    In my house!
    Posts
    583
    Reputation
    12
    Thanks
    4
    Quote Originally Posted by juppeli View Post
    Any errors? And the address is 7EB66C?
    No there is no errors. I make hack with no errors, but when i go in game and activate it, IT doesnt do anything. An yes i tried that adress too!

  5. #5
    juppeli's Avatar
    Join Date
    May 2007
    Gender
    male
    Posts
    768
    Reputation
    12
    Thanks
    19
    Well try to add timer interval straight to 1 (without buttons) and give new report.

  6. #6
    Threadstarter
    Expert Member
    Darky's Avatar
    Join Date
    Mar 2007
    Location
    In my house!
    Posts
    583
    Reputation
    12
    Thanks
    4
    Quote Originally Posted by juppeli View Post
    Well try to add timer interval straight to 1 (without buttons) and give new report.
    ???

    How can i activate the hack than, if it wont have a button.

    LOL

  7. #7
    ZeaS's Avatar
    Join Date
    Feb 2007
    Posts
    738
    Reputation
    15
    Thanks
    265
    with hotkey!?!?

    Private Sub Timer1_Timer()
    If GetKeyPress(vbKeyControl) And GetKeyPress(vbKeyS) Then
    If Timer2.Interval = 0 Then Timer2.Interval = 1
    Else: Timer2.Interval = 0
    End If
    End Sub

    Privat Sub Timer2_Timer()
    Call WriteALong("WarRock", &HADRESS, VALUE)
    End Sub

    :P

  8. #8
    Threadstarter
    Expert Member
    Darky's Avatar
    Join Date
    Mar 2007
    Location
    In my house!
    Posts
    583
    Reputation
    12
    Thanks
    4
    Quote Originally Posted by ZeaS View Post
    with hotkey!?!?

    Private Sub Timer1_Timer()
    If GetKeyPress(vbKeyControl) And GetKeyPress(vbKeyS) Then
    If Timer2.Interval = 0 Then Timer2.Interval = 1
    Else: Timer2.Interval = 0
    End If
    End Sub

    Privat Sub Timer2_Timer()
    Call WriteALong("WarRock", &HADRESS, VALUE)
    End Sub

    :P
    Mybe that will work. I just dont understaind what hotkeys will be set than?

  9. #9
    juppeli's Avatar
    Join Date
    May 2007
    Gender
    male
    Posts
    768
    Reputation
    12
    Thanks
    19
    click your timer, and at right you see properties. Scroll down so much as you see interval and replace 0 with 1. And make hotkeys after you made basics.

  10. #10
    Stranger00's Avatar
    Join Date
    May 2007
    Posts
    208
    Reputation
    17
    Thanks
    0
    For stamina, I think the value changed. It starts with a 4 now I think. Atleast for me it does.

  11. #11
    Threadstarter
    Expert Member
    Darky's Avatar
    Join Date
    Mar 2007
    Location
    In my house!
    Posts
    583
    Reputation
    12
    Thanks
    4
    Quote Originally Posted by juppeli View Post
    click your timer, and at right you see properties. Scroll down so much as you see interval and replace 0 with 1. And make hotkeys after you made basics.
    If i do that what will happen?

    Only interval will change?

  12. #12
    juppeli's Avatar
    Join Date
    May 2007
    Gender
    male
    Posts
    768
    Reputation
    12
    Thanks
    19
    Quote Originally Posted by Stranger00 View Post
    For stamina, I think the value changed. It starts with a 4 now I think. Atleast for me it does.
    But shouldnt it do something with stamina anyway (eg decrease it)?






    Yes, timer goes on automatically when you start it.
    Last edited by juppeli; 07-25-2007 at 11:31 PM.

  13. #13
    Threadstarter
    Expert Member
    Darky's Avatar
    Join Date
    Mar 2007
    Location
    In my house!
    Posts
    583
    Reputation
    12
    Thanks
    4
    No no everything is cool with stamina.

    I figure it out now. I fixed the problem. My next problem is i dont know how to make a hack with hotkey??
    Last edited by Darky; 07-25-2007 at 11:42 PM.

  14. #14
    juppeli's Avatar
    Join Date
    May 2007
    Gender
    male
    Posts
    768
    Reputation
    12
    Thanks
    19
    Go to you form1(code) and scroll code so up you can, and add this to above all else
    Code:
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
    And then, you can use hotkeys only with timer, and you need to keep it's interval always 1.

    Code:
    If GetAsyncKeyState(vbKeyNumpad1) Then
        Dim value As Long
        Dim value1 As Long
        Call ReadALong("Warrock", &terminator, value)
        value1 = value + &H9955
        Call WriteALong("Warrock", value1, 0)
    End if
    End Sub
    This is what your timer got.
    "If GetAsyncKeyState(vbKeyNumpad1)" This is you hotkey command, it's currently numpad 1, if you want it eg. to h, its like :
    "If GetAsyncKeyState(vbKeyH)"
    Last edited by juppeli; 07-25-2007 at 11:58 PM.

Similar Threads

  1. [Help]weird problem with my code
    By trevor206 in forum Visual Basic Programming
    Replies: 6
    Last Post: 09-02-2010, 12:34 PM
  2. Problem with VB6
    By terror1994 in forum WarRock - International Hacks
    Replies: 9
    Last Post: 02-17-2008, 10:06 AM
  3. Whats wrong with my code? =(
    By SadisticGrin in forum C++/C Programming
    Replies: 13
    Last Post: 08-03-2007, 11:39 AM
  4. Vb6 Problem With Weapon Code?
    By jokuvaan11 in forum WarRock - International Hacks
    Replies: 6
    Last Post: 07-03-2007, 12:06 AM
  5. Again Problem With Vb6 Swim Code
    By jokuvaan11 in forum WarRock - International Hacks
    Replies: 12
    Last Post: 06-09-2007, 05:26 PM