|
-
Sep 8th, 2001, 01:46 AM
#1
Thread Starter
New Member
Help: ReadProcessMemory
I was wondering if anyone can help with my problem. I am writing a program that will read the virtual address space of another process. My problem is in the ReadProcessMemory API. For some reason I keep getting a null value. Before I start my "big" program, I figured I'd try it out on a small one, so here's what I've done so far:
- Open the windows Calculator
- Enter a number in the window (ex. 33557799)
- I used SoftIce to determine the address location of that string (ex. H809D3E00) to be used for the API
- Then I plug that into my program
- 1 Form
- 1 TextBox
- 1 Button
-- General declarations --
Private Declare Function FindWindow ...
Private Declare Function GetWindowThreadProcessId ...
Private Declare Function OpenProcess ...
Private Declare Function ReadProcessMemory ...
Private Declare Function CloseHandle ...
Private Sub btnReadText_Click()
Dim hwnd As Long
Dim pid As Long
Dim pHandle As Long
Dim str As String * 20
hwnd = FindWindow(vbNullString, "Calculator")
If (hwnd = 0) Then Exit Sub
GetWindowThreadProcessId hwnd, pid
pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
If (pHandle = 0) Then Exit Sub
ReadProcessMemory pHandle, &H809D3E00, str, 8, 0&
txtDisplay = str
CloseHandle hProcess
End Sub
Now when I run the program and click the button, the text box is empty although it SHOULD display the same data as the Calculator. I'm stumped as to what i'm doing wrong.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|