2
Reply

writeprocessmemory problems

Gatene

Gatene

Apr 9 2005 8:46 PM
2.3k
Hey all, I have created a project in VB6, and upgraded it so I can use it in VB.net, and everything works, except for when I want to write a value into the process. The program opens and reads values, but refuses to write values to a process. Here's my function if this helps any, and yes I do have the declarations in my program...that's DEFINITELY not the problem. Public Sub PsoWrite(ByRef address As Integer, ByRef Value As Integer) Dim hwnd As Long, pid As Integer, phandle As Long Dim gatene As Integer hwnd = FindWindow(vbNullString, "PSO for PC") If hwnd = 0 Then hwnd = FindWindow(vbNullString, "Hacked PSO") If hwnd = 0 Then MsgBox("In The Readme, you were told to run my other application first! It is called FindWindow.exe", _ vbOKOnly, "Read the ReadMe File") GoTo endprog End If End If If (hwnd <> 0) Then GetWindowThreadProcessId(hwnd, pid) phandle = OpenProcess(PROCESS_ALL_ACCESS, gatene, pid) If (phandle <> 0) Then WriteProcessMemory(phandle, address, Value, 1, 0&) End If CloseHandle(phandle) End If Exit Sub endprog: Me.Close() End Sub Like I said before, I can read values without any problem....just writing gives me a fit. Thanks in advance, Gatene

Answers (2)