Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding
You last visited: Today at 07:28

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



VirtualAllocEx

Discussion on VirtualAllocEx within the General Coding forum part of the Coders Den category.

Reply
 
Old   #1
 
12354's Avatar
 
elite*gold: 0
Join Date: Apr 2007
Posts: 943
Received Thanks: 132
[Erledigt]VirtualAllocEx

Code:
    Private Declare Function VirtualAllocEx Lib "KERNEL32" (ByVal hProcess As Long, ByVal lpAddr As Long, ByVal dwSize As Long, ByVal flAllocationType As Long, ByVal flProtect As Long) As Int32
(...)
        Process.EnterDebugMode() 'EDIT
        Dim n As Int32
        Dim myProcesses As Process() = Process.GetProcessesByName("calc")
        Const PROCESS_ALL_ACCESS = &H1F0FFF
        prHandle = OpenProcess(PROCESS_ALL_ACCESS, 0, myProcesses(0).Id)
        n = VirtualAllocEx(prhandle, 0, 8074, &H1000, &H4)
        MsgBox(n)
Das Problem ist nur , es kommt immer 0 raus : /

Was mach ich falsch?


Erledigt- > siehe letzter Post / EDIT4
12354 is offline  
Old 09/06/2008, 12:31   #2
 
mr.rattlz's Avatar
 
elite*gold: 0
Join Date: Aug 2005
Posts: 896
Received Thanks: 334
Did you obtain the needed privileges beforehand?
Quote:
Remarks

To open a handle to another local process and obtain full access rights, you must enable the SeDebugPrivilege privilege.
mr.rattlz is offline  
Old 09/06/2008, 12:40   #3
 
12354's Avatar
 
elite*gold: 0
Join Date: Apr 2007
Posts: 943
Received Thanks: 132
Quote:
Originally Posted by mr.rattlz View Post
Did you obtain the needed privileges beforehand?


Jup hab ich auch : (

EDIT: Ich editiers mal rein
EDIT2: Es liegt nicht am ProzessHandle. ReadProcessMemory funktioniert mit genau dem Handle
12354 is offline  
Old 09/07/2008, 01:39   #4
 
mr.rattlz's Avatar
 
elite*gold: 0
Join Date: Aug 2005
Posts: 896
Received Thanks: 334
You should try and see what GetLastError has to say:
mr.rattlz is offline  
Old 09/07/2008, 10:34   #5
 
12354's Avatar
 
elite*gold: 0
Join Date: Apr 2007
Posts: 943
Received Thanks: 132
Quote:
Originally Posted by mr.rattlz View Post
You should try and see what GetLastError has to say:
Err.LastDllError.ToString = 87 ' ERROR_INVALID_PARAMETER
Parameter incorrect :/

Quote:
Originally Posted by Itburnz View Post
If you use .net try System.Diagnostics.Process.GetProcessesByName("Cal c");
Im already using this : D
Code:
        Dim myProcesses As Process() = [B]Process.GetProcessesByName("calc")[/B]
The Handle is alright. I can use ReadProcessMemory with it.

EDIT:Warum schreibt ihr eigentlich Englisch in einem deutschen Topic °-°

EDIT2: Anscheinend hab ich den VirtualAllocEx falsch deklariert.
Hab gerade ein ähnliches Problem bei einem anderen ApiCall gehabt!

EDIT3(-.-): Isses normal dass als Adresse jetzt immer 600000000(Hex) bzw 25769803776(Dez) rauskommt?
EDIT4 = Profit
Code:
    <DllImport("kernel32.dll", SetLastError:=True, ExactSpelling:=True)> _
        Private Function VirtualAllocEx(ByVal hProcess As IntPtr, ByVal lpAddress As IntPtr, _
    ByVal dwSize As UInteger, ByVal flAllocationType As UInteger, _
    ByVal flProtect As UInteger) As IntPtr
    End Function
12354 is offline  
Reply




All times are GMT +1. The time now is 07:28.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.