Re: How to Access Driver from an Application

On Thursday, March 29, 2001 7:40 AM “ashok.kadavakollu” wrote:

Hi ,
even i have the same issue.
can u please let me know how can i load and unload a driver from an
application.

Use the local Service Control Manager (SCM) API. Assuming you have
the driver installed on the system, you just have to:

  1. Connect to the local SCM, using OpenSCManager()
  2. Enable the driver, using:
    2.1. OpenService()
    2.2. StartService()
    2.3. CloseServiceHandle()
  3. Use whatever code you need from your driver, by:
    3.1. Opening the driver’s device, using CreateFile()
    3.2. Communicating with the driver, using DeviceIoControl()
    3.3. Closing the driver’s device, using CloseHandle()
  4. Disable the driver, using:
    4.1. OpenService()
    4.2. ControlService(…SERVICE_CONTROL_STOP…)
    4.3. CloseServiceHandle()
  5. Disconnect from the local SCM, using CloseServiceHandle()

If you wish to install/remove the driver from the system, you must have
Administrator privileges. You may then use CreateService() and
DeleteService() - but if you’re developing a user mode application, the
above steps should be enough for your needs.

Hope it helps, :wink:

Miguel Monteiro
xxxxx@criticalsoftware.com
www.criticalsoftware.com

«Humour and love are God’s answers
to Human weaknesses»


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

look at the general\instdrv sample in NT4 ddk.

regards
jeseem

----- Original Message -----
From: “Miguel Monteiro”
To: “NT Developers Interest List”
Sent: Thursday, March 29, 2001 8:13 PM
Subject: [ntdev] Re: How to Access Driver from an Application

> On Thursday, March 29, 2001 7:40 AM “ashok.kadavakollu” wrote:
>
>
> >Hi ,
> >even i have the same issue.
> >can u please let me know how can i load and unload a driver from an
> >application.
>
> Use the local Service Control Manager (SCM) API. Assuming you have
> the driver installed on the system, you just have to:
>
> 1. Connect to the local SCM, using OpenSCManager()
> 2. Enable the driver, using:
> 2.1. OpenService()
> 2.2. StartService()
> 2.3. CloseServiceHandle()
> 3. Use whatever code you need from your driver, by:
> 3.1. Opening the driver’s device, using CreateFile()
> 3.2. Communicating with the driver, using DeviceIoControl()
> 3.3. Closing the driver’s device, using CloseHandle()
> 4. Disable the driver, using:
> 4.1. OpenService()
> 4.2. ControlService(…SERVICE_CONTROL_STOP…)
> 4.3. CloseServiceHandle()
> 5. Disconnect from the local SCM, using CloseServiceHandle()
>
> If you wish to install/remove the driver from the system, you must have
> Administrator privileges. You may then use CreateService() and
> DeleteService() - but if you’re developing a user mode application, the
> above steps should be enough for your needs.
>
> Hope it helps, :wink:
>
> Miguel Monteiro
> xxxxx@criticalsoftware.com
> www.criticalsoftware.com
> ------------------------------------------------------------
> «Humour and love are God’s answers
> to Human weaknesses»
> ------------------------------------------------------------
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@hotmail.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

look at the general\instdrv sample in NT4 ddk.

regards
jeseem
mailto:xxxxx@hotmail.com

----- Original Message -----
From: “Miguel Monteiro”
To: “NT Developers Interest List”
Sent: Thursday, March 29, 2001 8:13 PM
Subject: [ntdev] Re: How to Access Driver from an Application

> On Thursday, March 29, 2001 7:40 AM “ashok.kadavakollu” wrote:
>
>
> >Hi ,
> >even i have the same issue.
> >can u please let me know how can i load and unload a driver from an
> >application.
>
> Use the local Service Control Manager (SCM) API. Assuming you have
> the driver installed on the system, you just have to:
>
> 1. Connect to the local SCM, using OpenSCManager()
> 2. Enable the driver, using:
> 2.1. OpenService()
> 2.2. StartService()
> 2.3. CloseServiceHandle()
> 3. Use whatever code you need from your driver, by:
> 3.1. Opening the driver’s device, using CreateFile()
> 3.2. Communicating with the driver, using DeviceIoControl()
> 3.3. Closing the driver’s device, using CloseHandle()
> 4. Disable the driver, using:
> 4.1. OpenService()
> 4.2. ControlService(…SERVICE_CONTROL_STOP…)
> 4.3. CloseServiceHandle()
> 5. Disconnect from the local SCM, using CloseServiceHandle()
>
> If you wish to install/remove the driver from the system, you must have
> Administrator privileges. You may then use CreateService() and
> DeleteService() - but if you’re developing a user mode application, the
> above steps should be enough for your needs.
>
> Hope it helps, :wink:
>
> Miguel Monteiro
> xxxxx@criticalsoftware.com
> www.criticalsoftware.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

DeviceIoControl API to communicate with Device Driver from Application.

Regards,
Satish K.S

----- Original Message -----
From: “Jeseem S”
To: “NT Developers Interest List”
Sent: Friday, March 30, 2001 12:35 PM
Subject: [ntdev] Re: How to Access Driver from an Application

> look at the general\instdrv sample in NT4 ddk.
>
> regards
> jeseem
> mailto:xxxxx@hotmail.com
>
>
> ----- Original Message -----
> From: “Miguel Monteiro”
> To: “NT Developers Interest List”
> Sent: Thursday, March 29, 2001 8:13 PM
> Subject: [ntdev] Re: How to Access Driver from an Application
>
>
> > On Thursday, March 29, 2001 7:40 AM “ashok.kadavakollu” wrote:
> >
> >
> > >Hi ,
> > >even i have the same issue.
> > >can u please let me know how can i load and unload a driver from an
> > >application.
> >
> > Use the local Service Control Manager (SCM) API. Assuming you have
> > the driver installed on the system, you just have to:
> >
> > 1. Connect to the local SCM, using OpenSCManager()
> > 2. Enable the driver, using:
> > 2.1. OpenService()
> > 2.2. StartService()
> > 2.3. CloseServiceHandle()
> > 3. Use whatever code you need from your driver, by:
> > 3.1. Opening the driver’s device, using CreateFile()
> > 3.2. Communicating with the driver, using DeviceIoControl()
> > 3.3. Closing the driver’s device, using CloseHandle()
> > 4. Disable the driver, using:
> > 4.1. OpenService()
> > 4.2. ControlService(…SERVICE_CONTROL_STOP…)
> > 4.3. CloseServiceHandle()
> > 5. Disconnect from the local SCM, using CloseServiceHandle()
> >
> > If you wish to install/remove the driver from the system, you must have
> > Administrator privileges. You may then use CreateService() and
> > DeleteService() - but if you’re developing a user mode application, the
> > above steps should be enough for your needs.
> >
> > Hope it helps, :wink:
> >
> > Miguel Monteiro
> > xxxxx@criticalsoftware.com
> > www.criticalsoftware.com
>
> —
> You are currently subscribed to ntdev as: xxxxx@aalayance.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