- DEFINE_GUID and it's use in SetupDiEnumDeviceInterfaces
- Posted by dmitrym_10 on August 17th, 2007
Hi,
I embed interface guid (it is generated with uuidgen) in my driver with
DEFINE_GUID(GUID_DEVINTERFACE_MYDRIVER_FILTER,
0x1d9e9eb0, 0x393a, 0x4345, 0xbb, 0x1d, 0xba, 0xf7, 0x45, 0x68, 0x62, 0xf3);
/* 1d9e9eb0-393a-4345-bb1d-baf7456862f3 */
Then I try to find path to that device using
info = SetupDiGetClassDevs(guid_from_above, NULL, NULL, DIGCF_PRESENT |
DIGCF_DEVICEINTERFACE)
Next I call SetupDiEnumDeviceInterfaces(info, NULL, guid_from_above, 0,
interfaceData)
Which fails (returns false) and LastError() returns ERROR_NO_MORE_ITEMS even
if index is 0.
When I look into .sys file with hex editor I can't find my guid anywhere. Is
it somehow mangled?
Could somebody point me what I am doing wrong?
I use Vista x86 Checked build env to build driver and it runs on 32-bit
Vista box.
Thank you,
Dmitry.
- Posted by Doron Holan [MSFT] on August 17th, 2007
did you register and enable the device interface with
GUID_DEVINTERFACE_MYDRIVER_FILTER? one way to check if the guid is being
defined is to load your driver in windbg as a dump file (windbg -z
yourdriver.sys) and the dump the global, i.e.
dt <yourdriver>!GUID_DEVINTERFACE_MYDRIVER_FILTER
d
--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
"dmitrym_10" <dmitrym10@discussions.microsoft.com> wrote in message
news:1B6A2A45-8793-48CE-902E-5B4A65355A60@microsoft.com...
- Posted by dmitrym_10 on August 18th, 2007
Hi Doran,
It seems it is not exported.
WinDbg says Simbol ... not found. And when I look into sys file with hex
editor it is not there. I can build kbfiltr.sys and find
GUID_DEVINTERFACE_KBFILTER in it. Between DEVICE_EXTENSION and KmdfLibrary.
But if I build my driver I see 0x00000000 in the same spot. I install driver
using Inf file. How I suppose to register and enable it? I can't see any use
of GUID_DEVINTERFACE_KBFILTER in KbFilter code other than
DEFINE_GUID(GUID_DEVINTERFACE_KBFILTER... I assume it is enough to have it
embedded. Am I wrong?
I am sorry if I am asking obvious questions. I am new to driver development.
Thank you,
Dmitry.
- Posted by dmitrym_10 on August 18th, 2007
Hi Doran,
It seems to be not exported.
WinDbg says Simbol ... not found. And when I look into sys file with hex
editor it is not there. I can build kbfiltr.sys and find
GUID_DEVINTERFACE_KBFILTER in it. Between DEVICE_EXTENSION and KmdfLibrary.
But if I build my driver I see 0x00000000 in the same spot. I install driver
using Inf file. How I suppose to register and enable it? I can't see any use
of GUID_DEVINTERFACE_KBFILTER in KbFilter code other than
DEFINE_GUID(GUID_DEVINTERFACE_KBFILTER... I assume it is enough to have it
embedded. Am I wrong?
I am sorry if I am asking obvious questions. I am new to driver development.
Thank you,
Dmitry.
"Doron Holan [MSFT]" wrote:
- Posted by Neil Sandlin [MSFT] on August 18th, 2007
Hi Dmitry-
Perhaps you are not including <initguid.h> anywhere? This is a convention
that was set up to avoid multiple GUID definitions. You need at least one
instance of specifying DEFINE_GUID in a module that has included that header.
Hope that helps
-Neil
"dmitrym_10" wrote:
- Posted by dmitrym_10 on August 18th, 2007
Thank you Neil,
Sorry for keeping you guys late on Friday.
Here is top of my .h file
#ifndef MouseFilter_H
#define MouseFilter_H
#pragma warning(disable:4201)
#include <ntddk.h>
#include <ntddmou.h>
#include <kbdmou.h>
//#include <ntddkbd.h>
//#include <ntdd8042.h>
#pragma warning(default:4201)
#include <wdf.h>
#include <wdm.h>
#define NTSTRSAFE_LIB
#include <ntstrsafe.h>
#include <initguid.h>
#include <devguid.h>
I do have <initguid.h> there. Anything else you could think of?
Thank you,
Dmitry.
"Neil Sandlin [MSFT]" wrote:
- Posted by dmitrym_10 on August 18th, 2007
I found my mistake. I was not calling WdfDeviceCreateDeviceInterface() to
register it.
Thank you,
Dmitry.