CM_Get_Device_ID_List_SizeA function (cfgmgr32.h)

The CM_Get_Device_ID_List_Size function retrieves the buffer size required to hold a list of device instance IDs for the local machine's device instances.


  [out]          PULONG pulLen,
  [in, optional] PCSTR  pszFilter,
  [in]           ULONG  ulFlags


[out] pulLen

Receives a value representing the required buffer size, in characters.

[in, optional] pszFilter

Caller-supplied pointer to a character string specifying a subset of the machine's device instance identifiers, or NULL. See the following description of ulFlags.

[in] ulFlags

One of the optional, caller-supplied bit flags that specify search filters. If no flags are specified, the function supplies the buffer size required to hold all instance identifiers for all device instances. For a list of bit flags, see the ulFlags description for CM_Get_Device_ID_List.

Return value

If the operation succeeds, the function returns CR_SUCCESS. Otherwise, it returns one of the CR_-prefixed error codes defined in Cfgmgr32.h.


The CM_Get_Device_ID_List_Size function should be called to determine the buffer size required by CM_Get_Device_ID_List.

The size value supplied in the location pointed to by pulLen is guaranteed to represent a buffer size large enough to hold all device instance identifier strings and terminating NULLs. The supplied value might actually represent a buffer size that is larger than necessary, so don't assume the value represents the true length of the character strings that CM_Get_Device_ID_List will provide.

For information about device instance IDs, see Device Identification Strings.


The cfgmgr32.h header defines CM_Get_Device_ID_List_Size as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.


Requirement Value
Minimum supported client Available in Microsoft Windows 2000 and later versions of Windows.
Target Platform Universal
Header cfgmgr32.h (include Cfgmgr32.h)
Library Cfgmgr32.lib
DLL CfgMgr32.dll

See also