If I wanted to share a function between a driver and an application how could
I go about doing this? Is there a special type of DLL that can be shared
between the two?

Many Thanks,

Simon

Re: Sharing Code Between Drivers and Applications by Don

Don
Tue Jan 11 07:45:43 CST 2005

For the most part the answer here is bad idea. If your code is truly
standalone, i.e. no calls to anything outside your functions, you can build
a library and link it to both the driver and the application. This will
mean there are two copies running, but it guarantees the same algorithm.

There is no special capability to run the same block of code in both an
application and a driver. There have been some kludges published they are
all incredible security and reliability holes. If you want only one piece
of code, choose a location, i.e. the driver or the app and use IOCTL's to
request the invocation from whichever doesn't contain the code.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply


"Simon Morrow" <SimonMorrow@discussions.microsoft.com> wrote in message
news:F4FFAE51-B314-4F62-8F66-5E5355F4A545@microsoft.com...
> If I wanted to share a function between a driver and an application how
could
> I go about doing this? Is there a special type of DLL that can be shared
> between the two?
>
> Many Thanks,
>
> Simon
>



Re: Sharing Code Between Drivers and Applications by SimonMorrow

SimonMorrow
Tue Jan 11 08:23:07 CST 2005

Hi Don.
Thanks for the response. Probably best if I give you a bit more background.
Our software is supported on different platforms - on one we we use an NDIS
intermediate driver to connect to the network and on all others we use
separate interfaces however they perform very similar functions. In these
other interfaces we don't need to use the driver therefore we need to either
share common code that can be called from either the application or the
driver. Currently we have a IOCTL for each function that we wish to share (as
you're describing). However this is by no means an ideal solution as we're
having to ship the driver to platforms where it isn't necessary - as you can
imagine this adds significantly to QA and maintenance. The method you mention
below sounds like exactly what we're looking for. What are these library
types so I can investigate further? Also do you know of any examples of these
types of libraries on the msdn/web?

Many Thanks,

Simon


> For the most part the answer here is bad idea. If your code is truly
> standalone, i.e. no calls to anything outside your functions, you can build
> a library and link it to both the driver and the application. This will
> mean there are two copies running, but it guarantees the same algorithm.
>
> There is no special capability to run the same block of code in both an
> application and a driver. There have been some kludges published they are
> all incredible security and reliability holes. If you want only one piece
> of code, choose a location, i.e. the driver or the app and use IOCTL's to
> request the invocation from whichever doesn't contain the code.
>
>
> --
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> Remove StopSpam from the email to reply
>
>
> "Simon Morrow" <SimonMorrow@discussions.microsoft.com> wrote in message
> news:F4FFAE51-B314-4F62-8F66-5E5355F4A545@microsoft.com...
> > If I wanted to share a function between a driver and an application how
> could
> > I go about doing this? Is there a special type of DLL that can be shared
> > between the two?
> >
> > Many Thanks,
> >
> > Simon
> >
>
>
>

Re: Sharing Code Between Drivers and Applications by SimonMorrow

SimonMorrow
Tue Jan 11 08:31:07 CST 2005

I should also add that potentially we may want to support multiple platforms
at the same time (for example windows could use either the NDIS intermediate
driver or proxy), hence the reason for wanting to call a DLL from both the
app and the driver.

Many Thanks,

Simon

Re: Sharing Code Between Drivers and Applications by Arkady

Arkady
Tue Jan 11 14:44:18 CST 2005

Don !
Is it ( kludge you mention ) not using METHOD_NEITHER send address of
MapFile with code
set there, so possible to make jump into such code ? Just come to mind ,
interesting if it possible at all

Arkady

"Don Burn" <burn@stopspam.acm.org> wrote in message
news:bMQEd.3$B64.1@fe04.lga...
> For the most part the answer here is bad idea. If your code is truly
> standalone, i.e. no calls to anything outside your functions, you can
build
> a library and link it to both the driver and the application. This will
> mean there are two copies running, but it guarantees the same algorithm.
>
> There is no special capability to run the same block of code in both an
> application and a driver. There have been some kludges published they are
> all incredible security and reliability holes. If you want only one piece
> of code, choose a location, i.e. the driver or the app and use IOCTL's to
> request the invocation from whichever doesn't contain the code.
>
>
> --
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> Remove StopSpam from the email to reply
>
>
> "Simon Morrow" <SimonMorrow@discussions.microsoft.com> wrote in message
> news:F4FFAE51-B314-4F62-8F66-5E5355F4A545@microsoft.com...
> > If I wanted to share a function between a driver and an application how
> could
> > I go about doing this? Is there a special type of DLL that can be shared
> > between the two?
> >
> > Many Thanks,
> >
> > Simon
> >
>
>



Re: Sharing Code Between Drivers and Applications by Don

Don
Tue Jan 11 19:40:27 CST 2005

Simon, this is just a standard library, not a dll. Essentially the same a
including the sources in two projects.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply

"Simon Morrow" <SimonMorrow@discussions.microsoft.com> wrote in message
news:E4DBFF2E-A09B-4B28-877F-9885BF6F41A0@microsoft.com...
> Hi Don.
> Thanks for the response. Probably best if I give you a bit more
background.
> Our software is supported on different platforms - on one we we use an
NDIS
> intermediate driver to connect to the network and on all others we use
> separate interfaces however they perform very similar functions. In these
> other interfaces we don't need to use the driver therefore we need to
either
> share common code that can be called from either the application or the
> driver. Currently we have a IOCTL for each function that we wish to share
(as
> you're describing). However this is by no means an ideal solution as we're
> having to ship the driver to platforms where it isn't necessary - as you
can
> imagine this adds significantly to QA and maintenance. The method you
mention
> below sounds like exactly what we're looking for. What are these library
> types so I can investigate further? Also do you know of any examples of
these
> types of libraries on the msdn/web?
>
> Many Thanks,
>
> Simon
>
>
> > For the most part the answer here is bad idea. If your code is truly
> > standalone, i.e. no calls to anything outside your functions, you can
build
> > a library and link it to both the driver and the application. This will
> > mean there are two copies running, but it guarantees the same algorithm.
> >
> > There is no special capability to run the same block of code in both an
> > application and a driver. There have been some kludges published they
are
> > all incredible security and reliability holes. If you want only one
piece
> > of code, choose a location, i.e. the driver or the app and use IOCTL's
to
> > request the invocation from whichever doesn't contain the code.
> >
> >
> > --
> > Don Burn (MVP, Windows DDK)
> > Windows 2k/XP/2k3 Filesystem and Driver Consulting
> > Remove StopSpam from the email to reply
> >
> >
> > "Simon Morrow" <SimonMorrow@discussions.microsoft.com> wrote in message
> > news:F4FFAE51-B314-4F62-8F66-5E5355F4A545@microsoft.com...
> > > If I wanted to share a function between a driver and an application
how
> > could
> > > I go about doing this? Is there a special type of DLL that can be
shared
> > > between the two?
> > >
> > > Many Thanks,
> > >
> > > Simon
> > >
> >
> >
> >