App verifier, HOOK, shim and how wince works
- From: Vincent RICHOMME <richom.v@xxxxxxx>
- Date: Fri, 10 Nov 2006 22:29:31 +0100
Hi,
for a few months I am doing low level programming (while I am usually a high level programmer(C++)) and first I thought I would die but now I find it almost interesting. The more I go deep inside the kernel the more I learn however I have some questions.
What I wanted to do first was to hook system calls, I have managed (thanks to source code found on forums) to hooks some functions like CreateFile, RegCreateKeyE, ...
From what I have understood everytime a user application calls a System functions like createfile an exception is thrown. For instance when I look at CreateFile in coredll.dll, I can see this :
STMFD SP!, {R4-R11,LR}
SUB SP, SP, #0x10
MOV R9, R3
MOV R10, R2
MOV R11, R1
MOV R8, R0
MOVL LR, 0xFFFFC800
LDR LR, [LR]
LDR LR, [LR,#-0x14]
TST LR, #1
BEQ loc_0_10021060
....
LDR R4, =0xF000AFDC
Interesting part is on one hand 0xFFFFC800 because this memory address corresponds to the address where the kernel is loaded on ARM platform and on the other hand 0xF000AFDC because this corresponds to an exception and the kernel knows it corresponds to a system call.
With this two values and knowing kernel data structure it should be possible to hook functions.
What I don't understand is
1)When an application do a syscall, let's say CreateFile, is coredll loaded in the memory space of the application or is it shared ?
I suppose there is only one instance of coredll, so in which process is coredll loaded ? NK.exe ?
2)When I use remote process viewer I can see that some process loads coredll.dll.040c.mui? What does it mean ?
3)some syscalls (the ones I can hook) are located inside services,in the kernel structure the SystemAPISets[ApiSet]->pServer->hProc hold the process handle. For instance CreateFile is implemented inside filesys.exe but how can I hook syscalls when pServer is NULL
4)It seems MS provides a tool called app verifier and that is used to debug and track memory leaks. It works in kernel userland.On MSDN they explains that we can developp our own dll(called a shim) to intercept any syscall we want however it seems to work only per application. What if I want to intercept some syscalls from ALL the applications ?
5)Would it be possible to use detour patching on coredll ?
.
- Follow-Ups:
- Re: App verifier, HOOK, shim and how wince works
- From: Ross Jordan [MSFT]
- Re: App verifier, HOOK, shim and how wince works
- Prev by Date: Re: Migration to Mobile 5
- Next by Date: Re: Internet Explorer in WIN CE
- Previous by thread: Re: Migration to Mobile 5
- Next by thread: Re: App verifier, HOOK, shim and how wince works
- Index(es):
Relevant Pages
|