Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 02:20

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[C#] Addresse aus Pointer auslesen

Discussion on [C#] Addresse aus Pointer auslesen within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1
 
.NoThx's Avatar
 
elite*gold: 0
Join Date: Jun 2010
Posts: 3,146
Received Thanks: 583
[C#] Addresse aus Pointer auslesen

Hey leute, wie kann ich aus einem Pointer die addresse auslesen ?
.NoThx is offline  
Old 10/22/2012, 23:15   #2
 
elite*gold: 0
Join Date: Jan 2010
Posts: 250
Received Thanks: 21
Nabend,

bin mir jetzt echt nicht sicher, aber ich denke, dass es passt.

Quote:
int x = 10;

MessageBox.Show(((IntPtr)(&x)).ToString());
PS: der unsichere Modus (Msdn unsafe) muss aktiviert sein.

jou noch getestet:

Quote:
int x = 10;
IntPtr ptr = (IntPtr)(&x);
int y = *(int*)ptr;
MessageBox.Show(y.ToString());
ausgabe ist y=10.
bammes is offline  
Thanks
1 User
Old 10/23/2012, 00:02   #3
 
.NoThx's Avatar
 
elite*gold: 0
Join Date: Jun 2010
Posts: 3,146
Received Thanks: 583
Hmm Das Klappt nicht so, ich möchte aus dem Pointer die Addresse, hier mal der code, wie er zwar nciht geht aber im ansatz irgendwie richtig sein sollte:
Code:
        [Flags]
        public enum ProcessAccessFlags : uint
        {
            All = 0x001F0FFF,
            Terminate = 0x00000001,
            CreateThread = 0x00000002,
            VMOperation = 0x00000008,
            VMRead = 0x00000010,
            VMWrite = 0x00000020,
            DupHandle = 0x00000040,
            SetInformation = 0x00000200,
            QueryInformation = 0x00000400,
            Synchronize = 0x00100000
        }

        [DllImport("kernel32.dll")]
        private static extern IntPtr OpenProcess(ProcessAccessFlags dwDesiredAccess, [MarshalAs(UnmanagedType.Bool)] bool bInheritHandle, int dwProcessId);

        [DllImport("kernel32.dll", SetLastError = true)]
        private static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, uint nSize, out int lpNumberOfBytesWritten);

        [DllImport("kernel32.dll", SetLastError = true)]
        static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out] byte[] lpBuffer, int dwSize, out int lpNumberOfBytesRead);

        [DllImport("kernel32.dll")]
        public static extern Int32 CloseHandle(IntPtr hProcess);

	
        public static byte[] ReadMemory(Process process, int address, int numOfBytes, out int bytesRead)
        {
            IntPtr hProc = OpenProcess(ProcessAccessFlags.All, false, process.Id);
 
            byte[] buffer = new byte[numOfBytes];
 
            ReadProcessMemory(hProc, new IntPtr(address), buffer, numOfBytes, out bytesRead);
            return buffer;
        }
        public static bool WriteMemory(Process process, int address, long value, out int bytesWritten)
        {
            IntPtr hProc = OpenProcess(ProcessAccessFlags.All, false, process.Id);

            byte[] val = BitConverter.GetBytes(value);

            bool worked = WriteProcessMemory(hProc, new IntPtr(address), val, (UInt32)val.LongLength, out bytesWritten);

            CloseHandle(hProc);

            return worked;
        }
private unsafe void button5_Click(object sender, EventArgs e)
        {
            
                Process process = Process.GetProcessesByName("metin2.bin").FirstOrDefault();
                int address = 0x47D8D78A;

                int bytesRead;
                byte[] valuee = ReadMemory(process, address, 4, out bytesRead);
                //int x = 0x47D8D78A;

                int value = BitConverter.ToInt32(valuee, 0);

                int bytesWritten;
                
                WriteMemory(process, address, value, out bytesWritten);
            
            
        }
.NoThx is offline  
Old 10/23/2012, 12:35   #4
 
elite*gold: 0
Join Date: Jan 2010
Posts: 250
Received Thanks: 21
Hm sry mit sowas kenn ich mich net aus
bammes is offline  
Old 10/23/2012, 17:24   #5
 
elite*gold: 42
Join Date: Jun 2008
Posts: 5,425
Received Thanks: 1,888
Code:
button5_Click
dafug.

Bisher hast du ja fein kopierten Code, da du allerdings nichtmal weißt was ein Pointer überhaupt ist, wird er dir nichts bringen. Und wo ist bitte dein error-handling?
MoepMeep is offline  
Old 10/23/2012, 17:41   #6
 
.NoThx's Avatar
 
elite*gold: 0
Join Date: Jun 2010
Posts: 3,146
Received Thanks: 583
Quote:
Originally Posted by MoepMeep View Post
Code:
button5_Click
dafug.

Bisher hast du ja fein kopierten Code, da du allerdings nichtmal weißt was ein Pointer überhaupt ist, wird er dir nichts bringen. Und wo ist bitte dein error-handling?


Also, warum sollte ich den bitte jeden button umbennen, wobei ich, da ich aj neuanfangen muss das auch jetzt getan habe, um zuwissen welcher button welcher genau ist

Pointer sind Zeiger die auf Addressen im arbeitsspeicher zeigen

Und mein Code soll erstmal funktionieren, das programm soll ja auchnciht Public gemacht werden
.NoThx is offline  
Old 10/25/2012, 19:32   #7
 
elite*gold: 14
The Black Market: 108/0/1
Join Date: May 2011
Posts: 2,671
Received Thanks: 818
Quote:
Originally Posted by .NoThx View Post
Also, warum sollte ich den bitte jeden button umbennen
Weil das zu einer ordentlichen und sauberen Programmierung dazugehört?
Denk dir mal, jemand anders soll deinen Code überprüfen, warten, o.Ä..
vwap is offline  
Old 10/30/2012, 18:01   #8
 
Naworia's Avatar
 
elite*gold: 12
Join Date: Aug 2011
Posts: 455
Received Thanks: 418
Actually I don't support C# to accessing to processes

You can use C++
Naworia is offline  
Reply


Similar Threads Similar Threads
Pointer auslesen!
03/29/2012 - .NET Languages - 14 Replies
Schönen Guten Abend Zusammen, also ich brauche eure Hilfe bei einer Sache. Ich versuche seit Tagen den Wert eines Multi-LvL Pointer mit einer Klasse auszulesen. Doch dies funktioniert nicht. Ich glaube es liegt nicht an der Klasse sondern an dem Aufbau. Wenn ich Wert von Normale Adresse auslesen will funktioniert es ohne Probleme: int bytesread; int memoryaddress = 0x000EA754; - Pastebin.com
Pointer Auslesen
03/24/2011 - General Coding - 4 Replies
Hi Leute Ich habe eine Frage zum Pointer Auslesen In der 4 Story Sektion gab es mal den kdhack Er beinhaltete Den Pointer Auslesen von den Mobs die ich angreife was eigentlich Server Side ist Also daher die Frage
[VB] Pointer auslesen (Nostale) Help
03/12/2011 - .NET Languages - 20 Replies
Ich frag mal die Programmierer unter euch,die vll nen Plan haben wie ich das hinkrieg. Folgendes Problem : Ich will die Hp Adresse : 007B11A8 mit den beiden Offsets : 4C,AC in VB zum laufen kriegen. Mein Modul(Memory) sieht so aus : Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer,...
WoW Pointer mit Autoit auslesen
12/05/2010 - World of Warcraft - 0 Replies
Ich habe mit Cheat Engine 5.6 die werte von der Z position des eigenen Spielers herausgefunden. Anschließend habe ich rechtsklick auf den Wert gemacht und Pointer Scan for this Adress gemacht. Ich bekam eine Liste mit den Offsets und den Werten. Meine Werte sind alle 4 byte weil ich nicht weiß welche ich sonst nehmen soll. Das ist aber egal. Mit Cheat Engine klappt alles auch wenn es 4 byte sind. Nun meine Frage. Ich binde die Offsets mit der Nomadmemory in Autoit ein. Wenn ich den Wert...
Metin2 Wallhack pointer bzw. addresse
08/25/2010 - General Coding - 12 Replies
hallo, wie der name schon sagt such ich die addresse bzw. den pointer für metin2 wallhack.falls einer weis wie man ihn rausfindet würde das natürlich auch gehen. thx im vorraus MfG dimaska



All times are GMT +1. The time now is 02:20.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.