Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27311

VS 2008 Change the address permissions so i can read/ write to it

$
0
0
Hi !
I need to read 3 bytes from a address in some application, however i cant because i dont have permissions for that.
I tried changing the permissions, i found some code on the internet and i edited it a bit so it looks like this:
Code:

For Each p As Process In Process.GetProcessesByName("ProcessName_Here")
                            Const PAGE_EXECUTE_READWRITE As Integer = &H40
                            Dim oldProtect As Integer
                            VirtualProtectEx(p.Handle, &Haddress_here, 3, PAGE_EXECUTE_READWRITE, oldProtect)
                            p.Dispose()
                        Next

However it doesnt work, i still cant read or write to the address im trying to change.
My VirtualProtectEx declaration:
Code:

Declare Function VirtualProtectEx Lib "kernel32.dll" (ByVal hProcess As IntPtr, ByVal lpAddress As IntPtr, ByVal dwSize As IntPtr, ByVal newProtect As Integer, ByRef oldProtect As Integer) As Boolean
Could someone help me with this ?

Viewing all articles
Browse latest Browse all 27311

Trending Articles