Hi, again
Here are some more info.
This is what I have so far..
Declare Auto Function CM_Get_Device_ID_List_Size Lib "cfgmgr32.dll" _
(ByRef pulLen As Integer, ByVal pszFilter As String, ByVal ulFlags As
Integer) As Integer
Declare Auto Function CM_Get_Device_ID_List Lib "cfgmgr32.dll" _
(ByVal pszFilter As String, ByVal ptChar As System.Text.StringBuilder, ByVal
bufferLen As Integer, ByVal ulFlags As Integer) As Integer
Dim filter As String
Dim flags As Integer
Dim len As Integer
filter = 0
flags = 0
CM_Get_Device_ID_List_Size(len, filter, flags)
Dim sb As New StringBuilder(len + 1)
CM_Get_Device_ID_List(filter, sb, sb.Capacity, flags)
Console.WriteLine("*{0}*", sb.ToString)
System.Console.ReadLine()
The length I recive is about 8500, so that sounds right. right?
Thanks for your help
/ Henning
Below: The MSDN info for the CM_Get_Device_ID_List
--------------------------------------------------
CM_Get_Device_ID_List
The CM_Get_Device_ID_List function retrieves a list of device instance IDs
for the local machine's device instances.
CMAPI CONFIGRET WINAPI
CM_Get_Device_ID_List(
IN PCTSTR pszFilter, OPTIONAL
OUT PTCHAR Buffer,
IN ULONG BufferLen,
IN ULONG ulFlags
);
Parameters
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.
Buffer
Address of a buffer to receive a set of NULL-terminated device instance
identifier strings. The end of the set is terminated by an extra NULL. The
required buffer size should be obtained by calling
CM_Get_Device_ID_List_Size.
BufferLen
Caller-supplied length, in characters, of the buffer specified by Buffer.
ulFlags
One of the optional, caller-supplied bit flags, listed in the following
table, which specify search filters. If no flags are specified, the function
returns all device instance IDs for all device instances.
CM_GETIDLIST_FILTER_ENUMERATOR
If this flag is set, pszFilter must specify the name of a device enumerator,
optionally followed by a device identifier. The string format is
EnumeratorName\<DeviceID>, such as ROOT or ROOT\*PNP0500.
If pszFilter supplies only an enumerator name, the function returns device
instance IDs for the instances of each device associated with the
enumerator. Enumerator names can be obtained by calling
CM_Enumerate_Enumerators.
If pszFilter supplies both an enumerator and a device ID, the function
returns device instance IDs only for the device instances of the specified
device, associated with the enumerator.
CM_GETIDLIST_FILTER_SERVICE
If this flag is set, pszFilter must specify the name of a Windows service
(typically a driver). The function returns device instance IDs for the
device instances controlled by the specified service.
Note that if the device tree does not contain a device node for the
specified service, this function creates one by default. To inhibit this
behavior, also set CM_GETIDLIST_DONOTGENERATE.
CM_GETIDLIST_FILTER_EJECTRELATIONS
If this flag is set, pszFilter must specify a device name. The function
returns device instance IDs for the ejection relations of the specified
device instance.
CM_GETIDLIST_FILTER_REMOVALRELATIONS
If this flag is set, pszFilter must specify a device name. The function
returns device instance IDs for the removal relations of the specified
device instance.
CM_GETIDLIST_FILTER_POWERRELATIONS
Not used.
CM_GETIDLIST_FILTER_BUSRELATIONS
Not used.
CM_GETIDLIST_DONOTGENERATE
Used only with CM_GETIDLIST_FILTER_SERVICE. If set, and if the device tree
does not contain a device node for the specified service, this flag prevents
the function from creating a device node for the service.
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.
Headers
Declared in cfgmgr32.h. Include cfgmgr32.h.
Comments
For information about device instance IDs, see Device Identification
Strings.