View previous topic :: View next topic |
Author |
Message |
DaNemeziz Master Cheater
Reputation: 0
Joined: 29 Sep 2007 Posts: 430
|
Posted: Wed Nov 26, 2008 11:25 am Post subject: [VB.NET] WriteProcessMemory |
|
|
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 hProcess As Process() = Process.GetProcessesByName("winmine")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WriteProcessMemory(hProcess(0).Handle, &H100579C, New Byte() {255}, 4, 0)
End Sub
End Class
|
That is my current source, as you can see - if you understand it - I set the value of the timer to 255. But I can't set it higher than 255, is there a possibility to set it higher?  |
|
Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Wed Nov 26, 2008 11:27 am Post subject: |
|
|
You can use the BitConverter.GetBytes() method to convert another type to bytes, or simply declate the array and type the value reversed, for example for 65534 you could do:
new byte[] { 0xFE, 0xFF } |
|
Back to top |
|
 |
tombana Master Cheater
Reputation: 2
Joined: 14 Jun 2007 Posts: 456 Location: The Netherlands
|
Posted: Wed Nov 26, 2008 12:07 pm Post subject: |
|
|
You're trying to set a byte to something higher than 255, and that's not possible. So put something like New Int() there. |
|
Back to top |
|
 |
ElectroFusion Grandmaster Cheater
Reputation: 0
Joined: 17 Dec 2006 Posts: 786
|
Posted: Wed Nov 26, 2008 12:24 pm Post subject: |
|
|
Tombana, you beat me to it. A byte can only go up to 255, so try using int instead, because i'm pretty sure it can go up to 3903284824284284207402057207507 and higher. _________________
qwerty147 wrote: |
ghostonline wrote: |
what world are you in?
|
bera
but i live in NZ
|
|
|
Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Wed Nov 26, 2008 12:46 pm Post subject: |
|
|
Just be careful to take the Endianness into account when writing bytes like that.
ElectroFusion wrote: | Tombana, you beat me to it. A byte can only go up to 255, so try using int instead, because i'm pretty sure it can go up to 3903284824284284207402057207507 and higher. |
and no. |
|
Back to top |
|
 |
Spawnfestis GO Moderator
Reputation: 0
Joined: 02 Nov 2007 Posts: 1746 Location: Pakistan
|
Posted: Wed Nov 26, 2008 12:54 pm Post subject: |
|
|
ElectroFusion wrote: | Tombana, you beat me to it. A byte can only go up to 255, so try using int instead, because i'm pretty sure it can go up to 3903284824284284207402057207507 and higher. |
lmao. _________________
CLICK TO HAX MAPLESTORAY ^ !!!! |
|
Back to top |
|
 |
GMZorita Grandmaster Cheater Supreme
Reputation: 0
Joined: 21 Mar 2007 Posts: 1361
|
Posted: Wed Nov 26, 2008 12:59 pm Post subject: |
|
|
ElectroFusion wrote: | Tombana, you beat me to it. A byte can only go up to 255, so try using int instead, because i'm pretty sure it can go up to 3903284824284284207402057207507 and higher. |
UNSIGNED:
BYTE = 1 BYTE = 0xFF(MAX) = 255;
WORD = 2 BYTE's = 0xFFFF(MAX) = 65535;
DWORD = 4 BYTE's = 0xFFFFFFFF(MAX) = 4294967295;
QWORD = 8 BYTE's = 0xFFFFFFFFFFFFFFFF(MAX) = 18446744073709551615;
So NO it wont go to "3903284824284284207402057207507 and higher".
Well let me save you from getting "pwned" an int is the samething as an DWORD, it have just 4 BYTE's, remember 0xFFFFFFFF is the max it can reach. _________________
Gone |
|
Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Wed Nov 26, 2008 2:03 pm Post subject: |
|
|
Range - signed = -(2^(nBits-1))~2^(nBits-1)-1
Range - unsigned = 0~2^nBits-1
For example:
signed 32-bit: -(2^31)~2^(31)-1 = -2147483648~2147483647
unsigned 32-bit: 0~2^32-1 = 4294967296-1 = 4294967295 |
|
Back to top |
|
 |
ElJEffro Grandmaster Cheater Supreme
Reputation: 0
Joined: 15 Apr 2007 Posts: 1881 Location: La Tierra
|
Posted: Fri Nov 28, 2008 2:07 am Post subject: |
|
|
GMZorita wrote: | ElectroFusion wrote: | Tombana, you beat me to it. A byte can only go up to 255, so try using int instead, because i'm pretty sure it can go up to 3903284824284284207402057207507 and higher. |
UNSIGNED:
BYTE = 1 BYTE = 0xFF(MAX) = 255;
WORD = 2 BYTE's = 0xFFFF(MAX) = 65535;
DWORD = 4 BYTE's = 0xFFFFFFFF(MAX) = 4294967295;
QWORD = 8 BYTE's = 0xFFFFFFFFFFFFFFFF(MAX) = 18446744073709551615;
So NO it wont go to "3903284824284284207402057207507 and higher".
Well let me save you from getting "pwned" an int is the samething as an DWORD, it have just 4 BYTE's, remember 0xFFFFFFFF is the max it can reach. |
In some processor types int is 16 bit (word) |
|
Back to top |
|
 |
tombana Master Cheater
Reputation: 2
Joined: 14 Jun 2007 Posts: 456 Location: The Netherlands
|
Posted: Fri Nov 28, 2008 10:48 am Post subject: |
|
|
ElJEffro wrote: | In some processor types int is 16 bit (word) |
Yes I was thinking about that some time ago:
'long' is 32-bit (dword), 'short' is 16-bit (word), but 'int' can be both. When is an int 16-bit and when is it 32-bit? And what about 64-bits. Does 'long' automatically become 64-bit on a 64-bit system? |
|
Back to top |
|
 |
arigity Advanced Cheater
Reputation: 0
Joined: 03 Jul 2008 Posts: 65 Location: middle of nowhere.
|
Posted: Fri Nov 28, 2008 2:14 pm Post subject: |
|
|
2 problems here.
<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
1. your buffer is not just a byte, but a byte array.
WriteProcessMemory(hProcess(0).Handle, &H100579C, New Byte() {255}, 4, 0)
2. your byte array of 1 is writing 4 bytes. where are the other 3 coming from?
if you wanna write a specific amount of bytes to memory try lopping off the array part (ByVal lpBuffer As Byte) designate an array of bytes (dim mybytes() as byte) and then write them (WriteProcessMemory(Handle, address, mybytes(0), amountofbytes, 0))
if you want to write 436434 to memory change the buffer to an int or something (ByVal lpBuffer As integer) (dim hax as integer = 436434 ) (WriteProcessMemory(Handle, address, hax, 4 , 0))
you write 4 bytes the second time because an int is 4 bytes (in most cases. definitely yours.)
*note* if anything is incorrect or doesn't work, do note that i wrote it in the browser. you may need to change some stuff. _________________
|
|
Back to top |
|
 |
hacksign23 Master Cheater
Reputation: 0
Joined: 26 Nov 2006 Posts: 404
|
Posted: Fri Nov 28, 2008 5:43 pm Post subject: |
|
|
or you could use two writeprocessmemory s and... yea. _________________
|
|
Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Fri Nov 28, 2008 6:04 pm Post subject: |
|
|
Just use the BitConverter class, it has a method that will convert whatever to a byte array. |
|
Back to top |
|
 |
|