Desktop Functions: Smart Device Functions:
|
SP_DEVICE_INTERFACE_DETAIL_DATA (Structures)
The SP_DEVICE_INTERFACE_DETAIL_DATA structure provides detailed information about a particular device interface. C# Definition:
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 1)] C# Alternative Definition:Alternative definition:
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)] VB.net Definition:
<StructLayout(LayoutKind.Sequential)> _ Members:size, Size of the structure, in bytes. devicePath, NULL-terminated string that specifies the device path. size Size of the structure, in bytes. devicePath NULL-terminated string that specifies the device path. Notes:The cbSize parameter should be the size of the DWORD plus the first character of the string
SP_DEVICE_INTERFACE_DETAIL_DATA didd = new SP_DEVICE_INTERFACE_DETAIL_DATA(); Notes 2:The alternative definition is not recommended. The cbSize parameter is different on various operating systems. For Win7 64bit the field must be set to value returned by
didd.cbSize = Marshal.SizeOf(typeof(SP_DEVICE_INTERFACE_DETAIL_DATA)) of the first definition, which is 8 and this is the only value accepted by the OS. However when Vista 32bit is used the size must be set to
didd.cbSize = sizeof(int) + Marshal.SystemDefaultCharSize; as it was stated in the notes above. To use the structure it must be allocated on the system global heap to create space for the device path in the structure. The definition is header only which has room for null character only (text terminator). Example:
unsafe internal string GetDeviceInterfaceDetail(ref DeviceInterfaceData.NativeDeviceInterfaceData devIfaceData) Please edit this page!Do you have...
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed. |
|