通过Visual Studio构建Windows驱动程序时出现GUID错误

时间:2013-01-10 11:18:53

标签: driver guid umdf

我正在Visual Studio中构建UMDF智能卡读卡器驱动程序。我得到了类似的奇怪错误:

error C2374: 'GUID_DEVINTERFACE_DISK' : redefinition; multiple initialization C:\Program Files (x86)\Windows Kits\8.0\Include\UM\winioctl.h 43 1 BixVReader

文件winioctl.h包含不同设备的DEFINE_GUID(实际上每个设备有1个错误):

DEFINE_GUID(GUID_DEVINTERFACE_DISK, 0x53f56307L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);

我怀疑我在Internal.h中写的那行:

DEFINE_GUID(SmartCardReaderGuid, 0x50DD5230, 0xBA8A, 0x11D1, 0xBF,0x5D,0x00,0x00,0xF8,0x05,0xF5,0x30);

但是怎么了?

1 个答案:

答案 0 :(得分:3)

当我转换 #include“winioctl.h” #include 时,这些错误就会丢失:

//
// Windows IOCTL definitions.
//
#include "winioctl.h"

//
// GUID include
//
#include <initguid.h>

//
// Device Interface GUID
// 0x50DD5230, 0xBA8A, 0x11D1, 0xBF,0x5D,0x00,0x00,0xF8,0x05,0xF5,0x30
//
DEFINE_GUID(GUID_DEVINTERFACE_BixVReader,
    0x50DD5230, 0xBA8A, 0x11D1, 0xBF,0x5D,0x00,0x00,0xF8,0x05,0xF5,0x30);

我不是C ++专家,对我来说似乎很奇怪,但仍然如此。欢迎就此问题发表任何意见。