Hello All,
Do we have something similar to the Linux macro KERNEL in Windows to identify that we are running in Windows kernel?
Thanks and Regards,
Gaurav
Hello All,
Do we have something similar to the Linux macro KERNEL in Windows to identify that we are running in Windows kernel?
Thanks and Regards,
Gaurav
If you mean you’re looking for a macro that can determine, at compile time, whether code is being compiled for kernel-mode or user-mode, in Windows we have the _KERNEL_MODE macro.
Peter
OSR
@OSRDrivers
xxxxx@gmail.com wrote:
Do we have something similar to the Linux macro KERNEL in Windows to identify that we are running in Windows kernel?
Peter said something important in his reply that I want to emphasize.
The KERNEL and _KERNEL_MODE macros will both tell you whether the
code is being COMPILED for kernel mode. They don’t tell you where the
code is actually RUNNING. If you have a math library that can be used
in either user or kernel mode, and for some reason you need to know
where you are actually running, you’ll have to use other
processor-specific magic.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
One additional note, for the archives -
_KERNEL_MODE is new to the Win8 WDK (it’s tied in to the /kernel compiler flag which first appeared with that kit release). If you are using older WDK’s, _KERNEL_MODE won’t be set automatically by the compiler.
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Wednesday, September 03, 2014 10:01 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Windows Kernel Identification
xxxxx@gmail.com wrote:
Do we have something similar to the Linux macro KERNEL in Windows to identify that we are running in Windows kernel?
Peter said something important in his reply that I want to emphasize.
The KERNEL and _KERNEL_MODE macros will both tell you whether the code is being COMPILED for kernel mode. They don’t tell you where the code is actually RUNNING. If you have a math library that can be used in either user or kernel mode, and for some reason you need to know where you are actually running, you’ll have to use other processor-specific magic.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
TU Ken. That’s very useful.
I’ve only been using it since Win 8.1 myself… I never realized the macro was a new thing.
Much appreciated,
Peter
OSR
@OSRDrivers