| View previous topic :: View next topic |
| Author |
Message |
Wiw3K Grandmaster Cheater
Reputation: 0
Joined: 09 Jul 2006 Posts: 762 Location: Poland.
|
Posted: Thu Dec 18, 2008 6:39 am Post subject: [C#]asm scripts in VC# ? |
|
|
is there any way to put asm code in C#? in C++ i used __asm but there it doesnt work :O?
eg. i want to put that code
| Quote: |
[ENABLE]
00001337:
db 0F 84
[DISABLE]
00001337:
db 0F 85 |
on button1_Click
i know method
| Quote: | | byte[] ByteArray = { 0x90, 0x90 }; //this mean nop ye? |
but how to put script there?
Last edited by Wiw3K on Thu Dec 18, 2008 8:29 am; edited 1 time in total |
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Thu Dec 18, 2008 6:47 am Post subject: |
|
|
| i don't code in c# so not sure about the first question but the second one, yes that declares an array of size 2 with byte elements each of value 0x90 which is 2 NOPs. at least if the array declarations are the same as in c++.
|
|
| Back to top |
|
 |
Zerith Master Cheater
Reputation: 1
Joined: 07 Oct 2007 Posts: 468
|
Posted: Thu Dec 18, 2008 7:17 am Post subject: |
|
|
| C# Does not have an __asm function.
|
|
| Back to top |
|
 |
Wiw3K Grandmaster Cheater
Reputation: 0
Joined: 09 Jul 2006 Posts: 762 Location: Poland.
|
Posted: Thu Dec 18, 2008 7:57 am Post subject: |
|
|
| Zerith wrote: | | C# Does not have an __asm function. |
so how do i convert asm script i put in post 1 to VC# ?
|
|
| Back to top |
|
 |
Zerith Master Cheater
Reputation: 1
Joined: 07 Oct 2007 Posts: 468
|
Posted: Thu Dec 18, 2008 8:18 am Post subject: |
|
|
| Wiw3K wrote: | | Zerith wrote: | | C# Does not have an __asm function. |
so how do i convert asm script i put in post 1 to VC# ?  |
WriteProcessMemory().
|
|
| Back to top |
|
 |
Wiw3K Grandmaster Cheater
Reputation: 0
Joined: 09 Jul 2006 Posts: 762 Location: Poland.
|
Posted: Thu Dec 18, 2008 8:36 am Post subject: |
|
|
@up
huh?
Found on cef this
| Quote: | | Easily import a DLL made in C++ into your C# project and use the function from there, it'll work just as nicely. |
h o w ?
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Thu Dec 18, 2008 8:42 am Post subject: |
|
|
don't expect to do this without learning anything
You'll have to learn C++. And I'm not talking about just learning a bit of it cause you won't get anywhere.
If you want to use C# then like he said use WriteProcessMemory. did you even attempt to search it?
_________________
|
|
| Back to top |
|
 |
arigity Advanced Cheater
Reputation: 0
Joined: 03 Jul 2008 Posts: 65 Location: middle of nowhere.
|
Posted: Thu Dec 18, 2008 9:03 am Post subject: |
|
|
i'm not much of a C# guy but try something like this.
byte[] hack_on = { 0x0F, 0x84 };
byte[] hack_off = { 0x0F, 0x85 };
if(!mypatch)
{
writeProcessmemory(handle, address, hack_on, 2,0);
mypatch = 1;
}
else
{
writeProcessmemory(handle,address,hack_off,2,0);
mypatch =0;
}
as for inline asm, while C# doesn't normally have support for it their
are somewhat decent alternatives such as shynds blackmagic library
_________________
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Thu Dec 18, 2008 9:03 am Post subject: |
|
|
| why don't you write a dll in C++, the use inline asm to make you're script and then import that function into your C# project?
|
|
| Back to top |
|
 |
Wiw3K Grandmaster Cheater
Reputation: 0
Joined: 09 Jul 2006 Posts: 762 Location: Poland.
|
Posted: Thu Dec 18, 2008 10:11 am Post subject: |
|
|
| lurc wrote: | don't expect to do this without learning anything
You'll have to learn C++. And I'm not talking about just learning a bit of it cause you won't get anywhere.
If you want to use C# then like he said use WriteProcessMemory. did you even attempt to search it? |
yes i searched on google and i found change adress , etc. about WriteProcessMemory, i want put Script in C# not simple adress -.-.
| 1qaz wrote: | | why don't you write a dll in C++, the use inline asm to make you're script and then import that function into your C# project? |
yea i want to do that but i dont know how to propertly write it in C++ then use in C#
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Thu Dec 18, 2008 10:16 am Post subject: |
|
|
| Just write the bytes directly with WriteProcessMemory, same result.
|
|
| Back to top |
|
 |
Wiw3K Grandmaster Cheater
Reputation: 0
Joined: 09 Jul 2006 Posts: 762 Location: Poland.
|
Posted: Thu Dec 18, 2008 10:28 am Post subject: |
|
|
| slovach wrote: | | Just write the bytes directly with WriteProcessMemory, same result. |
ok so
| Code: | private void button1_Click(object sender, EventArgs e)
{
IntPtr bytesout;
byte[] NewVal = { 0x90 };
return WriteProcessMemory(ProcessHandle, (IntPtr)0x0001337 , NewVal, (UIntPtr)NewVal.Length, out bytesout);
} |
give error
| Quote: | | Since 'simpleTrainer.Form1.button1_Click(object, System.EventArgs)' returns void, a return keyword must not be followed by an object expression |
---edit---
when i delete return , error dissapear , can it be without return?
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Thu Dec 18, 2008 10:31 am Post subject: |
|
|
read the error, it tells you exactly what's wrong.
get rid of the return.
|
|
| Back to top |
|
 |
Wiw3K Grandmaster Cheater
Reputation: 0
Joined: 09 Jul 2006 Posts: 762 Location: Poland.
|
Posted: Thu Dec 18, 2008 10:36 am Post subject: |
|
|
| slovach wrote: | read the error, it tells you exactly what's wrong.
get rid of the return. |
ok no errors, my button looks that:
| Code: | private void button1_Click(object sender, EventArgs e)
{
WindowHandle = FindWindow("MapleStoryClass", "MapleStory");
GetWindowThreadProcessId(WindowHandle, out ProcID);
IntPtr bytesout;
ProcessHandle = OpenProcess(0x1F0FFF, 1, ProcID);
byte[] NewVal = { 0x90 };
WriteProcessMemory(ProcessHandle, (IntPtr)0x0001337 , NewVal, (UIntPtr)NewVal.Length, out bytesout);
} |
this example should nop adress 00001337 ?
|
|
| Back to top |
|
 |
Zerith Master Cheater
Reputation: 1
Joined: 07 Oct 2007 Posts: 468
|
Posted: Thu Dec 18, 2008 10:44 am Post subject: |
|
|
| Wiw3K wrote: | | slovach wrote: | read the error, it tells you exactly what's wrong.
get rid of the return. |
ok no errors, my button looks that:
| Code: | private void button1_Click(object sender, EventArgs e)
{
WindowHandle = FindWindow("MapleStoryClass", "MapleStory");
GetWindowThreadProcessId(WindowHandle, out ProcID);
IntPtr bytesout;
ProcessHandle = OpenProcess(0x1F0FFF, 1, ProcID);
byte[] NewVal = { 0x90 };
WriteProcessMemory(ProcessHandle, (IntPtr)0x0001337 , NewVal, (UIntPtr)NewVal.Length, out bytesout);
} |
this example should nop adress 00001337 ?  |
You used FindWindow with both the Class and the Window ... ,
use just the class.
Remember though, you need to nop ALL the bytes in that address.
And yes, it will work in case 0x000001337 exists.
|
|
| Back to top |
|
 |
|