Page 1 of 1

How to switch to kernel mode?

PostPosted: Aug 15, 2007 @ 9:15am
by drgoldie
I need to switch my application to kernel mode.
The docs say that this can be done using SetKMode() but that function is not available in the WM5 SDK.

Any ideas?

thanks,
Daniel

PostPosted: Aug 15, 2007 @ 4:08pm
by Kzinti

PostPosted: Aug 16, 2007 @ 11:00am
by drgoldie
Thanks a lot Thierry. The method is obvious, works and I should have guessed it myself.

Now another question: Is there a better way to find out if switching to kernel mode worked than switching back and checking the return value of SetKMode?

Daniel

PostPosted: Aug 16, 2007 @ 4:09pm
by Kzinti
I don't know of any way. I always surround my kernel mode code with a __try / __catch pair, just in case.

Even if SetKMode() succeeds, I've run into cases where the opcodes I was executing were not supported by a given CPU.