@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: The CM_Get_DevNode_Registry_Property function retrieves a specified device property from the registry. If the operation succeeds, the function returns CR_SUCCESS. Otherwise, it returns one of the CR_-prefixed error codes that are defined in Cfgmgr32.h. !!!!C# Signature: [DllImport("setupapi.dll", SetLastError=true)] public static extern int CM_Get_DevNode_Registry_Property( uint deviceInstance, uint property, out Microsoft.Win32.RegistryValueKind pulRegDataType, IntPtr buffer, ref uint length, uint flags); !!!!VB Signature: Declare Function CM_Get_DevNode_Registry_Property Lib "setupapi.dll" (TODO) As TODO !!!!Parameters: '''deviceInstance''', A caller-supplied device instance handle that is bound to the local machine. '''property''', A CM_DRP_-prefixed constant value that identifies the device property to be obtained from the registry. These constants are defined in Cfgmgr32.h. '''pulRegDataType''', Optional, can be NULL. A pointer to a location that receives the registry data type, specified as a REG_-prefixed constant defined in Winnt.h. '''buffer''', Optional, can be NULL. A pointer to a caller-supplied buffer that receives the requested device property. If this value is NULL, the function supplies only the length of the requested data in the address pointed to by pulLength. '''length''', A pointer to a ULONG variable into which the function stores the length, in bytes, of the requested device property. If the Buffer parameter is set to NULL, the ULONG variable must be set to zero. If the Buffer parameter is not set to NULL, the ULONG variable must be set to the length, in bytes, of the caller-supplied buffer. '''flags''', Not used, must be zero. !!!!User-Defined Types: None. !!!!Alternative Managed API: Do you know one? Please contribute it! !!!!Notes: In most cases you can use SetupDiGetDeviceRegistryProperty. Also Microsoft.Win32.RegistryValueKind only contains enumerations for the basic kinds. MSDN: This function is reserved for system use. Do not use this function in your class installers, co-installers, or device installation applications. Use device installation functions instead. !!!!Tips & Tricks: Please add some! !!!!Sample Code: // The following code shows how to grab the parent device's driver name. The devinfo_data.DevInst is // from SetupDiEnumDeviceInterfaces and SetupDiGetDeviceInterfaceDetail so please see those examples string driver_name; uint parent; if (CR_SUCCESS == CM_Get_Parent(out parent, devinfo_data.DevInst, 0)) { Microsoft.Win32.RegistryValueKind kind; uint length = 0; CM_Get_DevNode_Registry_Property(devinst, CM_DRP_DRIVER, out kind, IntPtr.Zero, ref length, 0); if (length > 0) { IntPtr buffer = Marshal.AllocHGlobal((int)length); if (CR_SUCCESS == CM_Get_DevNode_Registry_Property(devinst, CM_DRP_DRIVER, out kind, buffer, ref length, 0)) driver_name = Marshal.PtrToStringAnsi(buffer); Marshal.FreeHGlobal(buffer); } } Documentation: CM_Get_DevNode_Registry_Property@msdn on MSDN
Edit setupapi.CM_Get_D...
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.