Hi !
To explain the scenario and my aim :
Aim :
I am trying to create a graphical display on the desktop whenever a device (USB) is attached or detached from the system.
Constraints :
Driver source code is not exposed to me , so I need to work in the user space.
My approach:
I tried using GDI+(graphic device interface) in VS2012 to create an executable , which , when run displays a colored rectangle on the desktop with some message text “USB plugged-in”.
Next what I want to do is to have this executable pop-up on insertion of my USB device.
How do I go about doing this?
Once kernel-level PnP manager is done with calling DriverEntry , AddDevice routines , I would have tried invoking the executable.Since after success of AddDevice routine, I would be sure that its the device which I inserted.
Since I have no access to the driver , is there any return from the driver to the application upon insertion of the device? If there is a return , can I use this to invoke my graphical interface(colored rectangle)?
Thanks
Hi,
You need not to do anything with driver. There is support in Win32 to get
notification for device connection/disconnection.
Read this
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363432(v=vs.85).aspx
On Tue, May 21, 2013 at 5:41 PM, wrote:
> Hi !
> To explain the scenario and my aim :
>
> Aim :
> I am trying to create a graphical display on the desktop whenever a device
> (USB) is attached or detached from the system.
>
> Constraints :
> Driver source code is not exposed to me , so I need to work in the user
> space.
>
> My approach:
> I tried using GDI+(graphic device interface) in VS2012 to create an
> executable , which , when run displays a colored rectangle on the desktop
> with some message text “USB plugged-in”.
>
> Next what I want to do is to have this executable pop-up on insertion of
> my USB device.
>
> How do I go about doing this?
>
> Once kernel-level PnP manager is done with calling DriverEntry , AddDevice
> routines , I would have tried invoking the executable.Since after success
> of AddDevice routine, I would be sure that its the device which I inserted.
>
> Since I have no access to the driver , is there any return from the driver
> to the application upon insertion of the device? If there is a return , can
> I use this to invoke my graphical interface(colored rectangle)?
>
> Thanks
>
>
>
>
>
> —
> NTDEV is sponsored by OSR
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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
>
Hi,
Thanks for the reply.
Read he article suggested by you.
I built a win32 empty project using the code provided and changed GUID to my USB device.
The console displayed “Registered for USB device notification…”. Now when I attach and detach my device, the console repeatedly shows the same message “DBT_DEVNODES_CHANGED” whereas I expected “DBT_DEVICEARRIVAL” and “DBT_DEVICEREMOVECOMPLETE”.
On debugging I observe that wParam of switch (wParam) always gets a value 7 which is for case:“DBT_DEVNODES_CHANGED”.
FYI: These messages in quotes are part of the switch cases given in the code from the link suggested by you.
Any idea on this front?
Thanks in advance
Hi,
Explore this article complete it has more details in
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363215(v=vs.85).aspx
and
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363427(v=vs.85).aspx
Should help. if not you can search one sample application on codeproject on
same topic. Thats ready to use.
On Wed, May 22, 2013 at 12:00 PM, wrote:
> Hi,
> Thanks for the reply.
> Read he article suggested by you.
>
> I built a win32 empty project using the code provided and changed GUID to
> my USB device.
> The console displayed “Registered for USB device notification…”. Now
> when I attach and detach my device, the console repeatedly shows the same
> message “DBT_DEVNODES_CHANGED” whereas I expected “DBT_DEVICEARRIVAL” and
> “DBT_DEVICEREMOVECOMPLETE”.
>
> On debugging I observe that wParam of switch (wParam) always gets a value
> 7 which is for case:“DBT_DEVNODES_CHANGED”.
>
> FYI: These messages in quotes are part of the switch cases given in the
> code from the link suggested by you.
>
> Any idea on this front?
> Thanks in advance
>
> —
> NTDEV is sponsored by OSR
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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
>
Post your registration code
d
Bent from my phone
From: xxxxx@tataelxsi.co.inmailto:xxxxx
Sent: ?5/?21/?2013 11:32 PM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: RE:[ntdev] To create a notification via GUI for USB attach/detach
Hi,
Thanks for the reply.
Read he article suggested by you.
I built a win32 empty project using the code provided and changed GUID to my USB device.
The console displayed “Registered for USB device notification…”. Now when I attach and detach my device, the console repeatedly shows the same message “DBT_DEVNODES_CHANGED” whereas I expected “DBT_DEVICEARRIVAL” and “DBT_DEVICEREMOVECOMPLETE”.
On debugging I observe that wParam of switch (wParam) always gets a value 7 which is for case:“DBT_DEVNODES_CHANGED”.
FYI: These messages in quotes are part of the switch cases given in the code from the link suggested by you.
Any idea on this front?
Thanks in advance
—
NTDEV is sponsored by OSR
OSR is HIRING!! See http://www.osr.com/careers
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</mailto:xxxxx></mailto:xxxxx>
xxxxx@tataelxsi.co.in wrote:
I built a win32 empty project using the code provided and changed GUID to my USB device.
The console displayed “Registered for USB device notification…”. Now when I attach and detach my device, the console repeatedly shows the same message “DBT_DEVNODES_CHANGED” whereas I expected “DBT_DEVICEARRIVAL” and “DBT_DEVICEREMOVECOMPLETE”.
On debugging I observe that wParam of switch (wParam) always gets a value 7 which is for case:“DBT_DEVNODES_CHANGED”.
In general, the device notifications tell you “something in the device
tree has changed”. They don’t tell you what changed, or how, or in
which direction.
So, the best plan is for you to write a routine to do a complete
enumeration of all the devices you care about. Then, any time you get a
notification, go redo the enumeration and compare it to the last one to
see what changed. That will tell you what you need to know.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.