using Microsoft.Win32.SafeHandles; using System; using System.Runtime.InteropServices; using System.Text; using Vanara.Extensions; using Vanara.InteropServices; using static Vanara.PInvoke.AdvApi32; using static Vanara.PInvoke.SetupAPI; namespace Vanara.PInvoke { /// Items from the CfgMgr32.dll public static partial class CfgMgr32 { /// public static readonly uint BusNumberType_Range = (uint)Marshal.SizeOf(typeof(BUSNUMBER_RANGE)); /// public static readonly uint DType_Range = (uint)Marshal.SizeOf(typeof(DMA_RANGE)); /// public static readonly uint IOType_Range = (uint)Marshal.SizeOf(typeof(IO_RANGE)); /// public static readonly uint IRQType_Range = (uint)Marshal.SizeOf(typeof(IRQ_RANGE)); /// public static readonly uint MType_Range = (uint)Marshal.SizeOf(typeof(MEM_RANGE)); /// /// The BUSNUMBER_DES structure is used for specifying either a resource list or a resource requirements list that describes bus /// number usage for a device instance. For more information about resource lists and resource requirements lists, see Hardware Resources. /// /// The BUSNUMBER_DES structure is included as a member of the BUSNUMBER_RESOURCE structure. // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-busnumber_des typedef struct BusNumber_Des_s { DWORD // BUSD_Count; DWORD BUSD_Type; DWORD BUSD_Flags; ULONG BUSD_Alloc_Base; ULONG BUSD_Alloc_End; } BUSNUMBER_DES, *PBUSNUMBER_DES; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.BusNumber_Des_s")] [StructLayout(LayoutKind.Sequential)] public struct BUSNUMBER_DES { /// /// For a resource list: /// Zero. /// For a resource requirements list: /// The number of elements in the BUSNUMBER_RANGE array that is included in the BUSNUMBER_RESOURCE structure. /// public uint BUSD_Count; /// Must be set to the constant value . public uint BUSD_Type; /// Not used. public uint BUSD_Flags; /// /// For a resource list: /// The lowest-numbered of a range of contiguous bus numbers allocated to the device. /// For a resource requirements list: /// Zero. /// public uint BUSD_Alloc_Base; /// /// For a resource list: /// The highest-numbered of a range of contiguous bus numbers allocated to the device. /// For a resource requirements list: /// Zero. /// public uint BUSD_Alloc_End; } /// /// The BUSNUMBER_RANGE structure specifies a resource requirements list that describes bus number usage for a device instance. For /// more information about resource requirements lists, see Hardware Resources. /// /// The BUSNUMBER_RANGE structure is included as a member of the BUSNUMBER_RESOURCE structure. // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-busnumber_range typedef struct BusNumber_Range_s { ULONG // BUSR_Min; ULONG BUSR_Max; ULONG BUSR_nBusNumbers; ULONG BUSR_Flags; } BUSNUMBER_RANGE, *PBUSNUMBER_RANGE; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.BusNumber_Range_s")] [StructLayout(LayoutKind.Sequential)] public struct BUSNUMBER_RANGE { /// The lowest-numbered of a range of contiguous bus numbers that can be allocated to the device. public uint BUSR_Min; /// The highest-numbered of a range of contiguous bus numbers that can be allocated to the device. public uint BUSR_Max; /// The number of contiguous bus numbers required by the device. public uint BUSR_nBusNumbers; /// Not used. public uint BUSR_Flags; } /// /// The BUSNUMBER_RESOURCE structure specifies either a resource list or a resource requirements list that describes bus number /// usage for a device instance. For more information about resource lists and resource requirements lists, see Hardware Resources. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-busnumber_resource typedef struct BusNumber_Resource_s { // BUSNUMBER_DES BusNumber_Header; BUSNUMBER_RANGE BusNumber_Data[ANYSIZE_ARRAY]; } BUSNUMBER_RESOURCE, *PBUSNUMBER_RESOURCE; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.BusNumber_Resource_s")] [StructLayout(LayoutKind.Sequential)] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), "*")] public struct BUSNUMBER_RESOURCE { /// A BUSNUMBER_DES structure. public BUSNUMBER_DES BusNumber_Header; /// /// For a resource list: /// Zero. /// For a resource requirements list: /// A BUSNUMBER_RANGE array. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public BUSNUMBER_RANGE[] BusNumber_Data; } /// This is a device notification event data structure. /// /// The notification callback supplied to CM_Register_Notification receives a pointer to a structure of type /// CM_NOTIFY_EVENT_DATA in the callback's EventData parameter. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-cm_notify_event_data typedef struct _CM_NOTIFY_EVENT_DATA // { CM_NOTIFY_FILTER_TYPE FilterType; DWORD Reserved; union { struct { GUID ClassGuid; WCHAR SymbolicLink[ANYSIZE_ARRAY]; } // DeviceInterface; struct { GUID EventGuid; LONG NameOffset; DWORD DataSize; BYTE Data[ANYSIZE_ARRAY]; } DeviceHandle; struct { // WCHAR InstanceId[ANYSIZE_ARRAY]; } DeviceInstance; } u; } CM_NOTIFY_EVENT_DATA, *PCM_NOTIFY_EVENT_DATA; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32._CM_NOTIFY_EVENT_DATA")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct CM_NOTIFY_EVENT_DATA { /// /// The CM_NOTIFY_FILTER_TYPE from the CM_NOTIFY_FILTER structure that was used in the registration that generated this /// notification event data. /// public CM_NOTIFY_FILTER_TYPE FilterType; /// Reserved. Must be 0. public uint Reserved; /// /// A union that contains information about the notification event data. To determine which member of the union to examine, /// check the FilterType of the event data. /// public UNION u; /// /// A union that contains information about the notification event data. To determine which member of the union to examine, /// check the FilterType of the event data. /// [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode)] public struct UNION { /// Examine this part of the union when the FilterType is CM_NOTIFY_FILTER_TYPE_DEVICEINTERFACE. [FieldOffset(0)] public DEVICEINTERFACE DeviceInterface; /// /// Examine this part of the union when the FilterType is CM_NOTIFY_FILTER_TYPE_DEVICEHANDLE and the /// notification action is CM_NOTIFY_ACTION_DEVICECUSTOMEVENT. /// [FieldOffset(0)] public DEVICEHANDLE DeviceHandle; /// Examine this part of the union when the FilterType is CM_NOTIFY_FILTER_TYPE_DEVICEINSTANCE. [FieldOffset(0)] public DEVICEINSTANCE DeviceInstance; /// Examine this part of the union when the FilterType is CM_NOTIFY_FILTER_TYPE_DEVICEINTERFACE. public unsafe struct DEVICEINTERFACE { /// /// The GUID of the device interface class for the device interface to which the notification event data pertains. /// public Guid ClassGuid; /// The symbolic link path of the device interface to which the notification event data pertains. public fixed char SymbolicLink[1]; } /// /// Examine this part of the union when the FilterType is CM_NOTIFY_FILTER_TYPE_DEVICEHANDLE and the /// notification action is CM_NOTIFY_ACTION_DEVICECUSTOMEVENT. /// public unsafe struct DEVICEHANDLE { /// The GUID for the custom event. public Guid EventGuid; /// The offset of an optional string buffer. Usage depends on the contract for the EventGuid. public int NameOffset; /// The number of bytes that can be read from the Data member. public uint DataSize; /// Optional binary data. Usage depends on the contract for the EventGuid. public fixed byte Data[1]; } /// Examine this part of the union when the FilterType is CM_NOTIFY_FILTER_TYPE_DEVICEINSTANCE. public unsafe struct DEVICEINSTANCE { /// The device instance ID of the device to which the notification event data pertains. public fixed char InstanceId[1]; } } } /// Device notification filter structure /// /// When the driver calls the CM_Register_Notificationfunction, it supplies a pointer to a CM_NOTIFY_FILTER structure in the /// pFilter parameter. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-cm_notify_filter typedef struct _CM_NOTIFY_FILTER { DWORD // cbSize; DWORD Flags; CM_NOTIFY_FILTER_TYPE FilterType; DWORD Reserved; union { struct { GUID ClassGuid; } DeviceInterface; struct // { HANDLE hTarget; } DeviceHandle; struct { WCHAR InstanceId[MAX_DEVICE_ID_LEN]; } DeviceInstance; } u; } CM_NOTIFY_FILTER, *PCM_NOTIFY_FILTER; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32._CM_NOTIFY_FILTER")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode, Pack = 4)] public struct CM_NOTIFY_FILTER { /// Initializes a new instance of the struct. /// The GUID of the device interface class for which to receive notifications. public CM_NOTIFY_FILTER(Guid deviceInterfaceClassGuid) : this() { cbSize = (uint)Marshal.SizeOf(typeof(CM_NOTIFY_FILTER)); FilterType = CM_NOTIFY_FILTER_TYPE.CM_NOTIFY_FILTER_TYPE_DEVICEINTERFACE; u.DeviceInterface_ClassGuid = deviceInterfaceClassGuid; } /// Initializes a new instance of the struct. /// A handle to the device for which to receive notifications. public CM_NOTIFY_FILTER(IntPtr hTargetDevice) : this() { cbSize = (uint)Marshal.SizeOf(typeof(CM_NOTIFY_FILTER)); FilterType = CM_NOTIFY_FILTER_TYPE.CM_NOTIFY_FILTER_TYPE_DEVICEHANDLE; u.DeviceHandle_hTarget = hTargetDevice; } /// Initializes a new instance of the struct. /// The device instance ID for the device for which to receive notifications. public CM_NOTIFY_FILTER(string deviceInstanceId) : this() { cbSize = (uint)Marshal.SizeOf(typeof(CM_NOTIFY_FILTER)); FilterType = CM_NOTIFY_FILTER_TYPE.CM_NOTIFY_FILTER_TYPE_DEVICEINTERFACE; u.DeviceInstance_InstanceId = deviceInstanceId; } /// The size of the structure. public uint cbSize; /// /// A combination of zero or more of the following flags: /// CM_NOTIFY_FILTER_FLAG_ALL_INTERFACE_CLASSES /// /// Register to receive notifications for PnP events for all device interface classes. The memory at /// pFilter->u.DeviceInterface.ClassGuid must be zeroes. Do not use this flag with /// CM_NOTIFY_FILTER_FLAG_ALL_DEVICE_INSTANCES. This flag is only valid if pFilter->FilterType is CM_NOTIFY_FILTER_TYPE_DEVICEINTERFACE. /// /// CM_NOTIFY_FILTER_FLAG_ALL_DEVICE_INSTANCES /// /// Register to receive notifications for PnP events for all devices. pFilter->u.DeviceInstance.InstanceId must be an /// empty string. Do not use this flag with CM_NOTIFY_FILTER_FLAG_ALL_INTERFACE_CLASSES. This flag is only valid if /// pFilter->FilterType is CM_NOTIFY_FILTER_TYPE_DEVICEINSTANCE. /// /// public CM_NOTIFY_FILTER_FLAG Flags; /// /// Must be one of the following values: /// CM_NOTIFY_FILTER_TYPE_DEVICEINTERFACE /// /// Register for notifications for device interface events. pFilter->u.DeviceInterface.ClassGuid should be filled in /// with the GUID of the device interface class to receive notifications for. /// /// CM_NOTIFY_FILTER_TYPE_DEVICEHANDLE /// /// Register for notifications for device handle events. pFilter->u.DeviceHandle.hTarget must be filled in with a /// handle to the device to receive notifications for. /// /// CM_NOTIFY_FILTER_TYPE_DEVICEINSTANCE /// /// Register for notifications for device instance events. pFilter->u.DeviceInstance.InstanceId should be filled in /// with the device instance ID of the device to receive notifications for. /// /// public CM_NOTIFY_FILTER_TYPE FilterType; /// Set to 0. public uint Reserved; /// A union that contains information about the device to receive notifications for. public UNION u; /// Gets an instance of this structure set to filter all devices. public static readonly CM_NOTIFY_FILTER AllDevices = new() { cbSize = (uint)Marshal.SizeOf(typeof(CM_NOTIFY_FILTER)), Flags = CM_NOTIFY_FILTER_FLAG.CM_NOTIFY_FILTER_FLAG_ALL_DEVICE_INSTANCES, FilterType = CM_NOTIFY_FILTER_TYPE.CM_NOTIFY_FILTER_TYPE_DEVICEINSTANCE }; /// Gets an instance of this structure set to filter all device interface classes. public static readonly CM_NOTIFY_FILTER AllInterfaces = new() { cbSize = (uint)Marshal.SizeOf(typeof(CM_NOTIFY_FILTER)), Flags = CM_NOTIFY_FILTER_FLAG.CM_NOTIFY_FILTER_FLAG_ALL_INTERFACE_CLASSES, FilterType = CM_NOTIFY_FILTER_TYPE.CM_NOTIFY_FILTER_TYPE_DEVICEINTERFACE }; /// A union that contains information about the device to receive notifications for. [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode)] public unsafe struct UNION { /// The GUID of the device interface class for which to receive notifications. [FieldOffset(0)] public Guid DeviceInterface_ClassGuid; /// A handle to the device for which to receive notifications. [FieldOffset(0)] public IntPtr DeviceHandle_hTarget; [FieldOffset(0)] private fixed char iid[MAX_DEVICE_ID_LEN]; /// The device instance ID for the device for which to receive notifications. public string DeviceInstance_InstanceId { get { fixed (char* p = iid) return new string(p); } set { if (value is null) throw new ArgumentNullException(nameof(DeviceInstance_InstanceId)); if (value.Length >= MAX_DEVICE_ID_LEN) throw new ArgumentException($"String length exceeds maximum of {MAX_DEVICE_ID_LEN - 1} characters.", nameof(DeviceInstance_InstanceId)); for (int i = 0; i < value.Length; i++) iid[i] = value[i]; iid[value.Length] = '\0'; } } } } /// The CONFLICT_DETAILS structure is used as a parameter to the CM_Get_Resource_Conflict_Details function. /// /// Note /// /// The cfgmgr32.h header defines CONFLICT_DETAILS 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. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-conflict_details_a typedef struct _CONFLICT_DETAILS_A { // ULONG CD_ulSize; ULONG CD_ulMask; DEVINST CD_dnDevInst; RES_DES CD_rdResDes; ULONG CD_ulFlags; CHAR CD_szDescription[MAX_PATH]; } // CONFLICT_DETAILS_A, *PCONFLICT_DETAILS_A; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32._CONFLICT_DETAILS_A")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct CONFLICT_DETAILS { /// Initializes a new instance of the struct with the size and mask set. /// The mask of items to retrieve. public CONFLICT_DETAILS(CM_CDMASK mask) : this() { CD_ulSize = (uint)Marshal.SizeOf(typeof(CONFLICT_DETAILS)); CD_ulMask = mask; } /// Size, in bytes, of the CONFLICT_DETAILS structure. public uint CD_ulSize; /// /// /// One or more bit flags supplied by the caller of CM_Get_Resource_Conflict_Details. The bit flags are described in the /// following table. /// /// /// /// Flag /// Description /// /// /// CM_CDMASK_DEVINST /// If set, CM_Get_Resource_Conflict_Details supplies a value for the CD_dnDevInst member. /// /// /// CM_CDMASK_RESDES /// Not used. /// /// /// CM_CDMASK_FLAGS /// If set, CM_Get_Resource_Conflict_Details supplies a value for the CD_ulFlags member. /// /// /// CM_CDMASK_DESCRIPTION /// If set, CM_Get_Resource_Conflict_Details supplies a value for the CD_szDescription member. /// /// /// public CM_CDMASK CD_ulMask; /// /// If CM_CDMASK_DEVINST is set in CD_ulMask, this member will receive a handle to a device instance that has conflicting /// resources. If a handle is not obtainable, the member receives -1. /// public uint CD_dnDevInst; /// Not used. public RES_DES CD_rdResDes; /// /// If CM_CDMASK_FLAGS is set in CD_ulMask, this member can receive bit flags listed in the following table. /// /// /// Flag /// Description /// /// /// CM_CDFLAGS_DRIVER /// /// If set, the string contained in the CD_szDescription member represents a driver name instead of a device name, and /// CD_dnDevInst is -1. /// /// /// /// CM_CDFLAGS_ROOT_OWNED /// If set, the conflicting resources are owned by the root device (that is, the HAL), and CD_dnDevInst is -1. /// /// /// CM_CDFLAGS_RESERVED /// If set, the owner of the conflicting resources cannot be determined, and CD_dnDevInst is -1. /// /// /// public CM_CDFLAGS CD_ulFlags; /// /// If CM_CDMASK_DESCRIPTION is set in CD_ulMask, this member will receive a NULL-terminated text string representing a /// description of the device that owns the resources. If CM_CDFLAGS_DRIVER is set in CD_ulFlags, this string represents /// a driver name. If CM_CDFLAGS_ROOT_OWNED or CM_CDFLAGS_RESERVED is set, the string value is NULL. /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260 /*MAX_PATH*/)] public string CD_szDescription; } /// /// The CS_DES structure is used for specifying a resource list that describes device class-specific resource usage for a device /// instance. For more information about resource lists, see Hardware Resources. /// /// /// /// The data block identified by CSD_LegacyDataSize and CSD_LegacyDataOffset can contain legacy, class-specific data, /// as stored in the DeviceSpecificData member of a CM_PARTIAL_RESOURCE_DESCRIPTOR structure, if the structure's Type /// member is CmResourceTypeDeviceSpecific. /// /// /// The class-specific signature identified by CSD_SignatureLength and CSD_Signature can contain additional /// class-specific device identification information. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-cs_des typedef struct CS_Des_s { DWORD // CSD_SignatureLength; DWORD CSD_LegacyDataOffset; DWORD CSD_LegacyDataSize; DWORD CSD_Flags; GUID CSD_ClassGuid; BYTE // CSD_Signature[ANYSIZE_ARRAY]; } CS_DES, *PCS_DES; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.CS_Des_s")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), nameof(CSD_SignatureLength))] [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct CS_DES { /// The number of elements in the byte array specified by CSD_Signature. public uint CSD_SignatureLength; /// /// Offset, in bytes, from the beginning of the CSD_Signature array to the beginning of a block of data. For example, if /// the data block follows the signature array, and if the signature array length is 16 bytes, then the value for /// CSD_LegacyDataOffset should be 16. /// public uint CSD_LegacyDataOffset; /// Length, in bytes, of the data block whose offset is specified by CSD_LegacyDataOffset. public uint CSD_LegacyDataSize; /// Not used. public uint CSD_Flags; /// /// A globally unique identifier (GUID) identifying a device setup class. If both CSD_SignatureLength and /// CSD_LegacyDataSize are zero, the GUID is null. /// public Guid CSD_ClassGuid; /// A byte array containing a class-specific signature. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] CSD_Signature; } /// /// The CS_RESOURCE structure is used for specifying a resource list that describes device class-specific resource usage for a /// device instance. For more information about resource lists, see Hardware Resources. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-cs_resource typedef struct CS_Resource_s { CS_DES // CS_Header; } CS_RESOURCE, *PCS_RESOURCE; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.CS_Resource_s")] [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct CS_RESOURCE { /// A CS_DES structure. public CS_DES CS_Header; } /// /// The DMA_DES structure is used for specifying either a resource list or a resource requirements list that describes direct memory /// access (DMA) channel usage for a device instance. For more information about resource lists and resource requirements lists, see /// Hardware Resources. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-dma_des typedef struct DMA_Des_s { DWORD DD_Count; DWORD // DD_Type; DWORD DD_Flags; ULONG DD_Alloc_Chan; } DMA_DES, *PDMA_DES; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.DMA_Des_s")] [StructLayout(LayoutKind.Sequential)] public struct DMA_DES { /// /// For a resource list: /// Zero. /// For a resource requirements list: /// The number of elements in the DMA_RESOURCE structure. /// public uint DD_Count; /// Must be set to the constant value DType_Range. public uint DD_Type; /// /// One bit flag from each of the flag sets described in the following table. /// /// /// /// Flag /// Definition /// /// /// Channel Width Flags /// /// /// /// /// fDD_BYTE /// 8-bit DMA channel. /// /// /// /// fDD_WORD /// 16-bit DMA channel. /// /// /// /// fDD_DWORD /// 32-bit DMA channel. /// /// /// /// fDD_BYTE_AND_WORD /// 8-bit and 16-bit DMA channel. /// /// /// /// mDD_Width /// Bitmask for the bits within DD_Flags that specify the channel width value. /// /// /// Bus Mastering Flags /// /// /// /// /// fDD_NoBusMaster /// No bus mastering. /// /// /// /// fDD_BusMaster /// Bus mastering. /// /// /// /// mDD_BusMaster /// Bitmask for the bits within DD_Flags that specify the bus mastering value. /// /// /// DMA Type Flags /// /// /// /// /// fDD_TypeStandard /// Standard DMA. /// /// /// /// fDD_TypeA /// Type A DMA. /// /// /// /// fDD_TypeB /// Type B DMA. /// /// /// /// fDD_TypeF /// Type F DMA. /// /// /// /// mDD_Type /// Bitmask for the bits within DD_Flags that specify the DMA type value. /// /// /// public DMA_DES_FLAGS DD_Flags; /// /// For a resource list: /// The DMA channel allocated to the device. /// For a resource requirements list: /// Not used. /// public uint DD_Alloc_Chan; } /// /// The DMA_RANGE structure specifies a resource requirements list that describes DMA channel usage for a device instance. For more /// information about resource requirements lists, see Hardware Resources. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-dma_range typedef struct DMA_Range_s { ULONG DR_Min; // ULONG DR_Max; ULONG DR_Flags; } DMA_RANGE, *PDMA_RANGE; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.DMA_Range_s")] [StructLayout(LayoutKind.Sequential)] public struct DMA_RANGE { /// The lowest-numbered DMA channel that can be allocated to the device. public uint DR_Min; /// The highest-numbered DMA channel that can be allocated to the device. public uint DR_Max; /// One bit flag from DMA_DES structure. public uint DR_Flags; } /// /// The DMA_RESOURCE structure is used for specifying either a resource list or a resource requirements list that describes DMA /// channel usage for a device instance. For more information about resource list and resource requirements lists, see Hardware Resources. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-dma_resource typedef struct DMA_Resource_s { DMA_DES // DMA_Header; DMA_RANGE DMA_Data[ANYSIZE_ARRAY]; } DMA_RESOURCE, *PDMA_RESOURCE; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.DMA_Resource_s")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), "*")] [StructLayout(LayoutKind.Sequential)] public struct DMA_RESOURCE { /// A DMA_DES structure. public DMA_DES DMA_Header; /// /// For a resource list: /// Zero. /// For a resource requirements list: /// A DMA_RANGE array. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public DMA_RANGE[] DMA_Data; } /// /// The IO_DES structure is used for specifying either a resource list or a resource requirements list that describes I/O port usage /// for a device instance. For more information about resource lists and resource requirements lists, see Hardware Resources. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-io_des typedef struct IO_Des_s { DWORD IOD_Count; DWORD // IOD_Type; DWORDLONG IOD_Alloc_Base; DWORDLONG IOD_Alloc_End; DWORD IOD_DesFlags; } IO_DES, *PIO_DES; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.IO_Des_s")] [StructLayout(LayoutKind.Sequential, Pack = 4)] public struct IO_DES { /// /// For a resource list: /// Zero. /// For a resource requirements list: /// The number of elements in the IO_RANGE array that is included in the IO_RESOURCE structure. /// public uint IOD_Count; /// Must be set to the constant value IOType_Range. public uint IOD_Type; /// /// For a resource list: /// The lowest-numbered of a range of contiguous I/O port addresses allocated to the device. /// For a resource requirements list: /// Zero. /// public ulong IOD_Alloc_Base; /// /// For a resource list: /// The highest-numbered of a range of contiguous I/O port addresses allocated to the device. /// For a resource requirements list: /// Zero. /// public ulong IOD_Alloc_End; /// /// One bit flag from each of the flag sets described in the following table. /// /// /// /// Flag /// Definition /// /// /// Port Type Flags /// /// /// /// /// fIOD_IO /// The device is accessed in I/O address space. /// /// /// /// fIOD_Memory /// The device is accessed in memory address space. /// /// /// /// fIOD_PortType /// Bitmask for the bits within IOD_DesFlags that specify the port type value. /// /// /// Decode Flags /// /// /// /// /// fIOD_10_BIT_DECODE /// The device decodes 10 bits of the port address. /// /// /// /// fIOD_12_BIT_DECODE /// The device decodes 12 bits of the port address. /// /// /// /// fIOD_16_BIT_DECODE /// The device decodes 16 bits of the port address. /// /// /// /// fIOD_POSITIVE_DECODE /// The device uses "positive decode" instead of "subtractive decode." /// /// /// /// fIOD_DECODE /// Bitmask for the bits within IOD_DesFlags that specify the decode value. /// /// /// public IO_DES_FLAGS IOD_DesFlags; } /// /// The IO_RANGE structure specifies a resource requirements list that describes I/O port usage for a device instance. For more /// information about resource requirements lists, see Hardware Resources. /// /// /// The flags specified for IOR_Alias have the same interpretation as the address decoding flags specified for /// IOD_DesFlags. (However, the two sets of flags are not equivalent in assigned values and cannot be used interchangeably.) /// A resource requirements list can be specified using either set of flags, but using decode flags in IOD_DesFlags is /// recommended. If address decoding flags are specified using both IOD_DesFlags and IOR_Alias, contents of the latter /// overrides the former. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-io_range typedef struct IO_Range_s { DWORDLONG IOR_Align; // DWORD IOR_nPorts; DWORDLONG IOR_Min; DWORDLONG IOR_Max; DWORD IOR_RangeFlags; DWORDLONG IOR_Alias; } IO_RANGE, *PIO_RANGE; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.IO_Range_s")] [StructLayout(LayoutKind.Sequential, Pack = 4)] public struct IO_RANGE { /// Mask used to specify the port address boundary on which the first allocated I/O port address must be aligned. public ulong IOR_Align; /// The number of I/O port addresses required by the device. public uint IOR_nPorts; /// The lowest-numbered of a range of contiguous I/O port addresses that can be allocated to the device. public ulong IOR_Min; /// The highest-numbered of a range of contiguous I/O port addresses that can be allocated to the device. public ulong IOR_Max; /// One bit flag from IO_DES structure. For more information, see the following Remarks section. public uint IOR_RangeFlags; /// /// One of the bit flags described in the following table. /// /// /// Flag /// Definition /// /// /// IO_ALIAS_10_BIT_DECODE /// The device decodes 10 bits of the port address. /// /// /// IO_ALIAS_12_BIT_DECODE /// The device decodes 12 bits of the port address. /// /// /// IO_ALIAS_16_BIT_DECODE /// The device decodes 16 bits of the port address. /// /// /// IO_ALIAS_POSITIVE_DECODE /// The device uses "positive decode" instead of "subtractive decode." /// /// /// For more information, see the following Remarks section. /// public ulong IOR_Alias; } /// /// The IO_RESOURCE structure is used for specifying either a resource list or a resource requirements list that describes I/O port /// usage for a device instance. For more information about resource lists and resource requirements lists, see Hardware Resources. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-io_resource typedef struct IO_Resource_s { IO_DES // IO_Header; IO_RANGE IO_Data[ANYSIZE_ARRAY]; } IO_RESOURCE, *PIO_RESOURCE; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.IO_Resource_s")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), "*")] [StructLayout(LayoutKind.Sequential, Pack = 4)] public struct IO_RESOURCE { /// An IO_DES structure. public IO_DES IO_Header; /// /// For a resource list: /// Zero. /// For a resource requirements list: /// An IO_RANGE array. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public IO_RANGE[] IO_Data; } /// /// The IRQ_DES structure is used for specifying either a resource list or a resource requirements list that describes IRQ line /// usage for a device instance. For more information about resource lists and resource requirements lists, see Hardware Resources. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-irq_des_32 typedef struct IRQ_Des_32_s { DWORD // IRQD_Count; DWORD IRQD_Type; #if ... USHORT IRQD_Flags; USHORT IRQD_Group; #else DWORD IRQD_Flags; #endif ULONG IRQD_Alloc_Num; // ULONG32 IRQD_Affinity; } IRQ_DES_32, *PIRQ_DES_32; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.IRQ_Des_32_s")] [StructLayout(LayoutKind.Sequential)] public struct IRQ_DES_32 { /// /// For a resource list: /// Zero. /// For a resource requirements list: /// The number of elements in the IRQ_RANGE array that is included in the IRQ_RESOURCE structure. /// public uint IRQD_Count; /// Must be set to the constant value IRQType_Range. public uint IRQD_Type; /// /// One bit flag from each of the flag sets described in the following table. /// /// /// /// Flag /// Definition /// /// /// Sharing Flags /// /// /// /// /// fIRQD_Exclusive /// The IRQ line cannot be shared. /// /// /// /// fIRQD_Share /// The IRQ line can be shared. /// /// /// /// mIRQD_Share /// Bitmask for the bits within IRQD_Flags that specify the sharing value. /// /// /// Triggering Flags /// /// /// /// /// fIRQD_Level /// The IRQ line is level-triggered. /// /// /// /// fIRQD_Edge /// The IRQ line is edge-triggered. /// /// /// /// mIRQD_Edge_Level /// Bitmask for the bits within IRQD_Flags that specify the triggering value. /// /// /// public IRQD_FLAGS IRQD_Flags; /// Group number of interrupt target. public ushort IRQD_Group; /// /// For a resource list: /// The number of the IRQ line that is allocated to the device. /// For a resource requirements list: /// Not used. /// public uint IRQD_Alloc_Num; /// /// For a resource list: /// /// A bitmask representing the processor affinity of the IRQ line that is allocated to the device. Bit zero represents the first /// processor, bit two the second, and so on. Set this value to -1 to represent all processors. /// /// For a resource requirements list: /// Not used. /// public uint IRQD_Affinity; } /// /// The IRQ_DES structure is used for specifying either a resource list or a resource requirements list that describes IRQ line /// usage for a device instance. For more information about resource lists and resource requirements lists, see Hardware Resources. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-irq_des_64 typedef struct IRQ_Des_64_s { DWORD // IRQD_Count; DWORD IRQD_Type; #if ... USHORT IRQD_Flags; USHORT IRQD_Group; #else DWORD IRQD_Flags; #endif ULONG IRQD_Alloc_Num; // ULONG64 IRQD_Affinity; } IRQ_DES_64, *PIRQ_DES_64; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.IRQ_Des_64_s")] [StructLayout(LayoutKind.Sequential)] public struct IRQ_DES_64 { /// /// For a resource list: /// Zero. /// For a resource requirements list: /// The number of elements in the IRQ_RESOURCE structure. /// public uint IRQD_Count; /// Must be set to the constant value IRQType_Range. public uint IRQD_Type; /// /// One bit flag from each of the flag sets described in the following table. /// /// /// /// Flag /// Definition /// /// /// Sharing Flags /// /// /// /// /// fIRQD_Exclusive /// The IRQ line cannot be shared. /// /// /// /// fIRQD_Share /// The IRQ line can be shared. /// /// /// /// mIRQD_Share /// Bitmask for the bits within IRQD_Flags that specify the sharing value. /// /// /// Triggering Flags /// /// /// /// /// fIRQD_Level /// The IRQ line is level-triggered. /// /// /// /// fIRQD_Edge /// The IRQ line is edge-triggered. /// /// /// /// mIRQD_Edge_Level /// Bitmask for the bits within IRQD_Flags that specify the triggering value. /// /// /// public IRQD_FLAGS IRQD_Flags; /// Group number of interrupt target. public ushort IRQD_Group; /// /// For a resource list: /// The number of the IRQ line that is allocated to the device. /// For a resource requirements list: /// Not used. /// public uint IRQD_Alloc_Num; /// /// For a resource list: /// /// A bitmask representing the processor affinity of the IRQ line that is allocated to the device. Bit zero represents the first /// processor, bit two the second, and so on. Set this value to -1 to represent all processors. /// /// For a resource requirements list: /// Not used. /// public ulong IRQD_Affinity; } /// /// The IRQ_RANGE structure specifies a resource requirements list that describes IRQ line usage for a device instance. For more /// information about resource requirements lists, see Hardware Resources. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-irq_range typedef struct IRQ_Range_s { ULONG IRQR_Min; // ULONG IRQR_Max; #if ... USHORT IRQR_Flags; USHORT IRQR_Rsvdz; #else ULONG IRQR_Flags; #endif } IRQ_RANGE, *PIRQ_RANGE; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.IRQ_Range_s")] [StructLayout(LayoutKind.Sequential)] public struct IRQ_RANGE { /// The lowest-numbered of a range of contiguous IRQ lines that can be allocated to the device. public uint IRQR_Min; /// The highest-numbered of a range of contiguous IRQ lines that can be allocated to the device. public uint IRQR_Max; /// One bit flag from IRQ_DES structure. public IRQD_FLAGS IRQR_Flags; /// public ushort IRQR_Rsvdz; } /// /// The IRQ_RESOURCE structure is used for specifying either a resource list or a resource requirements list that describes IRQ line /// usage for a device instance. For more information about resource lists and resource requirements lists, see Hardware Resources. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-irq_resource_32 typedef struct IRQ_Resource_32_s { // IRQ_DES_32 IRQ_Header; IRQ_RANGE IRQ_Data[ANYSIZE_ARRAY]; } IRQ_RESOURCE_32, *PIRQ_RESOURCE_32; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.IRQ_Resource_32_s")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), "*")] [StructLayout(LayoutKind.Sequential)] public struct IRQ_RESOURCE_32 { /// An IRQ_DES structure. public IRQ_DES_32 IRQ_Header; /// /// For a resource list: /// Zero. /// For a resource requirements list: /// An IRQ_RANGE array. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public IRQ_RANGE[] IRQ_Data; } /// /// The IRQ_RESOURCE structure is used for specifying either a resource list or a resource requirements list that describes IRQ line /// usage for a device instance. For more information about resource lists and resource requirements lists, see Hardware Resources. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-irq_resource_64 typedef struct IRQ_Resource_64_s { // IRQ_DES_64 IRQ_Header; IRQ_RANGE IRQ_Data[ANYSIZE_ARRAY]; } IRQ_RESOURCE_64, *PIRQ_RESOURCE_64; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.IRQ_Resource_64_s")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), "*")] [StructLayout(LayoutKind.Sequential, Pack = 4)] public struct IRQ_RESOURCE_64 { /// An IRQ_DES structure. public IRQ_DES_64 IRQ_Header; /// /// For a resource list: /// Zero. /// For a resource requirements list: /// An IRQ_RANGE array. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public IRQ_RANGE[] IRQ_Data; } /// /// The MEM_DES structure is used for specifying either a resource list or a resource requirements list that describes memory usage /// for a device instance. For more information about resource lists and resource requirements lists, see Hardware Resources. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-mem_des typedef struct Mem_Des_s { DWORD MD_Count; DWORD // MD_Type; DWORDLONG MD_Alloc_Base; DWORDLONG MD_Alloc_End; DWORD MD_Flags; DWORD MD_Reserved; } MEM_DES, *PMEM_DES; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.Mem_Des_s")] [StructLayout(LayoutKind.Sequential)] public struct MEM_DES { /// /// For a resource list: /// Zero. /// For a resource requirements list: /// The number of elements in the MEM_RANGE array that is included in the MEM_RESOURCE structure. /// public uint MD_Count; /// Must be set to the constant value MType_Range. public uint MD_Type; /// /// For a resource list: /// The lowest-numbered of a range of contiguous physical memory addresses allocated to the device. /// For a resource requirements list: /// Zero. /// public ulong MD_Alloc_Base; /// /// For a resource list: /// The highest-numbered of a range of contiguous physical memory addresses allocated to the device. /// For a resource requirements list: /// Zero. /// public ulong MD_Alloc_End; /// /// One bit flag from each of the flag sets described in the following table. /// /// /// /// Flag /// Definition /// /// /// Read-Only Flags /// /// /// /// /// fMD_ROM /// The specified memory range is read-only. /// /// /// /// fMD_RAM /// The specified memory range is not read-only. /// /// /// /// mMD_MemoryType /// Bitmask for the bit within MD_Flags that specifies the read-only attribute. /// /// /// Write-Only Flags /// /// /// /// /// fMD_ReadDisallowed /// The specified memory range is write-only. /// /// /// /// fMD_ReadAllowed /// The specified memory range is not write-only. /// /// /// /// mMD_Readable /// Bitmask for the bit within MD_Flags that specifies the write-only attribute. /// /// /// Address Size Flags /// /// /// /// /// fMD_24 /// 24-bit addressing (not used). /// /// /// /// fMD_32 /// 32-bit addressing. /// /// /// /// mMD_32_24 /// Bitmask for the bit within MD_Flags that specifies the address size. /// /// /// Prefetch Flags /// /// /// /// /// fMD_PrefetchAllowed /// The specified memory range can be prefetched. /// /// /// /// fMD_PrefetchDisallowed /// The specified memory range cannot be prefetched. /// /// /// /// mMD_Prefetchable /// Bitmask for the bit within MD_Flags that specifies the prefetch ability. /// /// /// Caching Flags /// /// /// /// /// fMD_Cacheable /// The specified memory range can be cached. /// /// /// /// fMD_NonCacheable /// The specified memory range cannot be cached. /// /// /// /// mMD_Cacheable /// Bitmask for the bit within MD_Flags that specifies the caching ability. /// /// /// Combined-Write Caching Flags /// /// /// /// /// fMD_CombinedWriteAllowed /// Combined-write caching is allowed. /// /// /// /// fMD_CombinedWriteDisallowed /// Combined-write caching is not allowed. /// /// /// /// mMD_CombinedWrite /// Bitmask for the bit within MD_Flags that specifies the combine-write caching ability. /// /// /// public MEM_DES_FLAGS MD_Flags; /// For internal use only. public uint MD_Reserved; } /// /// The MEM_RANGE structure specifies a resource requirements list that describes memory usage for a device instance. For more /// information about resource requirements lists, see Hardware Resources. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-mem_range typedef struct Mem_Range_s { DWORDLONG // MR_Align; ULONG MR_nBytes; DWORDLONG MR_Min; DWORDLONG MR_Max; DWORD MR_Flags; DWORD MR_Reserved; } MEM_RANGE, *PMEM_RANGE; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.Mem_Range_s")] [StructLayout(LayoutKind.Sequential, Pack = 4)] public struct MEM_RANGE { /// Mask used to specify the memory address boundary on which the first allocated memory address must be aligned. public ulong MR_Align; /// The number of bytes of memory required by the device. public uint MR_nBytes; /// The lowest-numbered of a range of contiguous memory addresses that can be allocated to the device. public ulong MR_Min; /// The highest-numbered of a range of contiguous memory addresses that can be allocated to the device. public ulong MR_Max; /// One bit flag from MEM_DES structure. public MEM_DES_FLAGS MR_Flags; /// For internal use only. public uint MR_Reserved; } /// /// The MEM_RESOURCE structure is used for specifying either a resource list or a resource requirements list that describes memory /// usage for a device instance. For more information about resource lists and resource requirements lists, see Hardware Resources. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-mem_resource typedef struct Mem_Resource_s { MEM_DES // MEM_Header; MEM_RANGE MEM_Data[ANYSIZE_ARRAY]; } MEM_RESOURCE, *PMEM_RESOURCE; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.Mem_Resource_s")] [VanaraMarshaler(typeof(SafeAnysizeStructMarshaler), "*")] [StructLayout(LayoutKind.Sequential, Pack = 4)] public struct MEM_RESOURCE { /// A MEM_DES structure. public MEM_DES MEM_Header; /// /// For a resource list: /// Zero. /// For a resource requirements list: /// A MEM_RANGE array. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public MEM_RANGE[] MEM_Data; } /// /// The MFCARD_DES structure is used for specifying either a resource list or a resource requirements list that describes resource /// usage by one of the hardware functions provided by an instance of a multifunction device. For more information about resource /// lists and resource requirements lists, see Hardware Resources. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-mfcard_des typedef struct MfCard_Des_s { DWORD PMF_Count; // DWORD PMF_Type; DWORD PMF_Flags; BYTE PMF_ConfigOptions; BYTE PMF_IoResourceIndex; BYTE PMF_Reserved[2]; DWORD // PMF_ConfigRegisterBase; } MFCARD_DES, *PMFCARD_DES; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.MfCard_Des_s")] [StructLayout(LayoutKind.Sequential)] public struct MFCARD_DES { /// Must be 1. public uint PMF_Count; /// Not used. public uint PMF_Type; /// /// One bit flag is defined, as described in the following table. /// /// /// Flag /// Definition /// /// /// fPMF_AUDIO_ENABLE /// If set, audio is enabled. /// /// /// public uint PMF_Flags; /// Contents of the 8-bit PCMCIA Configuration Option Register. public byte PMF_ConfigOptions; /// /// Zero-based index indicating the IO_RESOURCE structure that describes the I/O resources for the hardware function being /// described by this MFCARD_DES structure. /// public byte PMF_IoResourceIndex; /// Not used. public ushort PMF_Reserved; /// Offset from the beginning of the card's attribute memory space to the base configuration register address. public uint PMF_ConfigRegisterBase; } /// /// The MFCARD_RESOURCE structure is used for specifying either a resource list or a resource requirements list that describes /// resource usage by one of the hardware functions provided by an instance of a multifunction device. For more information about /// resource lists and resource requirements lists, see Hardware Resources. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-mfcard_resource typedef struct MfCard_Resource_s { // MFCARD_DES MfCard_Header; } MFCARD_RESOURCE, *PMFCARD_RESOURCE; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.MfCard_Resource_s")] [StructLayout(LayoutKind.Sequential)] public struct MFCARD_RESOURCE { /// A MFCARD_DES structure. public MFCARD_DES MfCard_Header; } /// /// The PCCARD_DES structure is used for specifying either a resource list or a resource requirements list that describes resource /// usage by a PC Card instance. For more information about resource lists and resource requirements lists, see Hardware Resources. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-pccard_des typedef struct PcCard_Des_s { DWORD PCD_Count; // DWORD PCD_Type; DWORD PCD_Flags; BYTE PCD_ConfigIndex; BYTE PCD_Reserved[3]; DWORD PCD_MemoryCardBase1; DWORD // PCD_MemoryCardBase2; DWORD PCD_MemoryCardBase[PCD_MAX_MEMORY]; WORD PCD_MemoryFlags[PCD_MAX_MEMORY]; BYTE // PCD_IoFlags[PCD_MAX_IO]; } PCCARD_DES, *PPCCARD_DES; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.PcCard_Des_s")] [StructLayout(LayoutKind.Sequential, Pack = 2)] public struct PCCARD_DES { private const int PCD_MAX_MEMORY = 2; private const int PCD_MAX_IO = 2; /// Must be 1. public uint PCD_Count; /// Not used. public uint PCD_Type; /// /// One bit flag from each of the flag sets described in the following table. /// /// /// /// Flag /// Definition /// /// /// I/O Addressing Flags /// /// /// /// /// fPCD_IO_8 /// The device uses 8-bit I/O addressing. /// /// /// /// fPCD_IO_16 /// The device uses 16-bit I/O addressing. /// /// /// /// mPCD_IO_8_16 /// Bitmask for the bit within PCD_Flags that specifies 8-bit or 16-bit I/O addressing. /// /// /// Memory Addressing Flags /// /// /// /// /// fPCD_MEM_8 /// The device uses 8-bit memory addressing. /// /// /// /// fPCD_MEM_16 /// The device uses 16-bit memory addressing. /// /// /// /// mPCD_MEM_8_16 /// Bitmask for the bit within PCD_Flags that specifies 8-bit or 16-bit memory addressing. /// /// /// public PCD_FLAGS PCD_Flags; /// The 8-bit index value used to locate the device's configuration. public byte PCD_ConfigIndex; /// Not used. public byte PCD_Reserved1; /// Not used. public ushort PCD_Reserved2; /// Optional, card base address of the first memory window. public uint PCD_MemoryCardBase1; /// Optional, card base address of the second memory window. public uint PCD_MemoryCardBase2; /// This member is currently unused. [MarshalAs(UnmanagedType.ByValArray, SizeConst = PCD_MAX_MEMORY)] public uint[] PCD_MemoryCardBase; /// This member is currently unused. [MarshalAs(UnmanagedType.ByValArray, SizeConst = PCD_MAX_MEMORY)] public ushort[] PCD_MemoryFlags; /// This member is currently unused. [MarshalAs(UnmanagedType.ByValArray, SizeConst = PCD_MAX_IO)] public byte[] PCD_IoFlags; } /// /// The PCCARD_RESOURCE structure is used for specifying either a resource list or a resource requirements list that describes /// resource usage by a PC Card instance. For more information about resource lists and resource requirements lists, see Hardware Resources. /// // https://docs.microsoft.com/en-us/windows/win32/api/cfgmgr32/ns-cfgmgr32-pccard_resource typedef struct PcCard_Resource_s { // PCCARD_DES PcCard_Header; } PCCARD_RESOURCE, *PPCCARD_RESOURCE; [PInvokeData("cfgmgr32.h", MSDNShortId = "NS:cfgmgr32.PcCard_Resource_s")] [StructLayout(LayoutKind.Sequential, Pack = 2)] public struct PCCARD_RESOURCE { /// A PCCARD_DES structure. public PCCARD_DES PcCard_Header; } } }