c# - Getting Ptr Value of a Function -
i have api function in application:
<runtime.interopservices.dllimport("kernel32.dll", setlasterror:=true, charset:=runtime.interopservices.charset.ansi, exactspelling:=true)> private shared function getprocaddress(byval hmodule intptr, byval procname string) intptr end function
i want learn pointer 'intptr' value of function. how can it?
note: show exact thing want in c++
void* fngetprocaddress; fngetprocaddress = getprocaddress;
well, can continue using p/invoke...
(note, in c#, convertible)
[system.runtime.interopservices.dllimport("kernel32.dll")] public static extern intptr getprocaddress(intptr hmodule, string procname); [system.runtime.interopservices.dllimport("kernel32.dll")] public static extern intptr getmodulehandle(string modulename); var hmodule = getmodulehandle("kernel32.dll"); var procaddress = getprocaddress(hmodule, "getprocaddress");
Comments
Post a Comment