EMO Style ForumPro - Hos Geldiniz
Giriş yap

Şifremi unuttum

Istatistikler
Toplam 202 kayıtlı kullanıcımız var
Son kaydolan kullanıcımız: AnthonyFurey3

Kullanıcılarımız toplam 1186 mesaj attılar bunda 862 konu
Tarıyıcı
 Kapı
 Indeks
 Üye Listesi
 Profil
 SSS
 Arama
Arama
 
 

Sonuç :
 


Rechercher çıkıntı araştırma

RSS akısı


Yahoo! 
MSN 
AOL 
Netvibes 
Bloglines 


Kimler hatta?
Toplam 4 kullanıcı online :: 0 Kayıtlı, 0 Gizli ve 4 Misafir :: 1 Arama motorları

Yok

[ Bütün listeye bak ]


Sitede bugüne kadar en çok 92 kişi Paz Ağus. 28, 2016 6:58 am tarihinde online oldu.
En son konular
» İnternetten Para Kazandıran Oyun ! Ödeme Alt Limiti Yok ! DEV KONU
Cuma Ağus. 29, 2014 8:33 am tarafından Hello EMO

» goldenchase.net maden yaparak para kazanma
Cuma Ağus. 29, 2014 8:18 am tarafından Hello EMO

» etichal hacker görsel egitim seti
Çarş. Ağus. 06, 2014 4:57 am tarafından Hello EMO

» KO TBL Source C#
Ptsi Ara. 09, 2013 6:36 am tarafından Hello EMO

» x86 Registers
C.tesi Ağus. 24, 2013 5:02 am tarafından Hello EMO

» [Tutorial] Pegando Address, Pointers de WYD
Çarş. Tem. 10, 2013 7:25 am tarafından Hello EMO

» [Tutorial] Pegando Address, Pointers de CS Metodo²
Çarş. Tem. 10, 2013 7:23 am tarafından Hello EMO

» [Tutorial] Aprendendo basico deASM OLLYDBG
Çarş. Tem. 10, 2013 7:22 am tarafından Hello EMO

» Basic C# DLL injector
Ptsi Tem. 08, 2013 7:48 am tarafından Hello EMO

Reklam

Read Process Memory C#

Önceki başlık Sonraki başlık Aşağa gitmek

Read Process Memory C#

Mesaj tarafından Hello EMO Bir Ptsi Kas. 29, 2010 2:59 am

Hello.
I want to read Value from Steam Process.
I have:

Kod:
[color=#0000BB]using System[/color][color=#007700];
[/color][color=#0000BB]using System[/color][color=#007700].[/color][color=#0000BB]Diagnostics[/color][color=#007700];
[/color][color=#0000BB]using System[/color][color=#007700].[/color][color=#0000BB]Runtime[/color][color=#007700].[/color][color=#0000BB]InteropServices[/color][color=#007700];
 
[/color][color=#0000BB]namespace ProcessMemoryReaderLib
[/color][color=#007700]{
    [/color][color=#FF8000]/// <summary>
    /// ProcessMemoryReader is a class that enables direct reading a process memory
    /// </summary>
    [/color][color=#007700]class [/color][color=#0000BB]ProcessMemoryReaderApi
    [/color][color=#007700]{
        [/color][color=#FF8000]// constants information can be found in <winnt.h>
        [/color][color=#007700][[/color][color=#0000BB]Flags[/color][color=#007700]]
        public [/color][color=#0000BB]enum ProcessAccessType
        [/color][color=#007700]{
            [/color][color=#0000BB]PROCESS_TERMINATE            [/color][color=#007700]= ([/color][color=#0000BB]0x0001[/color][color=#007700]),
            [/color][color=#0000BB]PROCESS_CREATE_THREAD        [/color][color=#007700]= ([/color][color=#0000BB]0x0002[/color][color=#007700]),
            [/color][color=#0000BB]PROCESS_SET_SESSIONID        [/color][color=#007700]= ([/color][color=#0000BB]0x0004[/color][color=#007700]),
            [/color][color=#0000BB]PROCESS_VM_OPERATION        [/color][color=#007700]= ([/color][color=#0000BB]0x0008[/color][color=#007700]),
            [/color][color=#0000BB]PROCESS_VM_READ                [/color][color=#007700]= ([/color][color=#0000BB]0x0010[/color][color=#007700]),
            [/color][color=#0000BB]PROCESS_VM_WRITE            [/color][color=#007700]= ([/color][color=#0000BB]0x0020[/color][color=#007700]),
            [/color][color=#0000BB]PROCESS_DUP_HANDLE            [/color][color=#007700]= ([/color][color=#0000BB]0x0040[/color][color=#007700]),
            [/color][color=#0000BB]PROCESS_CREATE_PROCESS        [/color][color=#007700]= ([/color][color=#0000BB]0x0080[/color][color=#007700]),
            [/color][color=#0000BB]PROCESS_SET_QUOTA            [/color][color=#007700]= ([/color][color=#0000BB]0x0100[/color][color=#007700]),
            [/color][color=#0000BB]PROCESS_SET_INFORMATION        [/color][color=#007700]= ([/color][color=#0000BB]0x0200[/color][color=#007700]),
            [/color][color=#0000BB]PROCESS_QUERY_INFORMATION    [/color][color=#007700]= ([/color][color=#0000BB]0x0400[/color][color=#007700])
        }
       
        [/color][color=#FF8000]// function declarations are found in the MSDN and in <winbase.h>
       
        //        HANDLE OpenProcess(
        //            DWORD dwDesiredAccess,  // access flag
        //            BOOL bInheritHandle,    // handle inheritance option
        //            DWORD dwProcessId      // process identifier
        //            );
        [/color][color=#007700][[/color][color=#0000BB]DllImport[/color][color=#007700]([/color][color=#DD0000]"kernel32.dll"[/color][color=#007700])]
        public static [/color][color=#0000BB]extern IntPtr OpenProcess[/color][color=#007700]([/color][color=#0000BB]UInt32 dwDesiredAccess[/color][color=#007700], [/color][color=#0000BB]Int32 bInheritHandle[/color][color=#007700], [/color][color=#0000BB]UInt32 dwProcessId[/color][color=#007700]);
 
        [/color][color=#FF8000]//        BOOL CloseHandle(
        //            HANDLE hObject  // handle to object
        //            );
        [/color][color=#007700][[/color][color=#0000BB]DllImport[/color][color=#007700]([/color][color=#DD0000]"kernel32.dll"[/color][color=#007700])]
        public static [/color][color=#0000BB]extern Int32 CloseHandle[/color][color=#007700]([/color][color=#0000BB]IntPtr hObject[/color][color=#007700]);
 
        [/color][color=#FF8000]//        BOOL ReadProcessMemory(
        //            HANDLE hProcess,              // handle to the process
        //            LPCVOID lpBaseAddress,        // base of memory area
        //            LPVOID lpBuffer,              // data buffer
        //            SIZE_T nSize,                // number of bytes to read
        //            SIZE_T * lpNumberOfBytesRead  // number of bytes read
        //            );
        [/color][color=#007700][[/color][color=#0000BB]DllImport[/color][color=#007700]([/color][color=#DD0000]"kernel32.dll"[/color][color=#007700])]
        public static [/color][color=#0000BB]extern Int32 ReadProcessMemory[/color][color=#007700]([/color][color=#0000BB]IntPtr hProcess[/color][color=#007700], [/color][color=#0000BB]IntPtr lpBaseAddress[/color][color=#007700],[[/color][color=#0000BB]In[/color][color=#007700], [/color][color=#0000BB]Out[/color][color=#007700]] [/color][color=#0000BB]byte[/color][color=#007700][] [/color][color=#0000BB]buffer[/color][color=#007700], [/color][color=#0000BB]UInt32 size[/color][color=#007700], [/color][color=#0000BB]out IntPtr lpNumberOfBytesRead[/color][color=#007700]);
   
        [/color][color=#FF8000]//        BOOL WriteProcessMemory(
        //            HANDLE hProcess,                // handle to process
        //            LPVOID lpBaseAddress,          // base of memory area
        //            LPCVOID lpBuffer,              // data buffer
        //            SIZE_T nSize,                  // count of bytes to write
        //            SIZE_T * lpNumberOfBytesWritten // count of bytes written
        //            );
        [/color][color=#007700][[/color][color=#0000BB]DllImport[/color][color=#007700]([/color][color=#DD0000]"kernel32.dll"[/color][color=#007700])]
        public static [/color][color=#0000BB]extern Int32 WriteProcessMemory[/color][color=#007700]([/color][color=#0000BB]IntPtr hProcess[/color][color=#007700], [/color][color=#0000BB]IntPtr lpBaseAddress[/color][color=#007700],[[/color][color=#0000BB]In[/color][color=#007700], [/color][color=#0000BB]Out[/color][color=#007700]] [/color][color=#0000BB]byte[/color][color=#007700][] [/color][color=#0000BB]buffer[/color][color=#007700], [/color][color=#0000BB]UInt32 size[/color][color=#007700], [/color][color=#0000BB]out IntPtr lpNumberOfBytesWritten[/color][color=#007700]);
 
    }
 
    public class [/color][color=#0000BB]ProcessMemoryReader
    [/color][color=#007700]{
 
        public [/color][color=#0000BB]ProcessMemoryReader[/color][color=#007700]()
        {
        }
 
        [/color][color=#FF8000]/// <summary>   
        /// Process from which to read       
        /// </summary>
        [/color][color=#007700]public [/color][color=#0000BB]Process ReadProcess
        [/color][color=#007700]{
            [/color][color=#0000BB]get
            [/color][color=#007700]{
                return [/color][color=#0000BB]m_ReadProcess[/color][color=#007700];
            }
            [/color][color=#0000BB]set
            [/color][color=#007700]{
                [/color][color=#0000BB]m_ReadProcess [/color][color=#007700]= [/color][color=#0000BB]value[/color][color=#007700];
            }
        }
 
        private [/color][color=#0000BB]Process m_ReadProcess [/color][color=#007700]= [/color][color=#0000BB]null[/color][color=#007700];
 
        private [/color][color=#0000BB]IntPtr m_hProcess [/color][color=#007700]= [/color][color=#0000BB]IntPtr[/color][color=#007700].[/color][color=#0000BB]Zero[/color][color=#007700];
 
        public [/color][color=#0000BB]void OpenProcess[/color][color=#007700]()
        {
[/color][color=#FF8000]//            m_hProcess = ProcessMemoryReaderApi.OpenProcess(ProcessMemoryReaderApi.PROCESS_VM_READ, 1, (uint)m_ReadProcess.Id);
            [/color][color=#0000BB]ProcessMemoryReaderApi[/color][color=#007700].[/color][color=#0000BB]ProcessAccessType access[/color][color=#007700];
            [/color][color=#0000BB]access [/color][color=#007700]= [/color][color=#0000BB]ProcessMemoryReaderApi[/color][color=#007700].[/color][color=#0000BB]ProcessAccessType[/color][color=#007700].[/color][color=#0000BB]PROCESS_VM_READ
                [/color][color=#007700]| [/color][color=#0000BB]ProcessMemoryReaderApi[/color][color=#007700].[/color][color=#0000BB]ProcessAccessType[/color][color=#007700].[/color][color=#0000BB]PROCESS_VM_WRITE
                [/color][color=#007700]| [/color][color=#0000BB]ProcessMemoryReaderApi[/color][color=#007700].[/color][color=#0000BB]ProcessAccessType[/color][color=#007700].[/color][color=#0000BB]PROCESS_VM_OPERATION[/color][color=#007700];
                [/color][color=#0000BB]m_hProcess [/color][color=#007700]= [/color][color=#0000BB]ProcessMemoryReaderApi[/color][color=#007700].[/color][color=#0000BB]OpenProcess[/color][color=#007700](([/color][color=#0000BB]uint[/color][color=#007700])[/color][color=#0000BB]access[/color][color=#007700], [/color][color=#0000BB]1[/color][color=#007700], ([/color][color=#0000BB]uint[/color][color=#007700])[/color][color=#0000BB]m_ReadProcess[/color][color=#007700].[/color][color=#0000BB]Id[/color][color=#007700]);
        }
 
        public [/color][color=#0000BB]void CloseHandle[/color][color=#007700]()
        {
            [/color][color=#0000BB]int iRetValue[/color][color=#007700];
            [/color][color=#0000BB]iRetValue [/color][color=#007700]= [/color][color=#0000BB]ProcessMemoryReaderApi[/color][color=#007700].[/color][color=#0000BB]CloseHandle[/color][color=#007700]([/color][color=#0000BB]m_hProcess[/color][color=#007700]);
            if ([/color][color=#0000BB]iRetValue [/color][color=#007700]== [/color][color=#0000BB]0[/color][color=#007700])
                throw new [/color][color=#0000BB]Exception[/color][color=#007700]([/color][color=#DD0000]"CloseHandle failed"[/color][color=#007700]);
        }
 
        public [/color][color=#0000BB]byte[/color][color=#007700][] [/color][color=#0000BB]ReadProcessMemory[/color][color=#007700]([/color][color=#0000BB]IntPtr MemoryAddress[/color][color=#007700], [/color][color=#0000BB]uint bytesToRead[/color][color=#007700], [/color][color=#0000BB]out int bytesRead[/color][color=#007700])
        {
            [/color][color=#0000BB]byte[/color][color=#007700][] [/color][color=#0000BB]buffer [/color][color=#007700]= new [/color][color=#0000BB]byte[/color][color=#007700][[/color][color=#0000BB]bytesToRead[/color][color=#007700]];
           
            [/color][color=#0000BB]IntPtr ptrBytesRead[/color][color=#007700];
            [/color][color=#0000BB]ProcessMemoryReaderApi[/color][color=#007700].[/color][color=#0000BB]ReadProcessMemory[/color][color=#007700]([/color][color=#0000BB]m_hProcess[/color][color=#007700],[/color][color=#0000BB]MemoryAddress[/color][color=#007700],[/color][color=#0000BB]buffer [/color][color=#007700],[/color][color=#0000BB]bytesToRead[/color][color=#007700],[/color][color=#0000BB]out ptrBytesRead[/color][color=#007700]);
           
            [/color][color=#0000BB]bytesRead [/color][color=#007700]= [/color][color=#0000BB]ptrBytesRead[/color][color=#007700].[/color][color=#0000BB]ToInt32[/color][color=#007700]();
 
            return [/color][color=#0000BB]buffer[/color][color=#007700];
        }
 
        public [/color][color=#0000BB]void WriteProcessMemory[/color][color=#007700]([/color][color=#0000BB]IntPtr MemoryAddress[/color][color=#007700], [/color][color=#0000BB]byte[/color][color=#007700][] [/color][color=#0000BB]bytesToWrite [/color][color=#007700],[/color][color=#0000BB]out int bytesWritten[/color][color=#007700])
        {
            [/color][color=#0000BB]IntPtr ptrBytesWritten[/color][color=#007700];
            [/color][color=#0000BB]ProcessMemoryReaderApi[/color][color=#007700].[/color][color=#0000BB]WriteProcessMemory[/color][color=#007700]([/color][color=#0000BB]m_hProcess[/color][color=#007700],[/color][color=#0000BB]MemoryAddress[/color][color=#007700],[/color][color=#0000BB]bytesToWrite[/color][color=#007700],([/color][color=#0000BB]uint[/color][color=#007700])[/color][color=#0000BB]bytesToWrite[/color][color=#007700].[/color][color=#0000BB]Length[/color][color=#007700],[/color][color=#0000BB]out ptrBytesWritten[/color][color=#007700]);
           
            [/color][color=#0000BB]bytesWritten [/color][color=#007700]= [/color][color=#0000BB]ptrBytesWritten[/color][color=#007700].[/color][color=#0000BB]ToInt32[/color][color=#007700]();
        }
 
       
 
 
    }
} [/color]

and my app



Kod:
[color=#0000BB]using System[/color][color=#007700];
[/color][color=#0000BB]using System[/color][color=#007700].[/color][color=#0000BB]Collections[/color][color=#007700].[/color][color=#0000BB]Generic[/color][color=#007700];
[/color][color=#0000BB]using System[/color][color=#007700].[/color][color=#0000BB]ComponentModel[/color][color=#007700];
[/color][color=#0000BB]using System[/color][color=#007700].[/color][color=#0000BB]Data[/color][color=#007700];
[/color][color=#0000BB]using System[/color][color=#007700].[/color][color=#0000BB]Drawing[/color][color=#007700];
[/color][color=#0000BB]using System[/color][color=#007700].[/color][color=#0000BB]Linq[/color][color=#007700];
[/color][color=#0000BB]using System[/color][color=#007700].[/color][color=#0000BB]Text[/color][color=#007700];
[/color][color=#0000BB]using System[/color][color=#007700].[/color][color=#0000BB]Windows[/color][color=#007700].[/color][color=#0000BB]Forms[/color][color=#007700];
[/color][color=#0000BB]using ProcessMemoryReaderLib[/color][color=#007700];
[/color][color=#0000BB]using System[/color][color=#007700].[/color][color=#0000BB]Diagnostics[/color][color=#007700];
 
[/color][color=#0000BB]namespace SteamNameChanger
[/color][color=#007700]{
    public [/color][color=#0000BB]partial [/color][color=#007700]class [/color][color=#0000BB]MainWindowForm [/color][color=#007700]: [/color][color=#0000BB]Form
    [/color][color=#007700]{
        private [/color][color=#0000BB]ProcessMemoryReader reader [/color][color=#007700]= new [/color][color=#0000BB]ProcessMemoryReader[/color][color=#007700]();
        private [/color][color=#0000BB]Process[/color][color=#007700][] [/color][color=#0000BB]MyProcess [/color][color=#007700]= [/color][color=#0000BB]Process[/color][color=#007700].[/color][color=#0000BB]GetProcessesByName[/color][color=#007700]([/color][color=#DD0000]"Steam"[/color][color=#007700]);
        private [/color][color=#0000BB]ProcessModule mainModule[/color][color=#007700];
        private [/color][color=#0000BB]int SteamBaseAddres[/color][color=#007700];
        private [/color][color=#0000BB]int bytesReadSize[/color][color=#007700];
 
        public [/color][color=#0000BB]MainWindowForm[/color][color=#007700]()
        {
            [/color][color=#0000BB]InitializeComponent[/color][color=#007700]();
        }
 
        private [/color][color=#0000BB]void MainWindowForm_Load[/color][color=#007700]([/color][color=#0000BB]object sender[/color][color=#007700], [/color][color=#0000BB]EventArgs e[/color][color=#007700])
        {
            try
            {
                [/color][color=#0000BB]mainModule [/color][color=#007700]= [/color][color=#0000BB]MyProcess[/color][color=#007700][[/color][color=#0000BB]0[/color][color=#007700]].[/color][color=#0000BB]MainModule[/color][color=#007700];
                [/color][color=#0000BB]SteamBaseAddres [/color][color=#007700]= (int)[/color][color=#0000BB]mainModule[/color][color=#007700].[/color][color=#0000BB]BaseAddress[/color][color=#007700];
                [/color][color=#0000BB]reader[/color][color=#007700].[/color][color=#0000BB]ReadProcess [/color][color=#007700]= [/color][color=#0000BB]MyProcess[/color][color=#007700][[/color][color=#0000BB]0[/color][color=#007700]];
                [/color][color=#0000BB]reader[/color][color=#007700].[/color][color=#0000BB]OpenProcess[/color][color=#007700]();
            }
            catch
            {
                [/color][color=#0000BB]MessageBox[/color][color=#007700].[/color][color=#0000BB]Show[/color][color=#007700]([/color][color=#DD0000]"Please Start Steam\nBefore running this application."[/color][color=#007700], [/color][color=#DD0000]"Error: 120"[/color][color=#007700]);
                [/color][color=#0000BB]Application[/color][color=#007700].Exit();
            }
        }
 
        private [/color][color=#0000BB]void buttonTestAdress_Click[/color][color=#007700]([/color][color=#0000BB]object sender[/color][color=#007700], [/color][color=#0000BB]EventArgs e[/color][color=#007700])
        {
            try
            {
                [/color][color=#0000BB]byte[/color][color=#007700][] [/color][color=#0000BB]Name[/color][color=#007700];
                [/color][color=#0000BB]Name [/color][color=#007700]= [/color][color=#0000BB]reader[/color][color=#007700].[/color][color=#0000BB]ReadProcessMemory[/color][color=#007700](([/color][color=#0000BB]IntPtr[/color][color=#007700])([/color][color=#0000BB]SteamBaseAddres [/color][color=#007700]+ [/color][color=#0000BB]int[/color][color=#007700].[/color][color=#0000BB]Parse[/color][color=#007700]([/color][color=#0000BB]textBoxNameAdress[/color][color=#007700].[/color][color=#0000BB]Text[/color][color=#007700], [/color][color=#0000BB]System[/color][color=#007700].[/color][color=#0000BB]Globalization[/color][color=#007700].[/color][color=#0000BB]NumberStyles[/color][color=#007700].[/color][color=#0000BB]HexNumber[/color][color=#007700])), [/color][color=#0000BB]4[/color][color=#007700], [/color][color=#0000BB]out bytesReadSize[/color][color=#007700]);
                [/color][color=#0000BB]currentNameBox[/color][color=#007700].[/color][color=#0000BB]Text [/color][color=#007700]= [/color][color=#0000BB]String[/color][color=#007700].[/color][color=#0000BB]Format[/color][color=#007700]([/color][color=#DD0000]"{0}"[/color][color=#007700], [/color][color=#0000BB]Name[/color][color=#007700][[/color][color=#0000BB]0[/color][color=#007700]].[/color][color=#0000BB]ToString[/color][color=#007700]([/color][color=#DD0000]"X"[/color][color=#007700]));
 
                [/color][color=#FF8000]//userNames.Text += SteamBaseAddres;
                http://userNames.Text += "\t";
                http://userNames.Text += int.Parse(textBoxNameAdress.Text, System.Globalization.NumberStyles.HexNumber);
 
            [/color][color=#007700]}
            catch
            {
                [/color][color=#0000BB]currentNameBox[/color][color=#007700].[/color][color=#0000BB]Text [/color][color=#007700]= [/color][color=#DD0000]"Error!"[/color][color=#007700];
            }
 
        }
    }
} [/color]


And.

I find for example byte 44 in Cheat engine and when I put addres from cheatEngine into my app it reads totally different thing.

Where is my mistake?


Hello Kitty
vs
eMoStyLe




Hello EMO
EMO Team
EMO Team

Cinsiyet : Erkek
Burçlar : Yay
Yılan
Mesaj Sayısı : 935
Puan : 243043
Rep Puanı : 18
Doğum tarihi : 28/11/89
Kayıt tarihi : 21/07/09
Yaş : 27
Nerden : EMO WorlD
İş/Hobiler : RCE Student / Game Hacking / Learn Beginner C#,C++,Delphi
Lakap : EMO

Kullanıcı profilini gör http://emostyle.myforumpro.com

Sayfa başına dön Aşağa gitmek

Önceki başlık Sonraki başlık Sayfa başına dön


 
Bu forumun müsaadesi var:
Bu forumdaki mesajlara cevap veremezsiniz