Article View: borland.public.cppbuilder.nativeapi
Article #3125RegisterDeviceNotification() and 'Imaging Device'-class.
From: 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
Technical Details
Message-ID:
<qfj4j2liq9ktg4l0nn2662qss788jbmmlm@4ax.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,52c909c1b4dda956,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: Kris <test@test.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: RegisterDeviceNotification() and 'Imaging Device'-class. Date: Sun, 15 Oct 2006 17:07:28 +0200 Message-ID: <qfj4j2liq9ktg4l0nn2662qss788jbmmlm@4ax.com> X-Newsreader: Forte Free Agent 3.3/32.846 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 83.134.86.48 X-Trace: newsgroups.borland.com 1160924844 83.134.86.48 (15 Oct 2006 08:07:24 -0700) Lines: 144 Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail