Valhalla Legends Forums Archive | Visual Basic Programming | VirtualProtectEx in VB

AuthorMessageTime
Paul
Does anyone have a clear cut working example on how to use VirtualProtectEx in Visual Basic 6? How to declare everything properly and how to actually use it? I've tried googling for VirtualProtectEx+Visual Basic+Usage and find nothing that shows an idiot-proof example on how to properly use AND if possible test it.
March 3, 2004, 1:31 AM
TheMinistered
why do you need virtualprotectex, why not just virtualrprotect? But, I do have a working example in this project: www.backstab.ca/~source/VB%20PATCHER.zip

wait a second for me to upload
March 3, 2004, 1:36 AM
Paul
[quote author=TheMinistered link=board=31;threadid=5551;start=0#msg47160 date=1078277807]
why do you need virtualprotectex, why not just virtualrprotect?
[/quote]

Do you have an idiot-proof example on how to implement VirtualProtect?

Edit:
Cool, I'll check that out!

Double edit:

404 Error on that url. Nevermind! :P
March 3, 2004, 1:38 AM
Paul
In my form I have the following:

[code]Private Declare Function VirtualProtect Lib "kernel32" (ByVal lpAddress As Long, ByVal dwSize As Long, ByVal flNewProtect As Long, lpflOldProtect As Long) As Long

Private Const PAGE_EXECUTE_READWRITE As Long = &H40&

Dim lOldProtect As Long

VirtualProtect &Hoffsethere, 4, PAGE_EXECUTE_READWRITE, lOldProtect

[/code]

Is this how you use/declare everything? All I want to do is change the rights to one address.

March 3, 2004, 2:04 AM
TheMinistered
It looks like you got it down pretty much...
March 3, 2004, 2:23 AM
Paul
Is there a way to test the address I change permissions on because I don't think it's working.
March 3, 2004, 2:36 AM
TheMinistered
call VirtualProtect twice and check lOldProtection
March 3, 2004, 2:52 AM

Search