热情软件屋

 

哪里有以setupDi...开头的那些函数的说明


编号:QA003388
建立日期: 2000年10月10日 最后修改日期:2000年10月12日
所属类别:

江海:
    操作系统: Win98
    编程工具: 98ddk
    问题: 在%98ddk%\inc\win98\setupapi.h中所包含的、以setupDi...开头的那些函数原型,为什
    么在DDK帮助中没有说明?如果这些函数是未公开的部分,那么这些函数作用是什么,又是
    如何使用的呢?
    以下是一个函数的原型:
    WINSETUPAPI
    BOOL
    WINAPI
    SetupDiOpenDeviceInterfaceA(
     IN HDEVINFO DeviceInfoSet,
     IN PCSTR DevicePath,
     IN DWORD OpenFlags,
     OUT PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData OPTIONAL
     );
    水平: 刚入门

回答:

    在MSDN Library中有完整的帮助资料。
    江海问:
    首先感谢你上次给我的帮助,现在问题已经解决了。
    最近我正在编写WDM驱动程序,在编程过程中我发现Visual C++ 6的SetupApi.h中声明的函数SetupDiGetClassDevs在MSDN和98DDK帮助文件中都没有使用介绍。希望你在这方面能够给予帮助。
    答:我使用的MSDN Library是2000年7月版本,不是VC++ 6.0带的那个版本。在2000年7月版本中有这个函数的详细说明(见后面)。MSDN Library每个季度更新一次,有条件的单位可以向微软的代理商购买(如果通过了MCSD考试,免费赠送一年)。你也可以在微软的站点上搜索一下这个函数,一般都可以找到。
    

SetupDiGetClassDevs

The SetupDiGetClassDevs function retrieves a device information set that contains all devices of a specified class.

To retrieve a device information set for devices on a remote computer, call theSetupDiGetClassDevsEx function.

HDEVINFO SetupDiGetClassDevs(
  CONST LPGUID ClassGuid, 
  PCTSTR Enumerator, 
  HWND hwndParent, 
  DWORD Flags
);

Parameters

ClassGuid
[in] An optional pointer to a class GUID for a setup class or an interface class. If the DIGCF_DEVICEINTERFACE flag is set, ClassGuid represents an interface class; otherwise, ClassGuid represents a setup class.

If the DIGCF_ALLCLASSES flag is set, this parameter is ignored and the resulting list contains devices of all installed classes.

Enumerator
[in] An optional pointer to a string that filters the devices that are returned.

If the DIGCF_DEVICEINTERFACE flag is set, this parameter is an optional pointer to a string representing the PnP name of a particular device. This function examines this particular device only to determine whether it exposes any interfaces of the requested interface class.

If the DIGCF_DEVICEINTERFACE flag is not set, this parameter optionally specifies the name of the PnP enumerator for the devices of interest. (The names of system-supplied enumerators appear in the DDK header file Register.h.) This function examines only device instances of this enumerator. If this parameter is NULL, this function retrieves device information for all device instances on the system.

hwndParent
[in] Specifies the handle to the top-level window to be used for any user interface relating to the members of this set.
Flags
[in] Specifies control options used in building the device information set. This parameter can be one or more of the following values.
Value Meaning
DIGCF_ALLCLASSES Return a list of installed devices for all classes. If this flag is set, the ClassGuid parameter is ignored.
DIGCF_DEVICEINTERFACE Return devices that expose interfaces of the interface class specified by ClassGuid. If this flag is not set, ClassGuid specifies a setup class.
DIGCF_PRESENT Return only devices that are currently present.
DIGCF_PROFILE Return only devices that are a part of the current hardware profile.

Return Values

If the function succeeds, the return value is a handle to a device information set containing all installed devices matching the specified parameters.

If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.

Remarks

To destroy the device information set when you have finished, call the SetupDiDestroyDeviceInfoList function.

If DIGCF_DEVICEINTERFACE is set, ClassGuid (if used) must point to a device interface class GUID, and Enumerator (if used) must point to a PnP device name. The device information set returned contains devices that expose interfaces of the requested interface class. Enumerate the interfaces of the devices using the SetupDiEnumDeviceInterfaces function.

If DIGCF_DEVICEINTERFACE is not set, ClassGuid (if used) must point to a setup class GUID, and Enumerator (if used) must specify the name of the PnP enumerator that enumerates the devices of interest.

To retrieve the devices for a class on a remote computer, call the SetupDiGetClassDevsEx function.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 98.
  Header: Declared in Setupapi.h.
  Library: Use Setupapi.lib.

此问题由李海回答。

 
把这个问题推荐给朋友
   
   
您的意见类别
您的名字
您的电子邮件
您的建议(请尽可能详细)
 
 

版权所有 1997-2008 热情软件屋
如果您有任何建议和意见, 请给我发个电子邮件 askpro@china-askpro.com
Web Designed by ZebraStudio