Thread View: borland.public.cppbuilder.nativeapi
1 messages
1 total messages
Started by Kris
Sun, 15 Oct 2006 15:07
RegisterDeviceNotification() and 'Imaging Device'-class.
Author: Kris
Date: Sun, 15 Oct 2006 15:07
Date: Sun, 15 Oct 2006 15:07
144 lines
6991 bytes
6991 bytes
I'm currently detecting DBT_DEVICEARRIVAL and DBT_DEVICEREMOVECOMPLETE
for one specific device class. This is done by using
RegisterDeviceNotification() and specifying a NotificationFilter where
the dbcc_classguid contains the InterfaceClassGuid of the devices
which I would like to detect.
Currently the InterfaceClassGuid is set to GUID_DEVINTERFACE_CDROM
which is already pre-defined like this :
// Extract from <winioctl.h>
DEFINE_GUID(_CDROM,0x53f56308L,0xb6bf,0x11d0,0x94,0xf2,0x00,0xa0,0xc9,0x1e,0xfb,0x8b);
This works great, but now I'm looking at adding events from the
'Imaging Device'-class (cameras etc.)
Strangely enough my winioctl.h only contains a limited number
GUID_DEVINTERFACE_xxx entries and the 'Imaging Device'-class is not
among them.
I thought I could perhaps just add my own GUID based on the imaging
class GUID instead of using the a pre-defined one (which I can't find
anywhere). So I looked at the following URL to get an overview of the
different ClassGuids:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devinst_d/hh/DevInst_d/setup-cls_f7544122-69a3-4b34-85f5-db3714408026.xml.asp
It says :
CD-ROM Drives
Class = CDROM
ClassGuid = {4d36e965-e325-11ce-bfc1-08002be10318}
First I looked if the GUID from the webpage matches with the
GUID_DEVINTERFACE_CDROM I'm currently using (and which works), just to
be sure that the GUIDs on this web page are the ones that I need to
use.
But apparently they don't match since the GUID I'm now using is this
one :
DEFINE_GUID(GUID_DEVINTERFACE_CDROM,0x53f56308L,0xb6bf,0x11d0,0x94,0xf2,0x00,0xa0,0xc9,0x1e,0xfb,0x8b);
And that one is perfectly working fine but it totally different from
{4d36e965-e325-11ce-bfc1-08002be10318}.
So, I'm doubtful that using the GUID below from the 'Imaging
devices'-class would work :
Imaging Device
Class = Image
ClassGuid = {6bdd1fc6-810f-11d0-bec7-08002be2092f}
Does anybody know which GUID I have to use in order to allow
RegisterDeviceNotification() notify me of any changes in the 'Imaging
Device'-class ?
Just to see what happens, I tried actually using the
{6bdd1fc6-810f-11d0-bec7-08002be2092f}. But unfortunately I'm for some
reason not able to define my own GUID :
DEFINE_GUID(GUID_MYIMAGING,0x6bdd1fc6L,0x810f,0x11d0,0xbe,0xc7,0x08,0x00,0x2b,0xe2,0x09,0x2f);
[C++ Error] Assistant_Unit.cpp(273): E2215 Linkage specification not
allowed
[C++ Error] Assistant_Unit.cpp(273): E2500 __declspec(selectany) is
only for initialized and externally visible variables
[C++ Error] Assistant_Unit.cpp(273): E2189 extern variable cannot be
initialized
I'm currently detecting DBT_DEVICEARRIVAL and DBT_DEVICEREMOVECOMPLETE
for one specific device class. This is done by using
RegisterDeviceNotification() and specifying a NotificationFilter where
the dbcc_classguid contains the InterfaceClassGuid of the devices
which I would like to detect.
Currently the InterfaceClassGuid is set to GUID_DEVINTERFACE_CDROM
which is already pre-defined like this :
// Extract from <winioctl.h>
DEFINE_GUID(_CDROM,0x53f56308L,0xb6bf,0x11d0,0x94,0xf2,0x00,0xa0,0xc9,0x1e,0xfb,0x8b);
This works great, but now I'm looking at adding events from the
'Imaging Device'-class (cameras etc.)
Strangely enough my winioctl.h only contains a limited number
GUID_DEVINTERFACE_xxx entries and the 'Imaging Device'-class is not
among them.
I thought I could perhaps just add my own GUID based on the imaging
class GUID instead of using the pre-defined one (which I can't find
anywhere). So I looked at the following URL to get an overview of the
different ClassGuids:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devinst_d/hh/DevInst_d/setup-cls_f7544122-69a3-4b34-85f5-db3714408026.xml.asp
CD-ROM Drives
Class = CDROM
ClassGuid = {4d36e965-e325-11ce-bfc1-08002be10318}
First I looked if the GUID from the webpage matches with the
GUID_DEVINTERFACE_CDROM I'm currently using (and which works), just to
be sure that the GUIDs on this web page are the ones that I need to
use.
But apparently they don't match since the GUID I'm now using is this
one :
DEFINE_GUID(GUID_DEVINTERFACE_CDROM,0x53f56308L,0xb6bf,0x11d0,0x94,0xf2,0x00,0xa0,0xc9,0x1e,0xfb,0x8b);
And that one is perfectly working fine but it totally different from
{4d36e965-e325-11ce-bfc1-08002be10318}.
So, I'm doubtful that using the GUID below from the 'Imaging
devices'-class would work :
Imaging Device
Class = Image
ClassGuid = {6bdd1fc6-810f-11d0-bec7-08002be2092f}
Does anybody know which GUID I have to use in order to allow
RegisterDeviceNotification() notify me of any changes in the 'Imaging
Device'-class ?
Just to see what happens, I tried using the
{6bdd1fc6-810f-11d0-bec7-08002be2092f}. But unfortunately I'm for some
reason not able to define my own GUID :
DEFINE_GUID(GUID_MYIMAGING,0x6bdd1fc6L,0x810f,0x11d0,0xbe,0xc7,0x08,0x00,0x2b,0xe2,0x09,0x2f);
[C++ Error] Assistant_Unit.cpp(273): E2215 Linkage specification not
allowed
[C++ Error] Assistant_Unit.cpp(273): E2500 __declspec(selectany) is
only for initialized and externally visible variables
[C++ Error] Assistant_Unit.cpp(273): E2189 extern variable cannot be
initialized
And I did include <initguid.h>.
Any help on getting 'device image'-class registred for notification is
much appreciated.
I also wonder why the ClassGuid on the webpage (which are also the
ones used in the registry - HKEY_LOCAL_MACHINE \SYSTEM
\CurrentControlSet \Control \Class \ {GUID} - to categorize devices)
apparently don't match with the predefined GUID_DEVINTERFACE_xxx I
currently use for RegisterDeviceNotification().
Thanks,
Any help on getting 'device image'-class registred for notification is
much appreciated.
I also wonder why the ClassGuid on the webpage (which are also the
ones used in the registry - HKEY_LOCAL_MACHINE \SYSTEM
\CurrentControlSet \Control \Class \ {GUID} - to categorize devices)
apparently don't match with the predefined GUID_DEVINTERFACE_xxx I
currently use for RegisterDeviceNotification().
Thanks,
Kris
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads