Start/stop a driver programatically

How can I start/stop a driver programmatically (from a user mode app),
instead of ‘net start ’.

Thanks,
Aaron


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 Arron,

One thing you could do is yes the c programming function system to send a
net start command

Robert Fernando
Anite Telecoms Ltd
110 Fleet Road
Fleet
Hampshire GU51 4BL
United Kingdom
Tel: +44 (0) 1252 775200
Fax: +44 (0) 1252 775 321
Email: xxxxx@anitetelecoms.com

Anite Telecoms Limited Registered in England No. 1721900 Registered
Office: 100 Longwater Avenue, GreenPark, Reading, Berkshire RG2 6GP,
United Kingdom

-----Original Message-----
From: Aaron Elberg [mailto:xxxxx@mysticom.com]
Sent: 23 October 2001 17:12
To: NT Developers Interest List
Subject: [ntdev] Start/stop a driver programatically

How can I start/stop a driver programmatically (from a user mode app),
instead of ‘net start ’.

Thanks,
Aaron


You are currently subscribed to ntdev as: xxxxx@anitetelecoms.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

If you are using NT 4.0 you can use the ServiceControlManager. Open it by calling openscmanager(), then open a reference to your service with a call to OpenService(),then start your service with StartService() call.
All are documented in MSDN SDK docs.

If you are using Win2k, then it depends. Send more info.

Larry

-----Original Message-----
From: Aaron Elberg [mailto:xxxxx@mysticom.com]
Sent: Tuesday, October 23, 2001 12:12 PM
To: NT Developers Interest List
Subject: [ntdev] Start/stop a driver programatically

How can I start/stop a driver programmatically (from a user mode app),
instead of ‘net start ’.

Thanks,
Aaron


You are currently subscribed to ntdev as: xxxxx@diebold.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

Aaron,

Use the Win32 services API (OpenSCManager, OpenService, StartService,
ControlService, CloseServiceHandle, etc…).

Aaron Stavens

-----Original Message-----
From: Aaron Elberg [mailto:xxxxx@mysticom.com]
Sent: Tuesday, October 23, 2001 9:12 AM
To: NT Developers Interest List
Subject: [ntdev] Start/stop a driver programatically

How can I start/stop a driver programmatically (from a user mode app),
instead of ‘net start ’.

Thanks,
Aaron


You are currently subscribed to ntdev as: xxxxx@nmwco.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

As others have said, use the various service control manager
functions.

However, you may need to watch out for security here. Many of the
drivers are started by the local system so an ordinary user will
not be able to start/stop them (at least this has been by experience,
although it may have been the unique security constraints of the
systems I was working on). I was force to write a service that was
started at boot, and when my user mode application wanted to modify
a driver (start/stop) it would send a message to the service that
would then do the actual work.

George Huber
Computer Scientist
SRI, International
phone: 732-427-8064
fax : 732-427-2065
cell : 732-740-4018
xxxxx@mail1.monmouth.army.mil

-----Original Message-----
From: Aaron Elberg [mailto:xxxxx@mysticom.com]
Sent: Tuesday, October 23, 2001 12:12 PM
To: NT Developers Interest List
Subject: [ntdev] Start/stop a driver programatically

How can I start/stop a driver programmatically (from a user mode app),
instead of ‘net start ’.

Thanks,
Aaron


You are currently subscribed to ntdev as:
xxxxx@mail1.monmouth.army.mil
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

Yes, Security could be an issue. I encountered this when I wrote a service
to send mail using the SMTP protocol. The socket could not connect. So I had
to change the “start service as” from local system account to administrator
account. Then it worked fine.

Clark

----- Original Message -----
From: “Huber, George CECOM RDEC STCD SRI”

To: “NT Developers Interest List”
Sent: Tuesday, October 23, 2001 10:43 PM
Subject: [ntdev] RE: Start/stop a driver programatically

> As others have said, use the various service control manager
> functions.
>
> However, you may need to watch out for security here. Many of the
> drivers are started by the local system so an ordinary user will
> not be able to start/stop them (at least this has been by experience,
> although it may have been the unique security constraints of the
> systems I was working on). I was force to write a service that was
> started at boot, and when my user mode application wanted to modify
> a driver (start/stop) it would send a message to the service that
> would then do the actual work.
>
> George Huber
> Computer Scientist
> SRI, International
> phone: 732-427-8064
> fax : 732-427-2065
> cell : 732-740-4018
> xxxxx@mail1.monmouth.army.mil
>
>
> -----Original Message-----
> From: Aaron Elberg [mailto:xxxxx@mysticom.com]
> Sent: Tuesday, October 23, 2001 12:12 PM
> To: NT Developers Interest List
> Subject: [ntdev] Start/stop a driver programatically
>
>
> How can I start/stop a driver programmatically (from a user mode app),
> instead of ‘net start ’.
>
> Thanks,
> Aaron
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@mail1.monmouth.army.mil
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
> —
> You are currently subscribed to ntdev as: xxxxx@yahoo.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>

_________________________________________________________

Do You Yahoo!?

Get your free @yahoo.com address at http://mail.yahoo.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