Calling Win32 API User mode functions from Kernel Mode

Calling Win32 API User mode functions from Kernel Mode

Post by Manohara. » Wed, 11 Aug 2004 23:15:42


This is a multi-part message in MIME format.


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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV>
<P><FONT face=Arial size=2>Hi All,</FONT></P>
<P><FONT face=Arial size=2>Just wanted to know , If its possible , If yes ..how
?? .to call User Mode APIs/ Win32 APIs <BR>from Kernel Mode/Device
Drivers</FONT></P>
<P><BR><FONT face=Arial size=2>regards,<BR>Manohara</FONT></P>
<P><FONT face=Arial size=2>Calling Win32 API User mode functions from Kernel
Mode</FONT></P></DIV></BODY></HTML>
 
 
 

Calling Win32 API User mode functions from Kernel Mode

Post by Ray Tren » Thu, 12 Aug 2004 02:18:35

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.

 
 
 

Calling Win32 API User mode functions from Kernel Mode

Post by James Anto » Thu, 12 Aug 2004 09:54:36

This is a multi-part message in MIME format.


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.


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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2162" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>The short answer is, as Ray said, No.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>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.</FONT></DIV>
<DIV><BR>-- <BR>James Antognini<BR>Windows DDK Support</DIV>
<DIV> </DIV>
<DIV>This posting is provided "AS IS" with no warranties, and confers no
rights.<BR></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Manohara.K" <<A

<A

<DIV>
<P><FONT face=Arial size=2>Hi All,</FONT></P>
<P><FONT face=Arial size=2>Just wanted to know , If its possible , If yes
..how ?? .to call User Mode APIs/ Win32 APIs <BR>from Kernel Mode/Device
Drivers</FONT></P>
<P><BR><FONT face=Arial size=2>regards,<BR>Manohara</FONT></P>
<P><FONT face=Arial size=2>Calling Win32 API User mode functions from Kernel
Mode</FONT></P></DIV></BLOCKQUOTE></BODY></HTML>