DriverStudio
/*****************************************************************************
* 功能: 通过GUID打开设备,获得设备句柄
* 参数:
*****************************************************************************/
HANDLE lOpenByInterface(
GUID* pClassGuid, // points to the GUID that identifies the interface class
DWORD instance, // specifies which instance of the enumerated devices to open
PDWORD pError // address of variable to receive error status
)
{
HANDLE hDev=0;
CDeviceInterfaceClass DevClass(pClassGuid, pError);
if (*pError != ERROR_SUCCESS)
return INVALID_HANDLE_VALUE