Is there any way to dynamically load/unload kernel mode driver from
user mode application?
Best Regards
Kevin Liang
Accton Technology Corporation
Shanghai R&D Division
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
Hi, Kevin.
Assuming that by “dynamically load/unlod” you mean “Install
the kernel mode driver, then start it, use it, stop it, remove it
if necessary”… (this is to avoid some phylosophic threads
surrounding the concept, as we’ve seen in the past), the
answer is quite simple:
-Use local Service Control Manager (SCM) services:
OpenSCManager, CreateService, StartService,
ControlService (…SERVICE_CONTROL_STOP…),
DeleteService. Note that to install/remove the driver, you
must have Administrator privileges. This is a FAQ, so if you
have any doubts about the subject, refer to the help files…
«Humour and love are God’s answers
to Human weaknesses»
----- Original Message -----
From:
To: “NT Developers Interest List”
Sent: Wednesday, April 18, 2001 10:17 AM
Subject: [ntdev] dynamically load/unload kernel mode driver
Is there any way to dynamically load/unload kernel mode driver from
user mode application?
Best Regards
Kevin Liang
—
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
StartService/ControlService
----- Original Message -----
From:
To: “NT Developers Interest List”
Sent: Wednesday, April 18, 2001 1:17 PM
Subject: [ntdev] dynamically load/unload kernel mode driver
> Is there any way to dynamically load/unload kernel mode driver from
> user mode application?
>
> Best Regards
>
> Kevin Liang
> Accton Technology Corporation
> Shanghai R&D Division
> =========================
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
—
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
thanks for everyone who answered my question.
but startservice/deleteservice is only useful under w2k.
how can i implement this under win98.
thanks in advance.
Best Regards
Kevin Liang
Accton Technology Corporation
Shanghai R&D Division
“Maxim S. Shatskih”
om>
Sent by: cc:
xxxxx@lis Subject: [ntdev] Re: dynamically load/unload
ts.osr.com kernel mode driver
2001/04/18 11:17 PM
Please respond to “NT
Developers Interest
List”
StartService/ControlService
----- Original Message -----
From:
To: “NT Developers Interest List”
Sent: Wednesday, April 18, 2001 1:17 PM
Subject: [ntdev] dynamically load/unload kernel mode driver
> Is there any way to dynamically load/unload kernel mode driver from
> user mode application?
>
> Best Regards
>
> Kevin Liang
> Accton Technology Corporation
> Shanghai R&D Division
> =========================
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
—
You are currently subscribed to ntdev as: xxxxx@accton-sh.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
—
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
Try something like this:
BOOL bReturn = TRUE;
TCHAR lpVxdFile[64];
_stprintf( lpVxdFile, _T(“\\.\%s.VXD”), m_DriverName );
if( m_bDriverLoaded == FALSE )
{
// connect with VxD
m_hDriver = CreateFile( lpVxdFile,
0,
0,
NULL,
0,
FILE_FLAG_OVERLAPPED | FILE_FLAG_DELETE_ON_CLOSE,
NULL );
if ( INVALID_HANDLE_VALUE == m_hDriver )
{
m_bDriverLoaded = FALSE;
bReturn = FALSE;
m_dwLastError = ::GetLastError();
}
else
{
m_bDriverLoaded = TRUE;
}
}
else
m_dwLastError = ERROR_ALREADY_INITIALIZED;
return bReturn;
-----Original Message-----
From: xxxxx@accton-sh.com [mailto:xxxxx@accton-sh.com]
Sent: Thursday, April 19, 2001 12:44 AM
To: NT Developers Interest List
Subject: [ntdev] Re: dynamically load/unload kernel mode driver
thanks for everyone who answered my question.
but startservice/deleteservice is only useful under w2k.
how can i implement this under win98.
thanks in advance.
Best Regards
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com