Calling Win32 API User mode functions from Kernel Mode

Discussion in 'Windows Vista Drivers' started by Manohara.K, Aug 10, 2004.

  1. Manohara.K

    Manohara.K Guest

    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
     
    Manohara.K, Aug 10, 2004
    #1
    1. Advertisements

  2. Manohara.K

    Ray Trent Guest

    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.
     
    Ray Trent, Aug 10, 2004
    #2
    1. Advertisements

  3. 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
     
    James Antognini [MSFT], Aug 11, 2004
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.