User Vs Kernel mode -mouse like - SendInput/CreateFile("COM1",...)

Discussion in 'Windows Vista Drivers' started by microsoft.mcad, May 24, 2004.

  1. Hi all,

    I have to do a device driver for a TouchScreen monitor and it is supposed to
    work like a mouse.

    Now I'm studing how to do WDM driver (kernel-mode, right?)....But during my
    job of understand the firmware protocol I did an application that get
    touched coordinates through COM and set the windows mouse pointer to its
    position. This application works like that:

    hCom = CreateFile( "COM1", GENERIC_READ | GENERIC_WRITE... // Open COM port
    for read and write
    ....
    while ( true )
    {
    ReadFile(hCom, // read bytes from serial
    ...
    SendInput // insert mouse input (movement or click) events
    }

    ???? The question is, Could I use this application installed as a Service
    instead of use a WDM (or other kernel-mode) driver? What problems could
    arise because of this ???

    1- Will that "user-mode driver" have performance problems?
    2- When the system is in low memory conditions will it have problems?
    2.1 - I'm supposing this application will require less than 1Kbyte in
    memory for some controls variables and the COM1 file handle, I'm planning
    use VirtualAlloc and VirtualLock to keep it in physical memory, Does it
    solve the problems?
    3- And what about when the system is running in low CPU contions?
    4- I also have to do a USB version. All of the questions above are the same
    for USB?
    5- I'm planing use Plug-Play and Power management functionalities. Can it be
    well-done using "RegisterDeviceNotification" and related funcions?

    The application I refer above is just a MFC console application created
    using Visual Studio .NET. Can I call it a User-mode device driver? Is there
    any framework or way to do an application so it can be called a user-mode
    device driver?

    Thanks Very Much In Advance,
    Edgard Lima
     
    microsoft.mcad, May 24, 2004
    #1
    1. Advertisements

  2. microsoft.mcad

    Ray Trent Guest

    I've written exactly such a program, and it works fine in user mode. You
    could have some slowness of response under heavy load, but that's true
    even for a kernel mode device driver.

    Don't bother keeping it in memory. If you're that worried about
    real-time performance, you might want to consider an OS other than
    Windows :).

    For USB, the OS's driver should be adequate if you set up your HID
    report structure as an absolute pointing device. I think there might
    even be ways to hook up the the OS's calibration scheme, but I'm not
    sure about that.
     
    Ray Trent, May 25, 2004
    #2
    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.