Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[VB 2008][HELP]WriteProcessMemory or something
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
CrazyH4x0r
Expert Cheater
Reputation: 0

Joined: 03 Mar 2008
Posts: 224
Location: England

PostPosted: Sun Aug 17, 2008 4:35 pm    Post subject: [VB 2008][HELP]WriteProcessMemory or something Reply with quote

im using vb 2008 and im trying to first do something like "openprocess"
and then writeprocess memory.

for example i would like to know how to write.
Code:
[enable]
0049183D:
jmp 004918bd
00498ED7:
jmp 00498f57

into maplestory.exe (infinite flash jump).

full script here.
Code:

[enable]
0049183D:
jmp 004918bd
00498ED7:
jmp 00498f57

[disable]
0049183D:
jle 004918bd
00498ED7:
jle 00498f57

could someone help or teach me how to do this. thank you very much.
Back to top
View user's profile Send private message
Heartless
I post too much
Reputation: 0

Joined: 03 Dec 2006
Posts: 2436

PostPosted: Sun Aug 17, 2008 5:11 pm    Post subject: Reply with quote

Visual Basic 6 dosen't have an inline ASM, so no you wouldn't do it like that. WriteProcessMemeory() is much more confusing, but before you use WriteProcessMemory() you need to attach to it with OpenProcess(). Don't ask me, I am a beginner at Visual Basic and WriteProcessMemory(). Embarassed
_________________
What dosen't kill you, usually does the second time.
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Sun Aug 17, 2008 5:57 pm    Post subject: Reply with quote

Convert the script into bytes then use writeprocessmemory to write bytes from the base of the address. (where teh script starts) use bytearrays. or inject the bytes one after another.
Back to top
View user's profile Send private message
CrazyH4x0r
Expert Cheater
Reputation: 0

Joined: 03 Mar 2008
Posts: 224
Location: England

PostPosted: Sun Aug 17, 2008 6:21 pm    Post subject: Reply with quote

HornyAZNBoy wrote:
Visual Basic 6 dosen't have an inline ASM, so no you wouldn't do it like that. WriteProcessMemeory() is much more confusing, but before you use WriteProcessMemory() you need to attach to it with OpenProcess(). Don't ask me, I am a beginner at Visual Basic and WriteProcessMemory(). Embarassed

Thank you for the help, btw im not using vb 6, im using 2008 express edition.



dnsi0 wrote:
Convert the script into bytes then use writeprocessmemory to write bytes from the base of the address. (where teh script starts) use bytearrays. or inject the bytes one after another.
Thank you very much, i'll try that.
Back to top
View user's profile Send private message
pkedpker
Master Cheater
Reputation: 1

Joined: 11 Oct 2006
Posts: 412

PostPosted: Sun Aug 17, 2008 8:57 pm    Post subject: Reply with quote

You could do hooking in vb6 easily but to do inline assembly in VB6 is harder and its a 50\50 chance if the memory is not dynamic each load so with CopyMemory function.. find a location thats empty though lol. write assembly in notepad convert everything to bytes store it byte array and pass it threw copymemory also with

VarPtr, StrPtr, and ObjPtr you could get pointers to those stuff like variables,strings and objects. Only problem is VB6 doesn't support numbers bigger then 2,147 bill to -2,147 mayb both added up to 4 billion something is supported but big numbers like longs in C++ don't exist in vb6 you have to do fancy things like copy them in memory then combine them in string with loops it will be slower
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sun Aug 17, 2008 10:54 pm    Post subject: Reply with quote

Code:
Imports System.Runtime.InteropServices
Public Class Form1
    <DllImport("kernel32.dll")> _
        Public Shared Function WriteProcessMemory( _
        ByVal hProcess As IntPtr, _
        ByVal lpBaseAddress As IntPtr, _
        ByVal lpBuffer As Byte(), _
        ByVal nSize As UInt32, _
        ByRef lpNumberOfBytesWritten As UInt32 _
    ) As Boolean
    End Function

    Dim p As Process() = Process.GetProcessesByName("terriblegameforeightyearolds")
    Dim en1 As Byte() = {&HE9, &H9C, &H23, &HEC, &HFF} 'jmp 004918bd
    Dim en2 As Byte() = {&HE9, &H31, &H9A, &HEC, &HFF} 'jmp 00498f57

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
        WriteProcessMemory(p(0).Handle, &H49183D, en1, 5, 0)
        WriteProcessMemory(p(0).Handle, &H498ED7, en2, 5, 0)
    End Sub
End Class
Back to top
View user's profile Send private message
sunbinyuan
Newbie cheater
Reputation: 0

Joined: 17 Oct 2008
Posts: 22

PostPosted: Tue Jul 05, 2011 11:34 am    Post subject: Reply with quote

And if the code was this??

Code:
[ENABLE]
alloc(lol,128)
label(lol1)

009FD306:
jmp lol
db 90
lol1:

lol:
pushad
mov eax,[00DC7CB8]
mov eax,[eax+978]
mov eax,[eax+8C]
mov ecx,[00DC7CB8]
mov ecx,[ecx+978]
mov ecx,[ecx+88]
mov ebx,[00DC775C]
mov [ebx+43D8],eax
mov [ebx+43DC],ecx
mov [ebx+43D0],01
popad
jmp lol1

[DISABLE]
009FD306:
db 0F 84 5C 01 00 00
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Tue Jul 05, 2011 1:07 pm    Post subject: This post has 1 review(s) Reply with quote

Then i'd strongly recommend you start learning C for better memory control
and write an external dll in C using inline asm to set that script
unless you wanna mess around with writeprocessmemory a lot . .

_________________
Stylo
Back to top
View user's profile Send private message
sunbinyuan
Newbie cheater
Reputation: 0

Joined: 17 Oct 2008
Posts: 22

PostPosted: Tue Jul 05, 2011 8:17 pm    Post subject: Reply with quote

I heard that VB.NET was easier than C
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Wed Jul 06, 2011 3:33 am    Post subject: Reply with quote

You heard right, but most of the time not everything that's easier is better Smile
_________________
Stylo
Back to top
View user's profile Send private message
sunbinyuan
Newbie cheater
Reputation: 0

Joined: 17 Oct 2008
Posts: 22

PostPosted: Wed Jul 06, 2011 10:04 am    Post subject: Reply with quote

Do you know how to change the script to VB.NET anyways?
Thanks in advance
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Wed Jul 06, 2011 10:21 am    Post subject: Reply with quote

I'm not a vb programmer, But there was a quick answer for you few post above.
Convert that script into bytes and write them using WriteProcessMemory

_________________
Stylo
Back to top
View user's profile Send private message
sunbinyuan
Newbie cheater
Reputation: 0

Joined: 17 Oct 2008
Posts: 22

PostPosted: Wed Jul 06, 2011 3:57 pm    Post subject: Reply with quote

What do I do for db 0F 84 5C 01 00 00 and mov [ebx+43D0],01 ?
Back to top
View user's profile Send private message
Pingo
Grandmaster Cheater
Reputation: 8

Joined: 12 Jul 2007
Posts: 571

PostPosted: Wed Jul 06, 2011 8:15 pm    Post subject: This post has 1 review(s) Reply with quote

Edit:
So i just downloaded VB to make you guys an example app. Dont mind the noobness, this was the first time i used VB.
Sample for CrazyH4x0r
This one was straight forward. Your script
Code:
[enable]
0049183D:
jmp 004918bd
00498ED7:
jmp 00498f57

[disable]
0049183D:
jle 004918bd
00498ED7:
jle 00498f57

Converted
Code:
        If Not Patch Then
            Mem.Patch(&H49183D, "e99c160200")
            Mem.Patch(&H498ED7, "e9368d0200")
        Else
            Mem.Patch(&H49183D, "0f8e9b160200")
            Mem.Patch(&H498ED7, "0f8e358d0200")
        End If
        Patch = Not Patch


Sample for sunbinyuan
This one involved alot more since it creates a cave and converts jumps and all that other good stuff.
Your Script
Code:
[ENABLE]
alloc(lol,128)
label(lol1)

009FD306:
jmp lol
db 90
lol1:

lol:
pushad
mov eax,[00DC7CB8]
mov eax,[eax+978]
mov eax,[eax+8C]
mov ecx,[00DC7CB8]
mov ecx,[ecx+978]
mov ecx,[ecx+88]
mov ebx,[00DC775C]
mov [ebx+43D8],eax
mov [ebx+43DC],ecx
mov [ebx+43D0],01
popad
jmp lol1

[DISABLE]
009FD306:
db 0F 84 5C 01 00 00

Converted
Code:
        Dim Inj As String = "60a1b87cdc008b80780900008b808c0000008b0db87cdc008b89780900" +
            "008b89880000008b1d5c77dc008983d8430000898bdc430000c783d04300000100000061"
        If Not Inject Then
            Mem.Inject_Jmp(&H9FD306, 6, Inj)
        Else
            Mem.Deallocate(&H9FD306, "0F845C010000")
        End If
        Inject = Not Inject


The 6 in Mem.Inject_Jmp(&H9FD306,6, Inj)
is the distance to next instruction. Your disable was only 6 bytes so i used 6.
The deallocate part will deallocate the cave plus write the original instructions back.
The jump to and from the cave is calculated for you.
The Inj is only this converted to bytes.
Code:
pushad
mov eax,[00DC7CB8]
mov eax,[eax+978]
mov eax,[eax+8C]
mov ecx,[00DC7CB8]
mov ecx,[ecx+978]
mov ecx,[ecx+88]
mov ebx,[00DC775C]
mov [ebx+43D8],eax
mov [ebx+43DC],ecx
mov [ebx+43D0],01
popad


VB Injection Example.zip

_________________


Last edited by Pingo on Fri Jul 08, 2011 2:12 am; edited 1 time in total
Back to top
View user's profile Send private message
OmegaCES
Cheater
Reputation: 1

Joined: 02 Jul 2011
Posts: 44

PostPosted: Thu Jul 07, 2011 9:36 pm    Post subject: Reply with quote

@Pingo
Just had a look at your sourcecode.
Did you write all that without knowing any VB???
That was very well written, for a new VB person.

Anyways, I noticed you used virtualfreex before removing the jump to ur code in your allocation.

If for any reason the game uses the code in the allocated memory in the split second after it free's the memory.
This would surely cause a crash? Its been a while since I've gamehacked, and that was on windows XP, not sure how vista, 7 etc, handle memory, but I know i got a crash in XP back in the day because of the same way I wrote my code. (IE: you write to a piece of code which is updated all the time, onscreen display or something.)

I only glanced quickly at your code, so I might have just misread, but thought I'd post.

When I get a bit more time in RL, i'll take another look at your code, as its given me a few idea's on cleaning up some of my old trainer engines in all languages. .net has changed so many things.

So thanks for the ideas etc Pingo.
Good luck all.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites