Hi,
Can we load a ".sys" file from kernal mode driver.

We have one driver with .sys extension, I am trying to write some other
driver with more functionalities. In order to reduce reusability I like to
load the previous .sys driver and use some of its functionalities.

P.S : I know that we can load ".dl"l but I don't know how to load .sys and
use its functionalities.

Thanks in advance.

Thanks
Santhosh.

Re: Can we load a .sys file from another .sys file by Don

Don
Thu Feb 10 07:58:13 CST 2005

The answer is maybe. You can load a driver, but if it isn't a legacy driver
nothing will call AddDevice and create the device for you so the driver will
be unloaded. If it is a legacy driver you can load it then call the
existing functionality, but unless you have provided a mechanism for calling
internal routines, you will not be able to call something other than the
dispatch routines.



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



"santhosh kumar" <santhoshkumar@discussions.microsoft.com> wrote in message
news:78057383-6359-4A53-805C-61B54266BD8B@microsoft.com...
>
> Hi,
> Can we load a ".sys" file from kernal mode driver.
>
> We have one driver with .sys extension, I am trying to write some other
> driver with more functionalities. In order to reduce reusability I like to
> load the previous .sys driver and use some of its functionalities.
>
> P.S : I know that we can load ".dl"l but I don't know how to load .sys and
> use its functionalities.
>
> Thanks in advance.
>
> Thanks
> Santhosh.



Re: Can we load a .sys file from another .sys file by Maxim

Maxim
Thu Feb 10 09:33:02 CST 2005

Are these drivers PnP?

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"santhosh kumar" <santhoshkumar@discussions.microsoft.com> wrote in message
news:78057383-6359-4A53-805C-61B54266BD8B@microsoft.com...
>
> Hi,
> Can we load a ".sys" file from kernal mode driver.
>
> We have one driver with .sys extension, I am trying to write some other
> driver with more functionalities. In order to reduce reusability I like to
> load the previous .sys driver and use some of its functionalities.
>
> P.S : I know that we can load ".dl"l but I don't know how to load .sys and
> use its functionalities.
>
> Thanks in advance.
>
> Thanks
> Santhosh.



Re: Can we load a .sys file from another .sys file by santhoshkumar

santhoshkumar
Thu Feb 10 09:41:08 CST 2005


Thanks Don Burn, for your quick reply

Can you show some sample code on how this can be acheived.

Say old.sys has functions such as f1(), f2(), f3()
And new file called new.sys has functions f4(), f5().
Now how can new.sys can call f1() or f2(). Assume that I have source files
for both old.sys and new.sys


Appreciate your help.
Thanks
Santhosh.

"Don Burn" wrote:

> The answer is maybe. You can load a driver, but if it isn't a legacy driver
> nothing will call AddDevice and create the device for you so the driver will
> be unloaded. If it is a legacy driver you can load it then call the
> existing functionality, but unless you have provided a mechanism for calling
> internal routines, you will not be able to call something other than the
> dispatch routines.
>
>
>
> --
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> Remove StopSpam from the email to reply
>
>
>
> "santhosh kumar" <santhoshkumar@discussions.microsoft.com> wrote in message
> news:78057383-6359-4A53-805C-61B54266BD8B@microsoft.com...
> >
> > Hi,
> > Can we load a ".sys" file from kernal mode driver.
> >
> > We have one driver with .sys extension, I am trying to write some other
> > driver with more functionalities. In order to increase reusability I like to
> > load the previous .sys driver and use some of its functionalities.
> >
> > P.S : I know that we can load ".dl"l but I don't know how to load .sys and
> > use its functionalities.
> >
> > Thanks in advance.
> >
> > Thanks
> > Santhosh.
>
>
>

Re: Can we load a .sys file from another .sys file by santhoshkumar

santhoshkumar
Thu Feb 10 09:49:12 CST 2005

Yes these drivers has PnP support

"Maxim S. Shatskih" wrote:

> Are these drivers PnP?
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>
> "santhosh kumar" <santhoshkumar@discussions.microsoft.com> wrote in message
> news:78057383-6359-4A53-805C-61B54266BD8B@microsoft.com...
> >
> > Hi,
> > Can we load a ".sys" file from kernal mode driver.
> >
> > We have one driver with .sys extension, I am trying to write some other
> > driver with more functionalities. In order to reduce reusability I like to
> > load the previous .sys driver and use some of its functionalities.
> >
> > P.S : I know that we can load ".dl"l but I don't know how to load .sys and
> > use its functionalities.
> >
> > Thanks in advance.
> >
> > Thanks
> > Santhosh.
>
>
>

Re: Can we load a .sys file from another .sys file by Don

Don
Thu Feb 10 09:59:24 CST 2005

There are two basic ways to do this for a legacy driver:

1. Change the driver to be an export driver. Yes you can have a kernel
mode DLL that is also a driver, you would export the functions you want.

2. Add a custom IOCTL so that new driver calls old driver with a block of
pointers to be filled in. The old driver fills in the pointers to the
functions is want made available.

Also, note you could just reorganize you code so that either there is a
kernel mode DLL containing the common functions, or you build a static link
library you link to both drivers.


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



"santhosh kumar" <santhoshkumar@discussions.microsoft.com> wrote in message
news:E8A75810-6E68-4E02-82D0-79BF843CAEFC@microsoft.com...
>
> Thanks Don Burn, for your quick reply
>
> Can you show some sample code on how this can be acheived.
>
> Say old.sys has functions such as f1(), f2(), f3()
> And new file called new.sys has functions f4(), f5().
> Now how can new.sys can call f1() or f2(). Assume that I have source files
> for both old.sys and new.sys
>
>
> Appreciate your help.
> Thanks
> Santhosh.
>
> "Don Burn" wrote:
>
>> The answer is maybe. You can load a driver, but if it isn't a legacy
>> driver
>> nothing will call AddDevice and create the device for you so the driver
>> will
>> be unloaded. If it is a legacy driver you can load it then call the
>> existing functionality, but unless you have provided a mechanism for
>> calling
>> internal routines, you will not be able to call something other than the
>> dispatch routines.
>>
>>
>>
>> --
>> Don Burn (MVP, Windows DDK)
>> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>> Remove StopSpam from the email to reply
>>
>>
>>
>> "santhosh kumar" <santhoshkumar@discussions.microsoft.com> wrote in
>> message
>> news:78057383-6359-4A53-805C-61B54266BD8B@microsoft.com...
>> >
>> > Hi,
>> > Can we load a ".sys" file from kernal mode driver.
>> >
>> > We have one driver with .sys extension, I am trying to write some
>> > other
>> > driver with more functionalities. In order to increase reusability I
>> > like to
>> > load the previous .sys driver and use some of its functionalities.
>> >
>> > P.S : I know that we can load ".dl"l but I don't know how to load .sys
>> > and
>> > use its functionalities.
>> >
>> > Thanks in advance.
>> >
>> > Thanks
>> > Santhosh.
>>
>>
>>



Re: Can we load a .sys file from another .sys file by Don

Don
Thu Feb 10 10:13:01 CST 2005

I just got this message, ignore my previous responses. You cannot force a
PnP driver to load and stay there if the device is not present. If you load
the driver, DriverEntry will be called, but since AddDevice is not called
you will be unloaded a while later. Split out the functions you want common
to a kernel mode DLL or a static library.


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



"santhosh kumar" <santhoshkumar@discussions.microsoft.com> wrote in message
news:5CCC00CA-ECE9-4B32-AB50-35113CF53E0B@microsoft.com...
> Yes these drivers has PnP support
>
> "Maxim S. Shatskih" wrote:
>
>> Are these drivers PnP?
>>
>> --
>> Maxim Shatskih, Windows DDK MVP
>> StorageCraft Corporation
>> maxim@storagecraft.com
>> http://www.storagecraft.com
>>
>> "santhosh kumar" <santhoshkumar@discussions.microsoft.com> wrote in
>> message
>> news:78057383-6359-4A53-805C-61B54266BD8B@microsoft.com...
>> >
>> > Hi,
>> > Can we load a ".sys" file from kernal mode driver.
>> >
>> > We have one driver with .sys extension, I am trying to write some
>> > other
>> > driver with more functionalities. In order to reduce reusability I like
>> > to
>> > load the previous .sys driver and use some of its functionalities.
>> >
>> > P.S : I know that we can load ".dl"l but I don't know how to load .sys
>> > and
>> > use its functionalities.
>> >
>> > Thanks in advance.
>> >
>> > Thanks
>> > Santhosh.
>>
>>
>>



Re: Can we load a .sys file from another .sys file by Gary

Gary
Thu Feb 10 10:08:52 CST 2005

Export the functions you need and link them into the "some other driver."
Personally, I would cut any possible "problem" code from the "one driver"
that might in any way make the system use this poorman's DLL as a driver;
e.g. minimize DriverEntry to only return success. Drivers are DLLs, they
only have a SYS extension and a known entry point.

--
The personal opinion of
Gary G. Little

"santhosh kumar" <santhoshkumar@discussions.microsoft.com> wrote in message
news:78057383-6359-4A53-805C-61B54266BD8B@microsoft.com...
>
> Hi,
> Can we load a ".sys" file from kernal mode driver.
>
> We have one driver with .sys extension, I am trying to write some
other
> driver with more functionalities. In order to reduce reusability I like to
> load the previous .sys driver and use some of its functionalities.
>
> P.S : I know that we can load ".dl"l but I don't know how to load .sys and
> use its functionalities.
>
> Thanks in advance.
>
> Thanks
> Santhosh.



Re: Can we load a .sys file from another .sys file by Maxim

Maxim
Thu Feb 10 11:16:58 CST 2005

Then register a device interface in one, and use the device interface
arrival notification in another.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"santhosh kumar" <santhoshkumar@discussions.microsoft.com> wrote in message
news:5CCC00CA-ECE9-4B32-AB50-35113CF53E0B@microsoft.com...
> Yes these drivers has PnP support
>
> "Maxim S. Shatskih" wrote:
>
> > Are these drivers PnP?
> >
> > --
> > Maxim Shatskih, Windows DDK MVP
> > StorageCraft Corporation
> > maxim@storagecraft.com
> > http://www.storagecraft.com
> >
> > "santhosh kumar" <santhoshkumar@discussions.microsoft.com> wrote in message
> > news:78057383-6359-4A53-805C-61B54266BD8B@microsoft.com...
> > >
> > > Hi,
> > > Can we load a ".sys" file from kernal mode driver.
> > >
> > > We have one driver with .sys extension, I am trying to write some
other
> > > driver with more functionalities. In order to reduce reusability I like
to
> > > load the previous .sys driver and use some of its functionalities.
> > >
> > > P.S : I know that we can load ".dl"l but I don't know how to load .sys
and
> > > use its functionalities.
> > >
> > > Thanks in advance.
> > >
> > > Thanks
> > > Santhosh.
> >
> >
> >



Re: Can we load a .sys file from another .sys file by santhoshkumar

santhoshkumar
Thu Feb 10 22:55:03 CST 2005

Thanks Don,
Few question on your statements?
You commented that we can communicate with IOCTL's. Is this the same
with
videoport/miniport architecture? or Is this applicable only for WDM driver
models?
My actual requirement is like this? we devolped a driver with .sys extension
and it has
many versions or releases. Now I need write a new driver which should load
itself as driver and use some of the functions of old driver. If at any
point, we wish to disable this new driver, just change the .inf file to load
the old driver. Please note that changes in the old driver code are
expensive.
So .inf file should be a trigger to load either old driver or new dirver?
Please provide some informations on the possible ways, if the dirver
supports WDM architecture and
if the driver do not support WDM architecture(Example consider
Videoport/miniport) ?
"Don Burn" wrote:

> There are two basic ways to do this for a legacy driver:
>
> 1. Change the driver to be an export driver. Yes you can have a kernel
> mode DLL that is also a driver, you would export the functions you want.
>
> 2. Add a custom IOCTL so that new driver calls old driver with a block of
> pointers to be filled in. The old driver fills in the pointers to the
> functions is want made available.
>
> Also, note you could just reorganize you code so that either there is a
> kernel mode DLL containing the common functions, or you build a static link
> library you link to both drivers.
>
>
> --
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> Remove StopSpam from the email to reply
>
>
>
> "santhosh kumar" <santhoshkumar@discussions.microsoft.com> wrote in message
> news:E8A75810-6E68-4E02-82D0-79BF843CAEFC@microsoft.com...
> >
> > Thanks Don Burn, for your quick reply
> >
> > Can you show some sample code on how this can be acheived.
> >
> > Say old.sys has functions such as f1(), f2(), f3()
> > And new file called new.sys has functions f4(), f5().
> > Now how can new.sys can call f1() or f2(). Assume that I have source files
> > for both old.sys and new.sys
> >
> >
> > Appreciate your help.
> > Thanks
> > Santhosh.
> >
> > "Don Burn" wrote:
> >
> >> The answer is maybe. You can load a driver, but if it isn't a legacy
> >> driver
> >> nothing will call AddDevice and create the device for you so the driver
> >> will
> >> be unloaded. If it is a legacy driver you can load it then call the
> >> existing functionality, but unless you have provided a mechanism for
> >> calling
> >> internal routines, you will not be able to call something other than the
> >> dispatch routines.
> >>
> >>
> >>
> >> --
> >> Don Burn (MVP, Windows DDK)
> >> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> >> Remove StopSpam from the email to reply
> >>
> >>
> >>
> >> "santhosh kumar" <santhoshkumar@discussions.microsoft.com> wrote in
> >> message
> >> news:78057383-6359-4A53-805C-61B54266BD8B@microsoft.com...
> >> >
> >> > Hi,
> >> > Can we load a ".sys" file from kernal mode driver.
> >> >
> >> > We have one driver with .sys extension, I am trying to write some
> >> > other
> >> > driver with more functionalities. In order to increase reusability I
> >> > like to
> >> > load the previous .sys driver and use some of its functionalities.
> >> >
> >> > P.S : I know that we can load ".dl"l but I don't know how to load .sys
> >> > and
> >> > use its functionalities.
> >> >
> >> > Thanks in advance.
> >> >
> >> > Thanks
> >> > Santhosh.
> >>
> >>
> >>
>
>
>

Re: Can we load a .sys file from another .sys file by Don

Don
Fri Feb 11 08:44:08 CST 2005

If you are dealing with PNP drivers, then the old driver will have to load
assuming this driver is for a hardware device you will have to require the
old driver's hardware is present on the system! Otherwise you are going to
have to do some rearchitecture of the drivers. But if it is the case that
"old device" is always present when "new device" is there then use
IoRegisterDeviceInterface in the old driver to export a block of pointers
for the routines, and IoGetDeviceInterfaces in the new driver to locate it.

I suspect you do not have the situation where old device is alway present.
Then the question is "Is it common to have old device and new device on the
same system?" If so restructure your common routines to a kernel mode DLL,
and use it for both drivers. If not, then restructure your common code into
a static library and link it with both drivers.

Port drivers are typically kernel mode DLL's that mini-ports call.


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


"santhosh kumar" <santhoshkumar@discussions.microsoft.com> wrote in message
news:61D0D3DD-2735-4FCD-8E9C-CFD878742248@microsoft.com...
> Thanks Don,
> Few question on your statements?
> You commented that we can communicate with IOCTL's. Is this the same
> with
> videoport/miniport architecture? or Is this applicable only for WDM driver
> models?
> My actual requirement is like this? we devolped a driver with .sys
> extension
> and it has
> many versions or releases. Now I need write a new driver which should load
> itself as driver and use some of the functions of old driver. If at any
> point, we wish to disable this new driver, just change the .inf file to
> load
> the old driver. Please note that changes in the old driver code are
> expensive.
> So .inf file should be a trigger to load either old driver or new
> dirver?
> Please provide some informations on the possible ways, if the dirver
> supports WDM architecture and
> if the driver do not support WDM architecture(Example consider
> Videoport/miniport) ?