I want to debug a program in kernel mode, and I want to break on the entry point of the program like ollydbg
. But I can't break it with bp
because the program is not start and the symbol can't be loaded. I have found some way to do it but I think it's not so good.
1.Break on the CreateProcess
function in kernel. But I don't know which function exactly should I break and I think there is a long way between CreateProcess
and the entry point of the program.
2.Change the entry point of the program with cc
. But it needs other tools and I should change the code where the byte changed back. I think it is annoying.
3.With the help of ollydbg
. Debugging the program with ollydbg
in a virtual machine which is debugged with windbg. I don't think that it is a good idea.
4.Use sxe ld
. It can be found on Listing 3.29
in <<Advanced Windows Debugging>>
. I have tried it but I found that it only works on the first time. And I don't know what exactly should I do after the break.
5.Break on the entry function with bu
. But I don't know what exactly I should do either. For example, how to load the symbol?
6.Use .create
. I don't know whether it is properly or not to do what I said.
I think that it is a common use to break on the entry point of a program when debug in kernel mode with windbg
, and I think that there must be a good way to do that with the powerful windbg
. What's the best way to do it?
By the way, I want to debug a program in kernel mode because I want to get the token vaule of the program. I found that the windbg can identify the token with !token
in user mode, but I don't know how to get the value of token in user mode. It seems that I can only get the value of token in the kernel mode, right or wrong?