
Originally Posted by
javalover
@
WasserEsser how are you interpreting this:

Originally Posted by
javalover
Just to say, when you call ReadProcessMemory the ZwReadVirtualMemory function gets called too.
?
I'm not sure you know I'm not the one who suggested to use NtReadVirtualMemory.
I thought you were trying to say that ZwReadVirtualMemory is not part of ReadProcessMemory / Windows API and can be used as an alternative, as i said you can't access the memory of another process other than being part of the process or using the windows api. The response "not only, ZwReadVirtualMemory gets called too, thats the actual function" lead me into thinking that you meant that ZwReadVirtualMemory is not part of the Windows API. I was incorrectly interpreting your sentence and read it too quickly.

Originally Posted by
WasserEsser
NtReadVirtualMemory will then call ZwReadVirtualMemory, yes.

Originally Posted by
javalover
No. ZwReadVirtualMemory gets called just from the Ntoskrnl.exe core to access kernel mode or be aware it didn't access kernel mode, and not from NtReadVirtualMemory, that is called from ReadProcessMemory in ntdll.dll which contains just kernel NT functions.
When called from ntdll.dll in user mode, these groups are almost exactly the same; they trap into kernel mode and call the equivalent function in ntoskrnl.exe via the SSDT.
1.) ReadProcessMemory Calls NtReadVirtualMemory in NTDLL.DLL
2.) NtReadVirtualMemory passes through the SYSENTER/2Eh callgate and KeServiceDescriptorTable handler.
3.) ntoskrnl.exe calls ZwReadVirtualMemory for your application.
4.) ZwReadVirtualMemory reads the process memory and writes it into the buffer you supplied.
If you call a function directly or through a wrapper / descriptor table, you essentially made the function get called. You're right, NtReadVirtualMemory doesn't call ZwReadVirtualMemory directly, it gets called by ntoskrnl.exe, but you essentially got ZwReadVirtualMemory to get called, if you call it directly, call a wrapper or call it through the descriptor table, you ( NtReadVirtualMemory ) still got the function ( ZwReadVirtualMemory ) to get called. My wording is incorrect, yes.