Device Drivers and Application Programs

Jawab Device Drivers and Application Programs

  • 25 Februari 2012 0:07
     
     

    OK, I know this probably isn't the right forum but since I can't figure out where I should pose my question I'll pose it here.

    Can a device driver be written so that, when it gets called by some application, the device driver can know what application is calling it?

    • Dipindahkan oleh Lie You 27 Februari 2012 7:34 Help to find the right category. (From:Visual C# General)
    •  

Semua Balasan

  • 25 Februari 2012 2:38
     
     

    Write a proxy in between the application and the device driver.

    chanmm


    chanmm

  • 25 Februari 2012 20:28
     
     
    I don't know what that means. Can you elaborate?
  • 28 Februari 2012 14:09
    Moderator
     
     
    Write a DLL that calls into your device driver. Only provide the dll to your customer, do not give out any other communication protocol of your driver.


    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP

  • 09 April 2012 5:53
    Pemilik
     
     
    Okay, what are you writing it in?

    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

  • 09 April 2012 5:55
     
     

    This is a device that will be used by anybody. There will not be any specific application program of my own that will be associated with it. But it will need some way of knowing what applications are indeed accessing it, so that it can respond in specific ways based on what application is accessing it. Basically I want the user to be able to specify which applications can access it, and fo rthe device driver (or SOMETHING) be provided with that list of "valid" applications, then the dvice driver, by knowing what application happens to be trying to access it at any given time, can respond by either allowing the access or denying the access.

    So, it there a way that this can be done? Can a device driver figure out what application happens to be accessing it?

  • 09 April 2012 5:57
     
     
    I'm a software engineer with 35 years experience in C, C++, C# and the MFC application development. But I've never written a device driver.
  • 09 April 2012 23:04
    Pemilik
     
     

    There's not a good forum for this, but they should tell you before they turn you away that you can't do this in C# right now, but you can in C++.

    Other forums you can ask in...

    Visual C++ General

    Visual C++ (categories)                

    Now here is some of my searching around...

    http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/8e4c0a4d-e0b1-4bdf-89c9-a4574a020f1a - How to write a device driver (ironically this is the forum your question was moved out of)

    In that thread, Giorgi says: "You will need Windows Driver Development Kit in order to write drivers. You can write them in c++ but not in c#."

    Windows Driver Kit: http://msdn.microsoft.com/en-us/windows/hardware/gg487428.aspx

    User Mode Driver Framework FAQ: http://msdn.microsoft.com/en-us/windows/hardware/gg463301.aspx

    User Mode drivers: http://www.microsoft.com/whdc/driver/wdf/UMDF_FAQ.mspx

    How to write a Windows driver: http://msdn.microsoft.com/en-us/library/ms809956.aspx

    Develop a Windows driver: http://msdn.microsoft.com/en-us/windows/hardware/gg490655.aspx

    Getting Started with Windows Drivers: http://msdn.microsoft.com/library/windows/hardware/ff554690

    Getting Started with Windows Driver Development: http://msdn.microsoft.com/library/windows/hardware/gg463002

    Developing Drivers with WDF: http://msdn.microsoft.com/library/windows/hardware/gg463318

    Download Windows Driver Kit 8: http://msdn.microsoft.com/en-us/windows/hardware/br259105

    Okay. That might keep you busy. =^)

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

  • 16 April 2012 14:53
     
     

    Ed,

    This is all great information, but what I really need is an answer to my very basic question (BEFORE I try to wade through all the instructions on HOW to write a driver).

    Can the device driver itself know what program is calling it? For example, if I've written a device driver for a Disk Drive and installed it on someone's computer and subsequently some program (ANY program) tries to make access to a file on that disk drive, or even ifthe applicationt causes the standard file select dialog to come up, providing access to my disk drive, can the device driver itself KNOW what application is is making use of it? Can the device driver KNOW the name of the application or perhaps KNOW the location of the application (i.e. what folder it resides in) or SOMEHOW identify what application is calling it?

    - Roger

  • 16 April 2012 17:45
    Moderator
     
     Jawab

    You need a user mode component for the driver. I am not sure you can write a user mode component for a disk drive though, I only know some graphics card use it to isolate the address overhead to the process space. Visit the WDK forum and ask if it is possible to have a user mode component for a disk drive.



    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP

  • 16 April 2012 19:04
    Pemilik
     
     

    Ed,

    This is all great information, but what I really need is an answer to my very basic question (BEFORE I try to wade through all the instructions on HOW to write a driver).

    Can the device driver itself know what program is calling it? For example, if I've written a device driver for a Disk Drive and installed it on someone's computer and subsequently some program (ANY program) tries to make access to a file on that disk drive, or even ifthe applicationt causes the standard file select dialog to come up, providing access to my disk drive, can the device driver itself KNOW what application is is making use of it? Can the device driver KNOW the name of the application or perhaps KNOW the location of the application (i.e. what folder it resides in) or SOMEHOW identify what application is calling it?

    - Roger


    Roger, I know. This isn't an answer forum though. This is a "I don't know where to go. Can someone tell me where to ask my question?" forum. So that's what we deliver here... Places to go ask your question. I'll see where the WDK forum is.

    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)


  • 16 April 2012 19:27
    Pemilik
     
     Jawab

    You need a user mode component for the driver. I am not sure you can write a user mode component for a disk drive though, I only know some graphics card use it to isolate the address overhead to the process space. Visit the WDK forum and ask if it is possible to have a user mode component for a disk drive.



    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP

    Specifically it looks like the WDK issues are handled in the Windows SDK forum here:

    http://social.msdn.microsoft.com/Forums/en-US/windowssdk/threads

     

    And here's the MSDN page to learn more about the WDK:

    http://msdn.microsoft.com/en-us/windows/hardware/gg487428

     

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)