As title, any hints?
Anthony
As title, any hints?
Anthony
Anthony wrote:
As title, any hints?
Are you asking how to disable and enable a device? That would be one of
the CM_ calls. Specifically, you’re changing the state of a DEVNODE.
Are you asking how to dynmically load and unload a WDM driver in the
same way you can do in NT via Service Manager calls? You can’t. You
would need to write a VxD, which is very easy to load and unload by
calling CreateFile with the right parameters, followed eventually by
CloseHandle.
–
Walter Oney, Consulting and Training
Basic and Advanced Driver Programming Seminars
Check out our schedule at http://www.oneysoft.com
Hello Walter,
Thanks a lot. I get valuable info from your comments.
Yep, in fact I build a kernel model DLL(SYS) in 98. The build results
are a SYS and a LIB.
I have to active the SYS before my other driver(VXD) call service from
it. But I can’t find the right way to active the SYS manually in 98. To my
surprise, I can do it in 2000&xp either by certain tools or by calling
CreateService and so on.
Do I have to build a DLL(VXD) to achieve what I aim at?
Though it is test project, I think if it works well, it will do me a lot
of benefits.
Anthony
“Walter Oney” ??? news:xxxxx@ntdev…
>
> Anthony wrote:
> > As title, any hints?
>
> Are you asking how to disable and enable a device? That would be one of
> the CM_ calls. Specifically, you’re changing the state of a DEVNODE.
>
> Are you asking how to dynmically load and unload a WDM driver in the
> same way you can do in NT via Service Manager calls? You can’t. You
> would need to write a VxD, which is very easy to load and unload by
> calling CreateFile with the right parameters, followed eventually by
> CloseHandle.
>
> –
> Walter Oney, Consulting and Training
> Basic and Advanced Driver Programming Seminars
> Check out our schedule at http://www.oneysoft.com
>
>
Anthony wrote:
Yep, in fact I build a kernel model DLL(SYS) in 98. The build results
are a SYS and a LIB.I have to active the SYS before my other driver(VXD) call service from
it. But I can’t find the right way to active the SYS manually in 98. To my
surprise, I can do it in 2000&xp either by certain tools or by calling
CreateService and so on.
These two concepts don’t make sense to me together. A kernel DLL exports
functions for use by a WDM driver – there is no symbolic import
mechanism for VxDs.
What I’ve done in similar situations is to have the WDM driver create an
import table by calling PELDR_AddExportTable. The VxD can then call
_PELDR_GetProcAddress to get the address of a function in the WDM
driver. This works well for, e.g., a USB-to-Serial kind of driver. The
WDM driver for the USB device comes and goes like any other PnP device.
A VxD (loaded or unloaded by VCOMM) comes and goes when a handle is
open. The VxD can connect up with the WDM driver only when it’s actually
loaded, which matches well the semantics of a CreateFile call.
–
Walter Oney, Consulting and Training
Basic and Advanced Driver Programming Seminars
Check out our schedule at http://www.oneysoft.com
Hello Walter,
Originally, I do this in oder to avoid header file conflict in 98 such as
NDIS.H and WDM.H.
I want to build some so-called kernel DLL to be called by my VXD driver.
By defining TARGETTYPE, I can build a DLL or a LIB or a SYS. But all of
them can’t be called by my VXD driver.
In 2000&XP, I have to active the SYS before my driver active which will
call service from the SYS. But someone told me it will be actived
automaticallly by OS???
I read your valuable comments, but I don’t know how to use
PELDR_GetProcAddress in VXD. I am a new programmer in VXD programming. Do
you mind giving me some sample codes? Thanks!
Any more hints?
Anthony
“Walter Oney” ??? news:xxxxx@ntdev…
>
> Anthony wrote:
> > Yep, in fact I build a kernel model DLL(SYS) in 98. The build
results
> > are a SYS and a LIB.
> >
> > I have to active the SYS before my other driver(VXD) call service
from
> > it. But I can’t find the right way to active the SYS manually in 98. To
my
> > surprise, I can do it in 2000&xp either by certain tools or by calling
> > CreateService and so on.
>
> These two concepts don’t make sense to me together. A kernel DLL exports
> functions for use by a WDM driver – there is no symbolic import
> mechanism for VxDs.
>
> What I’ve done in similar situations is to have the WDM driver create an
> import table by calling PELDR_AddExportTable. The VxD can then call
> _PELDR_GetProcAddress to get the address of a function in the WDM
> driver. This works well for, e.g., a USB-to-Serial kind of driver. The
> WDM driver for the USB device comes and goes like any other PnP device.
> A VxD (loaded or unloaded by VCOMM) comes and goes when a handle is
> open. The VxD can connect up with the WDM driver only when it’s actually
> loaded, which matches well the semantics of a CreateFile call.
>
> –
> Walter Oney, Consulting and Training
> Basic and Advanced Driver Programming Seminars
> Check out our schedule at http://www.oneysoft.com
>
>
Dear Anthony.
There’s an example of how to use _PELDR_GetProcAddress() VXD service. The
following code is trying to obtain an address of PsTerminateSystemThread()
WDM function:
//=============================================================
typedef
NTSTATUS
(__stdcall *PSTERMINATESYSTEMTHREAD)(
NTSTATUS ExitStatus
);
CHAR szModuleName=“ntoskrnl.exe”;
CHAR szFunctionName=“PsTerminateSystemThread”;
PSTERMINATESYSTEMTHREAD pfnPsTerminateSystemThread;
pfnPsTerminateSystemThread=_PELDR_GetProcAddress((HPEMODULE)szModuleName,
szFunctionName,NULL);
if (pfnPsTerminateSystemThread)
{
…
…
}
else
{
// ERROR! Can’t get a function address.
}
//=============================================================
As concerns your WDM (SYS) driver activation you can do it in two ways:
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\testwdm]
“ImagePath”=“\SystemRoot\system32\drivers\testwdm.sys”
“Type”=dword:00000001
“Start”=dword:00000001
“Group”=“Base”
“Tag”=dword:00000100
“ErrorControl”=dword:00000001
But it’s worth to say that there’s one more way to dynamically load a WDM
driver thru NtLoadDriver() (or ZwLoadDriver()) WDM function or thru
_NtKernLoadDriver VXD service (in fact this service simply calls
NtLoadDriver function). It’s a pitty but there’s no way to unload a WDM
driver then.
----- Original Message -----
From: “Anthony”
Newsgroups: ntdev
To: “Windows System Software Developers Interest List”
Sent: Thursday, July 17, 2003 8:52 AM
Subject: [ntdev] Re: How to active a WDM driver manually in win98?
> Hello Walter,
>
> Originally, I do this in oder to avoid header file conflict in 98 such
as
> NDIS.H and WDM.H.
>
> I want to build some so-called kernel DLL to be called by my VXD
driver.
>
> By defining TARGETTYPE, I can build a DLL or a LIB or a SYS. But all of
> them can’t be called by my VXD driver.
>
> In 2000&XP, I have to active the SYS before my driver active which will
> call service from the SYS. But someone told me it will be actived
> automaticallly by OS???
>
> I read your valuable comments, but I don’t know how to use
> PELDR_GetProcAddress in VXD. I am a new programmer in VXD programming. Do
> you mind giving me some sample codes? Thanks!
>
> Any more hints?
>
> Anthony
>
>
> “Walter Oney” ??? news:xxxxx@ntdev…
> >
> > Anthony wrote:
> > > Yep, in fact I build a kernel model DLL(SYS) in 98. The build
> results
> > > are a SYS and a LIB.
> > >
> > > I have to active the SYS before my other driver(VXD) call service
> from
> > > it. But I can’t find the right way to active the SYS manually in 98.
To
> my
> > > surprise, I can do it in 2000&xp either by certain tools or by calling
> > > CreateService and so on.
> >
> > These two concepts don’t make sense to me together. A kernel DLL exports
> > functions for use by a WDM driver – there is no symbolic import
> > mechanism for VxDs.
> >
> > What I’ve done in similar situations is to have the WDM driver create an
> > import table by calling PELDR_AddExportTable. The VxD can then call
> > _PELDR_GetProcAddress to get the address of a function in the WDM
> > driver. This works well for, e.g., a USB-to-Serial kind of driver. The
> > WDM driver for the USB device comes and goes like any other PnP device.
> > A VxD (loaded or unloaded by VCOMM) comes and goes when a handle is
> > open. The VxD can connect up with the WDM driver only when it’s actually
> > loaded, which matches well the semantics of a CreateFile call.
> >
> > –
> > Walter Oney, Consulting and Training
> > Basic and Advanced Driver Programming Seminars
> > Check out our schedule at http://www.oneysoft.com
> >
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@nival.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>