How check how many instances of a mirror driver is running?

Hi,
Some times I have seen multiple instances of my mirror driver is running
because of client(Application) crash or… I am wondering how to find out
how many instances of my driver is running or if any previous instance is
currently running before going to initiate mirror driver from application.
Let me know if it is possible programmatically from application level or
driver level.

Any input will be highly appreciable.

Thanks and regards
/sarbojit

Sarbojit Sarkar wrote:

Some times I have seen multiple instances of my mirror driver is
running because of client(Application) crash or… I am wondering
how to find out how many instances of my driver is running or if any
previous instance is currently running before going to initiate mirror
driver from application. Let me know if it is possible
programmatically from application level or driver level.

You should be able to use EnumDisplayDevices to stroll through the list
of running display drivers. The DeviceString in the returned data
should have what you need.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

@Tim, Thanks for your response.
Are you saying EnumDisplayDevices will return my device name only
when my display driver(.dll) will be running or active?
If yes, But I have seen even though display drive is not running, it gives
my driver’s device name.

I had tried EnumDisplayDevices(), it is giving my device name in
DeviceString but it is not saying how many instances are running. I am
interested to know how many instances are running.

I am using EnumDisplayDevices(NULL,devIndex,&dispDev,0), Let me know if I
have to use different argument to get the information.

/sarbojit

On Wed, Apr 27, 2011 at 12:34 AM, Tim Roberts wrote:

> Sarbojit Sarkar wrote:
> >
> > Some times I have seen multiple instances of my mirror driver is
> > running because of client(Application) crash or… I am wondering
> > how to find out how many instances of my driver is running or if any
> > previous instance is currently running before going to initiate mirror
> > driver from application. Let me know if it is possible
> > programmatically from application level or driver level.
>
> You should be able to use EnumDisplayDevices to stroll through the list
> of running display drivers. The DeviceString in the returned data
> should have what you need.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Sarbojit Sarkar wrote:

@Tim, Thanks for your response.
Are you saying EnumDisplayDevices will return my device name
only when my display driver(.dll) will be running or active?
If yes, But I have seen even though display drive is not running, it
gives my driver’s device name.

How do you know your driver is not running? Have you checked in the
debugger?

I had tried EnumDisplayDevices(), it is giving my device name in
DeviceString but it is not saying how many instances are running. I
am interested to know how many instances are running.

Do you mean DISPLAY_DEVICE_ACTIVE is set, whether or not your mirror
driver is running? That doesn’t seem sensible. Theoretically, if you
have two mirror driver instances running, you should see your driver
twice in the returns from EnumDisplayDevices.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Tim wrote:

How do you know your driver is not running? Have you checked in the
debugger?
Yes, I have checked in debugger and it is showing my display driver(.dll) is
not loaded/running.Even though EnumDisplayDevices() func returns my driver’s
name.

AFAIK, in case of display driver we can have multiple instances of display
driver i.e. .dll running but there will be only once instance on miniport
driver(.sys). So my interest is first find out if one or more .dll instances
are already running then first unload them properly and then load one fresh
instance.

On Wed, Apr 27, 2011 at 11:02 PM, Tim Roberts wrote:

> Sarbojit Sarkar wrote:
> > @Tim, Thanks for your response.
> > Are you saying EnumDisplayDevices will return my device name
> > only when my display driver(.dll) will be running or active?
> > If yes, But I have seen even though display drive is not running, it
> > gives my driver’s device name.
>
> How do you know your driver is not running? Have you checked in the
> debugger?
>
> > I had tried EnumDisplayDevices(), it is giving my device name in
> > DeviceString but it is not saying how many instances are running. I
> > am interested to know how many instances are running.
>
> Do you mean DISPLAY_DEVICE_ACTIVE is set, whether or not your mirror
> driver is running? That doesn’t seem sensible. Theoretically, if you
> have two mirror driver instances running, you should see your driver
> twice in the returns from EnumDisplayDevices.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>