Tech Support > Microsoft Windows > Drivers > Calling Win32 API User mode functions from Kernel Mode
Calling Win32 API User mode functions from Kernel Mode
Posted by Manohara.K on August 10th, 2004


Hi All,

Just wanted to know , If its possible , If yes ..how ?? .to call User Mode APIs/ Win32 APIs
from Kernel Mode/Device Drivers


regards,
Manohara

Calling Win32 API User mode functions from Kernel Mode

Posted by Ray Trent on August 10th, 2004


There are some user-mode APIs that have equivalents in kernel mode, but
most don't. You can't directly call the user-mode APIs from kernel mode.

The only way to work around this in general is to have a user-mode
helper program (or service) that your driver triggers to call the Win32
APIs you need.

Manohara.K wrote:

Posted by James Antognini [MSFT] on August 11th, 2004


The short answer is, as Ray said, No.

The longer answer is that even if you could finagle the imports and effect the call (not impossible), the stuff you're calling isn't written to accommodate the environment a kernel-mode caller brings along with itself. You'd probably get a BSOD, and that would be the good outcome. The bad outcome would be damage to the process or to the OS without a BSOD.

--
James Antognini
Windows DDK Support

This posting is provided "AS IS" with no warranties, and confers no rights.

"Manohara.K" <manohara@sasken.com> wrote in message news:Ox8IISufEHA.3612@TK2MSFTNGP12.phx.gbl...
Hi All,

Just wanted to know , If its possible , If yes ..how ?? .to call User Mode APIs/ Win32 APIs
from Kernel Mode/Device Drivers


regards,
Manohara

Calling Win32 API User mode functions from Kernel Mode