Re: Several questions to develop driver with eVC

From: Dean Ramsier (ramsiernospam_at_nospam.com)
Date: 10/20/04


Date: Wed, 20 Oct 2004 14:38:26 -0400

One other option that might be appropriate for your situation...

You're using the term "driver", which typically have defined interfaces
accessible DeviceIoControl functions. However, if you're really building a
dll that just provides support to your application and isn't really a
"driver" in the traditional sense you can use a combination of LoadLibrary()
and GetProcAddress() to access functions in the dll from your application.

-- 
Dean Ramsier - eMVP
"Steve Maillet (eMVP)" <nospam1@EntelechyConsulting.com> wrote in message
news:%239WhlzptEHA.160@TK2MSFTNGP11.phx.gbl...
> a) eVC is not a tool fro writing device drivers. While it's possible if
you
> really know what you are doing, there are a number of caveats. Platform
> Builder is the more appropriate tool fro driver development.
>
>
> Q:. What and how to link the function name in driver and application?
> For example, when I call CreateFile() in application, how does wince know
> what to do? How does the function ReadFile() in application map to
> XXX_Read() in driver?
>
> A: FM (a.k.a Friggin' magic) don't worry about how the OS implements
that -
> you can't do anything about it! What you need to know is that the
> information for the driver is placed in the registry and then something
> calls ActivateDeviceEx pointing to the registry settings to tell the
device
> manager to load the driver. That something could be the device manager
> itself during boot when it reads the "BuiltIn" key or it could be a PnP
bus
> driver. It can also be any application that wants the driver loaded.
>
> Q: What's more, If I develop a driver with other exported function
>   (Other than XXX_Read() XXX_Write(), such as MyExpFunc() ), what should I
> do? That is, how to establish the link between exposed driver functions
and
> application functions.
>
> A: You can't do that. ALL application access to the driver is done through
> the standard stream interface. You can use xxx_IoControl to expose your
own
> functionality for the driver.
>
> Q: Is there any conception of user-space and system-space just like driver
> in Linux, where we should use copytouser() and copyfromuser() to transfer
> parameters?
>
> A: Yes and no. There is separate space for each process. The application
> runs in its own space and the driver operates in the Device Manager's
space.
> Device drivers are called in a kernel mode that has access to each space
but
> pointers to data in the applications space need to be mapped via a call to
> MapCallerPtr() before the driver can use them. The OS automatically does
> that for any pointers passed directly as arguments to the stream interface
> functions. Your driver only needs to call that for any pointers embedded
as
> data within a buffer passed to the stream functions.
>
>
> Q: In Mike's article, he created source file in PB. But I can create a new
> dll project in eVC either. What's more, I can build it to a DLL and export
> the function using eVC.
>    My question is: How to import my registry to make my driver work in
wince
> OS, if I don't edit project.reg.   (Is it enough to import the registry? )
>    I think it's tedious to build the whole image and download it time
after
> time, just after a few change in source.   Is there any tool like
"regsvr32"
> in desktop windows?
>
> A: No, When developing a driver you can use an application to put the
> correct values into the registry as needed and call ActivateDeviceEX to
load
> the driver and DeactivateDevice() to unload it. You can then edit and
> rebuild the driver without disconnecting the target as long as you don't
> have the driver included in the BIB file. (NOTE: In V5.0 there is now an
> option in the IDE to force the target OS to always load user specified
> modules from the connected desktop system even if it's listed in the BIB
> file. This makes it easy to debug drivers) If the driver is for a device
on
> a PnP bus then you can just remove the device from the bus to get the bus
> driver to unload the driver.
>
>
>
>
> -- 
> Steve Maillet
> EmbeddedFusion
> www.EmbeddedFusion.com
> smaillet at EmbeddedFusion dot com
>
>


Relevant Pages

  • Re: [RFC/PATCH 0/22] W1: sysfs, lifetime and other fixes
    ... > and they must follow protocol, defined in family driver. ... presented with a unified interface. ... bus - it's all the same. ... You are over-engineering and making kernel code ...
    (Linux-Kernel)
  • Re: NDIS WDM driver installation for multi-port NIC
    ... in reality a monolithic bus and function driver. ... design the interface correctly, this will allow you to have a seperate NDIS ... miniport devices to bus/functional devices is because the bus/functional ...
    (microsoft.public.development.device.drivers)
  • Re: How to know which of my two mice sent the message.
    ... (Display name is Mouse Class Driver.) ... interface so that you could add an interface to all mice and then be ... I have modified the mouclass.sys driver so ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Driver interface
    ... I know DDK has sample mouse driver, ... Then mess with the existing interface and find out what system settings are ... the remainder will likely be in the registry. ...
    (microsoft.public.win32.programmer.ui)
  • Re: static or not?
    ... > a dependency on the concrete class Driver. ... > the GUI, then if Database wants to output to a text file, it must have ... > also register that same interface to implement functionality for their ... > could all register their View interface in the Registry. ...
    (comp.lang.java.help)