CM_Reenumerate_DevNode_Ex (setupapi)
Last changed: -110.66.254.137

.
Summary
The CM_Reenumerate_DevNode_Ex function enumerates the devices identified by a specified device node and all of its children.

C# Signature:

[DllImport("setupapi.dll")]
static extern UInt32 CM_Reenumerate_DevNode_Ex(UInt32 dnDevInst, UInt32 ulFlags, IntPtr hMachine);

VB Signature:

Declare Function CM_Reenumerate_DevNode_Ex Lib "setupapi.dll" (dnDevInst As UInt32, ulFlags As UInt32, hMachine As IntPtr) As UInt32

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

Please add some!

Tips & Tricks:

Please add some!

ulFlags:
  const uint CM_REENUMERATE_NORMAL         = 0x00000000;
  const uint CM_REENUMERATE_SYNCHRONOUS    = 0x00000001;
  // XP and later versions
  const uint CM_REENUMERATE_RETRY_INSTALLATION = 0x00000002;
  const uint CM_REENUMERATE_ASYNCHRONOUS       = 0x00000004;

Result:
  const uint CR_SUCCESS = 0x00000000;
  :

Sample Code:

Please add some!

public bool RescanDevices()
{
     UInt32 devRoot;

     if(CM_Locate_DevNode_Ex(out devRoot, IntPtr.Zero, 0, IntPtr.Zero) != CR_SUCCESS) return false;
     if(CM_Reenumerate_DevNode_Ex(devRoot, 0, IntPtr.Zero) != CR_SUCCESS) return false;

     return true;
}

Documentation