Память

Программирование на Visual Basic, главный форум. Обсуждение тем программирования на VB 1—6.
Даже если вы плохо разбираетесь в VB и программировании вообще — тут вам помогут. В разумных пределах, конечно.
Правила форума
Темы, в которых будет сначала написано «что нужно сделать», а затем просьба «помогите», будут закрыты.
Читайте требования к создаваемым темам.
_Мика_
Гуру
Гуру
 
Сообщения: 1459
Зарегистрирован: 24.10.2003 (Пт) 15:05
Откуда: г. Москва, м.Речной вокзал

Память

Сообщение _Мика_ » 25.02.2004 (Ср) 17:02

Как можно узнать какое число лежит в предположем адрессе 0012E354 и как его можно изменить :)
-Папа, а правда, что форумы делают людей дибилами?
-гы гы гы, сынок, лол!

RayShade
Scarmarked
Scarmarked
Аватара пользователя
 
Сообщения: 5511
Зарегистрирован: 02.12.2002 (Пн) 17:11
Откуда: Russia, Saint-Petersburg

Сообщение RayShade » 25.02.2004 (Ср) 18:46

Насчет того, как узнать - это есть API CopyMemory.

А вот начет изменять - под виндами, особенно 2000 и старше, я бы делал это осторожно.

_Мика_
Гуру
Гуру
 
Сообщения: 1459
Зарегистрирован: 24.10.2003 (Пт) 15:05
Откуда: г. Москва, м.Речной вокзал

Сообщение _Мика_ » 26.02.2004 (Чт) 18:20

Не я наверное не доконца сформулировал :oops:
Дапустим в какой нибудь игре какое нибудь значение равно 100.
Заранее я знаю что по такому то адресу лежит это число.
Теперь как его можно изменить!!
-Папа, а правда, что форумы делают людей дибилами?
-гы гы гы, сынок, лол!

Strayd
Обычный пользователь
Обычный пользователь
 
Сообщения: 60
Зарегистрирован: 14.07.2003 (Пн) 4:22

Сообщение Strayd » 26.02.2004 (Чт) 18:29

Возими лучше Artmoney, он в процессе найдет все адреса, и позволит менять данные по адресу.

GSerg
Шаман
Шаман
 
Сообщения: 14286
Зарегистрирован: 14.12.2002 (Сб) 5:25
Откуда: Магадан

Сообщение GSerg » 26.02.2004 (Чт) 21:01

readprocessmemory
writeprocessmemory
Как только вы переберёте все варианты решения и не найдёте нужного, тут же обнаружится решение, простое и очевидное для всех, кроме вас

_Мика_
Гуру
Гуру
 
Сообщения: 1459
Зарегистрирован: 24.10.2003 (Пт) 15:05
Откуда: г. Москва, м.Речной вокзал

Сообщение _Мика_ » 27.02.2004 (Пт) 23:10

2_Strayd artmoney у меня есть!!!
Я хочу таким образом трейнеры писать

А вот про readprocessmemory writeprocessmemory если можно по подробней
-Папа, а правда, что форумы делают людей дибилами?
-гы гы гы, сынок, лол!

A.A.Z.
Член-корреспондент академии VBStreets
Член-корреспондент академии VBStreets
 
Сообщения: 3035
Зарегистрирован: 30.06.2003 (Пн) 13:38

Сообщение A.A.Z. » 27.02.2004 (Пт) 23:41

ReadProcessMemory:
API-Guide писал(а):Declaration:
Код: Выделить всё
Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long


Description:
The ReadProcessMemory function reads data from an area of memory in a specified process. The entire area to be read must be accessible, or the operation fails.

Parameters:
· hProcess
[in] Handle to the process whose memory is being read. The handle must have PROCESS_VM_READ access to the process.

· lpBaseAddress
[in] Pointer to the base address in the specified process from which to read. Before any data transfer occurs, the system verifies that all data in the base address and memory of the specified size is accessible for read access. If this is the case, the function proceeds; otherwise, the function fails.

· lpBuffer
[out] Pointer to a buffer that receives the contents from the address space of the specified process.

· nSize
[in] Specifies the requested number of bytes to read from the specified process.

· lpNumberOfBytesRead
[out] Pointer to a variable that receives the number of bytes transferred into the specified buffer. If lpNumberOfBytesRead is NULL, the parameter is ignored.

Return Value:
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
The function fails if the requested read operation crosses into an area of the process that is inaccessible.


WriteProcessMemory:
API-Guide писал(а):Declaration:
Код: Выделить всё
Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByVal lpBuffer As Any, ByVal nSize As Long, ByVal lpNumberOfBytesWritten As Long) As Long


Description:
The WriteProcessMemory function writes data to an area of memory in a specified process. The entire area to be written to must be accessible, or the operation fails.

Parameters:
· hProcess
[in] Handle to the process whose memory is to be modified. The handle must have PROCESS_VM_WRITE and PROCESS_VM_OPERATION access to the process.

· lpBaseAddress
[in] Pointer to the base address in the specified process to which data will be written. Before any data transfer occurs, the system verifies that all data in the base address and memory of the specified size is accessible for write access. If this is the case, the function proceeds; otherwise, the function fails.

· lpBuffer
[in] Pointer to the buffer that contains data to be written into the address space of the specified process.

· nSize
[in] Specifies the requested number of bytes to write into the specified process.

· lpNumberOfBytesWritten
[out] Pointer to a variable that receives the number of bytes transferred into the specified process. This parameter is optional. If lpNumberOfBytesWritten is NULL, the parameter is ignored.

Return Value:
If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError. The function will fail if the requested write operation crosses into an area of the process that is inaccessible.


API-Guide писал(а):Sample:
Код: Выделить всё
'You Need a button (Command1).
' MaRiO G. Serrano. 16/Abril/2002.-
Private Const PROCESS_ALL_ACCESS As Long = &H1F0FFF
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Declare Function WriteString Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByVal lpBuffer As Any, ByVal nSize As Long, ByVal lpNumberOfBytesWritten As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
'Private Declare Function WriteValue Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, ByVal lpNumberOfBytesWritten As Long) As Long

Private Sub Command1_Click()
    Dim str As String, MyString As String
    MyString = "HELLO"
    'in this case I read the memory of my own process
    MsgBox "MyString= " & MyString
   
    str = ReadMemory(Me.hWnd, StrPtr(MyString), LenB(MyString), "BYE!!")
   
    MsgBox "Now, MyString=" & MyString & vbCr & "Old Value= " & str
   
End Sub
Private Function ReadMemory(hWnd As Long, Address As Long, Bytes As Long, Optional strReplaceWith As String) As String
    'Runs For Not Unicode Strings (VB-Strings)
    On Error Resume Next
    Dim pId As Long        ' Used to hold the Process Id
    Dim pHandle As Long    ' Holds the Process Handle
    Dim bytValue As Long   'Stores the value  of a byte in the memory
    Dim i As Long
    Dim Text As String
   
    ' Get the ProcId of the Window
    GetWindowThreadProcessId hWnd, pId

    ' use the pId to get a handle
    pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, pId)
   
    If (pHandle = 0) Then
         'MsgBox "Unable to open process!"
         Exit Function
    End If
    If Address = 0 Then Exit Function
   
    For i = 1 To Bytes Step 2
       ' Read Byte to Byte
       ReadProcessMemory pHandle, Address + i - 1, bytValue, 1, 0&
       'value now contains the long value of the byte located in [Address + i - 1] pos.
       'ReadMemory is a string...
       
       ReadMemory = ReadMemory & Chr$(bytValue)
    Next
    'to write numeric values you can ..(Must) use WriteValue API
    If LenB(strReplaceWith) <> 0 Then
        'No Unicode!!
        WriteString pHandle, Address, StrPtr(strReplaceWith), LenB(strReplaceWith), 0&
    End If
    'Close the Handle
    CloseHandle pHandle
End Function
Нет меня больше

_Мика_
Гуру
Гуру
 
Сообщения: 1459
Зарегистрирован: 24.10.2003 (Пт) 15:05
Откуда: г. Москва, м.Речной вокзал

Сообщение _Мика_ » 28.02.2004 (Сб) 14:31

Санкс, ща попробую :D
-Папа, а правда, что форумы делают людей дибилами?
-гы гы гы, сынок, лол!

Ilya Vasilyev
Постоялец
Постоялец
 
Сообщения: 820
Зарегистрирован: 06.08.2002 (Вт) 5:36
Откуда: Russia, Omsk

Сообщение Ilya Vasilyev » 01.03.2004 (Пн) 8:18

А чё пробывать, RayShade же сказал, под NT-based может упасть...
Изображение
Компьютер позволяет решать все те проблемы, которые до его изобретения не существовали

_Мика_
Гуру
Гуру
 
Сообщения: 1459
Зарегистрирован: 24.10.2003 (Пт) 15:05
Откуда: г. Москва, м.Речной вокзал

Сообщение _Мика_ » 01.03.2004 (Пн) 17:51

Ну почему :?: :?: :?: :?: :?:
Artmoney нормально идет не чего не случается :)
-Папа, а правда, что форумы делают людей дибилами?
-гы гы гы, сынок, лол!

hCORe
VB - Экстремал
VB - Экстремал
Аватара пользователя
 
Сообщения: 2332
Зарегистрирован: 22.02.2003 (Сб) 15:21
Откуда: parent directory

Сообщение hCORe » 01.03.2004 (Пн) 18:36

Мммм... Ну VB же не MSVC++ 6 чтобы виртуозно работать с памятью. А Win NT и вправду может упасть :evil: У меня например, не падал, но ArtMoney не работал вообще. То есть ищет, изменяет/блокирует и ничего не происходит.
Моду создают модоки, а распространяют модозвоны.

_Мика_
Гуру
Гуру
 
Сообщения: 1459
Зарегистрирован: 24.10.2003 (Пт) 15:05
Откуда: г. Москва, м.Речной вокзал

Сообщение _Мика_ » 02.03.2004 (Вт) 10:14

Ну незнаю, короче говоря все работает, всем спаибо :D :D
-Папа, а правда, что форумы делают людей дибилами?
-гы гы гы, сынок, лол!


Вернуться в Visual Basic 1–6

Кто сейчас на конференции

Сейчас этот форум просматривают: AhrefsBot, Google-бот и гости: 9

    TopList