diff --git a/CHANGELOG.md b/CHANGELOG.md index f0b3517..14664bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,32 @@ # Changelog All notable changes to this project will be documented in this file. +## [1.0.3] - 2019-09-02 + +### Added + +- **iTin.Core.Interop**: + - Many structures, enumerations, win32 native methods have been added to project, for video cards, video modes, monitors, storage, etc ... + +- **iTin.Core.Hardware.Specification.Eedid**: + - Two new properties have been added (to meet the specification), + 1. WeekOfManufactureOrModelYearFlag + 2. YearOfManufactureOrModelYear + +- Minor changes. + +### Changed + +- **iTin.Core.Hardware**: +- Due to a problem with duplicate properties of the same type, the data type for storing the properties has been changed. (This change should not affect current behavior). + +### Fixed + +- **iTin.Core.Hardware.Specification.Eedid**: + - Fixed an issue that did not allow you to correctly calculate the value of the property **ManufactureDate** of the section **Vendor** + + - Fixed an issue that did not allow the property value **IdSerialNumber** of the **Vendor** section to be calculated correctly + ## [1.0.2] - 2019-08-28 ### Added @@ -23,6 +49,7 @@ All notable changes to this project will be documented in this file. - Minor changes. ### Changed + - The solution has been migrated to **.NetStandard**. - The supported targets are: @@ -41,6 +68,7 @@ All notable changes to this project will be documented in this file. ### Added - Create project and first commit +[1.0.3]: https://github.com/iAJTin/iEEDID/releases/tag/v1.0.3 [1.0.2]: https://github.com/iAJTin/iEEDID/releases/tag/v1.0.2 [1.0.1]: https://github.com/iAJTin/iEEDID/releases/tag/v1.0.1 [1.0.0]: https://github.com/iAJTin/iEEDID/releases/tag/v1.0.0 diff --git a/README.md b/README.md index ce71f64..273a84d 100644 --- a/README.md +++ b/README.md @@ -59,188 +59,189 @@ 3. Prints all **EEDID** blocks properties. - EEDID eedid = EEDID.Parse(MacBookPro2018.IntegratedLaptopPanelEdidTable); - DataBlockCollection blocks = eedid.Blocks; - foreach (DataBlock block in blocks) - { - Console.WriteLine(); - Console.WriteLine(@" ——————————————————————————————————————————————————————————————"); - Console.WriteLine($@" {block.Key} Block"); - Console.WriteLine(@" ——————————————————————————————————————————————————————————————"); - - var implSections = eedid.Blocks[block.Key].Sections.ImplementedSections; - Console.WriteLine(); - Console.WriteLine(@" > Implemented Sections"); - foreach (Enum section in implSections) - { - Console.WriteLine($@" > {GetFriendlyName(section)}"); - } - - Console.WriteLine(); - Console.WriteLine(@" > Sections detail"); - BaseDataSectionCollection sections = block.Sections; - foreach (DataSection section in sections) - { - Console.WriteLine(); - Console.WriteLine($@" > {GetFriendlyName(section.Key)} Section"); - - SectionPropertiesTable sectionProperties = section.Properties.Values; - foreach (KeyValuePair property in sectionProperties) - { - object value = property.Value; - - IPropertyKey key = (PropertyKey)property.Key; - string friendlyName = GetFriendlyName(key); - PropertyUnit valueUnit = key.PropertyUnit; - string unit = - valueUnit == PropertyUnit.None - ? string.Empty - : valueUnit.ToString(); - - if (value == null) - { - Console.WriteLine($@" > {friendlyName} > NULL"); - continue; - } - - if (value is string) - { - Console.WriteLine($@" > {friendlyName} > {value}{unit}"); - } - else if (value is bool) - { - Console.WriteLine($@" > {friendlyName} > {value}{unit}"); - } - else if (value is double) - { - Console.WriteLine($@" > {friendlyName} > {value}{unit}"); - } - else if (value is byte) - { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X2}h]"); - } - else if (value is short) - { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); - } - else if (value is ushort) - { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); - } - else if (value is int) - { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); - } - else if (value is uint) - { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); - } - else if (value is long) - { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X8}h]"); - } - else if (value is ulong) - { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X8}h]"); - } - else if (value is PointF) - { - Console.WriteLine($@" > {friendlyName}"); - Console.WriteLine($@" > X > {((PointF)value).X}"); - Console.WriteLine($@" > Y > {((PointF)value).Y}"); - } - else if (value.GetType() == typeof(ReadOnlyCollection)) - { - Console.WriteLine($@" > {friendlyName} > {string.Join(", ", (ReadOnlyCollection)value)}"); - } - else if (value.GetType() == typeof(ReadOnlyCollection)) - { - Console.WriteLine($@" > {friendlyName} > {string.Join(", ", (ReadOnlyCollection)value)}"); - } - else if (value is StandardTimingIdentifierDescriptorItem) - { - Console.WriteLine($@" > {(StandardTimingIdentifierDescriptorItem)value}"); - } - else if (value.GetType() == typeof(ReadOnlyCollection)) - { - var resolutions = (ReadOnlyCollection)value; - foreach (MonitorResolutionInfo resolution in resolutions) - { - Console.WriteLine($@" > {resolution}"); - } - } - else if (value.GetType() == typeof(SectionPropertiesTable)) - { - Console.WriteLine($@" > {friendlyName}"); - var dataBlockProperties = (SectionPropertiesTable)value; - foreach (KeyValuePair dataBlockProperty in dataBlockProperties) - { - object dataValue = dataBlockProperty.Value; - - IPropertyKey dataBlockKey = (PropertyKey)dataBlockProperty.Key; - string dataName = GetFriendlyName(dataBlockKey); - PropertyUnit dataBlockUnit = dataBlockKey.PropertyUnit; - string dataUnit = - dataBlockUnit == PropertyUnit.None - ? string.Empty - : dataBlockUnit.ToString(); - - Console.WriteLine($@" > {dataName} > {dataValue} {dataUnit}"); - } - } - else - { - Console.WriteLine($@" > {friendlyName} > {value}{unit}"); - } - } - } - } + { + EEDID edid = EEDID.Parse(MacBookPro2018.IntegratedLaptopPanelEdidTable); + DataBlockCollection blocks = edid.Blocks; + foreach (DataBlock block in blocks) + { + Console.WriteLine(); + Console.WriteLine($@" > {block.Key} Block"); + + var implSections = eedid.Blocks[block.Key].Sections.ImplementedSections; + Console.WriteLine(); + Console.WriteLine(@" > Implemented Sections"); + foreach (Enum section in implSections) + { + Console.WriteLine($@" > {GetFriendlyName(section)}"); + } + + Console.WriteLine(); + Console.WriteLine(@" > Sections detail"); + BaseDataSectionCollection sections = block.Sections; + foreach (DataSection section in sections) + { + Console.WriteLine(); + Console.WriteLine($@" > {GetFriendlyName(section.Key)} Section"); + + SectionPropertiesTable sectionProperties = section.Properties.Values; + foreach (KeyValuePair property in sectionProperties) + { + object value = property.Value; + + IPropertyKey key = (PropertyKey)property.Key; + string friendlyName = GetFriendlyName(key); + PropertyUnit valueUnit = key.PropertyUnit; + string unit = + valueUnit == PropertyUnit.None + ? string.Empty + : valueUnit.ToString(); + + if (value == null) + { + Console.WriteLine($@" > {friendlyName} > NULL"); + continue; + } + + if (value is string) + { + Console.WriteLine($@" > {friendlyName} > {value}{unit}"); + } + else if (value is bool) + { + Console.WriteLine($@" > {friendlyName} > {value}{unit}"); + } + else if (value is double) + { + Console.WriteLine($@" > {friendlyName} > {value}{unit}"); + } + else if (value is byte) + { + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X2}h]"); + } + else if (value is short) + { + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); + } + else if (value is ushort) + { + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); + } + else if (value is int) + { + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); + } + else if (value is uint) + { + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); + } + else if (value is long) + { + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X8}h]"); + } + else if (value is ulong) + { + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X8}h]"); + } + else if (value is PointF) + { + Console.WriteLine($@" > {friendlyName}"); + Console.WriteLine($@" > X > {((PointF)value).X}"); + Console.WriteLine($@" > Y > {((PointF)value).Y}"); + } + else if (value.GetType() == typeof(ReadOnlyCollection)) + { + Console.WriteLine($@" > {friendlyName} > {string.Join(", ", (ReadOnlyCollection)value)}"); + } + else if (value.GetType() == typeof(ReadOnlyCollection)) + { + Console.WriteLine($@" > {friendlyName} > {string.Join(", ", (ReadOnlyCollection)value)}"); + } + else if (value is StandardTimingIdentifierDescriptorItem) + { + Console.WriteLine($@" > {(StandardTimingIdentifierDescriptorItem)value}"); + } + else if (value.GetType() == typeof(ReadOnlyCollection)) + { + var resolutions = (ReadOnlyCollection)value; + foreach (MonitorResolutionInfo resolution in resolutions) + { + Console.WriteLine($@" > {resolution}"); + } + } + else if (value.GetType() == typeof(SectionPropertiesTable)) + { + Console.WriteLine($@" > {friendlyName}"); + var dataBlockProperties = (SectionPropertiesTable)value; + foreach (KeyValuePair dataBlockProperty in dataBlockProperties) + { + object dataValue = dataBlockProperty.Value; + + IPropertyKey dataBlockKey = (PropertyKey)dataBlockProperty.Key; + string dataName = GetFriendlyName(dataBlockKey); + PropertyUnit dataBlockUnit = dataBlockKey.PropertyUnit; + string dataUnit = + dataBlockUnit == PropertyUnit.None + ? string.Empty + : dataBlockUnit.ToString(); + + Console.WriteLine($@" > {dataName} > {dataValue} {dataUnit}"); + } + } + else + { + Console.WriteLine($@" > {friendlyName} > {value}{unit}"); + } + } + } + } + } - Console.ReadLine(); - } + ... + ... + ... - private static string GetFriendlyName(Enum value) - { - string friendlyName = value.GetPropertyName(); + private static string GetFriendlyName(Enum value) + { + string friendlyName = value.GetPropertyName(); - return string.IsNullOrEmpty(friendlyName) - ? value.ToString() - : friendlyName; - } + return string.IsNullOrEmpty(friendlyName) + ? value.ToString() + : friendlyName; + } - private static string GetFriendlyName(IPropertyKey value) - { - string friendlyName = value.GetPropertyName(); + private static string GetFriendlyName(IPropertyKey value) + { + string friendlyName = value.GetPropertyName(); - return string.IsNullOrEmpty(friendlyName) - ? value.PropertyId.ToString() - : friendlyName; - } + return string.IsNullOrEmpty(friendlyName) + ? value.PropertyId.ToString() + : friendlyName; + } - // nested classes - private class MacBookPro2018 - { - public static readonly byte[] IntegratedLaptopPanelEdidTable = - { - 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x42, 0x4c, 0x00, 0x50, 0x89, 0x13, 0x00, 0x00, - 0x06, 0x17, 0x01, 0x03, 0x0e, 0x21, 0x14, 0x78, - 0x6f, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, - 0x0f, 0x50, 0x54, 0x21, 0x08, 0x00, 0x81, 0x80, - 0x81, 0x40, 0x81, 0x00, 0x90, 0x40, 0x95, 0x00, - 0xa9, 0x40, 0xb3, 0x00, 0xd1, 0x00, 0xe5, 0xa7, - 0x20, 0x00, 0xd0, 0x34, 0x20, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, - 0x00, 0x00, 0x00, 0xfd, 0x00, 0x38, 0x40, 0x05, - 0xfa, 0xfa, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x50, - 0x61, 0x72, 0x61, 0x6c, 0x6c, 0x65, 0x6c, 0x73, - 0x20, 0x56, 0x75, 0x0a, 0x00, 0x00, 0x00, 0x10, - 0x00, 0x50, 0x61, 0x72, 0x61, 0x6c, 0x6c, 0x65, - 0x6c, 0x73, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0xc0 - }; - } + // nested classes + private class MacBookPro2018 + { + public static readonly byte[] IntegratedLaptopPanelEdidTable = + { + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, + 0x42, 0x4c, 0x00, 0x50, 0x89, 0x13, 0x00, 0x00, + 0x06, 0x17, 0x01, 0x03, 0x0e, 0x21, 0x14, 0x78, + 0x6f, 0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, + 0x0f, 0x50, 0x54, 0x21, 0x08, 0x00, 0x81, 0x80, + 0x81, 0x40, 0x81, 0x00, 0x90, 0x40, 0x95, 0x00, + 0xa9, 0x40, 0xb3, 0x00, 0xd1, 0x00, 0xe5, 0xa7, + 0x20, 0x00, 0xd0, 0x34, 0x20, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, + 0x00, 0x00, 0x00, 0xfd, 0x00, 0x38, 0x40, 0x05, + 0xfa, 0xfa, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x50, + 0x61, 0x72, 0x61, 0x6c, 0x6c, 0x65, 0x6c, 0x73, + 0x20, 0x56, 0x75, 0x0a, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x50, 0x61, 0x72, 0x61, 0x6c, 0x6c, 0x65, + 0x6c, 0x73, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0xc0 + }; + } 4. Gets a **single property** directly. diff --git a/README.txt b/README.txt index f7bfb2f..94aa5e2 100644 --- a/README.txt +++ b/README.txt @@ -36,30 +36,28 @@ Examples 3. Prints all EEDID blocks properties. - EEDID eedid = EEDID.Parse(MacBookPro2018.IntegratedLaptopPanelEdidTable); - DataBlockCollection blocks = eedid.Blocks; + EEDID edid = EEDID.Parse(MacBookPro2018.IntegratedLaptopPanelEdidTable); + DataBlockCollection blocks = edid.Blocks; foreach (DataBlock block in blocks) - { + { Console.WriteLine(); - Console.WriteLine(@" ——————————————————————————————————————————————————————————————"); - Console.WriteLine($@" {block.Key} Block"); - Console.WriteLine(@" ——————————————————————————————————————————————————————————————"); + Console.WriteLine($@" > {block.Key} Block"); var implSections = eedid.Blocks[block.Key].Sections.ImplementedSections; Console.WriteLine(); - Console.WriteLine(" > Implemented Sections"); + Console.WriteLine(@" > Implemented Sections"); foreach (Enum section in implSections) { - Console.WriteLine($@" > {GetFriendlyName(section)}"); + Console.WriteLine($@" > {GetFriendlyName(section)}"); } Console.WriteLine(); - Console.WriteLine(" > Sections detail"); + Console.WriteLine(@" > Sections detail"); BaseDataSectionCollection sections = block.Sections; foreach (DataSection section in sections) { Console.WriteLine(); - Console.WriteLine($@" > {GetFriendlyName(section.Key)} Section"); + Console.WriteLine($@" > {GetFriendlyName(section.Key)} Section"); SectionPropertiesTable sectionProperties = section.Properties.Values; foreach (KeyValuePair property in sectionProperties) @@ -76,79 +74,79 @@ Examples if (value == null) { - Console.WriteLine($@" > {friendlyName} > NULL"); + Console.WriteLine($@" > {friendlyName} > NULL"); continue; } if (value is string) { - Console.WriteLine($@" > {friendlyName} > {value}{unit}"); + Console.WriteLine($@" > {friendlyName} > {value}{unit}"); } else if (value is bool) { - Console.WriteLine($@" > {friendlyName} > {value}{unit}"); + Console.WriteLine($@" > {friendlyName} > {value}{unit}"); } else if (value is double) { - Console.WriteLine($@" > {friendlyName} > {value}{unit}"); + Console.WriteLine($@" > {friendlyName} > {value}{unit}"); } else if (value is byte) { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X2}h]"); + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X2}h]"); } else if (value is short) { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); } else if (value is ushort) { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); } else if (value is int) { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); } else if (value is uint) { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); } else if (value is long) { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X8}h]"); + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X8}h]"); } else if (value is ulong) { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X8}h]"); + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X8}h]"); } else if (value is PointF) { - Console.WriteLine($@" > {friendlyName}"); - Console.WriteLine($@" > X > {((PointF)value).X}"); - Console.WriteLine($@" > Y > {((PointF)value).Y}"); + Console.WriteLine($@" > {friendlyName}"); + Console.WriteLine($@" > X > {((PointF)value).X}"); + Console.WriteLine($@" > Y > {((PointF)value).Y}"); } else if (value.GetType() == typeof(ReadOnlyCollection)) { - Console.WriteLine($@" > {friendlyName} > {string.Join(", ", (ReadOnlyCollection)value)}"); + Console.WriteLine($@" > {friendlyName} > {string.Join(", ", (ReadOnlyCollection)value)}"); } else if (value.GetType() == typeof(ReadOnlyCollection)) { - Console.WriteLine($@" > {friendlyName} > {string.Join(", ", (ReadOnlyCollection)value)}"); + Console.WriteLine($@" > {friendlyName} > {string.Join(", ", (ReadOnlyCollection)value)}"); } else if (value is StandardTimingIdentifierDescriptorItem) { - Console.WriteLine($@" > {(StandardTimingIdentifierDescriptorItem)value}"); + Console.WriteLine($@" > {(StandardTimingIdentifierDescriptorItem)value}"); } else if (value.GetType() == typeof(ReadOnlyCollection)) { var resolutions = (ReadOnlyCollection)value; - foreach (MonitorResolutionInfo resolution in resolutions) + foreach (MonitorResolutionInfo resolution in resolutions) { - Console.WriteLine($@" > {resolution}"); + Console.WriteLine($@" > {resolution}"); } } else if (value.GetType() == typeof(SectionPropertiesTable)) { - Console.WriteLine($@" > {friendlyName}"); + Console.WriteLine($@" > {friendlyName}"); var dataBlockProperties = (SectionPropertiesTable)value; foreach (KeyValuePair dataBlockProperty in dataBlockProperties) { @@ -162,12 +160,12 @@ Examples ? string.Empty : dataBlockUnit.ToString(); - Console.WriteLine($@" > {dataName} > {dataValue} {dataUnit}"); + Console.WriteLine($@" > {dataName} > {dataValue} {dataUnit}"); } } else { - Console.WriteLine($@" > {friendlyName} > {value}{unit}"); + Console.WriteLine($@" > {friendlyName} > {value}{unit}"); } } } diff --git a/nuget/BuildNuGet.bat b/nuget/BuildNuGet.bat index b0f7fcc..40d2290 100644 --- a/nuget/BuildNuGet.bat +++ b/nuget/BuildNuGet.bat @@ -1,7 +1,7 @@ @ECHO OFF CLS -..\src\.nuget\nuget Pack iEEDID.1.0.2.nuspec -NoDefaultExcludes -NoPackageAnalysis -OutputDirectory ..\deployment\nuget +..\src\.nuget\nuget Pack iEEDID.1.0.3.nuspec -NoDefaultExcludes -NoPackageAnalysis -OutputDirectory ..\deployment\nuget pause diff --git a/nuget/iEEDID.1.0.2.nuspec b/nuget/iEEDID.1.0.3.nuspec similarity index 97% rename from nuget/iEEDID.1.0.2.nuspec rename to nuget/iEEDID.1.0.3.nuspec index 70420e7..28039d6 100644 --- a/nuget/iEEDID.1.0.2.nuspec +++ b/nuget/iEEDID.1.0.3.nuspec @@ -2,7 +2,7 @@ iEEDID - 1.0.2 + 1.0.3 iEEDID iAJTin iAJTin diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware.Specification/iTin.Core.Hardware.Specification.Eedid/EEDID.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware.Specification/iTin.Core.Hardware.Specification.Eedid/EEDID.cs index a333930..d8a2823 100644 --- a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware.Specification/iTin.Core.Hardware.Specification.Eedid/EEDID.cs +++ b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware.Specification/iTin.Core.Hardware.Specification.Eedid/EEDID.cs @@ -8,8 +8,6 @@ namespace iTin.Core.Hardware.Specification using Eedid; - using Interop.Edid; - /// /// Implementation of the E-EDID (Extended Display Identification Data) specification. /// @@ -203,9 +201,22 @@ private static IEnumerable> GetExtensionDataBlocks(Read var extensionBlockCount = edidData[0x7e]; var dataBlocks = new List>(); - for (int n = 0x01, i = 0x00; i < extensionBlockCount; i++, n++) + if (extensionBlockCount == 0) + { + for (int n = 0x01, i = 0x00; i < extensionBlockCount; i++, n++) + { + dataBlocks.Add(edidData.Extract((byte) (n * 0x80), 0x80)); + } + } + else { - dataBlocks.Add(edidData.Extract((byte)(n * 0x80), 0x80)); + if (edidData.Count > 0x80) + { + for (int n = 0x01, i = 0x00; i < extensionBlockCount; i++, n++) + { + dataBlocks.Add(edidData.Extract((byte)(n * 0x80), 0x80)); + } + } } return dataBlocks; @@ -263,10 +274,5 @@ private void InitBlockTable(IDictionary blockDict #endregion #endregion - - public static void EnumMonitorDevices() - { - SafeNativeMethods.EnumMonitorDevices(); - } } } diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware.Specification/iTin.Core.Hardware.Specification.Eedid/EEDID/Blocks/EDID/EdidPropertyEnum.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware.Specification/iTin.Core.Hardware.Specification.Eedid/EEDID/Blocks/EDID/EdidPropertyEnum.cs index 0ed5f03..cbae006 100644 --- a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware.Specification/iTin.Core.Hardware.Specification.Eedid/EEDID/Blocks/EDID/EdidPropertyEnum.cs +++ b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware.Specification/iTin.Core.Hardware.Specification.Eedid/EEDID/Blocks/EDID/EdidPropertyEnum.cs @@ -37,7 +37,7 @@ internal enum EdidVendorProperty IdManufacturerName, [PropertyDescription("")] - [PropertyType(typeof(int))] + [PropertyType(typeof(string))] [PropertyName("Product Code")] IdProductCode, @@ -48,11 +48,16 @@ internal enum EdidVendorProperty [PropertyDescription("")] [PropertyType(typeof(byte?))] - [PropertyName("Week Of Manufacture")] - WeekOfManufacture, + [PropertyName("Week Of Manufacture Or Model Year Flag")] + WeekOfManufactureOrModelYear, [PropertyDescription("")] - [PropertyType(typeof(byte))] + [PropertyType(typeof(byte?))] + [PropertyName("Year Of Manufacture Or Model Year")] + YearOfManufactureOrModelYear, + + [PropertyDescription("")] + [PropertyType(typeof(string))] [PropertyName("Manufacturer Date")] ManufactureDate, diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware.Specification/iTin.Core.Hardware.Specification.Eedid/EEDID/Blocks/EDID/Sections/VendorEdidSection.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware.Specification/iTin.Core.Hardware.Specification.Eedid/EEDID/Blocks/EDID/Sections/VendorEdidSection.cs index 14d530f..397cfda 100644 --- a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware.Specification/iTin.Core.Hardware.Specification.Eedid/EEDID/Blocks/EDID/Sections/VendorEdidSection.cs +++ b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware.Specification/iTin.Core.Hardware.Specification.Eedid/EEDID/Blocks/EDID/Sections/VendorEdidSection.cs @@ -93,10 +93,10 @@ public VendorEdidSection(ReadOnlyCollection sectionData) : base(sectionDat /// Property value. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private uint IdSerialNumber => (uint)RawData.GetWord(0x04); + private uint IdSerialNumber => (uint)RawData.GetDoubleWord(0x04); #endregion - #region [private] (byte) WeekOfManufacture: Gets a value representing the 'Week Of Manufacture' field. + #region [private] (byte) WeekOfManufactureOrModelYearFlag: Gets a value representing the 'Week Of Manufacture' field. /// /// Gets a value representing the Week Of Manufacture field. /// @@ -104,18 +104,18 @@ public VendorEdidSection(ReadOnlyCollection sectionData) : base(sectionDat /// Property value. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private byte WeekOfManufacture => RawData[0x08]; + private byte WeekOfManufactureOrModelYearFlag => RawData[0x08]; #endregion - #region [private] (byte) ManufactureDate: Gets a value representing the 'Manufacture Date' field + #region [private] (byte) YearOfManufactureOrModelYear: Gets a value representing the 'Year Of Manufacture' field. /// - /// Gets a value representing the Manufacture Date field. + /// Gets a value representing the Year Of Manufacture field. /// /// /// Property value. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private byte ManufactureDate => (byte) (1990 + RawData[0x09]); + private byte YearOfManufactureOrModelYear => RawData[0x09]; #endregion #endregion @@ -131,7 +131,7 @@ public VendorEdidSection(ReadOnlyCollection sectionData) : base(sectionDat protected override void PopulateProperties(SectionPropertiesTable properties) { properties.Add(EedidProperty.Edid.Vendor.IdManufacturerName, IdManufacturerName); - properties.Add(EedidProperty.Edid.Vendor.IdProductCode, IdProductCode); + properties.Add(EedidProperty.Edid.Vendor.IdProductCode, $"{IdProductCode:X4}"); var idSerialNumber = IdSerialNumber; if (idSerialNumber != 0x0000) @@ -139,20 +139,19 @@ protected override void PopulateProperties(SectionPropertiesTable properties) properties.Add(EedidProperty.Edid.Vendor.IdSerialNumber, (int?)IdSerialNumber); } - var weekOfManufacture = WeekOfManufacture; - if (weekOfManufacture != 0x00) + properties.Add(EedidProperty.Edid.Vendor.WeekOfManufactureOrModelYear, WeekOfManufactureOrModelYearFlag); + properties.Add(EedidProperty.Edid.Vendor.YearOfManufactureOrModelYear, YearOfManufactureOrModelYear); + var modelYearStrategy = WeekOfManufactureOrModelYearFlag == 0xff || WeekOfManufactureOrModelYearFlag == 0x00 ? KnownModelYearStrategy.ModelYear : KnownModelYearStrategy.YearOfManufacture; + properties.Add(EedidProperty.Edid.Vendor.ModelYearStrategy, modelYearStrategy); + + if (modelYearStrategy == KnownModelYearStrategy.ModelYear) { - if (weekOfManufacture != 0xff) - { - if (weekOfManufacture >= 0x01 && weekOfManufacture <= 0x36) - { - properties.Add(EedidProperty.Edid.Vendor.WeekOfManufacture, WeekOfManufacture); - } - } + properties.Add(EedidProperty.Edid.Vendor.ManufactureDate, 1990 + YearOfManufactureOrModelYear); + } + else + { + properties.Add(EedidProperty.Edid.Vendor.ManufactureDate, $"{WeekOfManufactureOrModelYearFlag} / {1990 + YearOfManufactureOrModelYear}"); } - - properties.Add(EedidProperty.Edid.Vendor.ManufactureDate, ManufactureDate); - properties.Add(EedidProperty.Edid.Vendor.ModelYearStrategy, weekOfManufacture == 0xff ? KnownModelYearStrategy.ModelYear : KnownModelYearStrategy.YearOfManufacture); } #endregion diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware.Specification/iTin.Core.Hardware.Specification.Eedid/EEDID/ComponentModel/DataSection.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware.Specification/iTin.Core.Hardware.Specification.Eedid/EEDID/ComponentModel/DataSection.cs index 93db2d3..6faa1f4 100644 --- a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware.Specification/iTin.Core.Hardware.Specification.Eedid/EEDID/ComponentModel/DataSection.cs +++ b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware.Specification/iTin.Core.Hardware.Specification.Eedid/EEDID/ComponentModel/DataSection.cs @@ -4,6 +4,7 @@ namespace iTin.Core.Hardware.Specification.Eedid using System; using System.Collections.Generic; using System.Diagnostics; + using System.Linq; /// /// Represents a data section @@ -107,7 +108,30 @@ public SectionProperties Properties /// /// Reference to the object that represents the value of the property. Always returns the first appearance of the property. /// - public object GetPropertyValue(IPropertyKey propertyKey) => _dataSection.Properties[propertyKey]; + public object GetPropertyValue(IPropertyKey propertyKey) + { + Type propertyType = propertyKey.GetPropertyType(); + + object result = _dataSection.Properties[propertyKey]; + if (!(result is List> itemList)) + { + return result; + } + + bool hasItems = itemList.Any(); + if (!hasItems) + { + return propertyType.GetDefaultValue(); + } + + bool onlyOneItem = itemList.Count == 1; + if (onlyOneItem) + { + return itemList.FirstOrDefault().Value; + } + + return propertyType.GetDefaultValue(); + } #endregion #region [public] (T) GetPropertyValue(IPropertyKey): Returns the the strongly typed value of specified property diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware.Specification/iTin.Core.Hardware.Specification.Eedid/EEDID/EedidProperty.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware.Specification/iTin.Core.Hardware.Specification.Eedid/EEDID/EedidProperty.cs index 2be78cf..d10a065 100644 --- a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware.Specification/iTin.Core.Hardware.Specification.Eedid/EEDID/EedidProperty.cs +++ b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware.Specification/iTin.Core.Hardware.Specification.Eedid/EEDID/EedidProperty.cs @@ -76,7 +76,7 @@ public static class Vendor /// Property: /// Unit: /// — Value —————————————————————— - /// Type: + /// Type: /// public static IPropertyKey IdProductCode => new PropertyKey(KnownEdidSection.Vendor, EdidVendorProperty.IdProductCode); #endregion @@ -89,22 +89,35 @@ public static class Vendor /// Property: /// Unit: /// — Value —————————————————————— - /// Type: + /// Type: uint?" /// public static IPropertyKey IdSerialNumber => new PropertyKey(KnownEdidSection.Vendor, EdidVendorProperty.IdSerialNumber); #endregion - #region [public] {static} (IPropertyKey) WeekOfManufacture: Gets a value representing the key to retrieve the property + #region [public] {static} (IPropertyKey) WeekOfManufactureOrModelYear: Gets a value representing the key to retrieve the property /// /// Gets a value representing the key to retrieve the property. /// — Key Composition ————————————————— /// Structure: - /// Property: + /// Property: /// Unit: /// — Value —————————————————————— /// Type: /// - public static IPropertyKey WeekOfManufacture => new PropertyKey(KnownEdidSection.Vendor, EdidVendorProperty.WeekOfManufacture); + public static IPropertyKey WeekOfManufactureOrModelYear => new PropertyKey(KnownEdidSection.Vendor, EdidVendorProperty.WeekOfManufactureOrModelYear); + #endregion + + #region [public] {static} (IPropertyKey) YearOfManufactureOrModelYear: Gets a value representing the key to retrieve the property + /// + /// Gets a value representing the key to retrieve the property. + /// — Key Composition ————————————————— + /// Structure: + /// Property: + /// Unit: + /// — Value —————————————————————— + /// Type: + /// + public static IPropertyKey YearOfManufactureOrModelYear => new PropertyKey(KnownEdidSection.Vendor, EdidVendorProperty.YearOfManufactureOrModelYear); #endregion #region [public] {static} (IPropertyKey) ManufactureDate: Gets a value representing the key to retrieve the property @@ -115,7 +128,7 @@ public static class Vendor /// Property: /// Unit: /// — Value —————————————————————— - /// Type: + /// Type: /// public static IPropertyKey ManufactureDate => new PropertyKey(KnownEdidSection.Vendor, EdidVendorProperty.ManufactureDate); #endregion diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/ComponentModel/BasePropertiesTable.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/ComponentModel/BasePropertiesTable.cs index a31b03d..320733a 100644 --- a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/ComponentModel/BasePropertiesTable.cs +++ b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/ComponentModel/BasePropertiesTable.cs @@ -1,31 +1,30 @@  namespace iTin.Core.Hardware.ComponentModel { - using System; using System.Collections; using System.Collections.Generic; + using System.Collections.ObjectModel; using System.Diagnostics; - using System.Linq; /// /// /// Define a suitable generic dictionary to store properties and their value. /// - public class BasePropertiesTable : IDictionary + public class BasePropertiesTable : IList> { #region private readonly members [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly Dictionary _table; + private readonly List> _table; #endregion #region constructor/s - #region [public] BasePropertiesTable(): Initialize a new instance of the class + #region [protected] BasePropertiesTable(): Initialize a new instance of the class /// /// /// Initializes a new instance of the class. /// - public BasePropertiesTable() => _table = new Dictionary(); + protected BasePropertiesTable() => _table = new List>(); #endregion #endregion @@ -34,8 +33,22 @@ public class BasePropertiesTable : IDictionary #region public indexers + #region [public] (KeyValuePair) this[index]: Gets or sets the element with the specified index + /// + /// Gets or sets the element with the specified index. + /// + /// The index of the element that is obtained or established. + /// + /// The element with the specified index. + /// + public KeyValuePair this[int index] + { + get => _table[index]; + set => _table[index] = value; + } + #endregion + #region [public] (object) this[IPropertyKey]: Gets or sets the element with the specified key - /// /// /// Gets or sets the element with the specified key. /// @@ -48,8 +61,8 @@ public class BasePropertiesTable : IDictionary /// The property is set and is read-only. public object this[IPropertyKey key] { - get => _table[key]; - set => _table[key] = value; + get => _table.FindAll(p => p.Key.Equals(key)); + set => _table.Add(new KeyValuePair(key, value)); } #endregion @@ -79,31 +92,74 @@ public object this[IPropertyKey key] public bool IsReadOnly => true; #endregion - #region [public] (ICollection) Keys: Gets an interface collection that contains the keys for the dictionary interface - /// + #region [public] (ICollection) Keys: Gets an interface collection that contains the keys /// - /// Gets an interface that contains the keys for the interface. + /// Gets an interface that contains the keys. /// /// - /// that contains the keys of the object that implements the . + /// that contains the keys of the object. /// - public ICollection Keys => _table.Keys; + public ICollection Keys + { + get + { + var keys = new Collection(); + foreach (var item in _table) + { + var exist = keys.Contains(item.Key); + if (exist) + { + continue; + } + + keys.Add(item.Key); + } + + return keys; + } + } #endregion - #region [public] (ICollection) Values: Gets a value that indicates whether collection is read-only - /// + //#region [public] (ICollection) Values: Gets a value that indicates whether collection is read-only + ///// + ///// + ///// Gets an interface that contains the values for the interface. + ///// + ///// + ///// that contains the values of the object that implements the . + ///// + //public ICollection Values => _table.Values; + //#endregion + + #endregion + + #region public methods + + #region [public] (int) IndexOf(KeyValuePair): /// - /// Gets an interface that contains the values for the interface. + /// /// - /// - /// that contains the values of the object that implements the . - /// - public ICollection Values => _table.Values; + /// + /// + public int IndexOf(KeyValuePair item) => _table.IndexOf(item); #endregion + #region [public] (void) Insert(int, KeyValuePair): + /// + /// + /// + /// + /// + public void Insert(int index, KeyValuePair item) => _table.Insert(index, item); #endregion - #region public methods + #region [public] (void) RemoveAt(int): + /// + /// + /// + /// + public void RemoveAt(int index) => _table.RemoveAt(index); + #endregion #region [public] (void) Add(KeyValuePair): Add an element to collection /// @@ -114,14 +170,10 @@ public object this[IPropertyKey key] /// Object to be added to . /// /// is read only. - public void Add(KeyValuePair item) - { - _table.Add(item.Key, item.Value); - } + public void Add(KeyValuePair item) => _table.Add(item); #endregion #region [public] (void) Add(IPropertyKey, object>): Add an element with the key and value provided to dictionary - /// /// /// Add an element with the key and value provided to . /// @@ -130,10 +182,7 @@ public void Add(KeyValuePair item) /// The value of is . /// An element with the same key already exists in . /// is read only. - public void Add(IPropertyKey key, object value) - { - _table.Add(key, value); - } + public void Add(IPropertyKey key, object value) => Add(new KeyValuePair(key, value)); #endregion #region [public] (void) Clear(): Remove all the elements of collection @@ -142,10 +191,7 @@ public void Add(IPropertyKey key, object value) /// Remove all the elements of . /// /// is read only. - public void Clear() - { - _table.Clear(); - } + public void Clear() => _table.Clear(); #endregion #region [public] (bool) Contains(KeyValuePair): Determines whether collection contains a specific value @@ -161,7 +207,6 @@ public void Clear() #endregion #region [public] (bool) ContainsKey(IPropertyKey): Determines whether dictionary contains an element with the specified key - /// /// /// Determines whether contains an element with the specified key. /// @@ -170,10 +215,11 @@ public void Clear() /// Is if contains an element with the key; otherwise, it is . /// /// The value of is . - public bool ContainsKey(IPropertyKey key) => _table.ContainsKey(key); + public bool ContainsKey(IPropertyKey key) => Keys.Contains(key); #endregion #region [public] (void) CopyTo(KeyValuePair[], int): Copy the elements of collection into array, starting with a given index of array + /// /// /// Copy the elements of into , starting with a given index of . @@ -186,10 +232,7 @@ public void Clear() /// The value of is . /// is less than 0. /// The number of elements at the origin of is greater than the available space from to the end of the destination of . - public void CopyTo(KeyValuePair[] array, int arrayIndex) - { - throw new NotImplementedException(); - } + public void CopyTo(KeyValuePair[] array, int arrayIndex) => _table.CopyTo(array, arrayIndex); #endregion #region [public] (IEnumerator) IEnumerable.GetEnumerator(): Returns an enumerator that processes an iteration in the collection @@ -225,46 +268,7 @@ public void CopyTo(KeyValuePair[] array, int arrayIndex) /// This method also returns if is not found in the original . /// /// is read only. - public bool Remove(KeyValuePair item) - { - return _table.Remove(item.Key); - } - - #endregion - - #region [public] (bool) Remove(IPropertyKey): Remove the element with the specified key from dictionary - /// - /// - /// Remove the element with the specified key from . - /// - /// Key of the item to be removed. - /// - /// Is if the element is removed correctly; otherwise, it is . - /// This method also returns if was not found in the original . - /// - /// The value of is . - /// is read only. - public bool Remove(IPropertyKey key) - { - return _table.Remove(key); - } - #endregion - - #region [public] (bool) TryGetValue(IPropertyKey, out object): Gets the value associated with the specified key - /// - /// - /// Gets the value associated with the specified key. - /// - /// Key whose value will be obtained. - /// - /// When this method returns the result, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the parameter . - /// This parameter is passed without initializing. - /// - /// - /// if the object that implements contains an element with the key; otherwise, . - /// - /// The value of is . - public bool TryGetValue(IPropertyKey key, out object value) => _table.TryGetValue(key, out value); + public bool Remove(KeyValuePair item) => _table.Remove(item); #endregion #endregion @@ -280,10 +284,7 @@ public bool Remove(IPropertyKey key) /// /// A string that represents the current object. /// - public override string ToString() - { - return $"Count = {_table.Count}"; - } + public override string ToString() => $"Count = {_table.Count}"; #endregion #endregion diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/DeviceInfo/DesktopDeviceEffects.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/DeviceInfo/DesktopDeviceEffects.cs new file mode 100644 index 0000000..c686e30 --- /dev/null +++ b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/DeviceInfo/DesktopDeviceEffects.cs @@ -0,0 +1,486 @@ + +namespace iTin.Core.Hardware.DeviceInfo +{ + using System.Diagnostics; + + using Configuration = Core.Interop.Windows.Development.UI.WindowsAndMessages.Configuration; + + /// + /// The data structure contains information about the desktop effects. + /// + public static class DesktopDeviceEffects + { + #region private static members + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private static bool _comboboxAnimation; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private static bool _dropShadowEffect; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private static bool _flatMenuEffect; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private static bool _fontSmoothing; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private static bool _clearType; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private static bool _dragFullWindows; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private static bool _hotTracking; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private static bool _iconTitleWrap; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private static bool _listBoxSmoothScrolling; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private static bool _menuAnimation; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private static bool _menuFade; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private static bool _mouseCursorShadow; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private static bool _selectionFade; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private static bool _showSounds; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private static bool _tooltipAnimation; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private static bool _tooltipFade; + #endregion + + #region public static properties + + #region [public] {static} (bool) ComboBoxAnimation: Gets or sets a value that indicates whether combo boxes have an effect when deployed + /// + /// Gets or sets a value that indicates whether combo boxes have an effect when deployed. + /// This feature is not supported by Windows NT, Windows 95. + /// + /// + /// true to indicate that this feature is enabled; false otherwise. + /// + public static bool ComboBoxAnimation + { + get + { + _comboboxAnimation = false; + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.GetComboboxAnimation, 0, ref _comboboxAnimation, Configuration.NativeMethods.SPIF.Zero); + return _comboboxAnimation; + } + set + { + if (value != _comboboxAnimation) + { + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.SetComboboxAnimation, 0, value, Configuration.NativeMethods.SPIF.Zero); + } + } + } + #endregion + + #region [public] {static} (bool) DropShadowEffect: Gets or sets a value that indicates whether shadows are displayed under windows + /// + /// Gets or sets a value that indicates whether shadows are displayed under windows. + /// This feature is not supported by Windows 2000 / NT, Windows Me / 98/95. + /// + /// + /// true to indicate that this feature is enabled; false otherwise. + /// + public static bool DropShadowEffect + { + get + { + _dropShadowEffect = false; + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.GetDropShadow, 0, ref _dropShadowEffect, Configuration.NativeMethods.SPIF.Zero); + return _dropShadowEffect; + } + set + { + if (value != _dropShadowEffect) + { + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.SetDropShadow, 0, value, Configuration.NativeMethods.SPIF.Zero); + } + } + } + #endregion + + #region [public] {static} (bool) FlatMenuEffect: Gets or sets a value that indicates whether menus are dimmed. + /// + /// Gets or sets a value that indicates whether menus are dimmed. + /// This feature is not supported by Windows 2000. + /// + /// + /// true to indicate that this feature is enabled; false otherwise. + /// + public static bool FlatMenuEffect + { + get + { + _flatMenuEffect = false; + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.GetFlatMenu, 0, ref _flatMenuEffect, Configuration.NativeMethods.SPIF.Zero); + return _flatMenuEffect; + } + set + { + if (value != _flatMenuEffect) + { + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.SetFlatMenu, 0, value, Configuration.NativeMethods.SPIF.Zero); + } + } + } + #endregion + + #region [public] {static} (bool) FontSmoothing: Gets or sets a value that indicates whether the font smoothing function is enabled + /// + /// Gets or sets a value that indicates whether the font smoothing function is enabled. + /// This function uses the smoothing of fonts so that the curves of the font are drawn softer at different gray levels. + /// For Windows 95, this feature is only supported if you have Windows Plus! + /// + /// + /// true to indicate that this feature is enabled; false otherwise. + /// + public static bool FontSmoothing + { + get + { + _fontSmoothing = false; + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.GetFontSmoothing, 0, ref _fontSmoothing, Configuration.NativeMethods.SPIF.Zero); + return _fontSmoothing; + } + set + { + if (value != _fontSmoothing) + { + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.SetFontSmoothing, 0, value, Configuration.NativeMethods.SPIF.Zero); + } + } + } + #endregion + + #region [public] {static} (bool) ClearType: Gets or sets a value that indicates whether the feature is activated + /// + /// Gets or sets a value that indicates whether the feature is activated. + /// ClearType is a software technology that improves text readability on monitors with a liquid crystal display (LCD). + /// This feature is not supported by Windows Server 2003 and Windows XP / 2000. + /// + /// + /// true to indicate that this feature is enabled; false otherwise. + /// + public static bool ClearType + { + get + { + _clearType = false; + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.GetClearType, 0, ref _clearType, Configuration.NativeMethods.SPIF.Zero); + return _clearType; + } + set + { + if (value != _clearType) + { + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.SetClearType, 0, _clearType, Configuration.NativeMethods.SPIF.Zero); + } + } + } + #endregion + + #region [public] {static} (bool) DragFullWindows: Get or set a value that indicates whether full window dragging is enabled (view content when dragging) + /// + /// Get or set a value that indicates whether full window dragging is enabled (view content when dragging). + /// For Windows 95, this feature is only supported if you have Windows Plus! + /// + /// + /// true to indicate that this feature is enabled; false otherwise. + /// + public static bool DragFullWindows + { + get + { + _dragFullWindows = false; + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.GetDragFullWindows, 0, ref _dragFullWindows, Configuration.NativeMethods.SPIF.Zero); + return _dragFullWindows; + } + set + { + if (value != _dragFullWindows) + { + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.SetDragFullWindows, 0, value, Configuration.NativeMethods.SPIF.Zero); + } + } + } + #endregion + + #region [public] {static} (bool) HotTracking: Gets or sets a value that indicates whether active tracking of user interface elements such as menu bars, menu names is enabled + /// + /// Gets or sets a value that indicates whether active tracking of user interface elements such as menu bars, menu names is enabled. + /// Active tracking means that when the cursor moves over an item, it is drawn with relief but not selected. + /// This feature is not supported by Windows NT, Windows 95. + /// + /// + /// true to indicate that this feature is enabled; false otherwise. + /// + public static bool HotTracking + { + get + { + _hotTracking = false; + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.GetHotTracking, 0, ref _hotTracking, Configuration.NativeMethods.SPIF.Zero); + return _hotTracking; + } + set + { + if (value != _hotTracking) + { + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.SetHotTracking, 0, value, Configuration.NativeMethods.SPIF.Zero); + } + } + } + #endregion + + #region [public] {static} (bool) IconTitleWrap: Gets or sets a value that indicates whether the title icon setting is enabled + /// + /// Gets or sets a value that indicates whether the title icon setting is enabled. + /// + /// + /// true to indicate that this feature is enabled; false otherwise. + /// + public static bool IconTitleWrap + { + get + { + _iconTitleWrap = false; + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.GetIconTitleWrap, 0, ref _iconTitleWrap, Configuration.NativeMethods.SPIF.Zero); + return _iconTitleWrap; + } + set + { + if (value != _iconTitleWrap) + { + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.SetIconTitleWrap, 0, value, Configuration.NativeMethods.SPIF.Zero); + } + } + } + #endregion + + #region [public] {static} (bool) ListBoxSmoothScrolling: Gets or sets a value that indicates whether the smooth scrolling effect is enabled for list boxes + /// + /// Gets or sets a value that indicates whether the smooth scrolling effect is enabled for list boxes. + /// This feature is not supported by Windows 95. + /// + /// + /// true to indicate that this feature is enabled; false otherwise. + /// + public static bool ListBoxSmoothScrolling + { + get + { + _listBoxSmoothScrolling = false; + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.GetListBoxSmoothScrolling, 0, ref _listBoxSmoothScrolling, Configuration.NativeMethods.SPIF.Zero); + return _listBoxSmoothScrolling; + } + set + { + if (value != _listBoxSmoothScrolling) + { + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.SetListBoxSmoothScrolling, 0, value, Configuration.NativeMethods.SPIF.Zero); + } + } + } + #endregion + + #region [public] {static} (bool) MenuAnimation: Gets or sets a value that indicates whether the menu animation feature is enabled + /// + /// Gets or sets a value that indicates whether the menu animation feature is enabled. + /// If the feature is activated, it indicates whether the menus use dimming or animation. + /// + /// + /// true to indicate that this feature is enabled; false otherwise. + /// + public static bool MenuAnimation + { + get + { + _menuAnimation = false; + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.GetMenuAnimation, 0, ref _menuAnimation, Configuration.NativeMethods.SPIF.Zero); + return _menuAnimation; + } + set + { + if (value != _menuAnimation) + { + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.SetMenuAnimation, 0, value, Configuration.NativeMethods.SPIF.Zero); + } + } + } + #endregion + + #region [public] {static} (bool) MenuFade: Gets or sets a value that indicates whether menu closure animation is enabled + /// + /// Gets or sets a value that indicates whether menu closure animation is enabled. + /// This feature is not supported by Windows NT, Windows Me / 98/95. + /// + /// + /// true to indicate that this feature is enabled; false otherwise. + /// + public static bool MenuFade + { + get + { + _menuFade = false; + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.GetMenuFade, 0, ref _menuFade, Configuration.NativeMethods.SPIF.Zero); + return _menuFade; + } + set + { + if (value != _menuFade) + { + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.SetMenuFade, 0, value, Configuration.NativeMethods.SPIF.Zero); + } + } + } + #endregion + + #region [public] {static} (bool) MouseCursorShadow: Gets or sets a value that indicates whether shadow is displayed under the mouse cursor + /// + /// Gets or sets a value that indicates whether shadow is displayed under the mouse cursor. + /// The effect is only noticeable on systems that have at least 256 colors of color depth. + /// This feature is not supported by Windows NT, Windows Me / 98/95. + /// + /// + /// true to indicate that this feature is enabled; false otherwise. + /// + public static bool MouseCursorShadow + { + get + { + _mouseCursorShadow = false; + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.GetCursorShadow, 0, ref _mouseCursorShadow, Configuration.NativeMethods.SPIF.Zero); + return _mouseCursorShadow; + } + set + { + if (value != _mouseCursorShadow) + { + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.SetCursorShadow, 0, value, Configuration.NativeMethods.SPIF.Zero); + } + } + } + #endregion + + #region [public] {static} (bool) SelectionFade: Gets or sets a value that indicates whether the fading effect of the selection is enabled + /// + /// Gets or sets a value that indicates whether the fading effect of the selection is enabled. + /// The fade effect of the selection causes the menu item selected by the user to remain on the screen briefly while slowly disappearing. + /// This feature is not supported by Windows NT, Windows Me / 98/95. + /// + /// + /// true to indicate that this feature is enabled; false otherwise. + /// + public static bool SelectionFade + { + get + { + _selectionFade = false; + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.GetSelectionFade, 0, ref _selectionFade, Configuration.NativeMethods.SPIF.Zero); + return _selectionFade; + } + set + { + if (value != _selectionFade) + { + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.SetSelectionFade, 0, value, Configuration.NativeMethods.SPIF.Zero); + } + } + } + #endregion + + #region [public] {static} (bool) ShowSounds: Gets or sets a value that indicates whether the sound option of the accessibility feature is enabled, events are audibly displayed + /// + /// Gets or sets a value that indicates whether the sound option of the accessibility feature is enabled, events are audibly displayed. + /// + /// + /// true to indicate that this feature is enabled; false otherwise. + /// + public static bool ShowSounds + { + get + { + _showSounds = false; + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.GetShowSounds, 0, ref _showSounds, Configuration.NativeMethods.SPIF.Zero); + return _showSounds; + } + set + { + if (value != _showSounds) + { + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.SetShowSounds, 0, value, Configuration.NativeMethods.SPIF.Zero); + } + } + } + #endregion + + #region [public] {static} (bool) TooltipAnimation: Gets or sets a value that indicates whether the animation of tool help balloons is enabled + /// + /// Gets or sets a value that indicates whether the animation of tool help balloons is enabled. + /// This feature is not supported by Windows NT, Windows Me / 98/95. + /// + /// + /// true to indicate that this feature is enabled; false otherwise. + /// + public static bool TooltipAnimation + { + get + { + _tooltipAnimation = false; + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.GetTooltipAnimation, 0, ref _tooltipAnimation, Configuration.NativeMethods.SPIF.Zero); + return _tooltipAnimation; + } + set + { + if (value != _tooltipAnimation) + { + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.SetTooltipAnimation, 0, value, Configuration.NativeMethods.SPIF.Zero); + } + } + } + #endregion + + #region [public] {static} (bool) TooltipFade: Gets or sets a value that indicates whether the TooltipAnimation, TooltipFade feature is enabled if help balloons use a transition effect or not + /// + /// Gets or sets a value that indicates whether the , TooltipFade feature is enabled if help balloons use a transition effect or not. + /// This feature is not supported by Windows NT, Windows Me / 98/95. + /// + /// + /// true to indicate that this feature is enabled; false otherwise. + /// + public static bool TooltipFade + { + get + { + _tooltipFade = false; + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.GetTooltipFade, 0, ref _tooltipFade, Configuration.NativeMethods.SPIF.Zero); + return _tooltipFade; + } + set + { + if (value != _tooltipAnimation) + { + Configuration.NativeMethods.SystemParametersInfo(Configuration.NativeMethods.SPI.SetTooltipFade, 0, value, Configuration.NativeMethods.SPIF.Zero); + } + } + } + #endregion + + #endregion + } +} diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/DeviceInfo/DesktopDeviceInfo.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/DeviceInfo/DesktopDeviceInfo.cs new file mode 100644 index 0000000..fc760dc --- /dev/null +++ b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/DeviceInfo/DesktopDeviceInfo.cs @@ -0,0 +1,638 @@ + +namespace iTin.Core.Hardware.DeviceInfo +{ + using System; + using System.Drawing; + + /// + /// The data structure contains information on the desktop associated with a certain screen. + /// + public struct DesktopDeviceInfo : IEquatable + { + #region public enumerations + + #region [public] (enum) Technologies: Types of technology of a device + /// + /// Types of technology of a device. + /// + public enum Technologies + { + /// + /// Plotter. + /// + Plotter, + + /// + /// Pantalla. + /// + RasDisplay, + + /// + /// Impresora. + /// + RasPrinter, + + /// + /// Cámara. + /// + RasCamera, + + /// + /// Secuencia de caracteres. + /// + CharStream, + + /// + /// Metafile. + /// + Metafile, + + /// + /// Display file. + /// + DispFile + } + #endregion + + #region [public] (enum) ShadeBlendCaps: Types of shading and transparency of a device + /// + /// Types of shading and transparency of a device. + /// + public enum ShadeBlendCaps + { + /// + /// Controls the SourceConstantAlpha member of the BLENDFUNCTION structure, which references the blendFunction parameter of the AlphaBlend function. + /// + ConstAlpha, + + /// + /// Indicates the ability to draw rectangles with color gradient. + /// + GradRect, + + /// + /// Indicates the ability to draw triangles with color gradient. + /// + GradTri, + + /// + /// Indicates that the device does not support any of these capabilities. + /// + None, + + /// + /// Indicates the ability to handle the alpha channel for each pixel in the AlphaBlend function (function to show transparent or semi-transparent bitmaps). + /// + PixelAlpha, + + /// + /// Indicates the ability to handle the premultiplied alpha channel in AlphaBlend (function to show transparent or semi-transparent bitmaps). + /// + PremultAlpha + } + #endregion + + #region [public] (enum) RasterCaps: Indicates the frame capabilities of a device + /// + /// Indicates the frame capabilities of a device. + /// + public enum RasterCaps + { + /// + /// Requires band support. + /// + Banding, + + /// + /// Indicates the ability to transfer bitmaps. + /// + BitBlt, + + /// + /// Indicates the ability to support bitmaps larger than 64KB. + /// + Bitmap64, + + /// + /// Indicates that it is compatible with the SetDIBits and GetDIBits functions. + /// + DiBitmap, + + /// + /// Indicates that it is compatible with the SetDIBitsToDevice function. + /// + DibToDev, + + /// + /// Indicates that it is capable of filling. + /// + FloodFill, + + /// + /// Specify a device based on the palette. + /// + Palette, + + /// + /// Indicates the scalability. + /// + Scaling, + + /// + /// Indicates that it is capable of performing the StretchBlt function. + /// + StretchBlt, + + /// + /// Indicates that it is capable of performing the StretchDIBits function. + /// + StretchDib + } + #endregion + + #region [public] (enum) CurveCaps: Indicates the capabilities to draw curves + /// + /// Indicates the capabilities to draw curves. + /// + public enum CurveCaps + { + /// + /// Indicates that the device does not support curves. + /// + None, + + /// + /// Indicates that the device can draw arcs. + /// + Chord, + + /// + /// Indicates that the device can draw circles. + /// + Circles, + + /// + /// Indicates that the device can draw ellipses. + /// + Ellipses, + + /// + /// Indicates that the device can draw interiors. + /// + Interiors, + + /// + /// Indicates that the device can draw shapes. + /// + Pie, + + /// + /// Indicates that the device can draw rounded rectangles. + /// + RoundRect, + + /// + /// Indicates that the device can draw stylish borders. + /// + Styled, + + /// + /// Indicates that the device can draw wide edges. + /// + Wide, + + /// + /// Indicates that the device can draw wide and stylish edges. + /// + WideStyled, + } + #endregion + + #region [public] (enum) LineCaps: Indicates the capabilities to draw lines + /// + /// Indicates the capabilities to draw lines. + /// + public enum LineCaps + { + /// + /// Indicates that the device does not support lines. + /// + None, + + /// + /// Indicates that the device can draw interiors. + /// + Interiors, + + /// + /// Indicates that the device can draw a marker. + /// + Marker, + + /// + /// Indicates that the device can draw polyline. + /// + PolyLine, + + /// + /// Indicates that the device can draw multiple markers. + /// + PolyMarker, + + /// + /// Indicates that the device can draw stylish lines. + /// + Styled, + + /// + /// Indicates that the device can draw lines with variable width. + /// + Wide, + + /// + /// Indicates that the device can draw lines with variable width and with style. + /// + WideStyled + } + #endregion + + #region [public] (enum) PolygonalCaps: Indicates the abilities to draw polygons + /// + /// Indicates the abilities to draw polygons. + /// + public enum PolygonalCaps + { + /// + /// Indicates that the device does not support polygons. + /// + None, + + /// + /// Indicates that the device can draw interiors. + /// + Interiors, + + /// + /// Indicates that the device can draw filled polygons. + /// + Polygon, + + /// + /// Indicates that the device can draw polyline. + /// + Rectangle, + + /// + /// Indicates that the device can draw only one line. + /// + ScanLine, + + /// + /// Indicates that the device can draw stylish borders. + /// + Styled, + + /// + /// Indicates that the device can draw borders with variable width. + /// + Wide, + + /// + /// Indicates that the device can draw borders with variable width and with style. + /// + WideStyled, + + /// + /// Indicates that the device can draw filled polygon borders. + /// + WindPolygon + } + #endregion + + #region [public] (enum) TextCaps: Indicates the capabilities to draw text + /// + /// Indicates the capabilities to draw text. + /// + public enum TextCaps + { + /// + /// Indicates that the device is capable of displaying character accuracy. + /// + OpCharacter, + + /// + /// Indicates that the device is capable of displaying stroke accuracy. + /// + OpStroke, + + /// + /// Indicates that the device is capable of displaying a clip with stroke accuracy. + /// + CpStroke, + + /// + /// Indicates that the device is capable of rotating a character 90º. + /// + Cr90, + + /// + /// Indicates that the device is capable of rotating a character. + /// + CrAny, + + /// + /// Indicates that the device is able to scale independently in the x direction or y direction. + /// + SfXyIndep, + + /// + /// Indicates that the device is capable of double-scale character. + /// + SaDouble, + + /// + /// Indicates that the device uses only integer multiples to scale a character. + /// + SaInteger, + + /// + /// Indicates that the device can scale a character to any multiple. + /// + SaContin, + + /// + /// Indicates that the device can draw in bold. + /// + EaDouble, + + /// + /// Indicates that the device can draw in italics. + /// + IaAbled, + + /// + /// Indicates that the device can draw underlines. + /// + UaAble, + + /// + /// Indicates that the device can draw strikeouts. + /// + SoAble, + + /// + /// Indicates that the device can draw fonts as bitmap. + /// + RaAble, + + /// + /// Indicates that the device can draw vector fonts. + /// + VaAble, + + /// + /// Reserved, must be 0. + /// + Reserved, + + /// + /// Indicates that the device cannot move through a bit block transfer. + /// Keep in mind that this meaning may be the opposite of expectations. + /// + ScrollBlt + } + #endregion + + #region [public] (enum) ColorMgmtCaps: Indicates the color management capabilities of a device + /// + /// Indicates the color management capabilities of a device. + /// + public enum ColorMgmtCaps + { + /// + /// Indicates that the device can accept the CMYK color space ICC color profile. + /// + CmykColor, + + /// + /// Indicates that the device can perform ICM on the device driver or on the device itself. + /// + DeviceIcm, + + /// + /// Indicates that the device supports GetDeviceGammaRamp and SetDeviceGammaRamp. + /// + GammaRamp, + + /// + /// Indicates that the device does not support ICM. + /// + None + } + #endregion + + #endregion + + #region interfaces + + #region [public] (bool) Equals(DesktopDeviceInfo): Indicates whether the current structure is the same as another structure of the same type + /// + /// Indicates whether the current structure is the same as another structure of the same type. + /// + /// Structure to be compared with this structure. + /// + /// Returns true if the structures are the same; otherwise, false. + /// + public bool Equals(DesktopDeviceInfo other) => other.Equals((object)this); + #endregion + + #endregion + + #region public operatos + + #region [public] {static} (bool) operator ==(DesktopDeviceInfo, DesktopDeviceInfo): Implements the equality operator (==) + /// + /// Implements the equality operator (==). + /// + /// Operand 1. + /// Operand 2. + /// + /// Returns true if left is equals to right; false otherwise. + /// + public static bool operator ==(DesktopDeviceInfo left, DesktopDeviceInfo right) => left.Equals(right); + #endregion + + #region [public] {static} (bool) operator !=(DesktopDeviceInfo, DesktopDeviceInfo): Implements the inequality operator (!=) + /// + /// Implements the inequality operator (!=). + /// + /// Operand 1. + /// Operand 2. + /// + /// Returns true if left is not equal to right; false otherwise. + /// + public static bool operator !=(DesktopDeviceInfo left, DesktopDeviceInfo right) => !left.Equals(right); + #endregion + + #endregion + + #region public properties + + #region [public] (int) ColorDepth: Gets or sets a value that represents the color depth of this desktop + /// + /// Gets or sets a value that represents the color depth of this desktop. + /// + /// + /// Color depth. + /// + public int ColorDepth { get; set; } + #endregion + + #region [public] (int) ColorPlanes: Gets or sets a value that represents the number of color planes of this desktop + /// + /// Gets or sets a value that represents the number of color planes of this desktop. + /// + /// + /// Number of color planes. + /// + public int ColorPlanes { get; set; } + #endregion + + #region [public] (string) DeviceName: Gets or sets a value that represents the device name + /// + /// Gets or sets a value that represents the device name. + /// + /// + /// Device name. + /// + public string DeviceName { get; set; } + #endregion + + #region [public] (string) DesktopWallpaper: Gets or sets a string that represents the background of this desktop + /// + /// Gets or sets a string that represents the background of this desktop. + /// + /// + /// Background of this desk. + /// + public string DesktopWallpaper { get; set; } + #endregion + + #region [public] (Size) FontResolution: Gets or sets a value that represents the number of pixels per inch both horizontally and vertically on this desktop + /// + /// Gets or sets a value that represents the number of pixels per inch both horizontally and vertically on this desktop. + /// + /// + /// Number of pixels per inch both horizontally and vertically on this desk. + /// + public Size FontResolution { get; set; } + #endregion + + #region [public] (int) PixelDiagonal: Gets or sets a value that represents the monitor that contains this desktop. + /// + /// Gets or sets a value that represents the monitor that contains this desktop. + /// + /// + /// Diagonal size of a pixel. + /// + public int PixelDiagonal { get; set; } + #endregion + + #region [public] (Size) PixelSize: Gets or sets a value that represents the size of a pixel on the desktop + /// + /// Gets or sets a value that represents the size of a pixel on the desktop. + /// + /// + /// Size of a pixel + /// + public Size PixelSize { get; set; } + #endregion + + #region [public] (Size) Resolution: Gets or sets a value that represents the resolution of this desktop, in pixels + /// + /// Gets or sets a value that represents the resolution of this desktop, in pixels. + /// + /// + /// Resolution of this desktop, in pixels. + /// + public Size Resolution { get; set; } + #endregion + + #region [public] (Technologies) Technology: Gets or sets a value that represents the type of device technology + /// + /// Gets or sets a value that represents the type of device technology. + /// + /// + /// Type of device technology. + /// + public Technologies Technology { get; set; } + #endregion + + #region [public] (int) Gets or sets a value that represents the vertical refresh rate of this desktop, in hertz (Hz) + /// + /// Gets or sets a value that represents the vertical refresh rate of this desktop, in hertz (Hz). + /// + /// + /// Vertical resolution of this desktop, in pixels. + /// + public int VerticalRefreshRate { get; set; } + #endregion + + #endregion + + #region public override methods + + #region [public] {override} (int) GetHashCode(): Returns a value that represents the hash code of this structure + /// + /// Returns a value that represents the hash code of this structure. + /// + /// + /// Hash code of this structure. + /// + public override int GetHashCode() => Resolution.Width ^ Resolution.Height ^ ColorDepth ^ VerticalRefreshRate; + + #endregion + + #region [public] {override} (bool) Equals(object obj): Returns a value that indicates whether this structure is the same as another + /// + /// Returns a value that indicates whether this structure is the same as another. + /// + /// Structure to compare. + /// + /// Result of the equality comparison. + /// + public override bool Equals(object obj) + { + if (obj == null) + { + return false; + } + + if (!(obj is DesktopDeviceInfo)) + { + return false; + } + + var other = (DesktopDeviceInfo)obj; + + return + other.Resolution.Width == Resolution.Width && + other.Resolution.Height == Resolution.Height && + other.ColorDepth == ColorDepth && + other.VerticalRefreshRate == VerticalRefreshRate; + } + #endregion + + #region [public] {override} (string) ToString(): Returns a string that represents the current structure + /// + /// Returns a string that represents the current structure. + /// + /// + /// String representing the current structure. + /// + public override string ToString() => $"{Resolution.Width} x {Resolution.Height}, {ColorDepth} bits, {VerticalRefreshRate}hz"; + #endregion + + #endregion + } +} diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/DeviceInfo/MonitorDeviceInfo.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/DeviceInfo/MonitorDeviceInfo.cs new file mode 100644 index 0000000..40ed451 --- /dev/null +++ b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/DeviceInfo/MonitorDeviceInfo.cs @@ -0,0 +1,239 @@ + +namespace iTin.Core.Hardware.DeviceInfo +{ + using System.Diagnostics; + using System.Linq; + using System.Drawing; + using System; + + using Interop.ComponentModel; + + /// + /// The data structure contains information about a system monitor. + /// + public struct MonitorDeviceInfo : IEquatable + { + #region private readonly members + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private readonly MonitorDeviceInfoNative _deviceInfo; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private readonly MonitorDeviceEdidInfoNative _edidDeviceInfo; + #endregion + + #region constructor/s + + #region [public] MonitorDeviceInfo(MonitorDeviceInfoNative, MonitorDeviceEdidInfoNative): Initializes a new instance of the structure + /// + /// Initializes a new instance of the structure. + /// + /// Monitor information. + /// Screen information. + internal MonitorDeviceInfo(MonitorDeviceInfoNative deviceInfo, MonitorDeviceEdidInfoNative edidDeviceInfo) + { + _deviceInfo = deviceInfo; + _edidDeviceInfo = edidDeviceInfo; + } + #endregion + + #endregion + + #region interfaces + + #region [public] (bool) Equals(MonitorDeviceInfo): Indicates whether the current structure is the same as another structure of the same type + /// + /// Indicates whether the current structure is the same as another structure of the same type. + /// + /// Structure to be compared with this structure. + /// + /// Returns true if the current structure is equal to the other parameter; otherwise, false. + /// + public bool Equals(MonitorDeviceInfo other) => other.Equals((object)this); + #endregion + + #endregion + + #region public operators + + #region [public] {static} (bool) operator ==(MonitorDeviceInfo, MonitorDeviceInfo): Implements the equality operator (==) + /// + /// Implements the equality operator (==). + /// + /// Left + /// Right + /// + /// Returns true if left is equal to right; false otherwise. + /// + public static bool operator ==(MonitorDeviceInfo left, MonitorDeviceInfo right) => left.Equals(right); + #endregion + + #region [public] {static} (bool) operator !=(MonitorDeviceInfo, MonitorDeviceInfo): Implements the inequality operator (!=) + /// + /// Implements the inequality operator (!=). + /// + /// Left + /// Right + /// + /// Returns true if left is not equal to right; false otherwise. + /// + public static bool operator !=(MonitorDeviceInfo left, MonitorDeviceInfo right) => !left.Equals(right); + #endregion + + #endregion + + #region public properties + + #region [public] (string) DeviceId: Gets a value that represents the device identifier + /// + /// Gets a value that represents the device identifier. + /// + /// + /// String representing the device identifier. + /// + public string DeviceId => _deviceInfo.DeviceId; + #endregion + + #region [public] (string) DisplayName: Get a value that represents the name of the screen that contains this monitor + /// + /// Get a value that represents the name of the screen that contains this monitor. + /// + /// + /// String representing the name of the screen that contains this monitor. + /// + public string DisplayName => _deviceInfo.DisplayName; + #endregion + + #region [public] (byte[]) Edid: Gets a value that contains the raw EDID information of this monitor + /// + /// Gets a value that contains the raw EDID information of this monitor. + /// + /// + /// Raw EDID information. + /// + public byte[] Edid => _edidDeviceInfo.RawEdid; + #endregion + + #region [public] (bool) IsAttached: Gets a value that indicates whether the monitor is part of the desktop + /// + /// Gets a value that indicates whether the monitor is part of the desktop. + /// + /// + /// Returns true if it is part of the desktop; false otherwise. + /// + public bool IsAttached => _deviceInfo.IsAttached; + #endregion + + #region [public] (bool) IsPrimaryMonitor: Gets a value that indicates whether the monitor is the main monitor + /// + /// Gets a value that indicates whether the monitor is the main monitor. + /// + /// + /// Returns true if it is the main monitor; false otherwise. + /// + public bool IsPrimaryMonitor => _deviceInfo.IsPrimaryMonitor; + #endregion + + #region [public] (Rectangle) MonitorArea: Gets a value that represents the total area of the monitor + /// + /// Gets a value that represents the total area of the monitor. + /// + /// + /// Rectangle of the monitor screen, expressed in virtual screen coordinates. + /// + /// + /// Note that if the monitor is not the monitor of the main screen, some of the coordinates of the rectangle may be negative values. + /// + public Rectangle MonitorArea => _deviceInfo.MonitorArea; + #endregion + + #region [public] (string) MonitorDriverRegistryPath: Gets a value that represents the registry key that contains the information on this monitor + /// + /// Gets a value that represents the registry key that contains the information on this monitor. + /// + /// + /// String representing the registry key that contains the information on this monitor. + /// + public string MonitorDriverRegistryPath => _deviceInfo.MonitorDriverRegistryPath; + #endregion + + #region [public] (string) MonitorName: Gets a value that represents the name of the monitor + /// + /// Gets a value that represents the name of the monitor. + /// + /// + /// String representing the name of the monitor. + /// + public string MonitorName => _deviceInfo.MonitorName; + #endregion + + #region [public] (Rectangle) MonitorWorkingArea: Gets a value that represents the usable surface of the monitor + /// + /// Gets a value that represents the usable surface of the monitor. + /// + /// + /// Usable monitor rectangle, taskbar and sidebars are excluded. + /// + /// + /// Note that if the monitor is not the monitor of the main screen, some of the coordinates of the rectangle may be negative values. + /// + public Rectangle MonitorWorkingArea => _deviceInfo.MonitorWorkingArea; + #endregion + + #endregion + + #region public override methods + + #region [public] {override} (int) GetHashCode(): Returns a value that represents the hash code of this structure + /// + /// Returns a value that represents the hash code of this structure. + /// + /// + /// Hash code of this structure. + /// + public override int GetHashCode() => _deviceInfo.GetHashCode() ^ _edidDeviceInfo.GetHashCode() ^ Edid.GetHashCode(); + #endregion + + #region [public] {override} (bool) Equals(object obj): Returns a value that indicates whether this structure is the same as another + /// + /// Returns a value that indicates whether this structure is the same as another. + /// + /// Structure to compare. + /// + /// Result of the equality comparison. + /// + public override bool Equals(object obj) + { + if (obj == null) + { + return false; + } + + if (!(obj is MonitorDeviceInfo)) + { + return false; + } + + var other = (MonitorDeviceInfo)obj; + + return + other.DisplayName.Equals(DisplayName) && + other.MonitorName.Equals(MonitorName) && + other.IsAttached.Equals(IsAttached) && + other.IsPrimaryMonitor.Equals(IsPrimaryMonitor) && + other.Edid.SequenceEqual(Edid); + } + #endregion + + #region [public] {override} (string) ToString(): Returns a string that represents the current structure + /// + /// Returns a string that represents the current structure. + /// + /// + /// String representing the current structure. + /// + public override string ToString() => $"{MonitorName}"; + #endregion + + #endregion + } +} diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/DeviceInfo/VideoAdapterDeviceInfo.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/DeviceInfo/VideoAdapterDeviceInfo.cs new file mode 100644 index 0000000..ec8e1d2 --- /dev/null +++ b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/DeviceInfo/VideoAdapterDeviceInfo.cs @@ -0,0 +1,214 @@ + +namespace iTin.Core.Hardware.DeviceInfo +{ + using System; + using System.Diagnostics; + + using Core.Interop.Windows.Development.Graphics.Legacy.Gdi.DeviceContext; + + /// + /// The data structure contains information about a video adapter. + /// + public struct VideoAdapterDeviceInfo : IEquatable + { + #region private readonly members + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private readonly DISPLAY_DEVICE _adapterInfo; + #endregion + + #region constructor/s + + #region [public] VideoAdapterDeviceInfo(DISPLAY_DEVICE): Initializes a new instance of the structure + /// + /// Initializes a new instance of the structure. + /// + /// Native video adapter information.. + public VideoAdapterDeviceInfo(DISPLAY_DEVICE adapterInfo) => _adapterInfo = adapterInfo; + #endregion + + #endregion + + #region interfaces + + #region [public] (bool) Equals(VideoAdapterDeviceInfo): Indicates whether the current structure is the same as another structure of the same type + /// + /// Indicates whether the current structure is the same as another structure of the same type. + /// + /// Structure to be compared with this structure. + /// + /// Returns true if the current structure is equal to the other parameter; otherwise, false. + /// + public bool Equals(VideoAdapterDeviceInfo other) => other.Equals((object)this); + #endregion + + #endregion + + #region public operators + + #region [public] {static} (bool) operator ==(VideoAdapterDeviceInfo, VideoAdapterDeviceInfo): Implements the equality operator (==) + /// + /// Implements the equality operator (==). + /// + /// Left + /// Right + /// + /// Returns true if left is equal to right; false otherwise. + /// + public static bool operator ==(VideoAdapterDeviceInfo left, VideoAdapterDeviceInfo right) => left.Equals(right); + #endregion + + #region [public] {static} (bool) operator !=(VideoAdapterDeviceInfo, VideoAdapterDeviceInfo): Implements the inequality operator (!=) + /// + /// Implements the inequality operator (!=). + /// + /// Left + /// Right + /// + /// Returns true if left is not equal to right; false otherwise. + /// + public static bool operator !=(VideoAdapterDeviceInfo left, VideoAdapterDeviceInfo right) => !left.Equals(right); + #endregion + + #endregion + + #region public properties + + #region [public] (string) DeviceId: Gets a string that represents the PnP identifier of this video adapter + /// + /// Gets a string that represents the PnP identifier of this video adapter. + /// + /// + /// PnP identifier of this video adapter. + /// + public string DeviceId => _adapterInfo.DeviceID; + #endregion + + #region [public] (string) DisplayName: Gets a value that represents the name of the screen to which this video adapter is connected + /// + /// Gets a value that represents the name of the screen to which this video adapter is connected. + /// + /// + /// String representing the name of the screen to which this video adapter is connected. + /// + public string DisplayName => _adapterInfo.DeviceName; + #endregion + + #region [public] (bool) IsAttached: Gets a value that indicates whether the video adapter shows the desktop + /// + /// Gets a value that indicates whether the video adapter shows the desktop. + /// + /// + /// Returns true if it is part of the desktop; false otherwise. + /// + public bool IsAttached + { + get + { + DISPLAY_DEVICE.KnownDisplayDeviceStates flags = _adapterInfo.State; + return (flags & DISPLAY_DEVICE.KnownDisplayDeviceStates.AttachedToDesktop) == DISPLAY_DEVICE.KnownDisplayDeviceStates.AttachedToDesktop; + } + } + #endregion + + #region [public] (bool) IsPrimaryVideoAdapter: Gets a value that indicates whether this video adapter is the primary adapter + /// + /// Gets a value that indicates whether this video adapter is the primary adapter. + /// + /// + /// Returns true if it is the primary adapter; false otherwise. + /// + public bool IsPrimaryVideoAdapter + { + get + { + DISPLAY_DEVICE.KnownDisplayDeviceStates flags = _adapterInfo.State; + return (flags & DISPLAY_DEVICE.KnownDisplayDeviceStates.PrimaryDevice) == DISPLAY_DEVICE.KnownDisplayDeviceStates.PrimaryDevice; + } + } + #endregion + + #region [public] (string) VideoAdapterDriverRegistryPath: Gets a value that represents the registry key that contains the information for this video adapter + /// + /// Gets a value that represents the registry key that contains the information for this video adapter. + /// + /// + /// String representing the registry key that contains the information of this video adapter. + /// + public string VideoAdapterDriverRegistryPath + { + get + { + int i = _adapterInfo.DeviceKey.IndexOf("\\System", StringComparison.OrdinalIgnoreCase); + string deviceRegistryKeyBranch = _adapterInfo.DeviceKey.Substring(i + 1, _adapterInfo.DeviceKey.Length - (i + 1)); + + return deviceRegistryKeyBranch; + } + } + #endregion + + #region [public] (string) VideoAdapterName: Gets a value that represents the name of the video adapter + /// + /// Gets a value that represents the name of the video adapter. + /// + /// + /// String representing the name of the video adapter. + /// + public string VideoAdapterName => _adapterInfo.DeviceString; + #endregion + + #endregion + + #region public override methods + + #region [public] {override} (int) GetHashCode(): Returns a value that represents the hash code of this structure + /// + /// Returns a value that represents the hash code of this structure. + /// + /// + /// Hash code of this structure. + /// + public override int GetHashCode() => _adapterInfo.GetHashCode(); + #endregion + + #region [public] {override} (bool) Equals(object obj): Returns a value that indicates whether this structure is the same as another + /// + /// Returns a value that indicates whether this structure is the same as another. + /// + /// Structure to compare. + /// + /// Result of the equality comparison. + /// + public override bool Equals(object obj) + { + if (obj == null) + { + return false; + } + + if (!(obj is VideoAdapterDeviceInfo)) + { + return false; + } + + var other = (VideoAdapterDeviceInfo)obj; + + return + other.DisplayName.Equals(DisplayName) && + other.VideoAdapterName.Equals(VideoAdapterName) && + other.IsAttached.Equals(IsAttached); + } + #endregion + + #region [public] {override} (string) ToString(): Returns a string that represents the current structure + /// + /// Returns a string that represents the current structure. + /// + /// + /// String representing the current structure. + /// + public override string ToString() => $"{VideoAdapterName}"; + #endregion + + #endregion + } +} diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/DeviceInfo/VideoModeDeviceInfo.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/DeviceInfo/VideoModeDeviceInfo.cs new file mode 100644 index 0000000..90d885c --- /dev/null +++ b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/DeviceInfo/VideoModeDeviceInfo.cs @@ -0,0 +1,206 @@ + +namespace iTin.Core.Hardware.DeviceInfo +{ + using System; + using System.Diagnostics; + using System.Drawing; + + using Core.Interop.Windows.Development.DocumentAndPrinting.Printing.GdiPrint; + + /// + /// La estructura de datos VideoModeInfo contiene información abaout a video mode. + /// + public struct VideoModeDeviceInfo : IEquatable + { + #region private readonly members + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private readonly DEVMODE _modeInfo; + #endregion + + #region private members + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private bool _current; + #endregion + + #region constructor/s + + #region [public] VideoModeDeviceInfo(DEVMODE): Initializes a new instance of the structure + /// + /// Initializes a new instance of the structure. + /// + /// Native video mode information. + public VideoModeDeviceInfo(DEVMODE modeInfo) + { + _current = false; + _modeInfo = modeInfo; + } + #endregion + + #endregion + + #region interfaces + + #region [public] (bool) Equals(VideoModeDeviceInfo): Indicates whether the current structure is the same as another structure of the same type + /// + /// Indicates whether the current structure is the same as another structure of the same type. + /// + /// Structure to be compared with this structure. + /// + /// Returns true if the current structure is equal to the other parameter; otherwise, false. + /// + public bool Equals(VideoModeDeviceInfo other) => other.Equals((object)this); + #endregion + + #endregion + + #region public operators + + #region [public] {static} (bool) operator ==(VideoModeDeviceInfo, VideoModeDeviceInfo): Implements the equality operator (==) + /// + /// Implements the equality operator (==). + /// + /// Left + /// Right + /// + /// Returns true if left is equal to right; false otherwise. + /// + public static bool operator ==(VideoModeDeviceInfo left, VideoModeDeviceInfo right) => left.Equals(right); + #endregion + + #region [public] {static} (bool) operator !=(VideoModeDeviceInfo, VideoModeDeviceInfo): Implements the inequality operator (!=) + /// + /// Implements the inequality operator (!=). + /// + /// Left + /// Right + /// + /// Returns true if left is not equal to right; false otherwise. + /// + public static bool operator !=(VideoModeDeviceInfo left, VideoModeDeviceInfo right) => !left.Equals(right); + #endregion + + #endregion + + #region public properties + + #region [public] (int) BitsPerPixel: Gets the number of bits used to display each pixel + /// + /// Gets the number of bits used to display each pixel. + /// + /// + /// Number of bits used to display each pixel. + /// + public int BitsPerPixel => _modeInfo.dmBitsPerPel; + #endregion + + #region [public] (int) Frequency: Gets a value that represents how often the video driver updates the monitor image + /// + /// Gets a value that represents how often the video driver updates the monitor image. + /// + /// + /// Frequency with which the video controller updates the monitor image. + /// + public int Frequency => _modeInfo.dmDisplayFrequency; + #endregion + + #region [public] (bool) IsCurrent: Gets a value that indicates whether this video mode is the current one + /// + /// Gets a value that indicates whether this video mode is the current one. + /// + /// + /// true if it's the current video mode; false otherwise. + /// + public bool IsCurrent => _current; + #endregion + + #region [public] (Point) Location: Gets a value that represents the coordinate of the first pixel of this video mode + /// + /// Gets a value that represents the coordinate of the first pixel of this video mode. + /// + /// + /// Coordinate of the first pixel of this video mode. + /// + public Point Location => new Point(_modeInfo.dmPosition.X, _modeInfo.dmPosition.Y); + #endregion + + #region [public] (Size) Size: Gets a value that represents the size in pixels of the video mode + /// + /// Gets a value that represents the size in pixels of the video mode. + /// + /// + /// Value representing the size in pixels of the video mode. + /// + public Size Size => new Size(_modeInfo.dmPelsWidth, _modeInfo.dmPelsHeight); + #endregion + + #endregion + + #region public override methods + + #region [public] {override} (int) GetHashCode(): Returns a value that represents the hash code of this structure + /// + /// Returns a value that represents the hash code of this structure. + /// + /// + /// Hash code of this structure. + /// + public override int GetHashCode() => _modeInfo.GetHashCode(); + #endregion + + #region [public] {override} (bool) Equals(object obj): Returns a value that indicates whether this structure is the same as another + /// + /// Returns a value that indicates whether this structure is the same as another. + /// + /// Structure to compare. + /// + /// Result of the equality comparison. + /// + public override bool Equals(object obj) + { + if (obj == null) + { + return false; + } + + if (!(obj is VideoModeDeviceInfo)) + { + return false; + } + + var other = (VideoModeDeviceInfo)obj; + + return + other.Size == Size && + other.BitsPerPixel == BitsPerPixel && + other.Frequency == Frequency; + } + #endregion + + #region [public] {override} (string) ToString(): Returns a string that represents the current structure + /// + /// Returns a string that represents the current structure. + /// + /// + /// String representing the current structure. + /// + public override string ToString() => _modeInfo.ToString(); + #endregion + + #endregion + + #region internal methods + + #region [internal] (void) SetCurrent(bool): Sets this instance as the current one + /// + /// Sets this instance as the current one + /// + /// Indicates if is current. + internal void SetCurrent(bool current) + { + _current = current; + } + #endregion + + #endregion + } +} diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SMBIOS/Firmware.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/ComponentModel/Firmware.cs similarity index 98% rename from src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SMBIOS/Firmware.cs rename to src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/ComponentModel/Firmware.cs index ab3b3eb..28d2b6a 100644 --- a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SMBIOS/Firmware.cs +++ b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/ComponentModel/Firmware.cs @@ -1,5 +1,5 @@  -namespace iTin.Core.Hardware.Interop.Smbios +namespace iTin.Core.Hardware.Interop.ComponentModel { using System; using System.Runtime.InteropServices; diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/ComponentModel/MonitorDeviceEdidInfoNative.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/ComponentModel/MonitorDeviceEdidInfoNative.cs new file mode 100644 index 0000000..7595048 --- /dev/null +++ b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/ComponentModel/MonitorDeviceEdidInfoNative.cs @@ -0,0 +1,146 @@ + +namespace iTin.Core.Hardware.Interop.ComponentModel +{ + using System; + using System.Linq; + + /// + /// The data structure contains the raw EDID information of a system monitor. + /// + internal struct MonitorDeviceEdidInfoNative : IEquatable + { + #region public static properties + public static MonitorDeviceEdidInfoNative NoValid => new MonitorDeviceEdidInfoNative(); + #endregion + + #region public properties + + #region [public] (string) DeviceId: Gets a value that represents the device identifier + /// + /// Gets a value that represents the device identifier. + /// + /// + /// String representing the device identifier. + /// + public string DeviceId { get; internal set; } + #endregion + + #region [public] (bool) IsValid: Gets a value that indicates whether the raw EDID information is valid + /// + /// Gets a value that indicates whether the raw EDID information is valid. + /// + /// + /// Returns true if the raw EDID information is valid; false otherwise. + /// + public bool IsValid { get; internal set; } + #endregion + + #region [public] (byte[]) RawEdid: Gets or sets a value that contains the raw edid information + /// + /// Gets or sets a value that contains the raw EDID information + /// + /// + /// Returns raw EDID information. + /// + public byte[] RawEdid { get; internal set; } + #endregion + + #endregion + + #region interfaces + + #region [public] (bool) Equals(MonitorDeviceEdidInfoNative): Indicates whether the current structure is the same as another structure of the same type + /// + /// Indicates whether the current structure is the same as another structure of the same type. + /// + /// Structure to be compared with this structure. + /// + /// Returns true if the current structure is equal to the other parameter; otherwise, false. + /// + public bool Equals(MonitorDeviceEdidInfoNative other) => other.Equals((object)this); + #endregion + + #endregion + + #region public operators + + #region [public] {static} (bool) operator ==(MonitorDeviceEdidInfoNative, MonitorDeviceEdidInfoNative): Implements the equality operator (==) + /// + /// Implements the equality operator (==). + /// + /// Left + /// Right + /// + /// Returns true if left is equal to right; false otherwise. + /// + public static bool operator ==(MonitorDeviceEdidInfoNative left, MonitorDeviceEdidInfoNative right) => left.Equals(right); + #endregion + + #region [public] {static} (bool) operator !=(MonitorDeviceEdidInfoNative, MonitorDeviceEdidInfoNative): Implements the inequality operator (!=) + /// + /// Implements the inequality operator (!=). + /// + /// Left + /// Right + /// + /// Returns true if left is not equal to right; false otherwise. + /// + public static bool operator !=(MonitorDeviceEdidInfoNative left, MonitorDeviceEdidInfoNative right) => !left.Equals(right); + #endregion + + #endregion + + #region public override methods + + #region [public] {override} (int) GetHashCode(): Returns a value that represents the hash code of this structure + /// + /// Returns a value that represents the hash code of this structure. + /// + /// + /// Hash code of this structure. + /// + public override int GetHashCode() => DeviceId.GetHashCode() ^ IsValid.GetHashCode() ^ RawEdid.GetHashCode(); + #endregion + + #region [public] {override} (bool) Equals(object obj): Returns a value that indicates whether this structure is the same as another + /// + /// Returns a value that indicates whether this structure is the same as another. + /// + /// Structure to compare. + /// + /// Result of the equality comparison. + /// + public override bool Equals(object obj) + { + if (obj == null) + { + return false; + } + + if (!(obj is MonitorDeviceEdidInfoNative)) + { + return false; + } + + var other = (MonitorDeviceEdidInfoNative)obj; + + return + other.DeviceId.Equals(DeviceId) && + other.IsValid.Equals(IsValid) && + other.RawEdid.SequenceEqual(RawEdid); + } + #endregion + + #region [public] {override} (string) ToString(): Returns a string that represents the current structure + /// + /// Returns a string that represents the current structure + /// + /// + /// String representing the current structure. + /// + public override string ToString() => $"{DeviceId}"; + #endregion + + #endregion + } +} diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/ComponentModel/MonitorDeviceInfoNative.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/ComponentModel/MonitorDeviceInfoNative.cs new file mode 100644 index 0000000..5066340 --- /dev/null +++ b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/ComponentModel/MonitorDeviceInfoNative.cs @@ -0,0 +1,251 @@ + +namespace iTin.Core.Hardware.Interop.ComponentModel +{ + using System; + using System.Diagnostics; + using System.Drawing; + + using iTin.Core.Interop.Windows.Development.Graphics.Legacy.Gdi.DeviceContext; + using iTin.Core.Interop.Windows.Development.Graphics.Legacy.Gdi.MultipleDisplayMonitors; + + /// + /// The data structure contains the basic information of a system monitor. + /// + internal struct MonitorDeviceInfoNative : IEquatable + { + #region private readonly members + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private readonly MONITORINFOEX _monitorInfo; + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private readonly DISPLAY_DEVICE _displayInfo; + #endregion + + #region constructor/s + + #region [public] MonitorDeviceInfoNative(MONITORINFOEX, DISPLAY_DEVICE): Initializes a new instance of the structure + /// + /// Initializes a new instance of the structure. + /// + /// Monitor information. + /// Screen information. + public MonitorDeviceInfoNative(MONITORINFOEX monitorInfo, DISPLAY_DEVICE displayInfo) + { + _monitorInfo = monitorInfo; + _displayInfo = displayInfo; + } + #endregion + + #endregion + + #region interfaces + + #region [public] (bool) Equals(MonitorDeviceInfoNative): Indicates whether the current structure is the same as another structure of the same type + /// + /// Indicates whether the current structure is the same as another structure of the same type. + /// + /// Structure to be compared with this structure. + /// + /// Returns true if the current structure is equal to the other parameter; otherwise, false. + /// + public bool Equals(MonitorDeviceInfoNative other) => other.Equals((object)this); + #endregion + + #endregion + + #region public operators + + #region [public] {static} (bool) operator ==(MonitorDeviceInfoNative, MonitorDeviceInfoNative): Implements the equality operator (==) + /// + /// Implements the equality operator (==). + /// + /// Left + /// Right + /// + /// Returns true if left is equal to right; false otherwise. + /// + public static bool operator ==(MonitorDeviceInfoNative left, MonitorDeviceInfoNative right) => left.Equals(right); + #endregion + + #region [public] {static} (bool) operator !=(MonitorDeviceInfoNative, MonitorDeviceInfoNative): Implements the inequality operator (!=) + /// + /// Implements the inequality operator (!=). + /// + /// Left + /// Right + /// + /// Returns true if left is not equal to right; false otherwise. + /// + public static bool operator !=(MonitorDeviceInfoNative left, MonitorDeviceInfoNative right) => !left.Equals(right); + #endregion + + #endregion + + #region public properties + + #region [public] (string) DeviceId: Gets a value that represents the device identifier + /// + /// Gets a value that represents the device identifier. + /// + /// + /// String representing the device identifier. + /// + public string DeviceId => _displayInfo.DeviceID; + #endregion + + #region [public] (string) DisplayName: Get a value that represents the name of the screen that contains this monitor + /// + /// Get a value that represents the name of the screen that contains this monitor. + /// + /// + /// String representing the name of the screen that contains this monitor. + /// + public string DisplayName => _monitorInfo.DeviceName; + #endregion + + #region [public] (bool) IsAttached: Gets a value that indicates whether the monitor is part of the desktop + /// + /// Gets a value that indicates whether the monitor is part of the desktop. + /// + /// + /// Returns true if it is part of the desktop; false otherwise. + /// + public bool IsAttached + { + get + { + var flags = _displayInfo.State; + return (flags & DISPLAY_DEVICE.KnownDisplayDeviceStates.AttachedToDesktop) == DISPLAY_DEVICE.KnownDisplayDeviceStates.AttachedToDesktop; + } + } + #endregion + + #region [public] (bool) IsPrimaryMonitor: Gets a value that indicates whether the monitor is the main monitor + /// + /// Gets a value that indicates whether the monitor is the main monitor. + /// + /// + /// Returns true if it is the main monitor; false otherwise. + /// + public bool IsPrimaryMonitor + { + get + { + var flags = _monitorInfo.Flags; + return (flags & MONITORINFOEX.MONITORINFOF_PRIMARY) == MONITORINFOEX.MONITORINFOF_PRIMARY; + } + } + #endregion + + #region [public] (Rectangle) MonitorArea: Gets a value that represents the total area of the monitor + /// + /// Gets a value that represents the total area of the monitor. + /// + /// + /// Rectangle of the monitor screen, expressed in virtual screen coordinates. + /// + /// + /// Note that if the monitor is not the monitor of the main screen, some of the coordinates of the rectangle may be negative values. + /// + public Rectangle MonitorArea => _monitorInfo.Monitor; + #endregion + + #region [public] (string) MonitorDriverRegistryPath: Gets a value that represents the registry key that contains the information on this monitor + /// + /// Gets a value that represents the registry key that contains the information on this monitor. + /// + /// + /// String representing the registry key that contains the information on this monitor. + /// + public string MonitorDriverRegistryPath + { + get + { + var i = _displayInfo.DeviceKey.IndexOf("\\System", StringComparison.OrdinalIgnoreCase); + var deviceRegistryKeyBranch = _displayInfo.DeviceKey.Substring((i + 1), _displayInfo.DeviceKey.Length - (i + 1)); + + return deviceRegistryKeyBranch; + } + } + #endregion + + #region [public] (string) MonitorName: Gets a value that represents the name of the monitor + /// + /// Gets a value that represents the name of the monitor. + /// + /// + /// String representing the name of the monitor. + /// + public string MonitorName => _displayInfo.DeviceString; + #endregion + + #region [public] (Rectangle) MonitorWorkingArea: Gets a value that represents the usable surface of the monitor + /// + /// Gets a value that represents the usable surface of the monitor. + /// + /// + /// Usable monitor rectangle, taskbar and sidebars are excluded. + /// + /// + /// Note that if the monitor is not the monitor of the main screen, some of the coordinates of the rectangle may be negative values. + /// + public Rectangle MonitorWorkingArea => _monitorInfo.WorkArea; + #endregion + + #endregion + + #region public override methods + + #region [public] {override} (int) GetHashCode(): Returns a value that represents the hash code of this structure + /// + /// Returns a value that represents the hash code of this structure. + /// + /// + /// Hash code of this structure. + /// + public override int GetHashCode() => _displayInfo.GetHashCode() ^ _monitorInfo.GetHashCode(); + #endregion + + #region [public] {override} (bool) Equals(object obj): Returns a value that indicates whether this structure is the same as another + /// + /// Returns a value that indicates whether this structure is the same as another. + /// + /// Structure to compare. + /// + /// Result of the equality comparison. + /// + public override bool Equals(object obj) + { + if (obj == null) + { + return false; + } + + if (!(obj is MonitorDeviceInfoNative)) + { + return false; + } + + var other = (MonitorDeviceInfoNative)obj; + + return + other.DisplayName.Equals(DisplayName) && + other.MonitorName.Equals(MonitorName) && + other.IsAttached.Equals(IsAttached) && + other.IsPrimaryMonitor.Equals(IsPrimaryMonitor); + } + #endregion + + #region [public] {override} (string) ToString(): Devuelve una cadena que representa a la estructura actual. + /// + /// Returns a string that represents the current structure. + /// + /// + /// String representing the current structure. + /// + public override string ToString() => $"{MonitorName}"; + #endregion + + #endregion + } +} diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/EDID/SafeNativeMethods.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/EDID/SafeNativeMethods.cs deleted file mode 100644 index 3f2ba44..0000000 --- a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/EDID/SafeNativeMethods.cs +++ /dev/null @@ -1,162 +0,0 @@ - -namespace iTin.Core.Hardware.Interop.Edid -{ - using System; - using System.Runtime.InteropServices; - using System.Text; - - using iTin.Core.Interop.Windows.Development.DeviceAndDriverInstallation.SetupApi; - - /// - /// Safe natice methods for handle EDID. - /// - public static class SafeNativeMethods - { - public static void EnumMonitorDevices() - { - uint enumerator = 0; - Guid GUID_DEVCLASS_MONITOR = new Guid("{0x4d36e96e, 0xe325, 0x11ce, {0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18}}"); - - bool success = true; - while (success) - { - IntPtr devInfo = - NativeMethods.SetupDiGetClassDevsEx( - ref GUID_DEVCLASS_MONITOR, // class GUID - enumerator, // enumerator - IntPtr.Zero, // HWND - DiGetClassFlags.DIGCF_PRESENT, // Flags - IntPtr.Zero, // device info, create a new one - null, // machine name, local machine - IntPtr.Zero); - - SP_DEVINFO_DATA devInfoData = SP_DEVINFO_DATA.Empty; - var ok = NativeMethods.SetupDiEnumDeviceInfo(devInfo, 0, ref devInfoData); - if (!ok) - { - success = false; - } - - if (success) - { - PlayWithDeviceInfo(devInfo, devInfoData); - } - - enumerator++; - } - } - - public static void PlayWithDeviceInfo(IntPtr devInfo, SP_DEVINFO_DATA devInfoData) - { - UInt32 regType; - UInt32 requiredSize; - byte[] buffer = new byte[123]; - - // build a DevInfo Data structure - SP_DEVINFO_DATA da = new SP_DEVINFO_DATA(); - da.cbSize = (uint)Marshal.SizeOf(da); - - bool success = - NativeMethods.SetupDiGetDeviceRegistryProperty( - devInfo, - ref devInfoData, - NativeMethods.KnownSetupDiGetDeviceRegistryProperty.SPDRP_DEVICEDESC, - out regType, - buffer, - 124, - out requiredSize); - if (!success) - { - return; - } - - string deviceDescription = Encoding.Unicode.GetString(buffer); - - IntPtr key = - NativeMethods.SetupDiOpenDevRegKey( - devInfo, - ref devInfoData, - 0x00000001, - 0, - 0x00000001, - 0x00000001); - - int i = 0; - } - } -} - -//if ( -// SetupDiGetDeviceRegistryProperty( -// devInfo, -// devInfoData, -// SPDRP_DEVICEDESC, -// //SPDRP_UI_NUMBER, -// NULL, -// (PBYTE)(&uniID), -// sizeof(uniID), -// NULL)) -//{ -// printf("UID: %s\n", uniID); -//} -//else -//{ -// printf("ERROR: %d\n", GetLastError()); -//} - -//hDevRegKey = SetupDiOpenDevRegKey( -// devInfo, -// devInfoData, -// DICS_FLAG_GLOBAL, -// 0, -// DIREG_DEV, -// KEY_ALL_ACCESS); - -//if (hDevRegKey) -//{ -// LONG retValue, i; -// DWORD dwType, AcutalValueNameLength = NAME_SIZE; - -// CHAR valueName[NAME_SIZE]; - -// for (i = 0, retValue = ERROR_SUCCESS; retValue != ERROR_NO_MORE_ITEMS; i++) -// { -// unsigned char EDIDdata[1024]; -// DWORD j, edidsize = sizeof(EDIDdata); - -// retValue = RegEnumValue( -// hDevRegKey, -// i, -// &valueName[0], -// &AcutalValueNameLength, -// NULL,//reserved -// &dwType, -// EDIDdata, // buffer -// &edidsize); // buffer size - -// if (retValue == ERROR_SUCCESS) -// { -// if (!strcmp(valueName, "EDID")) -// { -// printf("Found value EDID\n"); -// { - -// for (j = 0; j < edidsize; j++) -// { -// if (j % 16 == 0) printf("\n"); -// printf("%02x ", EDIDdata[j]); -// } -// printf("\n"); -// } - -// break; -// } -// } -// } - -// RegCloseKey(hDevRegKey); -//} -//else -//{ -// printf("ERROR:%d\n", GetLastError()); -//} diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SMBIOS/FirmwareProvider.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/Enums/FirmwareProvider.cs similarity index 85% rename from src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SMBIOS/FirmwareProvider.cs rename to src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/Enums/FirmwareProvider.cs index 86fb516..0633be9 100644 --- a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SMBIOS/FirmwareProvider.cs +++ b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/Enums/FirmwareProvider.cs @@ -1,5 +1,5 @@  -namespace iTin.Core.Hardware.Interop.Smbios +namespace iTin.Core.Hardware.Interop { /// /// Defines firmware tables diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/CPUID/SafeNativeMethods.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SafeCpuidNativeMethods.cs similarity index 94% rename from src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/CPUID/SafeNativeMethods.cs rename to src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SafeCpuidNativeMethods.cs index 917d882..afe609f 100644 --- a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/CPUID/SafeNativeMethods.cs +++ b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SafeCpuidNativeMethods.cs @@ -1,12 +1,12 @@  -namespace iTin.Core.Hardware.Interop.Cpuid +namespace iTin.Core.Hardware.Interop { using iTin.Core.Interop.Windows.Development.Hardware.uProcessor.CPUID; /// /// Methods for handle CPUID microprocessor features. /// - public static class SafeNativeMethods + public static class SafeCpuidNativeMethods { /// /// Call CPUID with the specified function. diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SafeDesktopNativeMethods.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SafeDesktopNativeMethods.cs new file mode 100644 index 0000000..06cda5d --- /dev/null +++ b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SafeDesktopNativeMethods.cs @@ -0,0 +1,99 @@ + +namespace iTin.Core.Hardware.Interop +{ + using System; + using System.Drawing; + + using iTin.Core.Interop.Windows; + + using DeviceInfo; + + using Gdi = Core.Interop.Windows.Development.Graphics.Legacy.Gdi; + using GdiPrint = Core.Interop.Windows.Development.DocumentAndPrinting.Printing.GdiPrint; + using UserInterfaceConfiguration = Core.Interop.Windows.Development.UI.WindowsAndMessages.Configuration; + + /// + /// Defines a set of safe desktop native methods. + /// + public static class SafeDesktopNativeMethods + { + #region public static members + + #region [public] {static} (DesktopDeviceInfo) GetDesktopInfoFromMonitor(MonitorDeviceInfo): Gets the desktop information associated with the specified monitor + /// + /// Gets the desktop information associated with the specified monitor. + /// + /// Monitor information. + /// + /// Returns a structure that contains the desktop information associated with the specified monitor. + /// + public static DesktopDeviceInfo GetDesktopInfoFromMonitor(MonitorDeviceInfo monitorDevice) => GetDesktopInfoFromDisplay(monitorDevice.DisplayName); + #endregion + + #region [public] {static} (DesktopDeviceInfo) GetDesktopInfoFromDisplay(string): Get the desktop information associated with the specified screen. + /// + /// Get the desktop information associated with the specified screen. + /// + /// Device identifier. + /// + /// Returns a structure that contains the desktop information associated with the specified screen. + /// + public static DesktopDeviceInfo GetDesktopInfoFromDisplay(string displayName) + { + var emptyDevMode = GdiPrint.DEVMODE.Empty; + + return PopulatesDesktopInfo( + displayName, + Gdi.DeviceContext.NativeMethods.CreateDC( + displayName, + null, + null, ref emptyDevMode)); + } + #endregion + + #endregion + + #region private static members + + private static string GetDesktopWallPaper() + { + var result = string.Empty; + + var currentWallpaper = new string('\0', Constants.MAX_PATH); + bool success = + UserInterfaceConfiguration.NativeMethods.SystemParametersInfo( + UserInterfaceConfiguration.NativeMethods.SPI.GetDeskWallPaper, + (uint) currentWallpaper.Length, currentWallpaper, + UserInterfaceConfiguration.NativeMethods.SPIF.Zero); + if (success) + { + result = currentWallpaper.Substring(0, currentWallpaper.IndexOf('\0')); + } + + return result; + } + + private static DesktopDeviceInfo PopulatesDesktopInfo(string displayName, IntPtr dc) + { + var desktopInfo = new DesktopDeviceInfo + { + DeviceName = displayName, + ColorDepth = Gdi.DeviceContext.NativeMethods.GetDeviceCaps(dc, Gdi.DeviceContext.NativeMethods.DeviceCap.BITSPIXEL), + ColorPlanes = Gdi.DeviceContext.NativeMethods.GetDeviceCaps(dc, Gdi.DeviceContext.NativeMethods.DeviceCap.PLANES), + FontResolution = new Size(Gdi.DeviceContext.NativeMethods.GetDeviceCaps(dc, Gdi.DeviceContext.NativeMethods.DeviceCap.LOGPIXELSX), Gdi.DeviceContext.NativeMethods.GetDeviceCaps(dc, Gdi.DeviceContext.NativeMethods.DeviceCap.LOGPIXELSY)), + PixelDiagonal = Gdi.DeviceContext.NativeMethods.GetDeviceCaps(dc, Gdi.DeviceContext.NativeMethods.DeviceCap.ASPECTXY), + PixelSize = new Size(Gdi.DeviceContext.NativeMethods.GetDeviceCaps(dc, Gdi.DeviceContext.NativeMethods.DeviceCap.ASPECTX), Gdi.DeviceContext.NativeMethods.GetDeviceCaps(dc, Gdi.DeviceContext.NativeMethods.DeviceCap.ASPECTY)), + Resolution = new Size(Gdi.DeviceContext.NativeMethods.GetDeviceCaps(dc, Gdi.DeviceContext.NativeMethods.DeviceCap.DESKTOPHORZRES), Gdi.DeviceContext.NativeMethods.GetDeviceCaps(dc, Gdi.DeviceContext.NativeMethods.DeviceCap.DESKTOPVERTRES)), + Technology = (DesktopDeviceInfo.Technologies)Gdi.DeviceContext.NativeMethods.GetDeviceCaps(dc, Gdi.DeviceContext.NativeMethods.DeviceCap.TECHNOLOGY), + VerticalRefreshRate = Gdi.DeviceContext.NativeMethods.GetDeviceCaps(dc, Gdi.DeviceContext.NativeMethods.DeviceCap.VREFRESH), + DesktopWallpaper = GetDesktopWallPaper() + }; + + Gdi.DeviceContext.NativeMethods.DeleteDC(dc); + + return desktopInfo; + } + + #endregion + } +} diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SafeDiskManagementNativeMethods.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SafeDiskManagementNativeMethods.cs new file mode 100644 index 0000000..ebf2f6d --- /dev/null +++ b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SafeDiskManagementNativeMethods.cs @@ -0,0 +1,421 @@ + +namespace iTin.Core.Hardware.Interop +{ + using System; + using System.Collections.Generic; + using System.ComponentModel; + using System.IO; + using System.Runtime.InteropServices; + using System.Text; + + using iTin.Core.Interop.Windows; + using iTin.Core.Interop.Windows.Development.Storage.LocalFileSystems.DiskManagement; + using iTin.Core.Interop.Windows.Hardware.DriverKit.Storage; + using iTin.Core.Interop.Windows.Hardware.DriverKit.Storage.Ata; + using iTin.Core.Interop.Windows.Hardware.DriverKit.Storage.Ide; + + using Microsoft.Win32.SafeHandles; + + using DeviceManagement = Core.Interop.Windows.Development.Devices.DeviceManagement; + using FileManagement = Core.Interop.Windows.Development.Storage.LocalFileSystems.FileManagement; + using VolumeManagement = Core.Interop.Windows.Development.Storage.LocalFileSystems.VolumeManagement; + + /// + /// Defines a set of Safe monitor native methods. + /// + public static class SafeDiskManagementNativeMethods + { + #region public static methods + + #region [public] {static} (DISK_GEOMETRY) GetDiskGeometry(string): Retrieves information about the geometry of the physical disk: type, number of cylinders, tracks per cylinder, sectors per track and bytes per sector + /// + /// Retrieves information about the geometry of the physical disk: type, number of cylinders, tracks per cylinder, sectors per track and bytes per sector. + /// + /// Physical unit to check. + /// + /// Structure with the physical geometry information of the specified unit. + /// + public static DISK_GEOMETRY GetDiskGeometry(string phisycalDrive) + { + using (var hDevice = FileManagement.NativeMethods.CreateFile(phisycalDrive, 0, FileShare.ReadWrite, IntPtr.Zero, FileMode.Open, FileOptions.None, IntPtr.Zero)) + { + if (hDevice.IsInvalid) + { + return DISK_GEOMETRY.Empty; + } + + // Reservar memoria para la estructura. + var diskGeometryStructurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(DISK_GEOMETRY))); + + // Obtener información. + uint bytesReturned = 0; + var ok = DeviceManagement.NativeMethods.DeviceIoControl( + hDevice, + DeviceControlCode.IOCTL_DISK_GET_DRIVE_GEOMETRY, IntPtr.Zero, 0, + diskGeometryStructurePointer, (uint) Marshal.SizeOf(typeof(DISK_GEOMETRY)), ref bytesReturned, + IntPtr.Zero); + + if (!ok) + { + return DISK_GEOMETRY.Empty; + } + + // Asignar valor a la estructura. + var diskGeometryStrucutreValue = (DISK_GEOMETRY)Marshal.PtrToStructure(diskGeometryStructurePointer, typeof(DISK_GEOMETRY)); + + return diskGeometryStrucutreValue; + } + } + #endregion + + #region [public] {static} (IEnumerable) GetDiskPartitions(string): Retrieve the information for each entry in the partition tables of a disk + /// + /// Retrieve the information for each entry in the partition tables of a disk. + /// + /// Physical unit to check. + /// + /// Array of structures with the partition information of the specified drive. + /// + public static PARTITION_INFORMATION_EX[] GetDiskPartitions(string phisycalDrive) + { + var partitions = new List(); + + using (var hDevice = FileManagement.NativeMethods.CreateFile(phisycalDrive, 0x00, FileShare.ReadWrite, IntPtr.Zero, FileMode.Open, FileOptions.None, IntPtr.Zero)) + { + if (hDevice.IsInvalid) + { + throw new Win32Exception("Must run as administrator, otherwise we get ACCESS DENIED"); + } + + var done = false; + var numPartitions = 1; + while (!done) + { + // Creación dinámica del buffer de salida. (Array de estructuras PARTITION_INFORMATION_EX). + // Tamaño de la estructura DRIVE_LAYOUT_INFORMATION_EX (0x30), en el byte 0x31 comienza el Array de estructuras PARTITION_INFORMATION_EX(0x90). + // Por tanto vamos aumentando el buffer de salida (que contiene el array de estructuras PARTITION_INFORMATION_EX) en uno hasta que la función DeviceIoControl + // devuelva como resultado true(indica que ha recuperado correctamente el array de estructuras). + var outBufferSize = 0x30 + (numPartitions * 0x90); + + // Reservar memoria para la estructura. + var driveLayoutInformationStructurePointer = Marshal.AllocHGlobal(outBufferSize); + + // Obtener información. + uint bytesReturned = 0; + var result = DeviceManagement.NativeMethods.DeviceIoControl( + hDevice, + IoctlDiskControlCode.IOCTL_DISK_GET_DRIVE_LAYOUT_EX, + IntPtr.Zero, + 0x00, + driveLayoutInformationStructurePointer, + (uint) outBufferSize, + ref bytesReturned, + IntPtr.Zero); + + // Si es falso aumentamos el buffer en 1 estructura PARTITION_INFORMATION_EX. + if (result == false) + { + // If the buffer wasn't too small, then something else went wrong. + if (Marshal.GetLastWin32Error() != Win32ErrorCode.ERROR_INSUFFICIENT_BUFFER) + { + throw new Win32Exception(); + } + + numPartitions++; + } + else + { + // Ok, salimos del while. + done = true; + + // Asignar valor a la estructura contenedora. + var driveLayoutInformationStructureValue = (DRIVE_LAYOUT_INFORMATION_EX)Marshal.PtrToStructure(driveLayoutInformationStructurePointer, typeof(DRIVE_LAYOUT_INFORMATION_EX)); + + // Obtenemos las estructuras PARTITION_INFORMATION_EX contenidas en la estructura DRIVE_LAYOUT_INFORMATION_EX. + for (var i = 0; i < driveLayoutInformationStructureValue.PartitionCount - 1; i++) + { + // Calcular el inicio de cada estructura PARTITION_INFORMATION_EX. + var offset = new IntPtr(driveLayoutInformationStructurePointer.ToInt64() + 48 + (i * 144)); + + // Asignar valor a la estructura. + var partitionInformationStructureValue = (PARTITION_INFORMATION_EX)Marshal.PtrToStructure(offset, typeof(PARTITION_INFORMATION_EX)); + + // Añadir a la lista de estructuras. + partitions.Add(partitionInformationStructureValue); + } + } + } + } + + return (PARTITION_INFORMATION_EX[])partitions.ToArray().Clone(); + } + #endregion + + #region [public] {static} (GETVERSIONINPARAMS) IsSmartSupported(string): Recupera información acerca de la geometría del disco físico: tipo, número de cilindros, pistas por cilindro, sectores por pista y bytes por sector. + /// + /// Recupera información acerca de la geometría del disco físico: tipo, número de cilindros, pistas por cilindro, sectores por pista y bytes por sector. + /// + /// Unidad física a comprobar. + /// + /// Estructura con la información de geometría física de la unidad especificada. + /// + public static GETVERSIONINPARAMS IsSmartSupported(string phisycalDrive) + { + using (var hDevice = FileManagement.NativeMethods.CreateFile(phisycalDrive, FileAccess.ReadWrite, FileShare.ReadWrite | FileShare.Delete, IntPtr.Zero, FileMode.Open, FileOptions.None, IntPtr.Zero)) + { + if (hDevice.IsInvalid) + { + return GETVERSIONINPARAMS.Empty; + } + + // Reservar memoria para la estructura. + var diskGeometryStructurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(GETVERSIONINPARAMS))); + + // Obtener información. + uint bytesReturned = 0; + var ok = DeviceManagement.NativeMethods.DeviceIoControl(hDevice, DeviceControlCode.SMART_GET_VERSION, IntPtr.Zero, 0, diskGeometryStructurePointer, (uint)Marshal.SizeOf(typeof(GETVERSIONINPARAMS)), ref bytesReturned, IntPtr.Zero); + + if (!ok) + { + return GETVERSIONINPARAMS.Empty; + } + + // Asignar valor a la estructura. + var diskGeometryStrucutreValue = (GETVERSIONINPARAMS)Marshal.PtrToStructure(diskGeometryStructurePointer, typeof(GETVERSIONINPARAMS)); + + return diskGeometryStrucutreValue; + } + } + #endregion + + public static string GetDriveName(string drive) + { + // receives volume name of drive + StringBuilder volname = new StringBuilder(Constants.MAX_PATH + 1); + StringBuilder sysname = new StringBuilder(Constants.MAX_PATH + 1); + + uint sn; + uint maxcomplen; + VolumeManagement.NativeMethods.FileSystemFlags sysflags; + var retval = VolumeManagement.NativeMethods.GetVolumeInformation(drive, volname, 256, out sn, out maxcomplen, out sysflags, sysname, 261); + + return retval ? volname.ToString() : string.Empty; + } + + public static string[] GetPhysicalDrives() + { + var drives = new List(); + for (int i = 0; ; i++) + { + // Attempt to obtain a handle to the device that is to perform the operation, in this + // case physical drive n.The first drive is 0, second drive is 1 etc. + // hDevice will return INVALID_HANDLE_VALUE when no more physical drives are located. + using (SafeFileHandle h = FileManagement.NativeMethods.CreateFile(string.Concat("\\\\.\\PHYSICALDRIVE", i), 0x00, FileShare.ReadWrite, IntPtr.Zero, FileMode.Open, FileOptions.None, IntPtr.Zero)) + { + // If a valid handle, pass that to o btain the physical disk geometry + if (h.IsInvalid) + { + break; + } + + drives.Add(string.Concat("\\\\.\\PHYSICALDRIVE", i)); + } + } + + return (string[])drives.ToArray().Clone(); + } + + public static bool ReadPhysicalDriveInNtUsingSmart() + { + bool done = false; + + for (int drive = 0; drive < 16; drive++) + { + // Try to get a handle to PhysicalDrive IOCTL, report failure + // and exit if can't. + string driveName = String.Concat("\\\\.\\PhysicalDrive", drive); + + // Windows NT, Windows 2000, Windows Server 2003, Vista + var hPhysicalDriveIoctl = OpenDisk(drive); + + //FileManagementNativeMethods.CreateFile(driveName, + // FileAccess.ReadWrite, + // FileShare.Delete | FileShare.ReadWrite, + // IntPtr.Zero, + // FileMode.Open, + // FileOptions.None, + // IntPtr.Zero); + if (!hPhysicalDriveIoctl.IsInvalid) + { + // Reservar memoria para la estructura. + var getVersionParamsStructurePointer = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(GETVERSIONINPARAMS))); + uint cbBytesReturned = 0; + var fgfg = DeviceManagement.NativeMethods.DeviceIoControl(hPhysicalDriveIoctl, + DiskIoControlCode.SMART_GET_VERSION, + IntPtr.Zero, + 0, + getVersionParamsStructurePointer, + (uint) Marshal.SizeOf(typeof(GETVERSIONINPARAMS)), + ref cbBytesReturned, + IntPtr.Zero); + + if (fgfg) + { + // Asignar valor a la estructura. + var getVersionParamsStructureValue = (GETVERSIONINPARAMS)Marshal.PtrToStructure(getVersionParamsStructurePointer, typeof(GETVERSIONINPARAMS)); + var deviceLocation = getVersionParamsStructureValue.DeviceLocation; + + + const byte ID_CMD = 0xEC; // Returns ID sector for ATA + const Int32 IDENTIFY_BUFFER_SIZE = 512; + uint iBytesReturned = 0; + var sci = new SENDCMDINPARAMS + { + irDriveRegs = { bCommandReg = ID_CMD }, + bDriveNumber = (byte)0, + cBufferSize = IDENTIFY_BUFFER_SIZE + }; + + var hhhhhh = (uint)Marshal.SizeOf(typeof(IDENTIFY_DEVICE_DATA)); + var sciPointer = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(SENDCMDINPARAMS))); + var scoPointer = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(SENDCMDOUTPARAMS))); + Marshal.StructureToPtr(sci, sciPointer, true); + + var hhhh = DeviceManagement.NativeMethods.DeviceIoControl( + hPhysicalDriveIoctl, + DiskIoControlCode.SMART_RCV_DRIVE_DATA, + sciPointer, + (uint) Marshal.SizeOf(typeof(SENDCMDINPARAMS)), + scoPointer, + (uint) Marshal.SizeOf(typeof(SENDCMDOUTPARAMS)), + ref iBytesReturned, + IntPtr.Zero); + var scoPointerValue = (SENDCMDOUTPARAMS)Marshal.PtrToStructure(scoPointer, typeof(SENDCMDOUTPARAMS)); + + var bdb = Marshal.SizeOf(typeof(IDENTIFY_DEVICE_DATA)); + + var IdentifyDeviceDataPointer = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IDENTIFY_DEVICE_DATA))); + Marshal.Copy(scoPointerValue.bBuffer, 0, IdentifyDeviceDataPointer, 512); + var identifyDeviceDataValue = (IDENTIFY_DEVICE_DATA)Marshal.PtrToStructure(IdentifyDeviceDataPointer, typeof(IDENTIFY_DEVICE_DATA)); + + var fff = identifyDeviceDataValue.GetSupportedFeature(IDENTIFY_DEVICE_DATA.StateFeature.Bit48Lba); + + //var modelNumber = identifyDeviceDataValue.ModelNumber; + + //byte[] mnArray = new byte[identifyDeviceDataValue.ModelNumber.Length]; + //Array.Copy(.ModelNumber, 0, mnArray, 0, identifyDeviceDataValue.ModelNumber.Length - 1); + //mnArray.SwapBytes(); + //var modelNumber = new StringBuilder(); + //modelNumber.Append(Encoding.ASCII.GetString(mnArray, 0, mnArray.Length)); + + //byte[] snArray1 = new byte[identifyDeviceDataValue.ModelNumber.Length]; + //Array.Copy(identifyDeviceDataValue.ModelNumber, 0, snArray1, 0, identifyDeviceDataValue.ModelNumber.Length - 1); + //snArray1.SwapBytes(); + //var snResult1 = new StringBuilder(); + //snResult1.Append(Encoding.ASCII.GetString(snArray1, 0, snArray1.Length)); + + //byte[] snArray = new byte[identifyDeviceDataValue.FirmwareRevision.Length]; + //Array.Copy(identifyDeviceDataValue.FirmwareRevision, 0, snArray, 0, identifyDeviceDataValue.FirmwareRevision.Length - 1); + //snArray.SwapBytes(); + //var snResult = new StringBuilder(); + //snResult.Append(Encoding.ASCII.GetString(snArray, 0, snArray.Length)); + + int aaa = 0; + aaa++; + } + } + } + + return done; + } + + #endregion + + #region private static methods + + private static Win32Exception CreateWin32Exception(int errorCode, string context) + { + var win32Exception = new Win32Exception(errorCode); + win32Exception.Data["Context"] = context; + return win32Exception; + } + + public static SafeFileHandle OpenDisk(int diskNumber) + { + SafeFileHandle hDevice = FileManagement.NativeMethods.CreateFile(string.Format(@"\\.\PhysicalDrive{0}", diskNumber), FileAccess.ReadWrite, FileShare.ReadWrite, IntPtr.Zero, FileMode.Open, FileOptions.None, IntPtr.Zero); + if (!hDevice.IsInvalid) + { + return hDevice; + } + + throw CreateWin32Exception(Marshal.GetLastWin32Error(), "CreateFile"); + } + + public static bool ReadPhysicalDriveInNtUsingSmart2(int drive) + { + using (var hDisk = OpenDisk(drive)) + { + ATA_PASS_THROUGH_EX apex = new ATA_PASS_THROUGH_EX(); + apex.Length = (ushort)Marshal.SizeOf(apex); + apex.AtaFlags = AtaFlags.ReceiveData; // 2 ATA_FLAGS_DATA_IN + apex.DataTransferLength = 512; // The command returns a 512 byte package of info. + apex.TimeOutValue = 10; // 10 second timeout. + + apex.DataBufferOffset = Marshal.OffsetOf(typeof(ATA_PASS_THROUGH_EX_WITH_BUFFER), "Data"); + apex.CurrentTaskFile = new ATA_TASK_FILE(); // This contains the command we are requesting. + apex.CurrentTaskFile = new ATA_TASK_FILE(AtaCommand.IdentifyDevice); // &HEC <-- the command "IDENTIFY DEVICE" + //uint inBufferSize = (uint)Marshal.SizeOf(typeof(ATA_PASS_THROUGH_EX)) + apex.DataTransferLength; + + var apexb = new ATA_PASS_THROUGH_EX_WITH_BUFFER { Apt = apex }; + uint inBufferSize = (uint)Marshal.SizeOf(typeof(ATA_PASS_THROUGH_EX_WITH_BUFFER)); + + //var sciPointer = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(SENDCMDINPARAMS))); + + var apexHandle = Marshal.AllocHGlobal((int)inBufferSize); + Marshal.StructureToPtr(apexb, apexHandle, true); + + uint bytesReturned = 0; + var result = DeviceManagement.NativeMethods.DeviceIoControl(hDisk, IdeIoControlCode.IOCTL_ATA_PASS_THROUGH, apexHandle, inBufferSize, apexHandle, inBufferSize, ref bytesReturned, IntPtr.Zero); + var apexValue = (ATA_PASS_THROUGH_EX_WITH_BUFFER)Marshal.PtrToStructure(apexHandle, typeof(ATA_PASS_THROUGH_EX_WITH_BUFFER)); + var sddd = result; + var i = 0; + i++; + + + IDENTIFY_DEVICE_DATA idd = new IDENTIFY_DEVICE_DATA(); + var iddHandle = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IDENTIFY_DEVICE_DATA))); + //Marshal.StructureToPtr(idd, iddHandle, true); + + ATA_PASS_THROUGH_DIRECT aptd = new ATA_PASS_THROUGH_DIRECT(); + aptd.Length = (ushort)Marshal.SizeOf(typeof(ATA_PASS_THROUGH_DIRECT)); //(ushort)Marshal.SizeOf(aptd); + aptd.AtaFlags = AtaFlags.ReceiveData; // 2 ATA_FLAGS_DATA_IN + aptd.DataTransferLength = 512; // The command returns a 512 byte package of info. + aptd.TimeOutValue = 10; // 10 second timeout. + aptd.CurrentTaskFile = new ATA_TASK_FILE(); // This contains the command we are requesting. + aptd.CurrentTaskFile = new ATA_TASK_FILE(AtaCommand.IdentifyDevice); // &HEC <-- the command "IDENTIFY DEVICE" + aptd.DataBuffer = iddHandle; + + + var apedHandle = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(ATA_PASS_THROUGH_DIRECT))); + Marshal.StructureToPtr(aptd, apedHandle, true); + + uint bytesReturned2 = 0; + var result2 = DeviceManagement.NativeMethods.DeviceIoControl(hDisk, IdeIoControlCode.IOCTL_ATA_PASS_THROUGH_DIRECT, apedHandle, aptd.Length, apedHandle, aptd.Length, ref bytesReturned2, IntPtr.Zero); + + var jkjk = aptd.DataBuffer; + var apedValue = (IDENTIFY_DEVICE_DATA)Marshal.PtrToStructure(jkjk, typeof(IDENTIFY_DEVICE_DATA)); + var ddd = apedValue.ModelNumber; + + var jhh = new byte[512]; + Marshal.Copy(aptd.DataBuffer, jhh, 0, 511); + //var apedValue = (IDENTIFY_DEVICE_DATA)Marshal..PtrToStructure(aptd.DataBuffer, typeof(IDENTIFY_DEVICE_DATA)); + var jj = result2; + i++; + } + + return true; + } + + #endregion + } +} diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SafeMonitorNativeMethods.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SafeMonitorNativeMethods.cs new file mode 100644 index 0000000..2b3cfa2 --- /dev/null +++ b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SafeMonitorNativeMethods.cs @@ -0,0 +1,222 @@ + +namespace iTin.Core.Hardware.Interop +{ + using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Diagnostics; + using System.Linq; + using System.Runtime.InteropServices; + using System.Text; + + using iTin.Core.Interop.Windows; + + using ComponentModel; + using DeviceInfo; + + using Gdi = Core.Interop.Windows.Development.Graphics.Legacy.Gdi; + using Registry = Core.Interop.Windows.Development.Registry; + using SetupApi = Core.Interop.Windows.Development.DeviceAndDriverInstallation.SetupApi; + + /// + /// Defines a set of Safe monitor native methods. + /// + public static class SafeMonitorNativeMethods + { + #region private readonly members + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private static readonly IList Monitors = new List(); + #endregion + + #region public static members + + #region [public] {static} (IEnumerable) EnumerateMonitorDevices(): Returns an array with the information of the system monitors + /// + /// Returns an array with the information of the system monitors. + /// + /// + /// Returns an of structures which contains the information of the system monitors. + /// + public static IEnumerable EnumerateMonitorDevices() + { + var monitors = new Collection(); + + IEnumerable devicesInfo = EnumerateMonitorDevicesImpl().ToList(); + IEnumerable edidDevicesInfo = EnumerateMonitorEdidDevicesImpl().ToList(); + + foreach (var deviceInfo in devicesInfo) + { + var deviceIdNormalized = deviceInfo.DeviceId.Replace("#", "\\").ToLowerInvariant(); + foreach (var edidDeviceInfo in edidDevicesInfo) + { + var edidDeviceInfoNormalized = edidDeviceInfo.DeviceId.ToLowerInvariant(); + + var canAdd = deviceIdNormalized.Contains(edidDeviceInfoNormalized); + if (!canAdd) + { + continue; + } + + monitors.Add(new MonitorDeviceInfo(deviceInfo, edidDeviceInfo)); + } + } + + return monitors; + } + #endregion + + #endregion + + #region private static members + + private static IEnumerable EnumerateMonitorDevicesImpl() + { + Monitors.Clear(); + Gdi.MultipleDisplayMonitors.NativeMethods.EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero, EnumMonitorsCallBack, IntPtr.Zero); + + var monitorDevices = new List(); + foreach (var monitorInfo in Monitors) + { + for (uint i = 0; ; i++) + { + var monitorDevice = Gdi.DeviceContext.DISPLAY_DEVICE.Empty; + bool deviceIsAvailable = Gdi.DeviceContext.NativeMethods.EnumDisplayDevices(monitorInfo.DeviceName, i, ref monitorDevice, Gdi.DeviceContext.DISPLAY_DEVICE.EDD_GET_DEVICE_INTERFACE_NAME); + if (!deviceIsAvailable) + { + break; + } + + if ((monitorDevice.State & Gdi.DeviceContext.DISPLAY_DEVICE.KnownDisplayDeviceStates.MirroringDriver) != Gdi.DeviceContext.DISPLAY_DEVICE.KnownDisplayDeviceStates.MirroringDriver) + { + monitorDevices.Add(new MonitorDeviceInfoNative(monitorInfo, monitorDevice)); + } + } + } + + return monitorDevices; + } + + private static IEnumerable EnumerateMonitorEdidDevicesImpl() + { + var info = new Collection(); + var GUID_DEVCLASS_MONITOR = GuidDevClass.GUID_DEVCLASS_MONITOR; + + var canContinue = true; + while (canContinue) + { + IntPtr devInfo = + SetupApi.NativeMethods.SetupDiGetClassDevsEx( + ref GUID_DEVCLASS_MONITOR, // class GUID + null, // enumerator + IntPtr.Zero, // HWND + SetupApi.DiGetClassFlags.DIGCF_PRESENT, // Flags + IntPtr.Zero, // device info, create a new one + null, // machine name, local machine + IntPtr.Zero); + if (devInfo == IntPtr.Zero) + { + canContinue = false; + } + + if (!canContinue) + { + break; + } + + for (uint i = 0; Marshal.GetLastWin32Error() != Win32ErrorCode.ERROR_NO_MORE_ITEMS; i++) + { + SetupApi.SP_DEVINFO_DATA devInfoData = SetupApi.SP_DEVINFO_DATA.Empty; + bool deviceInfoSuccess = SetupApi.NativeMethods.SetupDiEnumDeviceInfo(devInfo, i, ref devInfoData); + if (!deviceInfoSuccess) + { + canContinue = false; + } + + if (!canContinue) + { + continue; + } + + MonitorDeviceEdidInfoNative candidate = GetMonitorDeviceEdidInfo(devInfo, devInfoData); + var canAdd = candidate.IsValid && candidate != MonitorDeviceEdidInfoNative.NoValid; + if (canAdd) + { + info.Add(candidate); + } + } + } + + return info; + } + + private static bool EnumMonitorsCallBack(IntPtr hMonitor, IntPtr hdcMonitor, ref Gdi.Rectangles.RECT lprcMonitor, IntPtr dwData) + { + Gdi.MultipleDisplayMonitors.MONITORINFOEX mi = Gdi.MultipleDisplayMonitors.MONITORINFOEX.Empty; + bool ok = Gdi.MultipleDisplayMonitors.NativeMethods.GetMonitorInfo(hMonitor, ref mi); + if (ok) + { + Monitors.Add(mi); + } + + return ok; + } + + private static MonitorDeviceEdidInfoNative GetMonitorDeviceEdidInfo(IntPtr devInfo, SetupApi.SP_DEVINFO_DATA devInfoData) + { + uint instanceIdSize = 0; + IntPtr instanceIdSizePointer = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(uint))); + Marshal.StructureToPtr(instanceIdSize, instanceIdSizePointer, false); + + var instanceId = new char[256]; + bool deviceInstanceSuccess = + SetupApi.NativeMethods.SetupDiGetDeviceInstanceId( + devInfo, + ref devInfoData, + instanceId, + 256, + instanceIdSizePointer); + + if (!deviceInstanceSuccess) + { + return MonitorDeviceEdidInfoNative.NoValid; + } + + byte[] instanceIdBytes = Encoding.Unicode.GetBytes(instanceId, 0, instanceId.Length); + uint instanceIdSizeValue = ((uint)Marshal.PtrToStructure(instanceIdSizePointer, typeof(uint)) - 1) << 1; + string instanceIdString = Encoding.Unicode.GetString(instanceIdBytes, 0, (int)instanceIdSizeValue); + + IntPtr edidRegKey = + SetupApi.NativeMethods.SetupDiOpenDevRegKey( + devInfo, + ref devInfoData, + 1, //NativeConstants.DICS_FLAG_GLOBAL, + 0, + 1, //NativeConstants.DIREG_DEV, + 0x20019); //NativeConstants.KEY_READ); + + uint edidSize = 128; + var edidData = new byte[edidSize]; + uint regQuerySuccess = Registry.NativeMethods.RegQueryValueEx( + edidRegKey, + "EDID", + IntPtr.Zero, + IntPtr.Zero, + edidData, + ref edidSize); + + if (regQuerySuccess != Win32ErrorCode.ERROR_SUCCESS) + { + return MonitorDeviceEdidInfoNative.NoValid; + } + + return new MonitorDeviceEdidInfoNative + { + DeviceId = instanceIdString, + IsValid = !Array.TrueForAll(edidData, y => y == 0), + RawEdid = edidData + }; + } + + #endregion + } +} diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SafeVideoAdapterNativeMethods.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SafeVideoAdapterNativeMethods.cs new file mode 100644 index 0000000..478379e --- /dev/null +++ b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SafeVideoAdapterNativeMethods.cs @@ -0,0 +1,59 @@ + +namespace iTin.Core.Hardware.Interop +{ + using System.Collections.Generic; + using System.Linq; + + using DeviceInfo; + + using DeviceContext = Core.Interop.Windows.Development.Graphics.Legacy.Gdi.DeviceContext; + + /// + /// Defines a set of Safe monitor native methods. + /// + public static class SafeVideoAdapterNativeMethods + { + /// + /// Array with the information of the system video adapters. + /// + /// + /// Returns a of structures that contains the system's video adapters. + /// + public static VideoAdapterDeviceInfo[] EnumerateVideoAdapterDevices() + { + var adapters = new List(); + + for (uint i = 0; ; i++) + { + var adapterDevice = DeviceContext.DISPLAY_DEVICE.Empty; + bool deviceIsAvailable = DeviceContext.NativeMethods.EnumDisplayDevices(null, i, ref adapterDevice, 0); + + if (!deviceIsAvailable) + { + break; + } + + if (!string.IsNullOrEmpty(adapterDevice.DeviceID)) + { + adapters.Add(new VideoAdapterDeviceInfo(adapterDevice)); + } + } + + return adapters.ToArray(); + } + + /// + /// Get the video adapter information associated with the specified monitor. + /// + /// Monitor information. + /// + /// Returns a structure that contains the adapter information associated with the specified monitor. + /// + public static VideoAdapterDeviceInfo GetVideoAdapterDeviceFromMonitor(MonitorDeviceInfo monitorDeviceInfo) + { + var adapters = EnumerateVideoAdapterDevices(); + + return adapters.SingleOrDefault(adapter => adapter.DisplayName == monitorDeviceInfo.DisplayName); + } + } +} diff --git a/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SafeVideoModeNativeMethods.cs b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SafeVideoModeNativeMethods.cs new file mode 100644 index 0000000..47dca10 --- /dev/null +++ b/src/lib/iTin.Core.Hardware/iTin.Core.Hardware/Interop/SafeVideoModeNativeMethods.cs @@ -0,0 +1,139 @@ + +namespace iTin.Core.Hardware.Interop +{ + using System; + using System.Collections.ObjectModel; + using System.Linq; + + using DeviceInfo; + + using DeviceContext = Core.Interop.Windows.Development.Graphics.Legacy.Gdi.DeviceContext; + using GdiPrint = Core.Interop.Windows.Development.DocumentAndPrinting.Printing.GdiPrint; + + /// + /// Defines a set of Safe monitor native methods. + /// + public static class SafeVideoModeNativeMethods + { + #region public static methods + + #region [public] {static} (VideoModeDeviceInfo[]) EnumerateVideoModesFromAdapter(VideoAdapterDeviceInfo): Change the current video mode to the specified mode + /// + /// Array with the information of the video modes supported by a video adapter. + /// + /// Video adapter information. + /// + /// Returns a of structures that contains the video modes supported by a video adapter. + /// + public static VideoModeDeviceInfo[] EnumerateVideoModesFromAdapter(VideoAdapterDeviceInfo videoAdapterInfo) + { + var videoModes = new Collection(); + var currentMode = GetCurrentVideoModeFromAdapter(videoAdapterInfo); + + for (int i = 0; ; i++) + { + var videoMode = GdiPrint.DEVMODE.Empty; + var modeIsAvailable = DeviceContext.NativeMethods.EnumDisplaySettingsEx(videoAdapterInfo.DisplayName, i, ref videoMode, DeviceContext.NativeMethods.EnumDisplayFlags.EDS_NORMAL); + + if (!modeIsAvailable) + { + break; + } + + var apiModeInfo = new VideoModeDeviceInfo(videoMode); + if (apiModeInfo == currentMode) + { + apiModeInfo.SetCurrent(true); + } + + videoModes.Add(apiModeInfo); + } + + return (VideoModeDeviceInfo[])videoModes.ToArray().Clone(); + } + #endregion + + #region [public] {static} (bool) ChangeVideoMode(VideoAdapterDeviceInfo, VideoModeDeviceInfo): Change the current video mode to the specified mode + /// + /// Change the current video mode to the specified mode. + /// + /// Video adapter information. + /// New video mode. + /// + /// true if the operation could be performed; false otherwise. + /// + public static bool ChangeVideoMode(VideoAdapterDeviceInfo adapter, VideoModeDeviceInfo mode) + { + const DeviceContext.NativeMethods.ChangeDisplaySettingsFlags flags = DeviceContext.NativeMethods.ChangeDisplaySettingsFlags.CDS_UPDATEREGISTRY | DeviceContext.NativeMethods.ChangeDisplaySettingsFlags.CDS_SET_PRIMARY; + var result = ChangeVideoMode(adapter, mode, flags); + return result == DeviceContext.NativeMethods.DISP_CHANGE.DISP_CHANGE_SUCCESSFUL; + } + #endregion + + #region [public] {static} (VideoModeDeviceInfo) GetCurrentVideoModeFromAdapter(VideoAdapterDeviceInfo): Returns a reference to the current video mode information for the specified device + /// + /// Returns a reference to the current video mode information for the specified device. + /// + /// Video adapter information. + /// + /// Returns a structure that contains the current video mode information. + /// + public static VideoModeDeviceInfo GetCurrentVideoModeFromAdapter(VideoAdapterDeviceInfo videoAdapterData) + { + var mode = GdiPrint.DEVMODE.Empty; + DeviceContext.NativeMethods.EnumDisplaySettings(videoAdapterData.DisplayName, GdiPrint.DEVMODE.ENUM_CURRENT_SETTINGS, ref mode); + + return new VideoModeDeviceInfo(mode); + } + #endregion + + #region [public] {static} (bool) TestVideoMode(VideoAdapterDeviceInfo, VideoModeInfo): Check if this video mode is a valid video mode + /// + /// Check if this video mode is a valid video mode. + /// + /// Video adapter information. + /// Video mode to check. + /// + /// true if it is a valid video mode; false otherwise. + /// + public static bool TestVideoMode(VideoAdapterDeviceInfo adapter, VideoModeDeviceInfo mode) + { + var result = ChangeVideoMode(adapter, mode, DeviceContext.NativeMethods.ChangeDisplaySettingsFlags.CDS_TEST); + + return result == DeviceContext.NativeMethods.DISP_CHANGE.DISP_CHANGE_SUCCESSFUL; + } + #endregion + + #endregion + + #region private static methods + + #region [private] {static} (DISP_CHANGE) ChangeVideoMode(VideoAdapterDeviceInfo, VideoModeInfo, DeviceContext.NativeMethods.ChangeDisplaySettingsFlags): Change the current video mode to the specified mode + /// + /// Change the current video mode to the specified mode. + /// + /// The adapter. + /// New video mode. + /// Status indicators for changing / testing a video mode. + /// + /// One of the values in the enumeration that indicates the status. + /// + private static DeviceContext.NativeMethods.DISP_CHANGE ChangeVideoMode(VideoAdapterDeviceInfo adapter, VideoModeDeviceInfo newVideoMode, DeviceContext.NativeMethods.ChangeDisplaySettingsFlags flags) + { + var devMode = GdiPrint.DEVMODE.Empty; + + devMode.dmFields = GdiPrint.DEVMODE.DM.Position | GdiPrint.DEVMODE.DM.PelsWidth | GdiPrint.DEVMODE.DM.PelsHeight | GdiPrint.DEVMODE.DM.DisplayFlags | GdiPrint.DEVMODE.DM.BitsPerPixel | GdiPrint.DEVMODE.DM.DisplayFrequency; + devMode.dmPelsWidth = newVideoMode.Size.Width; + devMode.dmPelsHeight = newVideoMode.Size.Height; + devMode.dmPosition.X = newVideoMode.Location.X; + devMode.dmPosition.Y = newVideoMode.Location.Y; + devMode.dmBitsPerPel = newVideoMode.BitsPerPixel; + devMode.dmDisplayFrequency = newVideoMode.Frequency; + + return DeviceContext.NativeMethods.ChangeDisplaySettingsEx(adapter.DisplayName, ref devMode, IntPtr.Zero, (int)flags, IntPtr.Zero); + } + #endregion + + #endregion + } +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DeviceAndDriverInstallation/ConfigurationManager/NativeMethods.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DeviceAndDriverInstallation/ConfigurationManager/NativeMethods.cs new file mode 100644 index 0000000..3c3ab85 --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DeviceAndDriverInstallation/ConfigurationManager/NativeMethods.cs @@ -0,0 +1,97 @@ + +namespace iTin.Core.Interop.Windows.Development.DeviceAndDriverInstallation.ConfigurationManager +{ + using System; + using System.Runtime.InteropServices; + + /// + /// Functions to develop Device and Driver Installation Reference. + /// + public static class NativeMethods + { + #region public constants + + public const int CR_SUCCESS = 0x00000000; + public const int CR_DEFAULT = 0x00000001; + public const int CR_OUT_OF_MEMORY = 0x00000002; + public const int CR_INVALID_POINTER = 0x00000003; + public const int CR_INVALID_FLAG = 0x00000004; + public const int CR_INVALID_DEVNODE = 0x00000005; + public const int CR_INVALID_DEVINST = CR_INVALID_DEVNODE; + public const int CR_INVALID_RES_DES = 0x00000006; + public const int CR_INVALID_LOG_CONF = 0x00000007; + public const int CR_INVALID_ARBITRATOR = 0x00000008; + public const int CR_INVALID_NODELIST = 0x00000009; + public const int CR_DEVNODE_HAS_REQS = 0x0000000A; + public const int CR_DEVINST_HAS_REQS = CR_DEVNODE_HAS_REQS; + public const int CR_INVALID_RESOURCEID = 0x0000000B; + public const int CR_DLVXD_NOT_FOUND = 0x0000000C; + public const int CR_NO_SUCH_DEVNODE = 0x0000000D; + public const int CR_NO_SUCH_DEVINST = CR_NO_SUCH_DEVNODE; + public const int CR_NO_MORE_LOG_CONF = 0x0000000E; + public const int CR_NO_MORE_RES_DES = 0x0000000F; + public const int CR_ALREADY_SUCH_DEVNODE = 0x00000010; + public const int CR_ALREADY_SUCH_DEVINST = CR_ALREADY_SUCH_DEVNODE; + public const int CR_INVALID_RANGE_LIST = 0x00000011; + public const int CR_INVALID_RANGE = 0x00000012; + public const int CR_FAILURE = 0x00000013; + public const int CR_NO_SUCH_LOGICAL_DEV = 0x00000014; + public const int CR_CREATE_BLOCKED = 0x00000015; + public const int CR_NOT_SYSTEM_VM = 0x00000016; + public const int CR_REMOVE_VETOED = 0x00000017; + public const int CR_APM_VETOED = 0x00000018; + public const int CR_INVALID_LOAD_TYPE = 0x00000019; + public const int CR_BUFFER_SMALL = 0x0000001A; + public const int CR_NO_ARBITRATOR = 0x0000001B; + public const int CR_NO_REGISTRY_HANDLE = 0x0000001C; + public const int CR_REGISTRY_ERROR = 0x0000001D; + public const int CR_INVALID_DEVICE_ID = 0x0000001E; + public const int CR_INVALID_DATA = 0x0000001F; + public const int CR_INVALID_API = 0x00000020; + public const int CR_DEVLOADER_NOT_READY = 0x00000021; + public const int CR_NEED_RESTART = 0x00000022; + public const int CR_NO_MORE_HW_PROFILES = 0x00000023; + public const int CR_DEVICE_NOT_THERE = 0x00000024; + public const int CR_NO_SUCH_VALUE = 0x00000025; + public const int CR_WRONG_TYPE = 0x00000026; + public const int CR_INVALID_PRIORITY = 0x00000027; + public const int CR_NOT_DISABLEABLE = 0x00000028; + public const int CR_FREE_RESOURCES = 0x00000029; + public const int CR_QUERY_VETOED = 0x0000002A; + public const int CR_CANT_SHARE_IRQ = 0x0000002B; + public const int CR_NO_DEPENDENT = 0x0000002C; + public const int CR_SAME_RESOURCES = 0x0000002D; + public const int CR_NO_SUCH_REGISTRY_KEY = 0x0000002E; + public const int CR_INVALID_MACHINENAME = 0x0000002F; + public const int CR_REMOTE_COMM_FAILURE = 0x00000030; + public const int CR_MACHINE_UNAVAILABLE = 0x00000031; + public const int CR_NO_CM_SERVICES = 0x00000032; + public const int CR_ACCESS_DENIED = 0x00000033; + public const int CR_CALL_NOT_IMPLEMENTED = 0x00000034; + public const int CR_INVALID_PROPERTY = 0x00000035; + public const int CR_DEVICE_INTERFACE_ACTIVE = 0x00000036; + public const int CR_NO_SUCH_DEVICE_INTERFACE = 0x00000037; + public const int CR_INVALID_REFERENCE_STRING = 0x00000038; + public const int CR_INVALID_CONFLICT_LIST = 0x00000039; + public const int CR_INVALID_INDEX = 0x0000003A; + public const int CR_INVALID_STRUCTURE_SIZE = 0x0000003B; + + #endregion + + #region P/Invoke + + #region [public] {static} {extern} (uint) CM_Enumerate_Classes(uint, ref Guid, uint): Retrieves the GUID identifier of each class installed on this system. The function must be called repeatedly until the CR_NO_SUCH_VALUE value is returned + /// + /// When called repeatedly, enumerates the local machine's installed device classes by supplying each class's GUID. + /// Retrieves the GUID identifier of each class installed on this system. The function must be called repeatedly until the CR_NO_SUCH_VALUE value is returned. + /// + /// + /// For more information, please see http://msdn.microsoft.com/en-us/library/ff538021%28v=VS.85%29.aspx. + /// + [DllImport(ExternDll.Win.Cfgmgr32, SetLastError = true)] + public static extern uint CM_Enumerate_Classes(uint classIndex, ref Guid classGuid, uint flags); + #endregion + + #endregion + } +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DeviceAndDriverInstallation/SetupApi/Enums/DiGetClassFlags .cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DeviceAndDriverInstallation/SetupApi/Enums/DiGetClassFlags .cs index 19a1a8c..682af99 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DeviceAndDriverInstallation/SetupApi/Enums/DiGetClassFlags .cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DeviceAndDriverInstallation/SetupApi/Enums/DiGetClassFlags .cs @@ -3,13 +3,35 @@ namespace iTin.Core.Interop.Windows.Development.DeviceAndDriverInstallation.Setu { using System; + /// + /// Defines control options that filter the device information elements. + /// [Flags] public enum DiGetClassFlags : uint { + /// + /// Return only the device that is associated with the system default device interface, if one is set, for the specified device interface classes. + /// DIGCF_DEFAULT = 0x00000001, // only valid with DIGCF_DEVICEINTERFACE + + /// + /// Return only devices that are currently present in a system. + /// DIGCF_PRESENT = 0x00000002, + + /// + /// Return a list of installed devices for all device setup classes or all device interface classes. + /// DIGCF_ALLCLASSES = 0x00000004, + + /// + /// Return only devices that are a part of the current hardware profile. + /// DIGCF_PROFILE = 0x00000008, + + /// + /// Return devices that support device interfaces for the specified device interface classes. This flag must be set in the Flags parameter if the Enumerator parameter specifies a device instance ID. + /// DIGCF_DEVICEINTERFACE = 0x00000010, } } diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DeviceAndDriverInstallation/SetupApi/Enums/DiGetDeviceRegistryProperty.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DeviceAndDriverInstallation/SetupApi/Enums/DiGetDeviceRegistryProperty.cs new file mode 100644 index 0000000..47e2ce2 --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DeviceAndDriverInstallation/SetupApi/Enums/DiGetDeviceRegistryProperty.cs @@ -0,0 +1,47 @@ + +namespace iTin.Core.Interop.Windows.Development.DeviceAndDriverInstallation.SetupApi +{ + /// + /// Flags for SetupDiGetDeviceRegistry property parameter + /// + public enum DiGetDeviceRegistryProperty : uint + { + SPDRP_DEVICEDESC = 0x00000000, // DeviceDesc (R/W) + SPDRP_HARDWAREID = 0x00000001, // HardwareID (R/W) + SPDRP_COMPATIBLEIDS = 0x00000002, // CompatibleIDs (R/W) + SPDRP_UNUSED0 = 0x00000003, // unused + SPDRP_SERVICE = 0x00000004, // Service (R/W) + SPDRP_UNUSED1 = 0x00000005, // unused + SPDRP_UNUSED2 = 0x00000006, // unused + SPDRP_CLASS = 0x00000007, // Class (R--tied to ClassGUID) + SPDRP_CLASSGUID = 0x00000008, // ClassGUID (R/W) + SPDRP_DRIVER = 0x00000009, // Driver (R/W) + SPDRP_CONFIGFLAGS = 0x0000000A, // ConfigFlags (R/W) + SPDRP_MFG = 0x0000000B, // Mfg (R/W) + SPDRP_FRIENDLYNAME = 0x0000000C, // FriendlyName (R/W) + SPDRP_LOCATION_INFORMATION = 0x0000000D, // LocationInformation (R/W) + SPDRP_PHYSICAL_DEVICE_OBJECT_NAME = 0x0000000E, // PhysicalDeviceObjectName (R) + SPDRP_CAPABILITIES = 0x0000000F, // Capabilities (R) + SPDRP_UI_NUMBER = 0x00000010, // UiNumber (R) + SPDRP_UPPERFILTERS = 0x00000011, // UpperFilters (R/W) + SPDRP_LOWERFILTERS = 0x00000012, // LowerFilters (R/W) + SPDRP_BUSTYPEGUID = 0x00000013, // BusTypeGUID (R) + SPDRP_LEGACYBUSTYPE = 0x00000014, // LegacyBusType (R) + SPDRP_BUSNUMBER = 0x00000015, // BusNumber (R) + SPDRP_ENUMERATOR_NAME = 0x00000016, // Enumerator Name (R) + SPDRP_SECURITY = 0x00000017, // Security (R/W, binary form) + SPDRP_SECURITY_SDS = 0x00000018, // Security (W, SDS form) + SPDRP_DEVTYPE = 0x00000019, // Device Type (R/W) + SPDRP_EXCLUSIVE = 0x0000001A, // Device is exclusive-access (R/W) + SPDRP_CHARACTERISTICS = 0x0000001B, // Device Characteristics (R/W) + SPDRP_ADDRESS = 0x0000001C, // Device Address (R) + SPDRP_UI_NUMBER_DESC_FORMAT = 0X0000001D, // UiNumberDescFormat (R/W) + SPDRP_DEVICE_POWER_DATA = 0x0000001E, // Device Power Data (R) + SPDRP_REMOVAL_POLICY = 0x0000001F, // Removal Policy (R) + SPDRP_REMOVAL_POLICY_HW_DEFAULT = 0x00000020, // Hardware Removal Policy (R) + SPDRP_REMOVAL_POLICY_OVERRIDE = 0x00000021, // Removal Policy Override (RW) + SPDRP_INSTALL_STATE = 0x00000022, // Device Install State (R) + SPDRP_LOCATION_PATHS = 0x00000023, // Device Location Paths (R) + SPDRP_BASE_CONTAINERID = 0x00000024 // Base ContainerID (R) + } +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DeviceAndDriverInstallation/SetupApi/Enums/DiOpenClassFlags.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DeviceAndDriverInstallation/SetupApi/Enums/DiOpenClassFlags.cs new file mode 100644 index 0000000..0e880ae --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DeviceAndDriverInstallation/SetupApi/Enums/DiOpenClassFlags.cs @@ -0,0 +1,22 @@ + +namespace iTin.Core.Interop.Windows.Development.DeviceAndDriverInstallation.SetupApi +{ + using System; + + /// + /// Defines the type of registry key that will be opened. + /// + [Flags] + public enum DiOpenClassFlags : uint + { + /// + /// Open a configuration class key. If ClassGuid is null, open the root key of the class installer's branch. + /// + DIOCR_INSTALLER = 0x00000001, + + /// + /// Open an interface class key. If ClassGuid is null, open the root key of the interface class branch. + /// + DIOCR_INTERFACE = 0x00000002 + } +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DeviceAndDriverInstallation/SetupApi/NativeMethods.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DeviceAndDriverInstallation/SetupApi/NativeMethods.cs index 7900a75..6570558 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DeviceAndDriverInstallation/SetupApi/NativeMethods.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DeviceAndDriverInstallation/SetupApi/NativeMethods.cs @@ -3,65 +3,38 @@ namespace iTin.Core.Interop.Windows.Development.DeviceAndDriverInstallation.Setu { using System; using System.Runtime.InteropServices; + using System.Text; /// /// Functions to develop Device and Driver Installation Reference. /// public static class NativeMethods { - #region enumerations - - #region [public] (enum) KnownSetupDiGetDeviceRegistryProperty: Flags for SetupDiGetDeviceRegistry property parameter + #region [public] {static} {extern} (bool) SetupDiClassNameFromGuid(ref Guid, StringBuilder, uint, ref uint): Retrieves the class name associated with a class GUID /// - /// Flags for SetupDiGetDeviceRegistry property parameter + /// Retrieves the class name associated with a class GUID. The function must be called repeatedly until the CR_NO_SUCH_VALUE value is returned. /// - public enum KnownSetupDiGetDeviceRegistryProperty : uint - { - SPDRP_DEVICEDESC = 0x00000000, // DeviceDesc (R/W) - SPDRP_HARDWAREID = 0x00000001, // HardwareID (R/W) - SPDRP_COMPATIBLEIDS = 0x00000002, // CompatibleIDs (R/W) - SPDRP_UNUSED0 = 0x00000003, // unused - SPDRP_SERVICE = 0x00000004, // Service (R/W) - SPDRP_UNUSED1 = 0x00000005, // unused - SPDRP_UNUSED2 = 0x00000006, // unused - SPDRP_CLASS = 0x00000007, // Class (R--tied to ClassGUID) - SPDRP_CLASSGUID = 0x00000008, // ClassGUID (R/W) - SPDRP_DRIVER = 0x00000009, // Driver (R/W) - SPDRP_CONFIGFLAGS = 0x0000000A, // ConfigFlags (R/W) - SPDRP_MFG = 0x0000000B, // Mfg (R/W) - SPDRP_FRIENDLYNAME = 0x0000000C, // FriendlyName (R/W) - SPDRP_LOCATION_INFORMATION = 0x0000000D, // LocationInformation (R/W) - SPDRP_PHYSICAL_DEVICE_OBJECT_NAME = 0x0000000E, // PhysicalDeviceObjectName (R) - SPDRP_CAPABILITIES = 0x0000000F, // Capabilities (R) - SPDRP_UI_NUMBER = 0x00000010, // UiNumber (R) - SPDRP_UPPERFILTERS = 0x00000011, // UpperFilters (R/W) - SPDRP_LOWERFILTERS = 0x00000012, // LowerFilters (R/W) - SPDRP_BUSTYPEGUID = 0x00000013, // BusTypeGUID (R) - SPDRP_LEGACYBUSTYPE = 0x00000014, // LegacyBusType (R) - SPDRP_BUSNUMBER = 0x00000015, // BusNumber (R) - SPDRP_ENUMERATOR_NAME = 0x00000016, // Enumerator Name (R) - SPDRP_SECURITY = 0x00000017, // Security (R/W, binary form) - SPDRP_SECURITY_SDS = 0x00000018, // Security (W, SDS form) - SPDRP_DEVTYPE = 0x00000019, // Device Type (R/W) - SPDRP_EXCLUSIVE = 0x0000001A, // Device is exclusive-access (R/W) - SPDRP_CHARACTERISTICS = 0x0000001B, // Device Characteristics (R/W) - SPDRP_ADDRESS = 0x0000001C, // Device Address (R) - SPDRP_UI_NUMBER_DESC_FORMAT = 0X0000001D, // UiNumberDescFormat (R/W) - SPDRP_DEVICE_POWER_DATA = 0x0000001E, // Device Power Data (R) - SPDRP_REMOVAL_POLICY = 0x0000001F, // Removal Policy (R) - SPDRP_REMOVAL_POLICY_HW_DEFAULT = 0x00000020, // Hardware Removal Policy (R) - SPDRP_REMOVAL_POLICY_OVERRIDE = 0x00000021, // Removal Policy Override (RW) - SPDRP_INSTALL_STATE = 0x00000022, // Device Install State (R) - SPDRP_LOCATION_PATHS = 0x00000023, // Device Location Paths (R) - SPDRP_BASE_CONTAINERID = 0x00000024 // Base ContainerID (R) - } + /// + /// For more information, please see http://msdn.microsoft.com/en-us/library/ff538021%28v=VS.85%29.aspx. + /// + [DllImport(ExternDll.Win.SetupApi, SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SetupDiClassNameFromGuid(ref Guid classGuid, StringBuilder className, uint classNameSize, ref uint requiredSize); #endregion + #region [public] {static} {extern} (bool) SetupDiDestroyDeviceInfoList(IntPtr): Deletes a set of information from the device and frees all associated memory + /// + /// Deletes a set of information from the device and frees all associated memory. + /// + /// + /// For more information, please see http://msdn.microsoft.com/en-us/library/ff550996%28v=VS.85%29.aspx. + /// + [DllImport(ExternDll.Win.SetupApi, SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SetupDiDestroyDeviceInfoList(IntPtr deviceInfoSet); #endregion - #region P/Invoke - - #region [public] {static} {extern} (bool) SetupDiEnumDeviceInfo (IntPtr, UInt32, ref SP_DEVINFO_DATA): Returns a SP_DEVINFO_DATA structure that specifies a device information element in a device information set + #region [public] {static} {extern} (bool) SetupDiEnumDeviceInfo (IntPtr, uint, ref SP_DEVINFO_DATA): Returns a SP_DEVINFO_DATA structure that specifies a device information element in a device information set /// /// Returns a structure that specifies a device information element in a device information set. /// @@ -69,42 +42,63 @@ public enum KnownSetupDiGetDeviceRegistryProperty : uint /// For more information, please see https://docs.microsoft.com/es-es/windows/win32/api/setupapi/nf-setupapi-setupdienumdeviceinfo /// [DllImport(ExternDll.Win.SetupApi, SetLastError = true)] - public static extern bool SetupDiEnumDeviceInfo(IntPtr hdevinfo, UInt32 memberIndex, ref SP_DEVINFO_DATA deviceInfoData); + public static extern bool SetupDiEnumDeviceInfo(IntPtr hdevinfo, uint memberIndex, ref SP_DEVINFO_DATA deviceInfoData); + #endregion + + #region [public] {static} {extern} (IntPtr) SetupDiGetClassDevs(ref Guid, uint, IntPtr, uint): Returns a handle to a device information set that contains requested device information elements for a local computer + /// + /// Returns a handle to a device information set that contains requested device information elements for a local computer. + /// + /// + /// For more information, please see https://docs.microsoft.com/en-us/windows/win32/api/setupapi/nf-setupapi-setupdigetclassdevsw. + /// + [DllImport(ExternDll.Win.SetupApi, SetLastError = true)] + public static extern IntPtr SetupDiGetClassDevs(ref Guid classGuid, uint enumerator, IntPtr hwndParent, uint flags); #endregion - #region [public] {static} {extern} (IntPtr) SetupDiGetClassDevsEx(ref Guid, UInt32, IntPtr, DiGetClassFlags, IntPtr, string, IntPtr): Returns a handle to a device information set that contains requested device information elements for a local or a remote computer + #region [public] {static} {extern} (IntPtr) SetupDiGetClassDevs(ref Guid, uint, IntPtr, DiGetClassFlags): Devuelve un identificador para un conjunto de información de dispositivo que contiene los elementos solicitados la información del dispositivo para un equipo local. + /// + /// Devuelve un identificador para un conjunto de información de dispositivo que contiene los elementos solicitados la información del dispositivo para un equipo local. + /// Para más información, ver http://msdn.microsoft.com/en-us/library/ff551069%28VS.85%29.aspx. + /// + [DllImport(ExternDll.Win.SetupApi, SetLastError = true)] + public static extern IntPtr SetupDiGetClassDevs(ref Guid classGuid, uint enumerator, IntPtr hwndParent, DiGetClassFlags flags); + #endregion + + #region [public] {static} {extern} (IntPtr) SetupDiGetClassDevsEx(ref Guid, uint, IntPtr, DiGetClassFlags, IntPtr, string, IntPtr): Returns a handle to a device information set that contains requested device information elements for a local or a remote computer /// /// Returns a handle to a device information set that contains requested device information elements for a local or a remote computer. - /// For more information, please see https://docs.microsoft.com/en-us/windows/win32/api/setupapi/nf-setupapi-setupdigetclassdevsexa /// + /// + /// For more information, please see https://docs.microsoft.com/en-us/windows/win32/api/setupapi/nf-setupapi-setupdigetclassdevsexa + /// [DllImport(ExternDll.Win.SetupApi, SetLastError = true, CharSet = CharSet.Unicode)] - public static extern IntPtr SetupDiGetClassDevsEx( - ref Guid guidClass, - UInt32 enumerator, - IntPtr hwndParent, - DiGetClassFlags flags, - IntPtr deviceInfoSet, - [MarshalAs(UnmanagedType.LPWStr)] string machineName, - IntPtr reserved); + public static extern IntPtr SetupDiGetClassDevsEx(ref Guid guidClass, uint enumerator, IntPtr hwndParent, DiGetClassFlags flags, IntPtr deviceInfoSet, [MarshalAs(UnmanagedType.LPWStr)] string machineName, IntPtr reserved); #endregion #region [public] {static} {extern} (IntPtr) SetupDiGetClassDevsEx(ref Guid, string, IntPtr, DiGetClassFlags, IntPtr, string, IntPtr): Returns a handle to a device information set that contains requested device information elements for a local or a remote computer /// /// Returns a handle to a device information set that contains requested device information elements for a local or a remote computer. - /// For more information, please see https://docs.microsoft.com/en-us/windows/win32/api/setupapi/nf-setupapi-setupdigetclassdevsexa /// + /// + /// For more information, please see https://docs.microsoft.com/en-us/windows/win32/api/setupapi/nf-setupapi-setupdigetclassdevsexa. + /// [DllImport(ExternDll.Win.SetupApi, SetLastError = true, CharSet = CharSet.Unicode)] - public static extern IntPtr SetupDiGetClassDevsEx( - ref Guid guidClass, - [MarshalAs(UnmanagedType.LPWStr)] string enumerator, - IntPtr hwndParent, - DiGetClassFlags flags, - IntPtr deviceInfoSet, - [MarshalAs(UnmanagedType.LPWStr)] string machineName, - IntPtr reserved); + public static extern IntPtr SetupDiGetClassDevsEx(ref Guid guidClass, [MarshalAs(UnmanagedType.LPWStr)] string enumerator, IntPtr hwndParent, DiGetClassFlags flags, IntPtr deviceInfoSet, [MarshalAs(UnmanagedType.LPWStr)] string machineName, IntPtr reserved); #endregion - #region [public] {static} {extern} (bool) SetupDiGetDeviceRegistryProperty (IntPtr, ref SP_DEVINFO_DATA, KnownSetupDiGetDeviceRegistryProperty, out UInt32, byte[], uint, out UInt32): Retrieves a specified Plug and Play device property + #region [public] {static} {extern} (bool) SetupDiGetDeviceInstanceId(IntPtr, ref SP_DEVINFO_DATA, char[], uint, IntPtr): Retrieves the device instance ID that is associated with a device information element + /// + /// Retrieves the device instance ID that is associated with a device information element. + /// + /// + /// For more information, please see https://docs.microsoft.com/en-us/windows/win32/api/setupapi/nf-setupapi-setupdigetdeviceinstanceida. + /// + [DllImport(ExternDll.Win.SetupApi, CharSet = CharSet.Unicode, SetLastError = true)] + public static extern bool SetupDiGetDeviceInstanceId(IntPtr deviceInfoSet, ref SP_DEVINFO_DATA deviceInfoData, char[] deviceInstanceId, uint deviceInstanceIdSize, IntPtr requiredSize); + #endregion + + #region [public] {static} {extern} (bool) SetupDiGetDeviceRegistryProperty (IntPtr, ref SP_DEVINFO_DATA, DiGetDeviceRegistryProperty, out uint, byte[], uint, out uint): Retrieves a specified Plug and Play device property /// /// Retrieves a specified Plug and Play device property. /// @@ -112,17 +106,67 @@ public static extern IntPtr SetupDiGetClassDevsEx( /// For more information, please see https://docs.microsoft.com/en-us/windows/win32/api/setupapi/nf-setupapi-setupdigetdeviceregistrypropertya /// [DllImport(ExternDll.Win.SetupApi, CharSet = CharSet.Auto, SetLastError = true)] - public static extern bool SetupDiGetDeviceRegistryProperty(IntPtr deviceInfoSet, ref SP_DEVINFO_DATA deviceInfoData, KnownSetupDiGetDeviceRegistryProperty property, out UInt32 propertyRegDataType, byte[] propertyBuffer, uint propertyBufferSize, out UInt32 requiredSize); + public static extern bool SetupDiGetDeviceRegistryProperty(IntPtr deviceInfoSet, ref SP_DEVINFO_DATA deviceInfoData, DiGetDeviceRegistryProperty property, out uint propertyRegDataType, byte[] propertyBuffer, uint propertyBufferSize, out uint requiredSize); #endregion - #region [public] {static} {extern} (bool) SetupDiOpenDevRegKey (IntPtr, ref SP_DEVINFO_DATA, KnownSetupDiGetDeviceRegistryProperty, UInt32, UInt32, ulong): Opens a registry key for device-specific configuration information + #region [public] {static extern} (IntPtr) SetupDiOpenClassRegKeyEx(ref Guid, uint, DiOpenClassFlags, IntPtr, uint): Open the device configuration from the registry, the device interface or subkey a specific class /// - /// Opens a registry key for device-specific configuration information. For more information, please see https://docs.microsoft.com/en-us/windows/win32/api/setupapi/nf-setupapi-setupdigetdeviceregistrypropertya + /// Open the device configuration from the registry, the device interface or subkey a specific class. + /// This function opens the key specified on the local computer or on a remote computer. /// - [DllImport(ExternDll.Win.SetupApi, CharSet = CharSet.Auto, SetLastError = true)] - public static extern IntPtr SetupDiOpenDevRegKey(IntPtr deviceInfoSet, ref SP_DEVINFO_DATA deviceInfoData, UInt32 scope, UInt32 hwProfile, UInt32 keyType, ulong samDesired); + /// + /// For more information, please see http://msdn.microsoft.com/en-us/library/ff552067%28VS.85%29.aspx. + /// + [DllImport(ExternDll.Win.SetupApi, SetLastError = true)] + public static extern IntPtr SetupDiOpenClassRegKeyEx(ref Guid guid, uint samDesired, DiOpenClassFlags flags, IntPtr machineName, uint reserved); + #endregion + + #region [public] {static extern} (IntPtr) SetupDiOpenClassRegKeyEx(ref Guid, uint, DiOpenClassFlags, IntPtr, IntPtr): Open the device configuration from the registry, the device interface or subkey a specific class + /// + /// Open the device configuration from the registry, the device interface or subkey a specific class. + /// This function opens the key specified on the local computer or on a remote computer. + /// + /// + /// For more information, please see http://msdn.microsoft.com/en-us/library/ff552067%28VS.85%29.aspx. + /// + [DllImport(ExternDll.Win.SetupApi, SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern IntPtr SetupDiOpenClassRegKeyEx(ref Guid guid, uint samDesired, DiOpenClassFlags flags, IntPtr machineName, IntPtr reserved); + #endregion + + #region [public] {static extern} (IntPtr) SetupDiOpenClassRegKeyEx(ref Guid, uint, DiOpenClassFlags, StringBuilder, uint): Open the device configuration from the registry, the device interface or subkey a specific class + /// + /// Open the device configuration from the registry, the device interface or subkey a specific class. + /// This function opens the key specified on the local computer or on a remote computer. + /// + /// + /// For more information, please see http://msdn.microsoft.com/en-us/library/ff552067%28VS.85%29.aspx. + /// + [DllImport(ExternDll.Win.SetupApi, SetLastError = true)] + public static extern IntPtr SetupDiOpenClassRegKeyEx(ref Guid guid, uint samDesired, DiOpenClassFlags flags, StringBuilder machineName, uint reserved); + #endregion + + #region [public] {static extern} (IntPtr) SetupDiOpenClassRegKeyEx(ref Guid, uint, DiOpenClassFlags, StringBuilder, IntPtr): Open the device configuration from the registry, the device interface or subkey a specific class + /// + /// Open the device configuration from the registry, the device interface or subkey a specific class. + /// This function opens the key specified on the local computer or on a remote computer. + /// + /// + /// For more information, please see http://msdn.microsoft.com/en-us/library/ff552067%28VS.85%29.aspx. + /// + [DllImport(ExternDll.Win.SetupApi, SetLastError = true)] + public static extern IntPtr SetupDiOpenClassRegKeyEx(ref Guid guid, uint samDesired, DiOpenClassFlags flags, StringBuilder machineName, IntPtr reserved); #endregion + #region [public] {static} {extern} (bool) SetupDiOpenDevRegKey (IntPtr, ref SP_DEVINFO_DATA, KnownSetupDiGetDeviceRegistryProperty, uint, uint, ulong): Open a registration key for device specific configuration information + /// + /// Open a registration key for device specific configuration information. + /// + /// + /// For more information, please see https://docs.microsoft.com/en-us/windows/win32/api/setupapi/nf-setupapi-setupdigetdeviceregistrypropertya. + /// + [DllImport(ExternDll.Win.SetupApi, CharSet = CharSet.Auto, SetLastError = true)] + public static extern IntPtr SetupDiOpenDevRegKey(IntPtr deviceInfoSet, ref SP_DEVINFO_DATA deviceInfoData, uint scope, uint hwProfile, uint keyType, ulong samDesired); #endregion } } diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DeviceAndDriverInstallation/SetupApi/Structures/SP_DEVINFO_DATA.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DeviceAndDriverInstallation/SetupApi/Structures/SP_DEVINFO_DATA.cs index 3a2e62f..39e602a 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DeviceAndDriverInstallation/SetupApi/Structures/SP_DEVINFO_DATA.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DeviceAndDriverInstallation/SetupApi/Structures/SP_DEVINFO_DATA.cs @@ -15,13 +15,13 @@ public struct SP_DEVINFO_DATA : IEquatable { #region interface/s - #region [public] (bool) Equals(SP_DEVINFO_DATA): Indica si el objeto actual es igual a otro objeto del mismo tipo. + #region [public] (bool) Equals(SP_DEVINFO_DATA): Indicates whether the current object is the same as another object of the same type /// - /// Indica si el objeto actual es igual a otro objeto del mismo tipo. + /// Indicates whether the current object is the same as another object of the same type. /// - /// Objeto que se va a comparar con este objeto. + /// Object to be compared with this object. /// - /// Devuelve true si el objeto actual es igual al parámetro other; en caso contrario, false. + /// Returns true if the current object is equal to the other parameter; otherwise, false. /// public bool Equals(SP_DEVINFO_DATA other) { @@ -62,26 +62,26 @@ public bool Equals(SP_DEVINFO_DATA other) #region public operators - #region [public] {static} (bool) operator ==(SP_DEVINFO_DATA, SP_DEVINFO_DATA): Implementa el operador de igualdad (==). + #region [public] {static} (bool) operator ==(DISPLAY_DEVICE, DISPLAY_DEVICE): Implement the equality operator (==) /// - /// Implementa el operador de igualdad (==). + /// Implement the equality operator (==). /// - /// Operando 1. - /// Operando 2. + /// Operand 1. + /// Operand 2. /// - /// Devuelve true si deviceInfo1 es igual a deviceInfo2; false en caso contrario. + /// Returns true if deviceInfo1 is equal to deviceInfo2; false otherwise. /// public static bool operator ==(SP_DEVINFO_DATA left, SP_DEVINFO_DATA right) => left.Equals(right); #endregion - #region [public] {static} (bool) operator !=(SP_DEVINFO_DATA, SP_DEVINFO_DATA): Implementa el operador de desigualdad (!=). + #region [public] {static} (bool) operator !=(DISPLAY_DEVICE, DISPLAY_DEVICE): Implements the inequality operator (!=) /// - /// Implementa el operador de desigualdad (!=). + /// Implements the inequality operator (!=). /// - /// Operando 1. - /// Operando 2. + /// Operand 1. + /// Operand 2. /// - /// Devuelve true si deviceInfo1 no es igual a deviceInfo2; false en caso contrario. + /// Returns true if deviceInfo1 is not equal to deviceInfo2; false otherwise. /// public static bool operator !=(SP_DEVINFO_DATA left, SP_DEVINFO_DATA right) => left.Equals(right); #endregion @@ -90,23 +90,23 @@ public bool Equals(SP_DEVINFO_DATA other) #region public override methods - #region [public] {override} (int) GetHashCode(): Devuelve el código hash del objeto + #region [public] {override} (int) GetHashCode(): Returns the hash code of the structure /// - /// Devuelve el código hash del objeto. + /// Returns the hash code of the structure. /// /// - /// Código Hash. + /// Hash code. /// - public override int GetHashCode() => cbSize.GetHashCode() ^ classGuid.GetHashCode() ^ devInst.GetHashCode() ^ reserved.GetHashCode(); + public override int GetHashCode() => cbSize.GetHashCode() ^ classGuid.GetHashCode() ^ devInst.GetHashCode() ^ reserved.GetHashCode(); #endregion - #region [public] {override} (bool) Equals(object obj): Devuelve un valor que indica si este objeto es igual a otro + #region [public] {override} (bool) Equals(object obj): Returns a value that indicates whether this object is equal to another /// - /// Devuelve un valor que indica si este objeto es igual a otro. + /// Returns a value that indicates whether this object is equal to another. /// - /// Objeto con el que comparar. + /// Object to compare. /// - /// Resultado de igualdad. + /// Equality result. /// public override bool Equals(object obj) { @@ -129,16 +129,13 @@ public override bool Equals(object obj) } #endregion - #region [public] {override} (string) ToString(): Devuelve una cadena que representa al objeto actual + #region [public] {override} (string) ToString(): Returns a string that represents the current object /// - /// Devuelve una cadena que representa al objeto actual. + /// Returns a string that represents the current object. /// /// - /// Cadena que representa al objeto actual. + /// Returns a string that represents the current object. /// - /// - /// El método devuelve una cadena que incluye el tipo de estructura. - /// public override string ToString() => $"ClassGuid = {classGuid}"; #endregion diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Devices/DeviceManagement/Enums/IoctlChangerControlCodes.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Devices/DeviceManagement/Enums/IoctlChangerControlCodes.cs new file mode 100644 index 0000000..4be9db1 --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Devices/DeviceManagement/Enums/IoctlChangerControlCodes.cs @@ -0,0 +1,108 @@ + +namespace iTin.Core.Interop.Windows.Development.Devices.DeviceManagement +{ + using System; + // ------------------------------------------------------------------------------- + // | Control Code Format = (type << 16) | function << 2 | method | access << 14) | + // ------------------------------------------------------------------------------- + + /// + /// Códigos de control. + /// + [Flags] + public enum IoctlChangerControlCodes : uint + { + /// + /// Código base para los códigos de control de dispositivos. + /// + IOCTL_CHANGER_BASE = DeviceType.Changer, + + /// + /// Moves a piece of media from a source element to one destination, and the piece of media originally in the first destination to a second destination. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363392%28v=VS.85%29.aspx + /// + IOCTL_CHANGER_EXCHANGE_MEDIUM = (IOCTL_CHANGER_BASE << 16) | (DeviceAccess.Read << 14) | (0x0008 << 2) | DeviceMethod.Buffered, + + /// + /// Recupera el estado de todos los elementos o un número determinado de elementos de un tipo particular. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363393%28v=VS.85%29.aspx + /// + IOCTL_CHANGER_GET_ELEMENT_STATUS = (IOCTL_CHANGER_BASE << 16) | ((DeviceAccess.Read | DeviceAccess.Write) << 14) | (0x0005 << 2) | DeviceMethod.Buffered, + + /// + /// Recupera los parámetros del dispositivo especificado. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363394%28v=VS.85%29.aspx + /// + IOCTL_CHANGER_GET_PARAMETERS = (IOCTL_CHANGER_BASE << 16) | (DeviceAccess.Read << 14) | (0x0000 << 2) | DeviceMethod.Buffered, + + /// + /// Recupera los datos del producto para el dispositivo especificado. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363395%28v=VS.85%29.aspx + /// + IOCTL_CHANGER_GET_PRODUCT_DATA = (IOCTL_CHANGER_BASE << 16) | (DeviceAccess.Read << 14) | (0x0002 << 2) | DeviceMethod.Buffered, + + /// + /// Recupera el estado actual del dispositivo especificado. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363396%28v=VS.85%29.aspx + /// + IOCTL_CHANGER_GET_STATUS = (IOCTL_CHANGER_BASE << 16) | (DeviceAccess.Read << 14) | (0x0001 << 2) | DeviceMethod.Buffered, + + /// + /// Inicializa el estado de todos los elementos o los elementos especificados de un tipo particular. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363397%28v=VS.85%29.aspx + /// + IOCTL_CHANGER_INITIALIZE_ELEMENT_STATUS = (IOCTL_CHANGER_BASE << 16) | (DeviceAccess.Read << 14) | (0x0006 << 2) | DeviceMethod.Buffered, + + /// + /// Moves a piece of media to a destination. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363398%28v=VS.85%29.aspx + /// + IOCTL_CHANGER_MOVE_MEDIUM = (IOCTL_CHANGER_BASE << 16) | (DeviceAccess.Read << 14) | (0x0009 << 2) | DeviceMethod.Buffered, + + /// + /// Recupera la información de etiqueta de volumen para los elementos especificados. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363399%28v=VS.85%29.aspx + /// + IOCTL_CHANGER_QUERY_VOLUME_TAGS = (IOCTL_CHANGER_BASE << 16) | ((DeviceAccess.Read | DeviceAccess.Write) << 14) | (0x000b << 2) | DeviceMethod.Buffered, + + /// + /// Physically recalibrates a transport element. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363400%28v=VS.85%29.aspx + /// + IOCTL_CHANGER_REINITIALIZE_TRANSPORT = (IOCTL_CHANGER_BASE << 16) | (DeviceAccess.Read << 14) | (0x000a << 2) | DeviceMethod.Buffered, + + /// + /// Establece el estado del puerto de inserción/expulsión del dispositivo, puerta o teclado. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363401%28v=VS.85%29.aspx + /// + IOCTL_CHANGER_SET_ACCESS = (IOCTL_CHANGER_BASE << 16) | ((DeviceAccess.Read | DeviceAccess.Write) << 14) | (0x0004 << 2) | DeviceMethod.Buffered, + + /// + /// Sets the changer's robotic transport mechanism to the specified element address. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363402%28v=VS.85%29.aspx + /// + IOCTL_CHANGER_SET_POSITION = (IOCTL_CHANGER_BASE << 16) | (DeviceAccess.Read << 14) | (0x0007 << 2) | DeviceMethod.Buffered, + } +} \ No newline at end of file diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Devices/DeviceManagement/Enums/IoctlStorageControlCodes.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Devices/DeviceManagement/Enums/IoctlStorageControlCodes.cs new file mode 100644 index 0000000..59ca009 --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Devices/DeviceManagement/Enums/IoctlStorageControlCodes.cs @@ -0,0 +1,144 @@ + +namespace iTin.Core.Interop.Windows.Development.Devices.DeviceManagement +{ + using System; + + // ------------------------------------------------------------------------------- + // | Control Code Format = (type << 16) | function << 2 | method | access << 14) | + // ------------------------------------------------------------------------------- + + /// + /// Códigos de control. + /// + [Flags] + public enum IoctlStorageControlCodes : uint + { + /// + /// Código base para los códigos de control de dispositivos. + /// + IOCTL_STORAGE_BASE = DeviceType.MassStorage, + + /// + /// Control de cambio de un dispositivo extraíble. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363404%28v=VS.85%29.aspx. + /// + IOCTL_STORAGE_CHECK_VERIFY = (IOCTL_STORAGE_BASE << 16) | (DeviceAccess.Read << 14) | (0x0200 << 2) | DeviceMethod.Buffered, + + /// + /// Expulsa medios de comunicación desde un dispositivo SCSI. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363406%28v=VS.85%29.aspx. + /// + IOCTL_STORAGE_EJECT_MEDIA = (IOCTL_STORAGE_BASE << 16) | (DeviceAccess.Read << 14) | (0x0202 << 2) | DeviceMethod.Buffered, + + /// + /// Activa o desactiva el mecanismo que expulsa los medios. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363405%28v=VS.85%29.aspx. + /// + IOCTL_STORAGE_EJECTION_CONTROL = (IOCTL_STORAGE_BASE << 16) | (DeviceAccess.Any << 14) | (0x0250 << 2) | DeviceMethod.Buffered, + + /// + /// Recupera el tipo de dispositivo, número de dispositivo y si este tiene particiones, el número de particiones. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/bb968800%28v=VS.85%29.aspx. + /// + IOCTL_STORAGE_GET_DEVICE_NUMBER = (IOCTL_STORAGE_BASE << 16) | (DeviceAccess.Any << 14) | (0x0420 << 2) | DeviceMethod.Buffered, + + /// + /// Recupera la configuración 'hotplug' del dispositivo especificado. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363408%28v=VS.85%29.aspx. + /// + IOCTL_STORAGE_GET_HOTPLUG_INFO = (IOCTL_STORAGE_BASE << 16) | (DeviceAccess.Any << 14) | (0x0305 << 2) | DeviceMethod.Buffered, + + /// + /// Recupera el número de serie de un dispositivo USB. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363411%28v=VS.85%29.aspx. + /// + IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER = (IOCTL_STORAGE_BASE << 16) | (DeviceAccess.Any << 14) | (0x0304 << 2) | DeviceMethod.Buffered, + + /// + /// Recupera la información de la geometría del dispositivo. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363412%28v=VS.85%29.aspx. + /// + IOCTL_STORAGE_GET_MEDIA_TYPES = (IOCTL_STORAGE_BASE << 16) | (DeviceAccess.Any << 14) | (0x0300 << 2) | DeviceMethod.Buffered, + + /// + /// Recupera la información sobre los tipos de medios admitidos por un dispositivo. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363413%28v=VS.85%29.aspx. + /// + IOCTL_STORAGE_GET_MEDIA_TYPES_EX = (IOCTL_STORAGE_BASE << 16) | (DeviceAccess.Any << 14) | (0x0301 << 2) | DeviceMethod.Buffered, + + /// + /// Carga el medio en el dispositivo especificado. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363413%28v=VS.85%29.aspx. + /// + IOCTL_STORAGE_LOAD_MEDIA = (IOCTL_STORAGE_BASE << 16) | (DeviceAccess.Read << 14) | (0x0203 << 2) | DeviceMethod.Buffered, + + /// + /// Comunica la información de atributos de recorte al dispositivo si es compatible con el dispositivo. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/ee907417%28v=VS.85%29.aspx. + /// + IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES = (IOCTL_STORAGE_BASE << 16) | (DeviceAccess.Write << 14) | (0x0501 << 2) | DeviceMethod.Buffered, + + /// + /// Habilita o deshabilita la notificación de cambio de medios. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363415%28v=VS.85%29.aspx. + /// + IOCTL_STORAGE_MCN_CONTROL = (IOCTL_STORAGE_BASE << 16) | (DeviceAccess.Any << 14) | (0x0251 << 2) | DeviceMethod.Buffered, + + /// + /// Activa o desactiva el mecanismo de expulsión de discos. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363416%28v=VS.85%29.aspx. + /// + IOCTL_STORAGE_MEDIA_REMOVAL = (IOCTL_STORAGE_BASE << 16) | (DeviceAccess.Read << 14) | (0x0201 << 2) | DeviceMethod.Buffered, + + /// + /// Recupera la información de geometría para el dispositivo. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363417%28v=VS.85%29.aspx. + /// + IOCTL_STORAGE_READ_CAPACITY = (IOCTL_STORAGE_BASE << 16) | (DeviceAccess.Read << 14) | (0x0450 << 2) | DeviceMethod.Buffered, + + /// + /// Establece la configuración de conexión en caliente del dispositivo especificado. + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/aa363418%28v=VS.85%29.aspx. + /// + IOCTL_STORAGE_SET_HOTPLUG_INFO = (IOCTL_STORAGE_BASE << 16) | ((DeviceAccess.Read | DeviceAccess.Write) << 14) | (0x0306 << 2) | DeviceMethod.Buffered, + } +} + +//StorageCheckVerify2 = (IOCTL_STORAGE_BASE << 16) | (DeviceAccess.Any << 14) | (0x0200 << 2) | DeviceMethod.Buffered, +//StorageLoadMedia2 = (IOCTL_STORAGE_BASE << 16) | (DeviceAccess.Any << 14) | (0x0203 << 2) | DeviceMethod.Buffered, +//StorageReserve = (IOCTL_STORAGE_BASE << 16) | (DeviceAccess.Read << 14) | (0x0204 << 2) | DeviceMethod.Buffered, +//StorageRelease = (IOCTL_STORAGE_BASE << 16) | (DeviceAccess.Read << 14) | (0x0205 << 2) | DeviceMethod.Buffered, +//StorageFindNewDevices = (IOCTL_STORAGE_BASE << 16) | (DeviceAccess.Read << 14) | (0x0206 << 2) | DeviceMethod.Buffered, +//StorageResetBus = (IOCTL_STORAGE_BASE << 16) | (DeviceAccess.Read << 14) | (0x0400 << 2) | DeviceMethod.Buffered, +//StorageResetDevice = (IOCTL_STORAGE_BASE << 16) | (DeviceAccess.Read << 14) | (0x0401 << 2) | DeviceMethod.Buffered, +//StoragePredictFailure = (IOCTL_STORAGE_BASE << 16) | (DeviceAccess.Any << 14) | (0x0440 << 2) | DeviceMethod.Buffered, +//StorageObsoleteResetBus = (IOCTL_STORAGE_BASE << 16) | ((DeviceAccess.Read | DeviceAccess.Write) << 14) | (0x0400 << 2) | DeviceMethod.Buffered, +//StorageObsoleteResetDevice = (IOCTL_STORAGE_BASE << 16) | ((DeviceAccess.Read | DeviceAccess.Write) << 14) | (0x0401 << 2) | DeviceMethod.Buffered, diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Devices/DeviceManagement/NativeMethods.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Devices/DeviceManagement/NativeMethods.cs new file mode 100644 index 0000000..b8a2c35 --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Devices/DeviceManagement/NativeMethods.cs @@ -0,0 +1,84 @@ + +namespace iTin.Core.Interop.Windows.Development.Devices.DeviceManagement +{ + using System; + using System.Runtime.InteropServices; + + using Microsoft.Win32.SafeHandles; + + using iTin.Core.Interop.Windows.Hardware.DriverKit.Storage; + + using Storage.LocalFileSystems.DiskManagement; + + /// + /// Functions for device management, provides a uniform way to report changes that occur with system devices. + /// + public static class NativeMethods + { + [DllImport(ExternDll.Win.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool DeviceIoControl( SafeFileHandle driveHandle + , DeviceControlCode ioControlCode + , IntPtr lpInBuffer + , uint inBufferSize + , IntPtr lpOutBuffer + , uint outBufferSize + , ref uint lpBytesReturned + , IntPtr lpOverlapped); + + [DllImport(ExternDll.Win.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool DeviceIoControl(SafeFileHandle driveHandle + , IoctlDiskControlCode ioControlCode + , IntPtr lpInBuffer + , uint inBufferSize + , IntPtr lpOutBuffer + , uint outBufferSize + , ref uint lpBytesReturned + , IntPtr lpOverlapped); + + [DllImport(ExternDll.Win.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool DeviceIoControl(SafeFileHandle driveHandle + , DiskIoControlCode ioControlCode + , IntPtr lpInBuffer + , uint inBufferSize + , IntPtr lpOutBuffer + , uint outBufferSize + , ref uint lpBytesReturned + , IntPtr lpOverlapped); + + [DllImport(ExternDll.Win.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool DeviceIoControl(SafeFileHandle driveHandle + , IdeIoControlCode ioControlCode + , IntPtr lpInBuffer + , uint inBufferSize + , IntPtr lpOutBuffer + , uint outBufferSize + , ref uint lpBytesReturned + , IntPtr lpOverlapped); + + [DllImport(ExternDll.Win.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool DeviceIoControl( SafeFileHandle driveHandle + , DeviceControlCode ioControlCode + , IntPtr lpInBuffer + , uint inBufferSize + , SafeHandle lpOutBuffer + , uint outBufferSize + , ref uint lpBytesReturned + , IntPtr lpOverlapped); + + + [DllImport(ExternDll.Win.Kernel32, CharSet = CharSet.Auto, ExactSpelling = true, SetLastError = true)] + public static extern bool DeviceIoControl( IntPtr hDevice + , uint dwIoControlCode + , IntPtr lpInBuffer + , uint nInBufferSize + , IntPtr lpOutBuffer + , uint nOutBufferSize + , out uint lpBytesReturned + , IntPtr lpOverlapped); + } +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DocumentsAndPrinting/Printing/GdiPrint/Structures/DEVMODE.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DocumentsAndPrinting/Printing/GdiPrint/Structures/DEVMODE.cs index 8ebd4a7..348f775 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DocumentsAndPrinting/Printing/GdiPrint/Structures/DEVMODE.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/DocumentsAndPrinting/Printing/GdiPrint/Structures/DEVMODE.cs @@ -1,13 +1,11 @@  -using System; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.Runtime.InteropServices; - -using iTin.Core.Interop.Windows.Development.Graphics.Legacy.Gdi.Metafiles; - namespace iTin.Core.Interop.Windows.Development.DocumentAndPrinting.Printing.GdiPrint { + using System; + using System.Runtime.InteropServices; + + using Graphics.Legacy.Gdi.Metafiles; + /// /// La estructura de datos DEVMODE contiene información para la inicialización de una impresora o un dispositivo de visualización. /// @@ -15,223 +13,212 @@ namespace iTin.Core.Interop.Windows.Development.DocumentAndPrinting.Printing.Gdi /// Para más información, ver http://msdn.microsoft.com/es-es/library/dd183565.aspx. /// [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Ansi)] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DEVMODE")] - struct DEVMODE : IEquatable + public struct DEVMODE : IEquatable { #region Constantes /// /// Indica que se va a recuperar la configuración actual para el dispositivo de pantalla. /// - [SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "ENUM")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "CURRENT")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "SETTINGS")] public const int ENUM_CURRENT_SETTINGS = -1; /// /// Indica que se va a recuperar la configuración del dispositivo de visualización que está almacenada en el registro. /// - [SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "ENUM")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "REGISTRY")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "SETTINGS")] public const int ENUM_REGISTRY_SETTINGS = -2; #endregion #region Enumeraciones - #region [public] (enum) DM: Enumeración de miembros de una estructura de tipo DEVMODE. + #region [public] (enum) DM: Enumeración de miembros de una estructura de tipo DEVMODE. + /// + /// Enumeración de miembros de una estructura de tipo . + /// + /// + /// Para más información, ver sección dmFields de http://msdn.microsoft.com/es-es/library/dd183565.aspx. + /// + [Flags] + public enum DM + { /// - /// Enumeración de miembros de una estructura de tipo . + /// Para más información ver . /// - /// - /// Para más información, ver sección dmFields de http://msdn.microsoft.com/es-es/library/dd183565.aspx. - /// - [Flags] - public enum DM - { - /// - /// Para más información ver . - /// - Orientation = 0x1, - - /// - /// Para más información ver . - /// - PaperSize = 0x2, - - /// - /// Para más información ver . - /// - PaperLength = 0x4, - - /// - /// Para más información ver . - /// - PaperWidth = 0x8, - - /// - /// Para más información ver . - /// - Scale = 0x10, - - /// - /// Para más información ver . - /// - Position = 0x20, - - /// - /// Para más información ver . - /// - Nup = 0x40, - - /// - /// Para más información ver . - /// - DisplayOrientation = 0x80, - - /// - /// Para más información ver . - /// - Copies = 0x100, - - /// - /// Para más información ver . - /// - DefaultSource = 0x200, - - /// - /// Para más información ver . - /// - PrintQuality = 0x400, - - /// - /// Para más información ver . - /// - Color = 0x800, - - /// - /// Para más información ver . - /// - Duplex = 0x1000, - - /// - /// Para más información ver . - /// - YResolution = 0x2000, - - /// - /// Para más información ver . - /// - TTOption = 0x4000, - - /// - /// Para más información ver . - /// - Collate = 0x8000, - - /// - /// Para más información ver . - /// - FormName = 0x10000, - - /// - /// Para más información ver . - /// - LogPixels = 0x20000, - - /// - /// Para más información ver . - /// - BitsPerPixel = 0x40000, - - /// - /// Para más información ver . - /// - PelsWidth = 0x80000, - - /// - /// Para más información ver . - /// - PelsHeight = 0x100000, - - /// - /// Para más información ver . - /// - [SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags")] DisplayFlags = - 0x200000, - - /// - /// Para más información ver . - /// - DisplayFrequency = 0x400000, - - /// - /// - /// - ///// Para más información ver . - IcmMethod = 0x800000, - - /// - /// - /// - ///// Para más información ver . - IcmIntent = 0x1000000, - - /// - /// - /// - ///// Para más información ver . - MediaType = 0x2000000, - - /// - /// - /// - ///// Para más información ver . - DitherType = 0x4000000, - - /// - /// - /// - ///// Para más información ver . - PanningWidth = 0x8000000, - - /// - /// - /// - ///// Para más información ver . - PanningHeight = 0x10000000, - - /// - /// - /// - ///// Para más información ver . - DisplayFixedOutput = 0x20000000 - } - #endregion + Orientation = 0x1, - #region [public] (enum) DisplayFlags: Enumeración de miembros de una estructura de tipo DEVMODE. /// - /// Enumeración de atributos de estado de una estructura . + /// Para más información ver . /// - /// - /// Para más información, ver sección StateFlags de http://msdn.microsoft.com/es-es/library/dd183569.aspx. - /// - [Flags] - [SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags")] - public enum DisplayFlags - { - /// - /// Escala de grises. - /// - GrayScale = 0x01, - - /// - /// Entrelazado. - /// - Interlaced = 0x02 - } - #endregion + PaperSize = 0x2, + + /// + /// Para más información ver . + /// + PaperLength = 0x4, + + /// + /// Para más información ver . + /// + PaperWidth = 0x8, + + /// + /// Para más información ver . + /// + Scale = 0x10, + + /// + /// Para más información ver . + /// + Position = 0x20, + + /// + /// Para más información ver . + /// + Nup = 0x40, + + /// + /// Para más información ver . + /// + DisplayOrientation = 0x80, + + /// + /// Para más información ver . + /// + Copies = 0x100, + + /// + /// Para más información ver . + /// + DefaultSource = 0x200, + + /// + /// Para más información ver . + /// + PrintQuality = 0x400, + + /// + /// Para más información ver . + /// + Color = 0x800, + + /// + /// Para más información ver . + /// + Duplex = 0x1000, + + /// + /// Para más información ver . + /// + YResolution = 0x2000, + + /// + /// Para más información ver . + /// + TTOption = 0x4000, + + /// + /// Para más información ver . + /// + Collate = 0x8000, + + /// + /// Para más información ver . + /// + FormName = 0x10000, + + /// + /// Para más información ver . + /// + LogPixels = 0x20000, + + /// + /// Para más información ver . + /// + BitsPerPixel = 0x40000, + + /// + /// Para más información ver . + /// + PelsWidth = 0x80000, + + /// + /// Para más información ver . + /// + PelsHeight = 0x100000, + + /// + /// Para más información ver . + /// + DisplayFlags = 0x200000, + + /// + /// Para más información ver . + /// + DisplayFrequency = 0x400000, + + /// + /// + /// + ///// Para más información ver . + IcmMethod = 0x800000, + + /// + /// + /// + ///// Para más información ver . + IcmIntent = 0x1000000, + + /// + /// + /// + ///// Para más información ver . + MediaType = 0x2000000, + + /// + /// + /// + ///// Para más información ver . + DitherType = 0x4000000, + + /// + /// + /// + ///// Para más información ver . + PanningWidth = 0x8000000, + + /// + /// + /// + ///// Para más información ver . + PanningHeight = 0x10000000, + + /// + /// + /// + ///// Para más información ver . + DisplayFixedOutput = 0x20000000 + } + #endregion + + #region [public] (enum) DisplayFlags: Enumeración de miembros de una estructura de tipo DEVMODE. + /// + /// Enumeración de atributos de estado de una estructura . + /// + /// + /// Para más información, ver sección StateFlags de http://msdn.microsoft.com/es-es/library/dd183569.aspx. + /// + [Flags] + public enum DisplayFlags + { + /// + /// Escala de grises. + /// + GrayScale = 0x01, + + /// + /// Entrelazado. + /// + Interlaced = 0x02 + } + #endregion #endregion @@ -241,8 +228,6 @@ public enum DisplayFlags /// por ejemplo, "pcl/HP LaserJet" en el caso de PCL/HP LaserJet. Esta cadena es única entre los controladores de dispositivos. /// [FieldOffset(0)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = CCHDEVICENAME)] public string dmDeviceName; @@ -251,16 +236,12 @@ public enum DisplayFlags /// Para asegurarse de que utiliza la versión correcta para cualquier sistema operativo, utilice DM_SPECVERSION. /// [FieldOffset(32)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public Int16 dmSpecVersion; /// /// Número de versión del controlador establecido por el fabricante del mismo. /// [FieldOffset(34)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public Int16 dmDriverVersion; /// @@ -268,8 +249,6 @@ public enum DisplayFlags /// del controlador privados que podrían seguir a los miembros públicos de la estructura. /// [FieldOffset(36)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public Int16 dmSize; /// @@ -277,8 +256,6 @@ public enum DisplayFlags /// Si un controlador de dispositivo no utiliza información específica del dispositivo, este campo ha de ser 0. /// [FieldOffset(38)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public Int16 dmDriverExtra; /// @@ -288,8 +265,6 @@ public enum DisplayFlags /// Para más información ver . /// [FieldOffset(40)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public DM dmFields; /// @@ -297,7 +272,6 @@ public enum DisplayFlags /// Este miembro puede ser DMORIENT_PORTRAIT (1) o DMORIENT_LANDSCAPE (2). /// [FieldOffset(44)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] private Int16 dmOrientation; /// @@ -308,7 +282,6 @@ public enum DisplayFlags /// DMPAPER_USER o a uno de los siguientes valores predefinidos. /// [FieldOffset(46)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] private Int16 dmPaperSize; /// @@ -318,14 +291,12 @@ public enum DisplayFlags /// Estos valores, junto con los demás valores de esta estructura que especifican una longitud física, son en décimas de milímetro /// [FieldOffset(48)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] private Int16 dmPaperLength; /// /// Sólo para dispositivos de impresión, reemplaza el ancho del papel especificado por el campo dmPaperSize /// [FieldOffset(50)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] private Int16 dmPaperWidth; /// @@ -334,14 +305,12 @@ public enum DisplayFlags /// el texto y los gráficos sería la mitad de su altura y ancho. /// [FieldOffset(52)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] private Int16 dmScale; /// /// Número de copias, si el dispositivo acepta multicopias. /// [FieldOffset(54)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] private Int16 dmCopies; /// @@ -350,14 +319,12 @@ public enum DisplayFlags /// Este miembro puede ser uno de los siguientes valores, o puede ser un valor específico del dispositivo mayor o igual a DMBIN_USER. /// [FieldOffset(56)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] private Int16 dmDefaultSource; /// /// Especifica la resolución de la impresora. /// [FieldOffset(58)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] private Int16 dmPrintQuality; /// @@ -365,7 +332,6 @@ public enum DisplayFlags /// a la zona de escritorio. El dispositivo de pantalla principal siempre está situado en las coordenadas (0,0). /// [FieldOffset(44)] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public POINTL dmPosition; /// @@ -378,8 +344,6 @@ public enum DisplayFlags /// DMDO_270, la orientación de la pantalla se rota 270 grados. (en sentido de las agujas del reloj) desde su posición natural. /// [FieldOffset(52)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public Int32 dmDisplayOrientation; /// @@ -394,8 +358,6 @@ public enum DisplayFlags /// DMDFO_STRETCH, la imagen de baja resolución se estira para rellenar el espacio de pantalla más grande /// [FieldOffset(56)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public Int32 dmDisplayFixedOutput; /// @@ -404,8 +366,6 @@ public enum DisplayFlags /// DMCOLOR_MONOCHROME . /// [FieldOffset(60)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public short dmColor; /// @@ -415,8 +375,6 @@ public enum DisplayFlags /// DMDUP_VERTICAL, el lado largo de la página es vertical. /// [FieldOffset(62)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public short dmDuplex; /// @@ -424,8 +382,6 @@ public enum DisplayFlags /// Si la impresora inicializa este miembro, el campo dmPrintQuality especifica la resolución x, en puntos por pulgada, de la impresora. /// [FieldOffset(64)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public short dmYResolution; /// @@ -437,8 +393,6 @@ public enum DisplayFlags /// DMTT_SUBDEV, sustituto para fuentes TrueType. Se trata de la acción predeterminada para las impresoras PostScript. /// [FieldOffset(66)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public short dmTTOption; /// @@ -448,8 +402,6 @@ public enum DisplayFlags /// DMCOLLATE_FALSE. no intercalar al imprimir varias copias. /// [FieldOffset(68)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public short dmCollate; /// @@ -458,16 +410,12 @@ public enum DisplayFlags /// [FieldOffset(72)] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = CCHFORMNAME)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public string dmFormName; /// /// Número de píxeles por pulgada. Los controladores de impresora no deben utilizar este campo. /// [FieldOffset(102)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public Int16 dmLogPixels; /// @@ -476,7 +424,6 @@ public enum DisplayFlags /// Los controladores de impresora no deben utilizar este campo. /// [FieldOffset(104)] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public Int32 dmBitsPerPel; /// @@ -485,7 +432,6 @@ public enum DisplayFlags /// Los controladores de impresora no deben utilizar este campo. /// [FieldOffset(108)] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public Int32 dmPelsWidth; /// @@ -494,7 +440,6 @@ public enum DisplayFlags /// Los controladores de impresora no deben utilizar este campo. /// [FieldOffset(112)] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public Int32 dmPelsHeight; /// @@ -503,9 +448,6 @@ public enum DisplayFlags /// DM_INTERLACED, especifica que el modo de visualización es entrelazado. Si no se establece este indicador, se asume que es no entrelazado. /// [FieldOffset(116)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] - [SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Flags")] public DisplayFlags dmDisplayFlags; /// @@ -514,8 +456,6 @@ public enum DisplayFlags /// DMNUP_ONEUP, la aplicación hace NUP. /// [FieldOffset(116)] - [SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public Int32 dmNup; /// @@ -529,7 +469,6 @@ public enum DisplayFlags /// o por un programa de configuración que no utilizan funciones de visualización como ChangeDisplaySettings. /// [FieldOffset(120)] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public Int32 dmDisplayFrequency; #endregion @@ -553,56 +492,52 @@ public bool Equals(DEVMODE other) #region Overrides - #region [public] {override} (int) GetHashCode(): Devuelve un valor que repesenta al código hash de esta estructura. - /// - /// Devuelve un valor que repesenta al código hash de esta estructura. - /// - /// - /// Tipo: - /// Código Hash de esta estructura. - /// - public override int GetHashCode() - { - return dmPelsWidth ^ dmPelsHeight ^ dmBitsPerPel ^ dmDisplayFrequency; - } - #endregion + #region [public] {override} (int) GetHashCode(): Devuelve un valor que repesenta al código hash de esta estructura. + /// + /// Devuelve un valor que repesenta al código hash de esta estructura. + /// + /// + /// Tipo: + /// Código Hash de esta estructura. + /// + public override int GetHashCode() + { + return dmPelsWidth ^ dmPelsHeight ^ dmBitsPerPel ^ dmDisplayFrequency; + } + #endregion - #region [public] {override} (bool) Equals(object): Devuelve un valor que indica si esta estructutra es igual a otra. - /// - /// Devuelve un valor que indica si esta estructutra es igual a otra. - /// - /// Estructura con la que comparar. - /// Resultado de la comparación de igualdad. - public override bool Equals(object obj) - { - if (obj == null) - return false; + #region [public] {override} (bool) Equals(object): Devuelve un valor que indica si esta estructutra es igual a otra. + /// + /// Devuelve un valor que indica si esta estructutra es igual a otra. + /// + /// Estructura con la que comparar. + /// Resultado de la comparación de igualdad. + public override bool Equals(object obj) + { + if (obj == null) + return false; - if (!(obj is DEVMODE)) - return false; + if (!(obj is DEVMODE)) + return false; - DEVMODE other = (DEVMODE) obj; - return (other.dmPelsWidth == dmPelsWidth) && (other.dmPelsHeight == dmPelsHeight) && - (other.dmBitsPerPel == dmBitsPerPel) && (other.dmDisplayFrequency == dmDisplayFrequency); - } - #endregion + DEVMODE other = (DEVMODE) obj; + return (other.dmPelsWidth == dmPelsWidth) && (other.dmPelsHeight == dmPelsHeight) && + (other.dmBitsPerPel == dmBitsPerPel) && (other.dmDisplayFrequency == dmDisplayFrequency); + } + #endregion - #region [public] {override} (string) ToString(): Devuelve una cadena que representa a la estructura actual. - /// - /// Devuelve una cadena que representa la estructura actual. - /// - /// - /// Tipo: - /// Cadena que representa la estructura actual. - /// - /// - /// El método devuelve una cadena que incluye la resolución, profundidad de color y velocidad de refresco actual. - /// - public override string ToString() - { - return String.Format(CultureInfo.InvariantCulture, "{0} x {1}, {2} bits, {3}hz", dmPelsWidth, dmPelsHeight, dmBitsPerPel, dmDisplayFrequency); - } - #endregion + #region [public] {override} (string) ToString(): Devuelve una cadena que representa a la estructura actual. + /// + /// Devuelve una cadena que representa la estructura actual. + /// + /// + /// Cadena que representa la estructura actual. + /// + /// + /// El método devuelve una cadena que incluye la resolución, profundidad de color y velocidad de refresco actual. + /// + public override string ToString() => $"{dmPelsWidth} x {dmPelsHeight}, {dmBitsPerPel} bits, {dmDisplayFrequency}hz"; + #endregion #endregion diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/DeviceContext/NativeMethods.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/DeviceContext/NativeMethods.cs index 099a194..b3cc148 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/DeviceContext/NativeMethods.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/DeviceContext/NativeMethods.cs @@ -5,282 +5,314 @@ namespace iTin.Core.Interop.Windows.Development.Graphics.Legacy.Gdi.DeviceContex using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; - using iTin.Core.Interop.Windows.Development.DocumentAndPrinting.Printing.GdiPrint; + using DocumentAndPrinting.Printing.GdiPrint; /// - /// Funciones que se pueden utilizar para controlar la configuración de parámetros del sistema y los diversos atributos del sistema, como el tiempo del doble clic, - /// el tiempo de espera del protector de pantalla, el ancho del borde de las ventanas. + /// Functions that can be used to control the configuration of system parameters and various system attributes, such as double click time, the screen saver timeout, the width of the window border. /// - static class NativeMethods + public static class NativeMethods { - #region nested classes - - #region [internal] {static} (class) EnumDisplayFlags: - internal static class EnumDisplayFlags - { - public const int EDS_NORMAL = 0x00; - public const int EDS_RAWMODE = 0x02; - public const int EDS_ROTATEDMODE = 0x04; - } - #endregion + #region public enumerations - #endregion - - #region Enums - - #region [internal] (enum) ChangeDisplaySettingsFlags: + #region [public] (enum) ChangeDisplaySettingsFlags: /// /// /// [Flags] - internal enum ChangeDisplaySettingsFlags + public enum ChangeDisplaySettingsFlags { /// - /// Cambia el modo gráfico actual, este se actualizarán en el registro. La información del modo se almacena en el perfil de usuario. + /// Change the current graphic mode, this will be updated in the registry. The mode information is stored in the user profile. /// CDS_UPDATEREGISTRY = 0x01, + /// - /// El sistema comprueba si se puede establecer el modo gráfico solicitado. + /// The system checks if the requested graphic mode can be set. /// CDS_TEST = 0x02, + /// - /// El modo es de carácter temporal. Si cambia a y desde otro escritorio, este modo no se restablecerá. + /// The mode is temporary. If you switch to and from another desktop, this mode will not be reset. /// CDS_FULLSCREEN = 0x04, + /// - /// La configuración se guardará en el área configuración global para que afectará a todos los usuarios de la máquina. - /// De lo contrario, se modifica sólo la configuración del usuario. - /// Este indicador sólo es válido cuando se usa junto con el flag . + /// The configuration will be saved in the global configuration area so that it will affect all users of the machine. + /// Otherwise, only the user settings are modified. + /// This indicator is only valid when used together with the flag . /// CDS_GLOBAL = 0x08, + /// - /// Este dispositivo se convertirá en el dispositivo primario. + /// This device will become the primary device. /// CDS_SET_PRIMARY = 0x10, + /// - /// Cuando se establece, el parámetro lParam es un puntero a una estructura VIDEOPARAMETERS. + /// When set, the lParam parameter is a pointer to a VIDEOPARAMETERS structure. /// CDS_VIDEOPARAMETERS = 0x020, + /// - /// La configuración se guardan en el registro, pero no tendrá efecto. - /// Este indicador sólo es válido cuando se usa junto con el flag . + /// The settings are saved in the registry, but will not take effect. + /// This indicator is only valid when used together with the flag . /// CDS_NORESET = 0x10000000, + /// - /// Debe cambiar la configuración, incluso si los ajustes solicitados son los mismos que la configuración actual. + /// You must change the settings, even if the requested settings are the same as the current settings. /// CDS_RESET = 0x40000000, } #endregion - #region [internal] (enum) DISP_CHANGE: Valores de retorno para las funciones ChangeDisplaySettings y ChangeDisplaySettingsEx. + #region [public] (enum) DISP_CHANGE: Return values for the ChangeDisplaySettings and ChangeDisplaySettingsEx functions /// - /// Valores de retorno para las funciones y . + /// Return values for the and functions. For more information, please see http://msdn.microsoft.com/es-es/library/dd183411.aspx. /// - /// - /// Para más información, ver sección return value de http://msdn.microsoft.com/es-es/library/dd183411.aspx - /// - internal enum DISP_CHANGE + public enum DISP_CHANGE { /// - /// El cambio de configuración se realizo con éxito. + /// The configuration change was successful. /// DISP_CHANGE_SUCCESSFUL = 0, + /// - /// Debe reiniciar el equipo para que el modo de gráfico funcione. + /// You must restart the computer for the chart mode to work. /// DISP_CHANGE_RESTART = 1, + /// - /// El controlador de generó un error para el modo de vídeo especificado. + /// The driver generated an error for the specified video mode. /// DISP_CHANGE_FAILED = -1, + /// - /// Modo gráfico no soportado. + /// Graphic mode not supported. /// DISP_CHANGE_BADMODE = -2, + /// - /// No se puede escribir la configuración en el registro. + /// The configuration cannot be written to the registry. /// DISP_CHANGE_NOTUPDATED = -3, + /// - /// Flag ó conjunto de Flags no válidos. + /// Flag or set of invalid Flags. /// DISP_CHANGE_BADFLAGS = -4, + /// - /// Se pasó un parámetro no válido en el campo Flags. - /// Esto puede incluir un flag no válido o una combinación de flags no válidos. + /// An invalid parameter was passed in the Flags field. + /// This may include an invalid flag or a combination of invalid flags. /// DISP_CHANGE_BADPARAM = -5, + /// - /// El cambio de configuración no tuvo éxito porque el sistema es capaz de DualView. + /// The configuration change was unsuccessful because the system is capable of DualView. /// DISP_CHANGE_BADDUALVIEW = -6 } #endregion - #region [internal] (enum) DeviceCap: Valores de retorno para las funciones ChangeDisplaySettings y ChangeDisplaySettingsEx. + #region [public] (enum) DeviceCap: GetDeviceCaps retrieves device specific information for the specified device /// - /// Rón GetDeviceCaps recupera información específica del dispositivo para el dispositivo especificado. + /// GetDeviceCaps retrieves device specific information for the specified device. /// - internal enum DeviceCap + public enum DeviceCap { /// - /// Versión del controlador del dispositivo. + /// Device driver version. /// DRIVERVERSION = 0, + /// /// Clasificación del dispositivo. /// TECHNOLOGY = 2, + /// - /// Tamaño horizontal en milimetros. + /// Horizontal size in millimeters. /// HORZSIZE = 4, + /// - /// Tamaño vertical en milimetros. + /// Vertical size in millimeters. /// VERTSIZE = 6, + /// /// Tamaño horizontal en pixeles. /// HORZRES = 8, + /// /// Tamaño vertical en pixeles. /// VERTRES = 10, + /// - /// Número de bits por pixel. + /// Number of bits per pixel. /// BITSPIXEL = 12, + /// - /// Numbero de planos de color. + /// Number of color planes. /// PLANES = 14, + /// - /// Número de pinceles que tiene el dispositivo. + /// Number of brushes the device has. /// NUMBRUSHES = 16, + /// - /// Número de pens que tiene el dispositivo. + /// Number of pens the device has /// NUMPENS = 18, + /// - /// Número de marcadores que tiene el dispositivo. + /// Number of bookmarks the device has. /// NUMMARKERS = 20, + /// - /// Número de fuentes que tiene el dispositivo. + /// Number of sources the device has. /// NUMFONTS = 22, + /// - /// Número de colores soportados por el dispositivo. + /// Number of colors supported by the device. /// NUMCOLORS = 24, + /// - /// Tamaño necesario para descriptor de dispositivo. + /// Required size for device descriptor. /// PDEVICESIZE = 26, + /// - /// Capacidades de curva. + /// Curve Capabilities. /// CURVECAPS = 28, + /// - /// Capacidades de línea. + /// Line Capabilities. /// LINECAPS = 30, + /// - /// Capacidades poligonales. + /// Polygonal capabilities. /// POLYGONALCAPS = 32, + /// /// Capacidades de texto. /// TEXTCAPS = 34, + /// /// Capacidades de recorte. /// CLIPCAPS = 36, + /// - /// Capacidades de BitBlt. + /// BitBlt Capabilities. /// RASTERCAPS = 38, + /// - /// Longitud X. + /// X length. /// ASPECTX = 40, + /// - /// Longitud Y. + /// Y length. /// ASPECTY = 42, + /// - /// Longitud de la hipotenusa. + /// Length of the hypotenuse. /// ASPECTXY = 44, + /// - /// Shading and Blending caps + /// Shading and Blending caps. /// SHADEBLENDCAPS = 45, /// - /// Logical pixels inch in X + /// Logical pixels inch in X. /// LOGPIXELSX = 88, + /// - /// Logical pixels inch in Y + /// Logical pixels inch in Y. /// LOGPIXELSY = 90, /// - /// Número de entradas físicas en paleta. + /// Number of physical entries in palette. /// SIZEPALETTE = 104, + /// - /// Número de entradas reservadas en paleta. + /// Number of reserved entries in palette. /// NUMRESERVED = 106, + /// - /// Resolución de color actual. + /// Current color resolution. /// COLORRES = 108, - // Relacionadas con la impresión. + // Related to printing. + // ------------------- /// /// Physical Width in device units /// PHYSICALWIDTH = 110, + /// /// Physical Height in device units /// PHYSICALHEIGHT = 111, + /// /// Physical Printable Area x margin /// PHYSICALOFFSETX = 112, + /// /// Physical Printable Area y margin /// PHYSICALOFFSETY = 113, + /// /// Scaling factor x /// SCALINGFACTORX = 114, + /// /// Scaling factor y /// SCALINGFACTORY = 115, /// - /// Refresco vertical del monitor actual, se mide en Hercios(Hz). + /// Vertical refreshment of the current monitor is measured in Hertz (Hz). /// VREFRESH = 116, + /// - /// Ancho completo del escritorio, en pixeles. + /// Full width of the desktop, in pixels. /// DESKTOPVERTRES = 117, + /// - /// Altura completa del escritorio, en pixeles. + /// Full height of the desk, in pixels. /// DESKTOPHORZRES = 118, + /// /// Preferred blt alignment /// @@ -292,112 +324,100 @@ internal enum DeviceCap #region P/Invoke - #region [public] {static} {extern} (DISP_CHANGE) ChangeDisplaySettings(ref DEVMODE, int): Cambiar la configuración del dispositivo de visualización por defecto para el modo de gráficos especificado. + #region [public] {static} {extern} (DISP_CHANGE) ChangeDisplaySettings(ref DEVMODE, int): Change the default display device settings for the specified graphics mode /// - /// Cambiar la configuración del dispositivo de visualización por defecto para el modo de gráficos especificado. - /// Para cambiar la configuración de un dispositivo de visualización especificado, utilice la función . + /// Change the default display device settings for the specified graphics mode. + /// To change the settings of a specified display device, use the function. + /// For more information, please see http://msdn.microsoft.com/es-es/library/dd183411.aspx. /// - /// - /// Para más información, ver http://msdn.microsoft.com/es-es/library/dd183411.aspx - /// [DllImport(ExternDll.Win.User32, CharSet = CharSet.Ansi, SetLastError = true)] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] public static extern DISP_CHANGE ChangeDisplaySettings(ref DEVMODE devMode, int flags); #endregion - #region [public] {static} {extern} (DISP_CHANGE) ChangeDisplaySettingsEx(string, ref DEVMODE, IntPtr, int, IntPtr): Cambiar la configuración de la pantalla especificado para el modo de gráficos especificado. + #region [public] {static} {extern} (DISP_CHANGE) ChangeDisplaySettingsEx(string, ref DEVMODE, IntPtr, int, IntPtr): Change the specified screen settings for the specified graphics mode /// - /// Cambiar la configuración de la pantalla especificado para el modo de gráficos especificado. + /// Change the specified screen settings for the specified graphics mode. For more information, please see http://msdn.microsoft.com/es-es/library/dd183411.aspx. /// - /// - /// Para más información, ver http://msdn.microsoft.com/es-es/library/dd183413.aspx - /// [DllImport(ExternDll.Win.User32, CharSet = CharSet.Ansi, SetLastError = true)] [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] public static extern DISP_CHANGE ChangeDisplaySettingsEx(string lpszDeviceName, ref DEVMODE lpDevMode, IntPtr hwnd, int dwflags, IntPtr lParam); #endregion - #region [public] {static} {extern} (IntPtr) CreateDC(string, string, string, ref DEVMODE): Crea un contexto de dispositivo (DC) para un dispositivo usando el nombre especificado. + #region [public] {static} {extern} (IntPtr) CreateDC(string, string, string, ref DEVMODE): Create a device context (DC) for a device using the specified name /// - /// Crea un contexto de dispositivo (DC) para un dispositivo usando el nombre especificado. + /// Create a device context (DC) for a device using the specified name. For more information, please see http://msdn.microsoft.com/en-us/library/dd183490%28VS.85%29.aspx. /// - /// - /// Para más información, ver http://msdn.microsoft.com/en-us/library/dd183490%28VS.85%29.aspx. - /// [DllImport(ExternDll.Win.Gdi32, CharSet = CharSet.Ansi, SetLastError = true)] public static extern IntPtr CreateDC(string lpszDriver, string lpszDevice, string lpszOutput, ref DEVMODE lpInitData); #endregion - #region [public] {static} {extern} (bool) DeleteDC(IntPtr): Borrar el contexto de dispositivo (DC) especificado. + #region [public] {static} {extern} (bool) DeleteDC(IntPtr): Delete the specified device context (DC) /// - /// Borrar el contexto de dispositivo (DC) especificado. + /// Delete the specified device context (DC). For more information, please see http://msdn.microsoft.com/en-us/library/dd183533%28v=VS.85%29.aspx. /// - /// - /// Para más información, ver http://msdn.microsoft.com/en-us/library/dd183533%28v=VS.85%29.aspx - /// [DllImport(ExternDll.Win.Gdi32)] [return: MarshalAs(UnmanagedType.Bool)] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] public static extern bool DeleteDC(IntPtr hdc); #endregion - #region [public] {static} {extern} (bool) EnumDisplayDevices(string, UInt32, ref DISPLAY_DEVICE, UInt32): Obtener información acerca de los dispositivos de visualización en la sesión actual. + #region [public] {static} {extern} (bool) EnumDisplayDevices(string, uint, ref DISPLAY_DEVICE, uint): Get information about the display devices in the current session /// - /// Obtener información acerca de los dispositivos de visualización en la sesión actual. + /// Get information about the display devices in the current session. For more information, please see http://msdn.microsoft.com/es-es/library/dd162609.aspx. /// - /// Puntero al nombre del dispositivo. Si es null, devuelve la información de todos los adaptadores de video del equipo. Para obtener la información de cada adaptador debemos ir incrementando el valor del parámetro iDevNum. - /// Índice que especifica el dispositivo de pantalla. El sistema operativo identifica cada dispositivo de visualización con un índice. Estos índices son enteros consecutivos, a partir de 0. Si la sesión actual tiene tres dispositivos de pantalla, por ejemplo, se especifican los valores de índice 0, 1 y 2 respectivamente. - /// Puntero a una estructura que recibe la información del dispositivo de pantalla especificado por iDevNum. Antes de llamar a la esta función, el miembro cb de la estructura se ha de inicializar con el tamaño de la estructura en bytes. - /// Establecer este indicador en EDD_GET_DEVICE_INTERFACE_NAME (0x00000001) para recuperar el nombre de la interfaz de dispositivo de GUID_DEVINTERFACE_MONITOR, que está registrado por el sistema operativo de base por monitor. El valor se coloca en el miembro DeviceID de la estructura en lpDisplayDevice. - /// - /// Para más información, ver http://msdn.microsoft.com/es-es/library/dd162609.aspx. - /// + /// Pointer to the device name. If it is null, it returns the information of all the video adapters on the device. To obtain the information of each adapter we must increase the value of the iDevNum parameter. + /// Index that specifies the display device. The operating system identifies each display device with an index. These indexes are consecutive integers, from 0. If the current session has three display devices, for example, the index values 0, 1 and 2 are specified respectively. + /// Pointer to a structure that receives the information from the display device specified by iDevNum. Before calling this function, the cb member of the structure must be initialized with the size of the structure in bytes. + /// Set this indicator to EDD_GET_DEVICE_INTERFACE_NAME (0x00000001) to retrieve the device interface name of GUID_DEVINTERFACE_MONITOR, which is registered by the base operating system by monitor. The value is placed in the DeviceID member of the structure in lpDisplayDevice. [DllImport(ExternDll.Win.User32, CharSet = CharSet.Ansi, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool EnumDisplayDevices([In] String lpDevice - , [In] UInt32 iDevNum - , [In] [Out] ref DISPLAY_DEVICE lpDisplayDevice - , [In] UInt32 dwFlags); + public static extern bool EnumDisplayDevices([In] string lpDevice, [In] uint iDevNum, [In] [Out] ref DISPLAY_DEVICE lpDisplayDevice, [In] uint dwFlags); #endregion - #region [public] {static} {extern} (bool) EnumDisplaySettings(string, int, ref DEVMODE): Obtiene información acerca de uno de los modos gráficos para un dispositivo de visualización. + #region [public] {static} {extern} (bool) EnumDisplaySettings(string, int, ref DEVMODE): Get information about one of the graphic modes for a display device /// - /// Obtiene información acerca de uno de los modos gráficos para un dispositivo de visualización. - /// Para recuperar información para todos los modos gráficos de un dispositivo de visualización, realizar una serie de llamadas a esta función. + /// Get information about one of the graphic modes for a display device. + /// To retrieve information for all graphic modes of a display device, make a series of calls to this function. + /// For more information, please see http://msdn.microsoft.com/es-es/library/dd162611.aspx. /// - /// - /// Para más información, ver http://msdn.microsoft.com/es-es/library/dd162611.aspx - /// [DllImport(ExternDll.Win.User32, CharSet = CharSet.Ansi, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumDisplaySettings(string deviceName, int modeNum, ref DEVMODE devMode); #endregion - #region [public] {static} {extern} (bool) EnumDisplaySettingsEx(string, int, ref DEVMODE, int): Obtiene información acerca de uno de los modos gráficos para un dispositivo de visualización. + #region [public] {static} {extern} (bool) EnumDisplaySettingsEx(string, int, ref DEVMODE, int): Retrieves information about one of the graphic modes for a display device /// - /// Recupera información acerca de uno de los modos gráficos para un dispositivo de visualización. - /// Para recuperar información para todos los modos gráficos para un dispositivo de visualización, realizar una serie de llamadas a esta función. - /// Esta función difiere de en que hay un parámetro dwFlags. + /// Retrieves information about one of the graphic modes for a display device. + /// To retrieve information for all graphic modes for a display device, make a series of calls to this function. + /// This function differs from in that there is a dwFlags parameter. + /// For more information, please see http://msdn.microsoft.com/en-us/library/dd162612.aspx. /// - /// - /// Para más información, ver http://msdn.microsoft.com/en-us/library/dd162612.aspx. - /// [return: MarshalAs(UnmanagedType.Bool)] [DllImport(ExternDll.Win.User32, CharSet = CharSet.Ansi, SetLastError = true)] public static extern bool EnumDisplaySettingsEx(string deviceName, int modeNum, ref DEVMODE devMode, int dwFlags); #endregion - #region [public] {static} {extern} (int) GetDeviceCaps(IntPtr, DeviceCap): Obtiene información específica del dispositivo especificado. + #region [public] {static} {extern} (int) GetDeviceCaps(IntPtr, DeviceCap): Get specific information of the specified device /// - /// Obtiene información específica del dispositivo especificado. + /// Get specific information of the specified device. For more information, please see http://msdn.microsoft.com/en-us/library/dd144877%28v=VS.85%29.aspx. /// - /// - /// Para más información, ver http://msdn.microsoft.com/en-us/library/dd144877%28v=VS.85%29.aspx - /// [DllImport(ExternDll.Win.Gdi32)] public static extern int GetDeviceCaps(IntPtr hdc, DeviceCap index); #endregion #endregion + + + #region nested classes + + #region [internal] {static} (class) EnumDisplayFlags: + public static class EnumDisplayFlags + { + public const int EDS_NORMAL = 0x00; + public const int EDS_RAWMODE = 0x02; + public const int EDS_ROTATEDMODE = 0x04; + } + #endregion + + #endregion } } diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/DeviceContext/Structures/DISPLAY_DEVICE.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/DeviceContext/Structures/DISPLAY_DEVICE.cs index 1eb160f..9317aae 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/DeviceContext/Structures/DISPLAY_DEVICE.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/DeviceContext/Structures/DISPLAY_DEVICE.cs @@ -1,270 +1,235 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.Runtime.InteropServices; - + namespace iTin.Core.Interop.Windows.Development.Graphics.Legacy.Gdi.DeviceContext { + using System; + using System.Runtime.InteropServices; + /// - /// La estructura DISPLAY_DEVICE recibe la información del dispositivo de pantalla especificado por el - /// parámetro iDevNum de la función . + /// The DISPLAY_DEVICE structure receives the information from the display device specified by the parameter iDevNum of function . + /// For more information, please see http://msdn.microsoft.com/es-es/library/dd183569.aspx. /// - /// - /// Para más información, ver http://msdn.microsoft.com/es-es/library/dd183569.aspx. - /// [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] - [SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DISPLAY")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DEVICE")] public struct DISPLAY_DEVICE : IEquatable { - #region Constantes + #region public constants /// - /// Indica que el campo DeviceId va a contener la clave del registro de este monitor. + /// Indicates that the DeviceId field will contain the registry key of this monitor. /// - [SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "EDD")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "GET")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DEVICE")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "INTERFACE")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "NAME")] public const uint EDD_GET_DEVICE_INTERFACE_NAME = 0x01; #endregion - #region Enums + #region public enumerations - #region [public] (enum) KnownDisplayDeviceStates: Enumeración de atributos de estado de una estructura DISPLAY_DEVICE. + #region [public] (enum) KnownDisplayDeviceStates: Enumeration of status attributes of a DISPLAY_DEVICE structure + /// + /// Enumeration of status attributes of a structure. For more information, please see http://msdn.microsoft.com/es-es/library/dd183569.aspx. + /// + [Flags] + public enum KnownDisplayDeviceStates + { /// - /// Enumeración de atributos de estado de una estructura . + /// Indicates that the device shows the desktop. /// - /// - /// Para más información, ver sección StateFlags de http://msdn.microsoft.com/es-es/library/dd183569.aspx - /// - [Flags] - public enum KnownDisplayDeviceStates - { - /// - /// Indica que el dispositivo muestra el escritorio. - /// - AttachedToDesktop = 0x00000001, - - /// - /// - /// - MultiDriver = 0x00000002, - - /// - /// Indica que és el escritorio principal. - /// Para un sistema con un adaptador de video, siempre se establece. - /// Para un sistema con varias tarjetas de vídeo, solo una puede tener este flag activo. - /// - PrimaryDevice = 0x00000004, - - /// - /// Representa un pseudo dispositivo para reflejar la aplicación de dibujo para la interacción remota o con otros fines. - /// Un pseudo monitor invisible está asociado con este dispositivo. Por ejemplo, NetMeeting lo utiliza. - /// - MirroringDriver = 0x00000008, - - /// - /// El dispositivo es compatible con VGA. - /// - VgaCompatible = 0x00000010, - - /// - /// El dispositivo es extraíble; no puede ser la pantalla principal. - /// - Removable = 0x00000020, - - /// - /// - /// - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Un")] - UnSafeModesOn = 0x00080000, - - /// - /// - /// - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Ts")] - TsCompatible = 0x00200000, - - /// - /// - /// - Disconnect = 0x02000000, - - /// - /// - /// - Remote = 0x04000000, - - /// - /// El dispositivo tiene más modos de vídeo. - /// - ModesPruned = 0x08000000, - } - #endregion + AttachedToDesktop = 0x00000001, + + /// + /// + /// + MultiDriver = 0x00000002, + + /// + /// Indicates that it is the main desktop. + /// For a system with a video adapter, it is always set. + /// For a system with several video cards, only one can have this flag active. + /// + PrimaryDevice = 0x00000004, + + /// + /// It represents a pseudo device to reflect the drawing application for remote interaction or for other purposes. + /// A pseudo invisible monitor is associated with this device. For example, NetMeeting uses it. + /// + MirroringDriver = 0x00000008, + + /// + /// The device is compatible with VGA. + /// + VgaCompatible = 0x00000010, + + /// + /// The device is removable; It cannot be the main screen. + /// + Removable = 0x00000020, + + /// + /// + /// + UnSafeModesOn = 0x00080000, + + /// + /// + /// + TsCompatible = 0x00200000, + + /// + /// + /// + Disconnect = 0x02000000, + /// + /// + /// + Remote = 0x04000000, + + /// + /// The device has more video modes. + /// + ModesPruned = 0x08000000, + } #endregion - #region Atributos + #endregion + + #region public members /// - /// Especifica el tamaño, en bytes, de la estructura DISPLAY_DEVICE. - /// Se debe inicializar antes de llamar a una función Api. + /// Specify the size, in bytes, of the DISPLAY_DEVICE structure. + /// Must be initialized before calling a Api function. /// [MarshalAs(UnmanagedType.U4)] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public int cb; /// - /// Una cadena que identifica el nombre de dispositivo. - /// Este es el dispositivo del adaptador o el dispositivo de monitor. + /// A string that identifies the device name. + /// This is the adapter device or the monitor device. /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public string DeviceName; /// - /// Una cadena que contiene el contexto de dispositivo. - /// Esto es tanto una descripción del adaptador de vídeo o del monitor de pantalla. + /// A string that contains the device context. + /// This is both a description of the video adapter or the screen monitor. /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public string DeviceString; /// - /// Indicadores de estado. + /// Status indicators. /// [MarshalAs(UnmanagedType.U4)] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public KnownDisplayDeviceStates State; /// - /// Identificador del dispositivo. + /// Device identifier. /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public string DeviceID; /// - /// Una cadena que contiene la ruta del registro de windows a la información del dispositivo. + /// A string containing the windows registry path to the device information. /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public string DeviceKey; #endregion - #region Interfaces + #region interfaces - #region [public] (bool) Equals(DISPLAY_DEVICE): Indica si el objeto actual es igual a otro objeto del mismo tipo. - /// - /// Indica si el objeto actual es igual a otro objeto del mismo tipo. - /// - /// Objeto que se va a comparar con este objeto. - /// - /// Devuelve true si el objeto actual es igual al parámetro other; en caso contrario, false. - /// - public bool Equals(DISPLAY_DEVICE other) - { - return other.Equals((object)this); - } - #endregion + #region [public] (bool) Equals(DISPLAY_DEVICE): Indicates whether the current object is the same as another object of the same type + /// + /// Indicates whether the current object is the same as another object of the same type. + /// + /// Object to be compared with this object. + /// + /// Returns true if the current object is equal to the other parameter; otherwise, false. + /// + public bool Equals(DISPLAY_DEVICE other) => other.Equals((object)this); + #endregion #endregion - #region Overrides + #region public operators - #region [public] {override} (int) GetHashCode(): Devuelve el código hash del objeto. - /// - /// Devuelve el código hash del objeto. - /// - /// - /// Tipo: - /// Código Hash. - /// - public override int GetHashCode() - { - return DeviceName.GetHashCode() ^ (int)State; - } - #endregion + #region [public] {static} (bool) operator ==(DISPLAY_DEVICE, DISPLAY_DEVICE): Implement the equality operator (==) + /// + /// Implement the equality operator (==). + /// + /// Operand 1. + /// Operand 2. + /// + /// Returns true if deviceInfo1 is equal to deviceInfo2; false otherwise. + /// + public static bool operator ==(DISPLAY_DEVICE left, DISPLAY_DEVICE right) => left.Equals(right); + #endregion - #region [public] {override} (bool) Equals(object obj): Devuelve un valor que indica si este objeto es igual a otro. - /// - /// Devuelve un valor que indica si este objeto es igual a otro. - /// - /// Objeto con el que comparar. - /// Resultado de igualdad. - public override bool Equals(object obj) - { - if (obj == null) - return false; + #region [public] {static} (bool) operator !=(DISPLAY_DEVICE, DISPLAY_DEVICE): Implements the inequality operator (!=) + /// + /// Implements the inequality operator (!=). + /// + /// Operand 1. + /// Operand 2. + /// + /// Returns true if deviceInfo1 is not equal to deviceInfo2; false otherwise. + /// + public static bool operator !=(DISPLAY_DEVICE left, DISPLAY_DEVICE right) => !left.Equals(right); + #endregion - if (!(obj is DISPLAY_DEVICE)) - return false; + #endregion - DISPLAY_DEVICE other = (DISPLAY_DEVICE)obj; - return (other.DeviceName == DeviceName) && (other.State == State); - } - #endregion + #region public static methods + /// + /// New empty structure. + /// + public static readonly DISPLAY_DEVICE Empty = new DISPLAY_DEVICE { cb = Marshal.SizeOf(typeof(DISPLAY_DEVICE)) }; + #endregion - #region [public] {override} (string) ToString(): Devuelve una cadena que representa al objeto actual. - /// - /// Devuelve una cadena que representa al objeto actual. - /// - /// - /// Tipo: - /// Cadena que representa al objeto actual. - /// - /// - /// El método devuelve una cadena que incluye el tipo de estructura. - /// - public override string ToString() - { - return string.Format(CultureInfo.InvariantCulture, "DeviceName = {0}", DeviceName); - } - #endregion + #region public override methods + #region [public] {override} (int) GetHashCode(): Returns the hash code of the structure + /// + /// Returns the hash code of the structure. + /// + /// + /// Hash code. + /// + public override int GetHashCode() => DeviceName.GetHashCode() ^ (int)State; #endregion - #region Operadores - - #region [public] {static} (bool) operator ==(DISPLAY_DEVICE, DISPLAY_DEVICE): Implementa el operador de igualdad (==). - /// - /// Implementa el operador de igualdad (==). - /// - /// Operando 1. - /// Operando 2. - /// - /// Devuelve true si deviceInfo1 es igual a deviceInfo2; false en caso contrario. - /// - public static bool operator ==(DISPLAY_DEVICE deviceInfo1, DISPLAY_DEVICE deviceInfo2) + #region [public] {override} (bool) Equals(object obj): Returns a value that indicates whether this object is equal to another + /// + /// Returns a value that indicates whether this object is equal to another. + /// + /// Object to compare. + /// + /// Equality result. + /// + public override bool Equals(object obj) + { + if (obj == null) { - return deviceInfo1.Equals(deviceInfo2); + return false; } - #endregion - #region [public] {static} (bool) operator !=(DISPLAY_DEVICE, DISPLAY_DEVICE): Implementa el operador de desigualdad (!=). - /// - /// Implementa el operador de desigualdad (!=). - /// - /// Operando 1. - /// Operando 2. - /// - /// Devuelve true si deviceInfo1 no es igual a deviceInfo2; false en caso contrario. - /// - public static bool operator !=(DISPLAY_DEVICE deviceInfo1, DISPLAY_DEVICE deviceInfo2) + if (!(obj is DISPLAY_DEVICE)) { - return !deviceInfo1.Equals(deviceInfo2); + return false; } - #endregion + var other = (DISPLAY_DEVICE)obj; + + return + other.DeviceName == DeviceName && + other.State == State; + } #endregion - #region Miembros estáticos + #region [public] {override} (string) ToString(): Returns a string that represents the current object /// - /// Nueva estructura vacía. + /// Returns a string that represents the current object. /// - public static readonly DISPLAY_DEVICE Empty = new DISPLAY_DEVICE { cb = Marshal.SizeOf(typeof(DISPLAY_DEVICE)) }; + /// + /// Returns a string that represents the current object. + /// + public override string ToString() => $"DeviceName = {DeviceName}"; + #endregion + #endregion } -} \ No newline at end of file +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/Metafiles/Structures/POINTL.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/Metafiles/Structures/POINTL.cs index 3db063f..e887042 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/Metafiles/Structures/POINTL.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/Metafiles/Structures/POINTL.cs @@ -1,183 +1,163 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using System.Drawing; -using System.Globalization; -using System.Runtime.InteropServices; - + namespace iTin.Core.Interop.Windows.Development.Graphics.Legacy.Gdi.Metafiles { + using System; + using System.Drawing; + using System.Runtime.InteropServices; + /// - /// La estructura POINTL contiene las coordenadas de un punto. + /// The POINTL structure contains the coordinates of a point. /// [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "POINTL")] public struct POINTL : IEquatable { - #region Atributos + #region public members /// - /// Coordenada X del punto. + /// X coordinate of the point. /// - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] - [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "X")] public int X; /// - /// Coordenada Y del punto. + /// Y coordinate of the point. /// - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] - [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Y")] public int Y; #endregion - #region Constructor/es + #region constructor/s - #region [public] POINTL(int, int): Inicializa una nueva instancia de la estructura. - /// - /// Inicializa una nueva instancia de la estructura . - /// - /// Coordenada X del punto. - /// Coordenada Y del punto. - [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "x")] - [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "y")] - public POINTL(int x, int y) - { - X = x; - Y = y; - } - #endregion + #region [public] POINTL(int, int): Initializes a new instance of the structure + /// + /// Initializes a new instance of the structure. + /// + /// X coordinate of the point. + /// Y coordinate of the point. + public POINTL(int x, int y) + { + X = x; + Y = y; + } + #endregion #endregion - #region Interfaces + #region interfaces - #region [public] (bool) Equals(POINTL): Indica si el objeto actual es igual a otro objeto del mismo tipo. - /// - /// Indica si el objeto actual es igual a otro objeto del mismo tipo. - /// - /// Objeto que se va a comparar con este objeto. - /// Devuelve true si el objeto actual es igual al parámetro other; en caso contrario, false. - public bool Equals(POINTL other) - { - return other.Equals((object)this); - } - #endregion + #region [public] (bool) Equals(POINTL): Indicates whether the current object is the same as another object of the same type + /// + /// Indicates whether the current object is the same as another object of the same type. + /// + /// Object to be compared with this object. + /// + /// Returns true if the current object is equal to the other parameter; otherwise, false. + /// + public bool Equals(POINTL other) => other.Equals((object)this); + #endregion #endregion - #region Overrides + #region public operators - #region [public] {override} (int) GetHashCode(): Devuelve el código hash del objeto. - /// - /// Devuelve el código hash del objeto. - /// - /// - /// Tipo: - /// Código Hash. - /// - public override int GetHashCode() - { - return X ^ Y; - } - #endregion - - #region [public] {override} (bool) Equals(object obj): Devuelve un valor que indica si este objeto es igual a otro. - /// - /// Devuelve un valor que indica si este objeto es igual a otro. - /// - /// Objeto con el que comparar. - /// Resultado de igualdad. - public override bool Equals(object obj) - { - if (obj == null) - return false; + #region Implicit + + #region [public] {static} (implicit operator) Point(POINTL): Make an implicit conversion from type POINTL to type Point + /// + /// Make an implicit conversion from type to type . + /// + /// Structure to convert. + /// + /// Converted structure. + /// + public static implicit operator Point(POINTL point) => new Point(point.X, point.Y); + #endregion + + #region [public] {static} (implicit operator) POINTL(Point): Perform an implicit conversion of type Point to type POINTL + /// + /// Perform an implicit conversion of type to type . + /// + /// Structure to convert. + /// + /// Converted structure. + /// + public static implicit operator POINTL(Point point) => new POINTL(point.X, point.Y); + #endregion + + #endregion + + #region comparison - if (!(obj is POINTL)) - return false; + #region [public] {static} (bool) operator ==(POINTL, POINTL): Implement the equality operator (==) + /// + /// Implement the equality operator (==). + /// + /// Operand 1. + /// Operand 2. + /// + /// Returns true if deviceInfo1 is equal to deviceInfo2; false otherwise. + /// + public static bool operator ==(POINTL deviceInfo1, POINTL deviceInfo2) => deviceInfo1.Equals(deviceInfo2); + #endregion + + #region [public] {static} (bool) operator !=(POINTL, POINTL): Implements the inequality operator (!=) + /// + /// Implements the inequality operator (!=). + /// + /// Operand 1. + /// Operand 2. + /// Returns true if deviceInfo1 is not equal to deviceInfo2; false otherwise. + public static bool operator !=(POINTL deviceInfo1, POINTL deviceInfo2) => !deviceInfo1.Equals(deviceInfo2); + #endregion + + #endregion + + #endregion + + #region public overrides methods + + #region [public] {override} (int) GetHashCode(): Returns the hash code of this structure + /// + /// Returns the hash code of this structure. + /// + /// + /// Hash code. + /// + public override int GetHashCode() => X ^ Y; + #endregion - POINTL other = (POINTL)obj; - return (other.X == X) && (other.Y == Y); + #region [public] {override} (bool) Equals(object obj): Returns a value that indicates whether this object is equal to another + /// + /// Returns a value that indicates whether this object is equal to another. + /// + /// Object to compare. + /// + /// Equality result. + /// + public override bool Equals(object obj) + { + if (obj == null) + { + return false; } - #endregion - - #region [public] {override} (string) ToString(): Devuelve una cadena que representa al objeto actual. - /// - /// Devuelve una cadena que representa al objeto actual. - /// - /// - /// Tipo: - /// Cadena que representa al objeto actual. - /// - /// - /// El método devuelve una cadena que incluye el tipo de estructura. - /// - public override string ToString() + + if (!(obj is POINTL)) { - return string.Format(CultureInfo.InvariantCulture, "X = {0}, Y = {1}", X, Y); + return false; } - #endregion - - #endregion - - #region Operadores - - #region Implicit - - #region [public] {static} (implicit operator) Point(POINTL): Realiza una conversión implícita del tipo POINTL al tipo Point. - /// - /// Realiza una conversión implícita del tipo al tipo . - /// - /// Estructura a convertir. - /// Estructura convertida. - public static implicit operator Point(POINTL point) - { - return new Point(point.X, point.Y); - } - #endregion - - #region [public] {static} (implicit operator) POINTL(Point): Realiza una conversión implícita del tipo Point al tipo POINTL. - /// - /// Realiza una conversión implícita del tipo al tipo . - /// - /// Estructura a convertir. - /// Estructura convertida. - public static implicit operator POINTL(Point point) - { - return new POINTL(point.X, point.Y); - } - #endregion - - #endregion - - #region Comparación - - #region [public] {static} (bool) operator ==(POINTL, POINTL): Implementa el operador de igualdad (==). - /// - /// Implementa el operador de igualdad (==). - /// - /// Operando 1. - /// Operando 2. - /// Devuelve true si deviceInfo1 es igual a deviceInfo2; false en caso contrario. - public static bool operator ==(POINTL deviceInfo1, POINTL deviceInfo2) - { - return deviceInfo1.Equals(deviceInfo2); - } - #endregion - - #region [public] {static} (bool) operator !=(POINTL, POINTL): Implementa el operador de desigualdad (!=). - /// - /// Implementa el operador de desigualdad (!=). - /// - /// Operando 1. - /// Operando 2. - /// Devuelve true si deviceInfo1 no es igual a deviceInfo2; false en caso contrario. - public static bool operator !=(POINTL deviceInfo1, POINTL deviceInfo2) - { - return !deviceInfo1.Equals(deviceInfo2); - } - #endregion - - #endregion + + POINTL other = (POINTL)obj; + return other.X == X && other.Y == Y; + } + #endregion + + #region [public] {override} (string) ToString(): Returns a string that represents the current structure + /// + /// Returns a string that represents the current object. + /// + /// + /// String representing the current structure. + /// + public override string ToString() => $"X = {X}, Y = {Y}"; + #endregion #endregion } -} \ No newline at end of file +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/MultipleDisplayMonitors/NativeMethods.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/MultipleDisplayMonitors/NativeMethods.cs index e954e61..09b7d5a 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/MultipleDisplayMonitors/NativeMethods.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/MultipleDisplayMonitors/NativeMethods.cs @@ -2,99 +2,93 @@ namespace iTin.Core.Interop.Windows.Development.Graphics.Legacy.Gdi.MultipleDisplayMonitors { using System; - using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using Rectangles; /// - /// Funciones que se pueden utilizar para controlar la configuración de parámetros del sistema y los diversos atributos del sistema, como el tiempo del doble clic, - /// el tiempo de espera del protector de pantalla, el ancho del borde de las ventanas. + /// Functions that can be used to control the configuration of system parameters and various system attributes, such as double click time, the screen saver timeout, the width of the window border. /// - internal static class NativeMethods + public static class NativeMethods { - #region Enums + #region public enumerations - #region [internal] (enum) MonitorOptions: Determina el valor devuelto por la función si el punto no se encuentra dentro de ningún monitor del sistema. - /// - /// Determina el valor devuelto por la función si el punto no se encuentra dentro de ningún monitor del sistema. - /// Para más información, ver sección dwFlags de http://msdn.microsoft.com/es-es/library/dd145062. - /// - internal enum MonitorOptions : uint - { - MONITOR_DEFAULTTONULL = 0x00000000, - MONITOR_DEFAULTTOPRIMARY = 0x00000001, - MONITOR_DEFAULTTONEAREST = 0x00000002 - } - #endregion + #region [internal] (enum) MonitorOptions: Determine the value returned by the function if the point is not within any system monitor + /// + /// Determine the value returned by the function if the point is not within any system monitor. + /// For more information, please see section dwFlags of http://msdn.microsoft.com/es-es/library/dd145062. + /// + public enum MonitorOptions : uint + { + MONITOR_DEFAULTTONULL = 0x00000000, + + MONITOR_DEFAULTTOPRIMARY = 0x00000001, + + MONITOR_DEFAULTTONEAREST = 0x00000002 + } + #endregion #endregion - #region Delegados + #region public delegates /// - /// Callback de la función . + /// Callback of the function. /// public delegate bool MonitorEnumCallBack(IntPtr hMonitor, IntPtr hdcMonitor, ref RECT lprcMonitor, IntPtr dwData); #endregion #region P/Invoke - #region [public] {static} (extern bool) EnumDisplayMonitors(IntPtr, IntPtr, MonitorEnumCallBack, IntPtr): Enumera los monitores (incluyendo los pseudo-monitores invisibles). Llama a una función de callback (MonitorEnumCallBack). + #region [public] {static} (extern bool) EnumDisplayMonitors(IntPtr, IntPtr, MonitorEnumCallBack, IntPtr): List the monitors (including invisible pseudo-monitors). Call a callback function (MonitorEnumCallBack) /// - /// Enumera los monitores (incluyendo los pseudo-monitores invisibles). Llama a una función de callback (MonitorEnumCallBack). + /// List the monitors (including invisible pseudo-monitors). Call a callback function (MonitorEnumCallBack). + /// For more information, see http://msdn.microsoft.com/en-us/library/dd162610%28v=VS.85%29.aspx /// - /// - /// Para más información, ver http://msdn.microsoft.com/en-us/library/dd162610%28v=VS.85%29.aspx - /// [DllImport(ExternDll.Win.User32, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumDisplayMonitors(IntPtr hdc, IntPtr lprcClip, MonitorEnumCallBack lpfnEnum, IntPtr dwData); #endregion - #region [public] {static} (extern bool) GetMonitorInfo(IntPtr, ref MONITORINFO): Obtiene información de un monitor. + #region [public] {static} (extern bool) GetMonitorInfo(IntPtr, ref MONITORINFO): Get information from a monitor /// - /// Obtiene información de un monitor. Para más información, ver http://msdn.microsoft.com/es-es/library/dd144901. + /// Get information from a monitor. For more information, please see http://msdn.microsoft.com/es-es/library/dd144901. /// [return: MarshalAs(UnmanagedType.Bool)] [DllImport(ExternDll.Win.User32, CharSet = CharSet.Auto, SetLastError = true)] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] public static extern bool GetMonitorInfo(IntPtr hMonitor, ref MONITORINFO lpmi); #endregion - #region [public] {static} (extern bool) GetMonitorInfo(IntPtr, ref MONITORINFOEX): Obtiene información de un monitor. + #region [public] {static} (extern bool) GetMonitorInfo(IntPtr, ref MONITORINFOEX): Get information from a monitor /// - /// Obtiene información de un monitor. Para más información, ver http://msdn.microsoft.com/es-es/library/dd144901. + /// Get information from a monitor. For more information, please see http://msdn.microsoft.com/es-es/library/dd144901. /// [DllImport(ExternDll.Win.User32, CharSet = CharSet.Auto, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool GetMonitorInfo(IntPtr hMonitor, ref MONITORINFOEX lpmi); #endregion - #region [public] {static} (extern IntPtr) MonitorFromPoint(POINT, MonitorOptions): Obtiene el identificador del monitor que contiene el punto especificado. + #region [public] {static} (extern IntPtr) MonitorFromPoint(POINT, MonitorOptions): Get the monitor ID that contains the specified point. /// - /// Obtiene el identificador del monitor que contiene el punto especificado. Para más información, ver http://msdn.microsoft.com/es-es/library/dd145062. + /// Get the monitor ID that contains the specified point. For more information, please see http://msdn.microsoft.com/es-es/library/dd145062. /// [DllImport(ExternDll.Win.User32, SetLastError = true)] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] public static extern IntPtr MonitorFromPoint(POINT pt, MonitorOptions dwFlags); #endregion - #region [public] {static} (extern IntPtr) MonitorFromRect(ref RECT, MonitorOptions): Obtiene el identificador del monitor que tiene la mayor área de intersección con el rectángulo especificado. + #region [public] {static} (extern IntPtr) MonitorFromRect(ref RECT, MonitorOptions): Get the identifier of the monitor that has the largest area of intersection with the specified rectangle /// - /// Obtiene el identificador del monitor que tiene la mayor área de intersección con el rectángulo especificado, ver http://msdn.microsoft.com/es-es/library/dd145062. + /// Get the identifier of the monitor that has the largest area of intersection with the specified rectangle. For more information, please see http://msdn.microsoft.com/es-es/library/dd145062. /// [DllImport(ExternDll.Win.User32, SetLastError = true)] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] public static extern IntPtr MonitorFromRect([In]ref RECT lprc, [In]MonitorOptions dwFlags); #endregion - #region [public] {static} (extern IntPtr) MonitorFromWindow(IntPtr, MonitorOptions): Obtiene el identificador del monitor que tiene la mayor área de intersección con el rectángulo de la ventana especificada. + #region [public] {static} (extern IntPtr) MonitorFromWindow(IntPtr, MonitorOptions): Get the identifier of the monitor that has the largest area of intersection with the rectangle of the specified window /// - /// Obtiene el identificador del monitor que tiene la mayor área de intersección con el rectángulo de la ventana especificada. - /// Para más información ver http://msdn.microsoft.com/es-es/library/dd145064. + /// Get the identifier of the monitor that has the largest area of intersection with the rectangle of the specified window. + /// For more information, please see http://msdn.microsoft.com/es-es/library/dd145064. /// [DllImport(ExternDll.Win.User32, SetLastError = true)] - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] public static extern IntPtr MonitorFromWindow([In]IntPtr hwnd, [In]MonitorOptions dwFlags); #endregion diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/MultipleDisplayMonitors/Structures/MONITORINFO.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/MultipleDisplayMonitors/Structures/MONITORINFO.cs index 5d6a48f..c55160a 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/MultipleDisplayMonitors/Structures/MONITORINFO.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/MultipleDisplayMonitors/Structures/MONITORINFO.cs @@ -1,184 +1,176 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using System.Runtime.InteropServices; - -using iTin.Core.Interop.Windows.Development.Graphics.Legacy.Gdi.Rectangles; - + namespace iTin.Core.Interop.Windows.Development.Graphics.Legacy.Gdi.MultipleDisplayMonitors { + using System; + using System.Runtime.InteropServices; + + using Rectangles; + /// - /// La estructura MONITORINFO contiene información acerca de un monitor. - /// La estructura MONITORINFO es un subconjunto de la estructura . La estructura agrega un miembro que contiene el nombre para el monitor. - /// Para más información, ver http://msdn.microsoft.com/es-es/library/dd145065. + /// The MONITORINFO structure contains information about a monitor. + /// The MONITORINFO structure is a subset of the structure. The structure adds a member that contains the name for the monitor. + /// For more information, please see http://msdn.microsoft.com/es-es/library/dd145065. /// [StructLayout(LayoutKind.Sequential)] - internal struct MONITORINFO : IEquatable + public struct MONITORINFO : IEquatable { - #region Atributos. + #region public memebrs /// - /// Especifica el tamaño, en bytes, de la estructura MONITORINFO. - /// Se debe inicializar antes de llamar a una función Api. + /// Specifies the size, in bytes, of the MONITORINFO structure. + /// Must be initialized before calling a Api function. /// public int Size; /// - /// Una estructura que especifica el rectángulo del área total del monitor. + /// A structure that specifies the rectangle of the total area of the monitor. /// public RECT Monitor; /// - /// Una estructura que especifica el rectángulo del área de trabajo del monitor útil - /// que puede ser utilizado por las aplicaciones, expresada en coordenadas de pantalla virtual. - /// Windows utiliza este rectángulo para maximizar una aplicación en el monitor. - /// Se excluye barras de herramientas, de estado, etc. + /// A structure that specifies the rectangle of the working area of the useful monitor + /// that can be used by applications, expressed in virtual screen coordinates. + /// Windows uses this rectangle to maximize an application on the monitor. + /// Toolbars, status bars, etc. are excluded. /// public RECT WorkArea; /// - /// Atributos del monitor. + /// Attributes of the monitor. /// public uint Flags; #endregion - #region Interfaces. + #region interfaces - #region [public] (bool) Equals(MONITORINFO): Indica si el objeto actual es igual a otro objeto del mismo tipo. - /// - /// Indica si el objeto actual es igual a otro objeto del mismo tipo. - /// - /// Objeto que se va a comparar con este objeto. - /// Devuelve true si el objeto actual es igual al parámetro other; en caso contrario, false. - public bool Equals(MONITORINFO other) - { - return other.Equals((object)this); - } - #endregion + #region [public] (bool) Equals(MONITORINFO): Indicates whether the current object is the same as another object of the same type + /// + /// Indicates whether the current object is the same as another object of the same type. + /// + /// Object to be compared with this object. + /// + /// Returns true if the current object is equal to the other parameter; otherwise, false. + /// + public bool Equals(MONITORINFO other) => other.Equals((object)this); + #endregion #endregion - #region Overrides. - - #region [public] {override} (int) GetHashCode(): Devuelve el código hash del objeto. - /// - /// Devuelve el código hash del objeto. - /// - /// - /// Tipo: - /// Código Hash. - /// - public override int GetHashCode() - { - return WorkArea.GetHashCode() ^ (int)Flags; - } - #endregion - - #region [public] {override} (bool) Equals(object obj): Devuelve un valor que indica si este objeto es igual a otro. - /// - /// Devuelve un valor que indica si este objeto es igual a otro. - /// - /// Objeto con el que comparar. - /// Resultado de igualdad. - public override bool Equals(object obj) - { - if (obj == null) - return false; + #region public operators - if (!(obj is MONITORINFO)) - return false; + #region [public] {static} (bool) operator ==(MONITORINFO, MONITORINFO): Implement the equality operator (==) + /// + /// Implement the equality operator (==). + /// + /// Operand 1. + /// Operand 2. + /// + /// Returns true if deviceInfo1 is equal to deviceInfo2; false otherwise. + /// + public static bool operator ==(MONITORINFO deviceInfo1, MONITORINFO deviceInfo2) => deviceInfo1.Equals(deviceInfo2); + #endregion - MONITORINFO other = (MONITORINFO)obj; - return (other.WorkArea == WorkArea) && (other.Monitor == Monitor) && (other.Flags == Flags); - } - #endregion - - #region [public] {override} (string) ToString(): Devuelve una cadena que representa al objeto actual. - /// - /// Devuelve una cadena que representa al objeto actual. - /// - /// - /// Tipo: - /// Cadena que representa al objeto actual. - /// - /// - /// El método devuelve una cadena que incluye el tipo de estructura. - /// - public override string ToString() - { - return WorkArea.ToString(); - } - #endregion + #region [public] {static} (bool) operator !=(MONITORINFO, MONITORINFO): Implements the inequality operator (!=) + /// + /// Implements the inequality operator (!=). + /// + /// Operand 1. + /// Operand 2. + /// + /// Returns true if deviceInfo1 is not equal to deviceInfo2; false otherwise. + /// + public static bool operator !=(MONITORINFO deviceInfo1, MONITORINFO deviceInfo2) => !deviceInfo1.Equals(deviceInfo2); + #endregion #endregion - #region Operadores. + #region public static properties - #region [public] {static} (bool) operator ==(MONITORINFO, MONITORINFO): Implementa el operador de igualdad (==). - /// - /// Implementa el operador de igualdad (==). - /// - /// Operando 1. - /// Operando 2. - /// Devuelve true si deviceInfo1 es igual a deviceInfo2; false en caso contrario. - public static bool operator ==(MONITORINFO deviceInfo1, MONITORINFO deviceInfo2) - { - return deviceInfo1.Equals(deviceInfo2); - } - #endregion - - #region [public] {static} (bool) operator !=(MONITORINFO, MONITORINFO): Implementa el operador de desigualdad (!=). - /// - /// Implementa el operador de desigualdad (!=). - /// - /// Operando 1. - /// Operando 2. - /// Devuelve true si deviceInfo1 no es igual a deviceInfo2; false en caso contrario. - public static bool operator !=(MONITORINFO deviceInfo1, MONITORINFO deviceInfo2) + #region [public] {static} (MONITORINFO) Create: Create a new instance of this structure + /// + /// Create a new instance of this structure. + /// + /// + /// New instance of the structure. + /// + public static MONITORINFO Create + { + get { - return !deviceInfo1.Equals(deviceInfo2); + MONITORINFO instance = new MONITORINFO(); + instance.Init(); + + return instance; } - #endregion + } + #endregion #endregion - #region Miembros privados. + #region public override methods - #region Métodos. + #region [public] {override} (int) GetHashCode(): Returns the hash code of the object + /// + /// Returns the hash code of the object. + /// + /// + /// Hash code. + /// + public override int GetHashCode() => WorkArea.GetHashCode() ^ (int)Flags; + #endregion - #region [private] (void) Init(): Inicializar internamente la estructura, llamar siempre antes de usar en una llamada API. - /// - /// Inicializar internamente la estructura, llamar siempre antes de usar en una llamada API. - /// - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - private void Init() - { - Size = Marshal.SizeOf(this); - } - #endregion + #region [public] {override} (bool) Equals(object obj):Returns a value that indicates whether this object is equal to another + /// + /// Returns a value that indicates whether this object is equal to another. + /// + /// Object to compare. + /// + /// Equality result. + /// + public override bool Equals(object obj) + { + if (obj == null) + { + return false; + } - #endregion + if (!(obj is MONITORINFO)) + { + return false; + } - #endregion + var other = (MONITORINFO)obj; - #region Miembros estáticos + return + other.WorkArea == WorkArea && + other.Monitor == Monitor && + other.Flags == Flags; + } + #endregion - #region [public] {static} (MONITORINFO) Create: Crea una instancia nueva de esta estructura. - /// - /// Crea una instancia nueva de esta estructura. - /// - /// Nueva instancia de la estructura. - [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public static MONITORINFO Create - { - get - { - MONITORINFO instance = new MONITORINFO(); - instance.Init(); + #region [public] {override} (string) ToString(): Returns a string that represents the current object + /// + /// Returns a string that represents the current object. + /// + /// + /// String representing the current object. + /// + public override string ToString() => WorkArea.ToString(); + #endregion - return instance; - } - } - #endregion + #endregion + + #region private members + #region [private] (void) Init(): Initialize the structure internally, call always before using in an API call + /// + /// Initialize the structure internally, call always before using in an API call. + /// + private void Init() + { + Size = Marshal.SizeOf(this); + } #endregion + + #endregion } -} \ No newline at end of file +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/MultipleDisplayMonitors/Structures/MONITORINFOEX.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/MultipleDisplayMonitors/Structures/MONITORINFOEX.cs index 0efe9ea..3feae92 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/MultipleDisplayMonitors/Structures/MONITORINFOEX.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/MultipleDisplayMonitors/Structures/MONITORINFOEX.cs @@ -1,176 +1,157 @@ -using System; -using System.Globalization; -using System.Runtime.InteropServices; - -using iTin.Core.Interop.Windows.Development.Graphics.Legacy.Gdi.Rectangles; - + namespace iTin.Core.Interop.Windows.Development.Graphics.Legacy.Gdi.MultipleDisplayMonitors { + using System; + using System.Runtime.InteropServices; + + using Rectangles; + /// - /// La estructura MONITORINFOEX contiene información acerca de un monitor. - /// La estructura MONITORINFOEX es un superconjunto de la estructura . + /// The MONITORINFOEX structure contains information about a monitor. + /// The MONITORINFOEX structure is a superset of the structure. + /// For more information, see http://msdn.microsoft.com/es-es/library/dd145066. /// - /// - /// Para más información, ver http://msdn.microsoft.com/es-es/library/dd145066. - /// [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] - struct MONITORINFOEX : IEquatable + public struct MONITORINFOEX : IEquatable { - #region Constantes + #region public constants public const uint MONITORINFOF_PRIMARY = 0x00000001; #endregion - - #region Atributos + + #region private constants + private const int CCHDEVICENAME = 0x20; + #endregion + + #region public members /// - /// Especifica el tamaño, en bytes, de la estructura MONITORINFOEX. - /// Se debe inicializar antes de llamar a una función Api. + /// Specifies the size, in bytes, of the MONITORINFOEX structure. + /// Must be initialized before calling a Api function. /// public int Size; /// - /// Una estructura que especifica el rectángulo del área total del monitor. + /// A structure that specifies the rectangle of the total area of the monitor. /// public RECT Monitor; /// - /// Una estructura que especifica el rectángulo del área de trabajo del monitor útil - /// que puede ser utilizado por las aplicaciones, expresada en coordenadas de pantalla virtual. - /// Windows utiliza este rectángulo para maximizar una aplicación en el monitor. - /// Se excluye barras de herramientas, de estado, etc. + /// A structure that specifies the rectangle of the working area of the useful monitor that can be used by applications, expressed in virtual screen coordinates. + /// Windows uses this rectangle to maximize an application on the monitor. + /// Toolbars, status bars, etc. are excluded. /// public RECT WorkArea; /// - /// Atributos del monitor. + /// Attributes of the monitor. /// public uint Flags; /// - /// Una cadena que especifica el nombre del monitor. + /// A string that specifies the name of the monitor. /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = CCHDEVICENAME)] public string DeviceName; #endregion - #region Interfaces - - #region [public] (bool) Equals(MONITORINFOEX): Indica si la estructura actual es igual a otra estructura del mismo tipo. - /// - /// Indica si la estructura actual es igual a otra estructura del mismo tipo. - /// - /// Estructura que se va a comparar con esta estructura. - /// - /// Devuelve true si la estructura actual es igual al parámetro other; en caso contrario, false. - /// - public bool Equals(MONITORINFOEX other) - { - return other.Equals((object)this); - } - #endregion + #region interfaces + #region [public] (bool) Equals(MONITORINFOEX): Indicates whether the current structure is the same as another structure of the same type + /// + /// Indicates whether the current structure is the same as another structure of the same type. + /// + /// Structure to be compared with this structure. + /// + /// Returns true if the current structure is equal to the other parameter; otherwise, false. + /// + public bool Equals(MONITORINFOEX other) => other.Equals((object)this); #endregion - #region Overrides - - #region [public] {override} (int) GetHashCode(): Devuelve un valor que repesenta al código hash de esta estructura. - /// - /// Devuelve un valor que repesenta al código hash de esta estructura. - /// - /// - /// Tipo: - /// Código Hash de esta estructura. - /// - public override int GetHashCode() - { - return ToString().GetHashCode(); - } - #endregion - - #region [public] {override} (bool) Equals(object): Devuelve un valor que indica si esta estructutra es igual a otra. - /// - /// Devuelve un valor que indica si esta estructutra es igual a otra. - /// - /// Estructura con la que comparar. - /// Resultado de la comparación de igualdad. - public override bool Equals(object obj) - { - if (obj == null) - return false; + #endregion - if (!(obj is MONITORINFOEX)) - return false; + #region public operators - var other = (MONITORINFOEX)obj; - return (other.Monitor == Monitor) && - (other.WorkArea == WorkArea) && - (other.Flags == Flags) && - (other.DeviceName == DeviceName); - } - #endregion - - #region [public] {override} (string) ToString(): Devuelve una cadena que representa a la estructura actual. - /// - /// Devuelve una cadena que representa la estructura actual. - /// - /// - /// Tipo: - /// Cadena que representa la estructura actual. - /// - /// - /// El método devuelve una cadena que incluye el nombre del monitor. - /// - public override string ToString() - { - return string.Format(CultureInfo.InvariantCulture, "DeviceName = {0}", DeviceName); - } - #endregion + #region [public] {static} (bool) operator ==(MONITORINFOEX, MONITORINFOEX): Implement the equality operator (==) + /// + /// Implement the equality operator (==). + /// + /// Operating 1. + /// Operating 2. + /// + /// Returns true if operator1 is equal to operator2; false otherwise. + /// + public static bool operator ==(MONITORINFOEX operator1, MONITORINFOEX operator2) => operator1.Equals(operator2); + #endregion + + #region [public] {static} (bool) operator !=(MONITORINFOEX, MONITORINFOEX): Implements the inequality operator (!=) + /// + /// Implements the inequality operator (!=). + /// + /// Operating 1. + /// Operating 2. + /// + /// Returns true if operator1 is not equal to operator2; false otherwise. + /// + public static bool operator !=(MONITORINFOEX operator1, MONITORINFOEX operator2) => !operator1.Equals(operator2); + #endregion #endregion - #region Operadores - - #region [public] {static} (bool) operator ==(MONITORINFOEX, MONITORINFOEX): Implementa el operador de igualdad (==). - /// - /// Implementa el operador de igualdad (==). - /// - /// Operando 1. - /// Operando 2. - /// - /// Devuelve true si operator1 es igual a operator2; false en caso contrario. - /// - public static bool operator ==(MONITORINFOEX operator1, MONITORINFOEX operator2) + #region public static properties + public static readonly MONITORINFOEX Empty = new MONITORINFOEX { Size = Marshal.SizeOf(typeof(MONITORINFOEX)) }; + #endregion + + #region public override methods + + #region [public] {override} (int) GetHashCode(): Returns a value that represents the hash code of this structure + /// + /// Returns a value that represents the hash code of this structure. + /// + /// + /// Hash code. + /// + public override int GetHashCode() => ToString().GetHashCode(); + #endregion + + #region [public] {override} (bool) Equals(object): Returns a value that indicates whether this structure is the same as another + /// + /// Returns a value that indicates whether this structure is the same as another. + /// + /// Structure to compare. + /// + /// Result of the equality comparison. + /// + public override bool Equals(object obj) + { + if (obj == null) { - return operator1.Equals(operator2); + return false; } - #endregion - - #region [public] {static} (bool) operator !=(MONITORINFOEX, MONITORINFOEX): Implementa el operador de desigualdad (!=). - /// - /// Implementa el operador de desigualdad (!=). - /// - /// Operando 1. - /// Operando 2. - /// - /// Devuelve true si operator1 no es igual a operator2; false en caso contrario. - /// - public static bool operator !=(MONITORINFOEX operator1, MONITORINFOEX operator2) + + if (!(obj is MONITORINFOEX)) { - return !operator1.Equals(operator2); + return false; } - #endregion - - #endregion - #region Miembros privados + var other = (MONITORINFOEX)obj; - #region Constantes - private const int CCHDEVICENAME = 0x20; - #endregion + return + other.Monitor == Monitor && + other.WorkArea == WorkArea && + other.Flags == Flags && + other.DeviceName == DeviceName; + } + #endregion + #region [public] {override} (string) ToString(): Returns a string that represents the current structure + /// + /// Returns a string that represents the current structure. + /// + /// + /// String representing the current structure. + /// + public override string ToString() => $"DeviceName = {DeviceName}"; #endregion - #region Miembros estáticos - public static readonly MONITORINFOEX Empty = new MONITORINFOEX { Size = Marshal.SizeOf(typeof(MONITORINFOEX)) }; #endregion } -} \ No newline at end of file +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/Rectangles/NativeMethods.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/Rectangles/NativeMethods.cs index d24f713..02e596c 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/Rectangles/NativeMethods.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/Rectangles/NativeMethods.cs @@ -4,14 +4,13 @@ namespace iTin.Core.Interop.Windows.Development.Graphics.Legacy.Gdi.Rectangles using System.Runtime.InteropServices; /// - /// Funciones que se pueden utilizar para controlar la configuración de parámetros del sistema y los diversos atributos del sistema, como el tiempo del doble clic, - /// el tiempo de espera del protector de pantalla, el ancho del borde de las ventanas. + /// Functions that can be used to control the configuration of system parameters and various system attributes, such as double click time, the screen saver timeout, the width of the window border. /// internal static class NativeMethods { /// - /// Determina si el rectángulo especificado está vacío. - /// Para más información, ver http://msdn.microsoft.com/en-us/library/dd145017%28v=VS.85%29.aspx. + /// Determine if the specified rectangle is empty. + /// For more information, please see http://msdn.microsoft.com/en-us/library/dd145017%28v=VS.85%29.aspx. /// [DllImport(ExternDll.Win.User32, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/Rectangles/Structures/POINT.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/Rectangles/Structures/POINT.cs index 2b18a24..d336905 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/Rectangles/Structures/POINT.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/Rectangles/Structures/POINT.cs @@ -1,183 +1,167 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using System.Drawing; -using System.Globalization; -using System.Runtime.InteropServices; - + namespace iTin.Core.Interop.Windows.Development.Graphics.Legacy.Gdi.Rectangles { + using System; + using System.Drawing; + using System.Runtime.InteropServices; + /// - /// La estructura POINT contiene las coordenadas de un punto. + /// The POINT structure contains the coordinates of a point. /// [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "POINT")] - internal struct POINT : IEquatable + public struct POINT : IEquatable { - #region Atributos. + #region public members /// - /// Coordenada X del punto. + /// X coordinate of the point. /// - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] - [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "X")] public int X; /// - /// Coordenada Y del punto. + /// Y coordinate of the point. /// - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] - [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Y")] public int Y; #endregion - #region Constructor/es. + #region constructor/s - #region [public] POINT(int, int): Inicializa una nueva instancia de la estructura. - /// - /// Inicializa una nueva instancia de la estructura . - /// - /// Coordenada X del punto. - /// Coordenada Y del punto. - [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "x")] - [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "y")] - public POINT(int x, int y) - { - X = x; - Y = y; - } - #endregion + #region [public] POINT(int, int): Initializes a new instance of the structure + /// + /// Initializes a new instance of the structure. + /// + /// X coordinate of the point. + /// y coordinate of the point. + public POINT(int x, int y) + { + X = x; + Y = y; + } + #endregion #endregion - #region Interfaces. + #region interfaces - #region [public] (bool) Equals(POINT): Indica si el objeto actual es igual a otro objeto del mismo tipo. - /// - /// Indica si el objeto actual es igual a otro objeto del mismo tipo. - /// - /// Objeto que se va a comparar con este objeto. - /// Devuelve true si el objeto actual es igual al parámetro other; en caso contrario, false. - public bool Equals(POINT other) - { - return other.Equals((object)this); - } - #endregion + #region [public] (bool) Equals(POINT): Indicates whether the current object is equal to another object of the same type + /// + /// Indicates whether the current object is equal to another object of the same type. + /// + /// Object to be compared with this object. + /// + /// Returns true if the current object is equal to the other parameter; otherwise, false. + /// + public bool Equals(POINT other) => other.Equals((object)this); + #endregion #endregion - #region Overrides. + #region public operators - #region [public] {override} (int) GetHashCode(): Devuelve el código hash del objeto. - /// - /// Devuelve el código hash del objeto. - /// - /// - /// Tipo: - /// Código Hash. - /// - public override int GetHashCode() - { - return X ^ Y; - } - #endregion - - #region [public] {override} (bool) Equals(object obj): Devuelve un valor que indica si este objeto es igual a otro. - /// - /// Devuelve un valor que indica si este objeto es igual a otro. - /// - /// Objeto con el que comparar. - /// Resultado de igualdad. - public override bool Equals(object obj) - { - if (obj == null) - return false; + #region implicit - if (!(obj is POINT)) - return false; + #region [public] {static} (implicit operator) Point(POINT): Perform an implicit conversion from type POINT to type Point + /// + /// Perform an implicit conversion from type to type . + /// + /// Structure to convert. + /// + /// Converted structure. + /// + public static implicit operator Point(POINT point) => new Point(point.X, point.Y); + #endregion - POINT other = (POINT)obj; - return (other.X == X) && (other.Y == Y); + #region [public] {static} (implicit operator) POINT(Point): Perform an implicit conversion of type Point to type POINT + /// + /// Perform an implicit conversion of type to type . + /// + /// Structure to convert. + /// + /// Converted structure. + /// + public static implicit operator POINT(Point point) => new POINT(point.X, point.Y); + #endregion + + #endregion + + #region comparison + + #region [public] {static} (bool) operator ==(POINT, POINT): Implement the equality operator (==) + /// + /// Implement the equality operator (==). + /// + /// Operand 1. + /// Operand 2. + /// + /// Returns true if deviceInfo1 is equal to deviceInfo2; false otherwise. + /// + public static bool operator ==(POINT deviceInfo1, POINT deviceInfo2) => deviceInfo1.Equals(deviceInfo2); + #endregion + + #region [public] {static} (bool) operator !=(POINT, POINT): Implement the inequality operator (!=) + /// + /// Implement the inequality operator (!=). + /// + /// Operand 1. + /// Operand 2. + /// + /// Returns true if deviceInfo1 is not equal to deviceInfo2; false otherwise. + public static bool operator !=(POINT deviceInfo1, POINT deviceInfo2) => !deviceInfo1.Equals(deviceInfo2); + #endregion + + #endregion + + #endregion + + #region public override methods + + #region [public] {override} (int) GetHashCode(): Returns the hash code of the object + /// + /// Returns the hash code of the object. + /// + /// + /// Hash code. + /// + public override int GetHashCode() => X ^ Y; + #endregion + + #region [public] {override} (bool) Equals(object obj): Returns a value that indicates whether this object is equal to another + /// + /// Returns a value that indicates whether this object is equal to another. + /// + /// Object to compare. + /// + /// Equality result. + /// + public override bool Equals(object obj) + { + if (obj == null) + { + return false; } - #endregion - - #region [public] {override} (string) ToString(): Devuelve una cadena que representa al objeto actual. - /// - /// Devuelve una cadena que representa al objeto actual. - /// - /// - /// Tipo: - /// Cadena que representa al objeto actual. - /// - /// - /// El método devuelve una cadena que incluye el tipo de estructura. - /// - public override string ToString() + + if (!(obj is POINT)) { - return string.Format(CultureInfo.InvariantCulture, "X = {0}, Y = {1}", X, Y); + return false; } - #endregion - - #endregion - - #region Operadores. - - #region Implicit - - #region [public] {static} (implicit operator) Point(POINT): Realiza una conversión implícita del tipo POINT al tipo Point. - /// - /// Realiza una conversión implícita del tipo al tipo . - /// - /// Estructura a convertir. - /// Estructura convertida. - public static implicit operator Point(POINT point) - { - return new Point(point.X, point.Y); - } - #endregion - - #region [public] {static} (implicit operator) POINT(Point): Realiza una conversión implícita del tipo Point al tipo POINT. - /// - /// Realiza una conversión implícita del tipo al tipo . - /// - /// Estructura a convertir. - /// Estructura convertida. - public static implicit operator POINT(Point point) - { - return new POINT(point.X, point.Y); - } - #endregion - - #endregion - - #region Comparación. - - #region [public] {static} (bool) operator ==(POINT, POINT): Implementa el operador de igualdad (==). - /// - /// Implementa el operador de igualdad (==). - /// - /// Operando 1. - /// Operando 2. - /// Devuelve true si deviceInfo1 es igual a deviceInfo2; false en caso contrario. - public static bool operator ==(POINT deviceInfo1, POINT deviceInfo2) - { - return deviceInfo1.Equals(deviceInfo2); - } - #endregion - - #region [public] {static} (bool) operator !=(POINT, POINT): Implementa el operador de desigualdad (!=). - /// - /// Implementa el operador de desigualdad (!=). - /// - /// Operando 1. - /// Operando 2. - /// Devuelve true si deviceInfo1 no es igual a deviceInfo2; false en caso contrario. - public static bool operator !=(POINT deviceInfo1, POINT deviceInfo2) - { - return !deviceInfo1.Equals(deviceInfo2); - } - #endregion - - #endregion + + var other = (POINT)obj; + + return + other.X == X && + other.Y == Y; + } + #endregion + + #region [public] {override} (string) ToString(): Returns a string that represents the current object + /// + /// Returns a string that represents the current object. + /// + /// + /// String representing the current object. + /// + public override string ToString() => $"X = {X}, Y = {Y}"; + #endregion #endregion } -} \ No newline at end of file +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/Rectangles/Structures/RECT.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/Rectangles/Structures/RECT.cs index a00bab6..8fd8616 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/Rectangles/Structures/RECT.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Graphics/Legacy/Gdi/Rectangles/Structures/RECT.cs @@ -1,195 +1,184 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using System.Drawing; -using System.Globalization; -using System.Runtime.InteropServices; - + namespace iTin.Core.Interop.Windows.Development.Graphics.Legacy.Gdi.Rectangles { + using System; + using System.Drawing; + using System.Runtime.InteropServices; + /// - /// La estructura RECT define las coordenadas de las esquinas superior izquierda e inferior derecha de un rectángulo. + /// The RECT structure defines the coordinates of the upper left and lower right corners of a rectangle. /// [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "RECT")] - internal struct RECT : IEquatable + public struct RECT : IEquatable { - #region Atributos. + #region public members /// - /// Coordenada X de la esquina superior izquierda del rectángulo. + /// X coordinate of the upper left corner of the rectangle. /// - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public int Left; /// - /// Coordenada Y de la esquina superior izquierda del rectángulo. + /// Y coordinate of the upper left corner of the rectangle. /// - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public int Top; /// - /// Coordenada X de la esquina inferior derecha del rectángulo. + /// X coordinate of the lower right corner of the rectangle. /// - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public int Right; /// - /// Coordenada Y de la esquina inferior derecha del rectángulo. + /// Y coordinate of the lower right corner of the rectangle. /// - [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public int Bottom; #endregion - #region Constructor/es. + #region constructor/s - #region [public] REC(int, int, int, int): Inicializa una nueva instancia de la estructura. - /// - /// Inicializa una nueva instancia de la estructura . - /// - /// Coordenada X de la esquina superior izquierda del rectángulo. - /// Coordenada Y de la esquina superior izquierda del rectángulo. - /// Coordenada X de la esquina inferior derecha del rectángulo. - /// Coordenada Y de la esquina inferior derecha del rectángulo. - public RECT(int left, int top, int right, int bottom) - { - Left = left; - Top = top; - Right = right; - Bottom = bottom; - } - #endregion + #region [public] REC(int, int, int, int): Initializes a new instance of the structure + /// + /// Initializes a new instance of the structure. + /// + /// X coordinate of the upper left corner of the rectangle. + /// Y coordinate of the upper left corner of the rectangle. + /// X coordinate of the lower right corner of the rectangle. + /// Y coordinate of the lower right corner of the rectangle. + public RECT(int left, int top, int right, int bottom) + { + Left = left; + Top = top; + Right = right; + Bottom = bottom; + } + #endregion #endregion - #region Interfaces. + #region interfaces - #region [public] (bool) Equals(RECT): Indica si el objeto actual es igual a otro objeto del mismo tipo. - /// - /// Indica si el objeto actual es igual a otro objeto del mismo tipo. - /// - /// Objeto que se va a comparar con este objeto. - /// Devuelve true si el objeto actual es igual al parámetro other; en caso contrario, false. - public bool Equals(RECT other) - { - return other.Equals((object)this); - } - #endregion + #region [public] (bool) Equals(RECT): Indicates whether the current object is equal to another object of the same type + /// + /// Indicates whether the current object is equal to another object of the same type. + /// + /// Object to be compared with this object. + /// + /// Returns true if the current object is equal to the other parameter; otherwise, false. + /// + public bool Equals(RECT other) => other.Equals((object)this); + #endregion #endregion - #region Overrides. + #region public operators - #region [public] {override} (int) GetHashCode(): Devuelve el código hash del objeto. - /// - /// Devuelve el código hash del objeto. - /// - /// - /// Tipo: - /// Código Hash. - /// - public override int GetHashCode() - { - return Left ^ Top ^ Right ^ Bottom; - } - #endregion - - #region [public] {override} (bool) Equals(object obj): Devuelve un valor que indica si este objeto es igual a otro. - /// - /// Devuelve un valor que indica si este objeto es igual a otro. - /// - /// Objeto con el que comparar. - /// Resultado de igualdad. - public override bool Equals(object obj) - { - if (obj == null) - return false; + #region implicit - if (!(obj is RECT)) - return false; + #region [public] {static} (implicit operator) Rectangle(RECT): Perform an implicit conversion of type RECT to type Rectangle + /// + /// Perform an implicit conversion of type to type . + /// + /// Structure to convert. + /// + /// Converted structure. + /// + public static implicit operator Rectangle(RECT rect) => new Rectangle(rect.Left, rect.Top, rect.Right - rect.Left, rect.Bottom - rect.Top); + #endregion - RECT other = (RECT)obj; - return (other.Left == Left) && (other.Top == Top) && (other.Right == Right) && (other.Bottom == Bottom); + #region [public] {static} (implicit operator) RECT(Rectangle): Perform an implicit conversion from type Rectangle to type RECT + /// + /// Perform an implicit conversion from type to type . + /// + /// Structure to convert. + /// + /// Converted structure. + /// + public static implicit operator RECT(Rectangle rect) => new RECT(rect.X, rect.Y, rect.Right - rect.Left, rect.Bottom - rect.Top); + #endregion + + #endregion + + #region comparison + + #region [public] {static} (bool) operator ==(RECT, RECT): Implement the equality operator (==) + /// + /// Implement the equality operator (==). + /// + /// Operand 1. + /// Operand 2. + /// + /// Returns true if deviceInfo1 is equal to deviceInfo2; false otherwise. + /// + public static bool operator ==(RECT deviceInfo1, RECT deviceInfo2) => deviceInfo1.Equals(deviceInfo2); + #endregion + + #region [public] {static} (bool) operator !=(RECT, RECT): Implements the inequality operator (!=) + /// + /// Implements the inequality operator (!=). + /// + /// Operand 1. + /// Operand 2. + /// + /// Returns true if deviceInfo1 is not equal to deviceInfo2; false otherwise. + /// + public static bool operator !=(RECT deviceInfo1, RECT deviceInfo2) => !deviceInfo1.Equals(deviceInfo2); + #endregion + + #endregion + + #endregion + + #region public override methods + + #region [public] {override} (int) GetHashCode(): Returns the hash code of the object + /// + /// Returns the hash code of the object. + /// + /// + /// Hash code. + /// + public override int GetHashCode() => Left ^ Top ^ Right ^ Bottom; + #endregion + + #region [public] {override} (bool) Equals(object obj): Returns a value that indicates whether this object is equal to another + /// + /// Returns a value that indicates whether this object is equal to another. + /// + /// Object to compare. + /// + /// Equality result. + /// + public override bool Equals(object obj) + { + if (obj == null) + { + return false; } - #endregion - - #region [public] {override} (string) ToString(): Devuelve una cadena que representa al objeto actual. - /// - /// Devuelve una cadena que representa al objeto actual. - /// - /// - /// Tipo: - /// Cadena que representa al objeto actual. - /// - /// - /// El método devuelve una cadena que incluye el tipo de estructura. - /// - public override string ToString() + + if (!(obj is RECT)) { - return string.Format(CultureInfo.InvariantCulture, "Left = {0}, Top = {1}, Right = {2}, Bottom = {3}", Left, Top, Right, Bottom); + return false; } - #endregion - - #endregion - - #region Operadores. - - #region Implicit - - #region [public] {static} (implicit operator) Rectangle(RECT): Realiza una conversión implícita del tipo RECT al tipo Rectangle. - /// - /// Realiza una conversión implícita del tipo al tipo . - /// - /// Estructura a convertir. - /// Estructura convertida. - public static implicit operator Rectangle(RECT rect) - { - return new Rectangle(rect.Left, rect.Top, rect.Right - rect.Left, rect.Bottom - rect.Top); - } - #endregion - - #region [public] {static} (implicit operator) RECT(Rectangle): Realiza una conversión implícita del tipo Rectangle al tipo RECT. - /// - /// Realiza una conversión implícita del tipo al tipo . - /// - /// Estructura a convertir. - /// Estructura convertida. - public static implicit operator RECT(Rectangle rect) - { - return new RECT(rect.X, rect.Y, rect.Right - rect.Left, rect.Bottom - rect.Top); - } - #endregion - - #endregion - - #region Comparación. - - #region [public] {static} (bool) operator ==(RECT, RECT): Implementa el operador de igualdad (==). - /// - /// Implementa el operador de igualdad (==). - /// - /// Operando 1. - /// Operando 2. - /// Devuelve true si deviceInfo1 es igual a deviceInfo2; false en caso contrario. - public static bool operator ==(RECT deviceInfo1, RECT deviceInfo2) - { - return deviceInfo1.Equals(deviceInfo2); - } - #endregion - - #region [public] {static} (bool) operator !=(RECT, RECT): Implementa el operador de desigualdad (!=). - /// - /// Implementa el operador de desigualdad (!=). - /// - /// Operando 1. - /// Operando 2. - /// Devuelve true si deviceInfo1 no es igual a deviceInfo2; false en caso contrario. - public static bool operator !=(RECT deviceInfo1, RECT deviceInfo2) - { - return !deviceInfo1.Equals(deviceInfo2); - } - #endregion - - #endregion + + var other = (RECT)obj; + + return + other.Left == Left && + other.Top == Top && + other.Right == Right && + other.Bottom == Bottom; + } + #endregion + + #region [public] {override} (string) ToString(): Returns a string that represents the current object + /// + /// Returns a string that represents the current object. + /// + /// + /// String representing the current object. + /// + public override string ToString() => $"Left = {Left}, Top = {Top}, Right = {Right}, Bottom = {Bottom}"; + #endregion #endregion } -} \ No newline at end of file +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Registry/NativeMethods.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Registry/NativeMethods.cs new file mode 100644 index 0000000..825b7c8 --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Registry/NativeMethods.cs @@ -0,0 +1,35 @@ + +namespace iTin.Core.Interop.Windows.Development.Registry +{ + using System; + using System.Runtime.InteropServices; + using System.Text; + + /// + /// Functions to develop Device and Driver Installation Reference. + /// + public static class NativeMethods + { + #region [public] {static} {extern} (uint) RegQueryValue(IntPtr, IntPtr, StringBuilder, ref uint): Retrieves the data associated with the default or unnamed value of a specified registry key + /// + /// Retrieves the data associated with the default or unnamed value of a specified registry key. The data must be a null-terminated + /// + /// For more information, please see https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regqueryvaluea. + /// + /// + [DllImport(ExternDll.Win.Advapi32, SetLastError = true)] + public static extern uint RegQueryValue(IntPtr keyClass, IntPtr subKey, StringBuilder classDescription, ref uint sizeB); + #endregion + + #region [public] {static} {extern} (uint) RegQueryValueEx(IntPtr, string, IntPtr, IntPtr, byte[], ref uint): Retrieves the type and data for the specified value name associated with an open registry key + /// + /// Retrieves the type and data for the specified value name associated with an open registry key. To ensure that any string values (REG_SZ, REG_MULTI_SZ, and REG_EXPAND_SZ) returned are null-terminated, use the RegGetValue function. + /// + /// For more information, please see https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regqueryvalueexa + /// + /// + [DllImport(ExternDll.Win.Advapi32, CharSet = CharSet.Unicode)] + public static extern uint RegQueryValueEx(IntPtr hKey, string lpValueName, IntPtr lpReserved, IntPtr lpType, byte[] lpData, ref uint lpcbData); + #endregion + } +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DirectoryManagement/Enums/FsctlDirectoryControlCodes.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DirectoryManagement/Enums/FsctlDirectoryControlCodes.cs index 3c04a09..17c8e72 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DirectoryManagement/Enums/FsctlDirectoryControlCodes.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DirectoryManagement/Enums/FsctlDirectoryControlCodes.cs @@ -1,13 +1,14 @@ -using System; - + namespace iTin.Core.Interop.Windows.Development.Storage.LocalFileSystems.DiskManagement { + using System; + // ------------------------------------------------------------------------------- // | Control Code Format = (type << 16) | function << 2 | method | access << 14) | // ------------------------------------------------------------------------------- /// - /// Códigos de control. + /// Control codes /// [Flags] public enum FsctlDirectoryControlCodes : uint diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Enums/IoctlDiskControlCode.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Enums/IoctlDiskControlCode.cs index 0b77f5a..51fe0b0 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Enums/IoctlDiskControlCode.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Enums/IoctlDiskControlCode.cs @@ -10,7 +10,7 @@ namespace iTin.Core.Interop.Windows.Development.Storage.LocalFileSystems.DiskMan /// Códigos de control. /// [Flags] - enum IoctlDiskControlCode : uint + public enum IoctlDiskControlCode : uint { /// /// Código base para los códigos de control de disco. diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Enums/MEDIA_TYPE.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Enums/MEDIA_TYPE.cs index f5a7074..13cdbcc 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Enums/MEDIA_TYPE.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Enums/MEDIA_TYPE.cs @@ -7,7 +7,7 @@ namespace iTin.Core.Interop.Windows.Development.Storage.LocalFileSystems.DiskMan /// /// Para más información ver: http://msdn.microsoft.com/en-us/library/aa365231%28v=VS.85%29.aspx /// - enum MEDIA_TYPE : uint + public enum MEDIA_TYPE : uint { /// /// Formato desconocido. diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Enums/PARTITION_STYLE.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Enums/PARTITION_STYLE.cs index 88762aa..b9ffbee 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Enums/PARTITION_STYLE.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Enums/PARTITION_STYLE.cs @@ -8,10 +8,7 @@ namespace iTin.Core.Interop.Windows.Development.Storage.LocalFileSystems.DiskMan /// /// Para más información ver: http://msdn.microsoft.com/en-us/library/aa365452%28v=VS.85%29.aspx /// - [SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "PARTITION")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "STYLE")] - enum PARTITION_STYLE + public enum PARTITION_STYLE { /// /// Formato de Master Boot Record (MBR). Corresponde al estándar de particiones MBR. diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Enums/PARTITION_TYPE.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Enums/PARTITION_TYPE.cs index 8420d2a..033aaab 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Enums/PARTITION_TYPE.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Enums/PARTITION_TYPE.cs @@ -8,10 +8,7 @@ namespace iTin.Core.Interop.Windows.Development.Storage.LocalFileSystems.DiskMan /// /// Para más información ver: http://msdn.microsoft.com/en-us/library/aa363990%28v=VS.85%29.aspx /// - [SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "TYPE")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "PARTITION")] - enum PARTITION_TYPE : byte + public enum PARTITION_TYPE : byte { /// /// Partición no utilizada. diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Enums/STORAGE_BUS_TYPE.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Enums/STORAGE_BUS_TYPE.cs index 2f7f4f5..5b75659 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Enums/STORAGE_BUS_TYPE.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Enums/STORAGE_BUS_TYPE.cs @@ -1,18 +1,15 @@ -using System.Diagnostics.CodeAnalysis; - + namespace iTin.Core.Interop.Windows.Development.Storage.LocalFileSystems.DiskManagement { + using System.Diagnostics.CodeAnalysis; + /// /// Representa los tipos de bus. /// /// /// Para más información ver: http://msdn.microsoft.com/en-us/library/ff800833%28v=VS.85%29.aspx. /// - [SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "STORAGE")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "BUS")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "TYPE")] - enum STORAGE_BUS_TYPE + public enum STORAGE_BUS_TYPE { /// /// Tipo de bus desconocido. diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/NativeMethods.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/NativeMethods.cs index a0f92ea..a49df89 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/NativeMethods.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/NativeMethods.cs @@ -4,14 +4,12 @@ namespace iTin.Core.Interop.Windows.Development.Storage.LocalFileSystems.DiskMan using System.Runtime.InteropServices; /// - /// Funciones para la gestión del espacio de un disco duro. - /// Un disco duro es un disco rígido que almacena y proporciona acceso relativamente rápido a grandes cantidades de datos. - /// Es el tipo de almacenamiento más utilizados en Windows. + /// Functions for managing hard disk space. + /// A hard disk is a hard disk that stores and provides relatively fast access to large amounts of data. + /// It is the most used type of storage in Windows. /// - internal static class NativeMethods + public static class NativeMethods { - #region P/Invoke - #region [public] {static} {extern} (bool) GetDiskFreeSpace(string, out uint, out uint, out uint, out uint): Recupera información sobre el disco especificado, incluyendo la cantidad de espacio libre en el disco. /// /// Recupera información sobre el disco especificado, incluyendo la cantidad de espacio libre en el disco. @@ -19,11 +17,7 @@ internal static class NativeMethods /// [DllImport(ExternDll.Win.Kernel32, CharSet = CharSet.Auto, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool GetDiskFreeSpace(string lpRootPathName - , out uint lpSectorsPerCluster - , out uint lpBytesPerSector - , out uint lpNumberOfFreeClusters - , out uint lpTotalNumberOfClusters); + public static extern bool GetDiskFreeSpace(string lpRootPathName, out uint lpSectorsPerCluster, out uint lpBytesPerSector, out uint lpNumberOfFreeClusters, out uint lpTotalNumberOfClusters); #endregion #region [public] {static} {extern} (bool) GetDiskFreeSpaceEx(string, out ulong, out ulong, out ulong): Recupera información sobre la cantidad de espacio que está disponible en un volumen de disco, la cantidad total de espacio, la cantidad total de espacio libre, y la cantidad total de espacio libre disponible para el usuario que está asociado con el subproceso de llamada. @@ -33,12 +27,7 @@ public static extern bool GetDiskFreeSpace(string lpRootPathName /// [DllImport(ExternDll.Win.Kernel32, CharSet = CharSet.Auto, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool GetDiskFreeSpaceEx( string lpDirectoryName - , out ulong lpFreeBytesAvailable - , out ulong lpTotalNumberOfBytes - , out ulong lpTotalNumberOfFreeBytes); - #endregion - + public static extern bool GetDiskFreeSpaceEx(string lpDirectoryName, out ulong lpFreeBytesAvailable, out ulong lpTotalNumberOfBytes, out ulong lpTotalNumberOfFreeBytes); #endregion } } diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/DISK_GEOMETRY.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/DISK_GEOMETRY.cs index 0bf3858..38ee1fc 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/DISK_GEOMETRY.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/DISK_GEOMETRY.cs @@ -1,175 +1,162 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.Runtime.InteropServices; - + namespace iTin.Core.Interop.Windows.Development.Storage.LocalFileSystems.DiskManagement { + using System; + using System.Runtime.InteropServices; + /// - /// La estructura de datos DISK_GEOMETRY contiene información del escritorio asociado a un determinado monitor. + /// Describes the geometry of disk devices and media. /// + /// + /// For more information, please see https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ns-winioctl-disk_geometry. + /// [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DISK")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "GEOMETRY")] - struct DISK_GEOMETRY : IEquatable + public struct DISK_GEOMETRY : IEquatable { - #region Atributos + #region public members /// - /// Número de cilindros. + /// Number of cylinders /// public long Cylinders; + /// - /// Tipo de media. Más información ver . + /// Media Type. For more information, please see . /// public MEDIA_TYPE MediaType; + /// - /// Número de pistas por cilindro. + /// Number of tracks per cylinder. /// public int TracksPerCylinder; + /// - /// Número de sectores por pista. + /// Number of sectors per track. /// public int SectorsPerTrack; + /// - /// Número de bytes por sector. + /// Number of bytes per sector. /// public int BytesPerSector; #endregion - #region Propiedades - - #region [public] (long) DiskSize: Obtiene un valor que representa el tamaño del disco, se mide en bytes. - /// - /// Obtiene un valor que representa el tamaño del disco, se mide en bytes. - /// - /// - /// Tipo: - /// Tamaño del disco en bytes. - /// - public long DiskSize - { - get { return Cylinders * TracksPerCylinder * SectorsPerTrack * BytesPerSector; } - } - #endregion + #region interfaces - #endregion + #region [public] (bool) Equals(DISK_GEOMETRY): Indicates whether the current object is the same as another object of the same type + /// + /// Indicates whether the current object is the same as another object of the same type. + /// + /// Object to be compared with this object. + /// + /// Returns true if the current object is equal to the other parameter; otherwise, false. + /// + public bool Equals(DISK_GEOMETRY other) => other.Equals((object)this); + #endregion - #region Interfaces + #endregion - #region [public] (bool) Equals(DISK_GEOMETRY): Indica si la estructura actual es igual a otra estructura del mismo tipo. - /// - /// Indica si la estructura actual es igual a otra estructura del mismo tipo. - /// - /// Estructura que se va a comparar con esta estructura. - /// - /// Devuelve true si la estructura actual es igual al parámetro other; en caso contrario, false. - /// - public bool Equals(DISK_GEOMETRY other) - { - return other.Equals((object)this); - } - #endregion + #region public static members + /// + /// Empty structure + /// + public static readonly DISK_GEOMETRY Empty; + #endregion + + #region public properties + #region [public] (long) DiskSize: Gets a value that represents the size of the disk, it is measured in bytes + /// + /// Gets a value that represents the size of the disk, it is measured in bytes. + /// + /// + /// Disk size in bytes. + /// + public long DiskSize => Cylinders * TracksPerCylinder * SectorsPerTrack * BytesPerSector; #endregion - #region Overrides - - #region [public] {override} (int) GetHashCode(): Devuelve un valor que repesenta al código hash de esta estructura. - /// - /// Devuelve un valor que repesenta al código hash de esta estructura. - /// - /// - /// Tipo: - /// Código Hash de esta estructura. - /// - public override int GetHashCode() - { - return ToString().GetHashCode(); - } - #endregion - - #region [public] {override} (bool) Equals(object): Devuelve un valor que indica si esta estructutra es igual a otra. - /// - /// Devuelve un valor que indica si esta estructutra es igual a otra. - /// - /// Estructura con la que comparar. - /// Resultado de la comparación de igualdad. - public override bool Equals(object obj) - { - if (obj == null) - return false; - - if (!(obj is DISK_GEOMETRY)) - return false; - - var other = (DISK_GEOMETRY)obj; - return (other.Cylinders == Cylinders) && - (other.MediaType == MediaType) && - (other.TracksPerCylinder == TracksPerCylinder) && - (other.SectorsPerTrack == SectorsPerTrack) && - (other.BytesPerSector == BytesPerSector); - } - #endregion - - #region [public] {override} (string) ToString(): Devuelve una cadena que representa a la estructura actual. - /// - /// Devuelve una cadena que representa la estructura actual. - /// - /// - /// Tipo: - /// Cadena que representa la estructura actual. - /// - /// - /// El método devuelve una cadena que incluye el tamaño. - /// - public override string ToString() - { - return String.Format(CultureInfo.InvariantCulture, "{0}", DiskSize); - } - #endregion + #endregion + #region public override methods + + #region [public] {override} (int) GetHashCode(): Returns the hash code of the structure + /// + /// Returns the hash code of the structure. + /// + /// + /// Hash code. + /// + public override int GetHashCode() => ToString().GetHashCode(); #endregion - #region Operadores - - #region [public] {static} (bool) operator ==(DISK_GEOMETRY, DISK_GEOMETRY): Implementa el operador de igualdad (==). - /// - /// Implementa el operador de igualdad (==). - /// - /// Operando 1. - /// Operando 2. - /// - /// Devuelve true si operator1 es igual a operator2; false en caso contrario. - /// - public static bool operator ==(DISK_GEOMETRY operator1, DISK_GEOMETRY operator2) + #region [public] {override} (bool) Equals(object obj): Returns a value that indicates whether this object is equal to another + /// + /// Returns a value that indicates whether this object is equal to another. + /// + /// Object to compare. + /// + /// Equality result. + /// + public override bool Equals(object obj) + { + if (obj == null) { - return operator1.Equals(operator2); + return false; } - #endregion - - #region [public] {static} (bool) operator !=(DISK_GEOMETRY, DISK_GEOMETRY): Implementa el operador de desigualdad (!=). - /// - /// Implementa el operador de desigualdad (!=). - /// - /// Operando 1. - /// Operando 2. - /// - /// Devuelve true si operator1 no es igual a operator2; false en caso contrario. - /// - public static bool operator !=(DISK_GEOMETRY operator1, DISK_GEOMETRY operator2) + + if (!(obj is DISK_GEOMETRY)) { - return !operator1.Equals(operator2); + return false; } - #endregion + var other = (DISK_GEOMETRY)obj; + + return + other.Cylinders == Cylinders && + other.MediaType == MediaType && + other.TracksPerCylinder == TracksPerCylinder && + other.SectorsPerTrack == SectorsPerTrack && + other.BytesPerSector == BytesPerSector; + } #endregion - #region Miembros estáticos + #region [public] {override} (string) ToString(): Returns a string that represents the current object /// - /// Estructura vacía. + /// Returns a string that represents the current object. /// - public static readonly DISK_GEOMETRY Empty; + /// + /// Returns a string that represents the current object. + /// + public override string ToString() => $"{DiskSize}"; + #endregion + + #endregion + + #region public operators + + #region [public] {static} (bool) operator ==(DISPLAY_DEVICE, DISPLAY_DEVICE): Implement the equality operator (==) + /// + /// Implement the equality operator (==). + /// + /// Operand 1. + /// Operand 2. + /// + /// Returns true if deviceInfo1 is equal to deviceInfo2; false otherwise. + /// + public static bool operator ==(DISK_GEOMETRY left, DISK_GEOMETRY right) => left.Equals(right); + #endregion + + #region [public] {static} (bool) operator !=(DISK_GEOMETRY, DISK_GEOMETRY): Implementa el operador de desigualdad (!=). + /// + /// Implements the inequality operator (!=). + /// + /// Operand 1. + /// Operand 2. + /// + /// Returns true if deviceInfo1 is not equal to deviceInfo2; false otherwise. + /// + public static bool operator !=(DISK_GEOMETRY left, DISK_GEOMETRY right) => !left.Equals(right); + #endregion + #endregion } -} \ No newline at end of file +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/DRIVE_LAYOUT_INFORMATION_EX.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/DRIVE_LAYOUT_INFORMATION_EX.cs index 0588a69..52c2062 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/DRIVE_LAYOUT_INFORMATION_EX.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/DRIVE_LAYOUT_INFORMATION_EX.cs @@ -1,22 +1,18 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.Runtime.InteropServices; - + namespace iTin.Core.Interop.Windows.Development.Storage.LocalFileSystems.DiskManagement { + using System; + using System.Globalization; + using System.Runtime.InteropServices; + /// - /// Proporciona información ampliada acerca de las particiones del disco. + /// Contains extended information about a drive's partitions. /// /// - /// Para más información ver: http://msdn.microsoft.com/en-us/library/aa364001%28v=VS.85%29.aspx + /// For more information, please see https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ns-winioctl-drive_layout_information_ex. /// [StructLayout(LayoutKind.Explicit)] - [SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "LAYOUT")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DRIVE")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "INFORMATION")] - struct DRIVE_LAYOUT_INFORMATION_EX : IEquatable + public struct DRIVE_LAYOUT_INFORMATION_EX : IEquatable { #region Atributos /// diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/DRIVE_LAYOUT_INFORMATION_GPT.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/DRIVE_LAYOUT_INFORMATION_GPT.cs index 879581e..767dfc8 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/DRIVE_LAYOUT_INFORMATION_GPT.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/DRIVE_LAYOUT_INFORMATION_GPT.cs @@ -1,153 +1,134 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.Runtime.InteropServices; - + namespace iTin.Core.Interop.Windows.Development.Storage.LocalFileSystems.DiskManagement { + using System; + using System.Runtime.InteropServices; + /// - /// Proporciona información acerca de las particiones GPT. + /// Contains information about a drive's GUID partition table (GPT) partitions. /// /// - /// Para más información ver: http://msdn.microsoft.com/en-us/library/aa364003%28v=VS.85%29.aspx + /// For more information, please see https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ns-winioctl-drive_layout_information_gpt. /// [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "LAYOUT")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DRIVE")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "GPT")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "INFORMATION")] - struct DRIVE_LAYOUT_INFORMATION_GPT : IEquatable + public struct DRIVE_LAYOUT_INFORMATION_GPT : IEquatable { - #region Atributos + #region public members /// - /// del disco, + /// Disk /// public Guid DiskId; /// - /// Offset del byte inicial del primer bloque utilizable. + /// Offset of the initial byte of the first usable block. /// public Int64 StartingUsableOffset; /// - /// Tamaño de los bloques utilizables en el disco, en bytes. + /// Size of the usable blocks on the disk, in bytes. /// public Int64 UsableLength; /// - /// Número máximo de particiones que pueden definirse en el bloque utilizable. + /// Maximum number of partitions that can be defined in the usable block. /// public Int32 MaxPartitionCount; #endregion - #region Interfaces - - #region [public] (bool) Equals(DRIVE_LAYOUT_INFORMATION_GPT): Indica si la estructura actual es igual a otra estructura del mismo tipo. - /// - /// Indica si la estructura actual es igual a otra estructura del mismo tipo. - /// - /// Estructura que se va a comparar con esta estructura. - /// - /// Devuelve true si la estructura actual es igual al parámetro other; en caso contrario, false. - /// - public bool Equals(DRIVE_LAYOUT_INFORMATION_GPT other) - { - return other.Equals((object)this); - } - #endregion + #region interfaces + + #region [public] (bool) Equals(DRIVE_LAYOUT_INFORMATION_GPT): Indica si la estructura actual es igual a otra estructura del mismo tipo. + /// + /// Indica si la estructura actual es igual a otra estructura del mismo tipo. + /// + /// Estructura que se va a comparar con esta estructura. + /// + /// Devuelve true si la estructura actual es igual al parámetro other; en caso contrario, false. + /// + public bool Equals(DRIVE_LAYOUT_INFORMATION_GPT other) => other.Equals((object)this); + #endregion #endregion - #region Overrides - - #region [public] {override} (int) GetHashCode(): Devuelve un valor que repesenta al código hash de esta estructura. - /// - /// Devuelve un valor que repesenta al código hash de esta estructura. - /// - /// - /// Tipo: - /// Código Hash de esta estructura. - /// - public override int GetHashCode() - { - return ToString().GetHashCode(); - } - #endregion - - #region [public] {override} (bool) Equals(object): Devuelve un valor que indica si esta estructutra es igual a otra. - /// - /// Devuelve un valor que indica si esta estructutra es igual a otra. - /// - /// Estructura con la que comparar. - /// Resultado de la comparación de igualdad. - public override bool Equals(object obj) - { - if (obj == null) - return false; - - if (!(obj is DRIVE_LAYOUT_INFORMATION_GPT)) - return false; - - var other = (DRIVE_LAYOUT_INFORMATION_GPT)obj; - return (other.DiskId == DiskId) && - (other.MaxPartitionCount == MaxPartitionCount) && - (other.StartingUsableOffset == StartingUsableOffset) && - (other.UsableLength == UsableLength); - } - #endregion - - #region [public] {override} (string) ToString(): Devuelve una cadena que representa a la estructura actual. - /// - /// Devuelve una cadena que representa la estructura actual. - /// - /// - /// Tipo: - /// Cadena que representa la estructura actual. - /// - /// - /// El método devuelve una cadena que incluye el tamaño. - /// - public override string ToString() - { - return String.Format(CultureInfo.InvariantCulture, "Count {0}", MaxPartitionCount); - } - #endregion + #region public operators + + #region [public] {static} (bool) operator ==(DRIVE_LAYOUT_INFORMATION_GPT, DRIVE_LAYOUT_INFORMATION_GPT): Implementa el operador de igualdad (==). + /// + /// Implementa el operador de igualdad (==). + /// + /// Operando 1. + /// Operando 2. + /// + /// Devuelve true si operator1 es igual a operator2; false en caso contrario. + /// + public static bool operator ==(DRIVE_LAYOUT_INFORMATION_GPT left, DRIVE_LAYOUT_INFORMATION_GPT right) => left.Equals(right); #endregion - #region Operadores - - #region [public] {static} (bool) operator ==(DRIVE_LAYOUT_INFORMATION_GPT, DRIVE_LAYOUT_INFORMATION_GPT): Implementa el operador de igualdad (==). - /// - /// Implementa el operador de igualdad (==). - /// - /// Operando 1. - /// Operando 2. - /// - /// Devuelve true si operator1 es igual a operator2; false en caso contrario. - /// - public static bool operator ==(DRIVE_LAYOUT_INFORMATION_GPT operator1, DRIVE_LAYOUT_INFORMATION_GPT operator2) - { - return operator1.Equals(operator2); - } - #endregion - - #region [public] {static} (bool) operator !=(DRIVE_LAYOUT_INFORMATION_GPT, DRIVE_LAYOUT_INFORMATION_GPT): Implementa el operador de desigualdad (!=). - /// - /// Implementa el operador de desigualdad (!=). - /// - /// Operando 1. - /// Operando 2. - /// - /// Devuelve true si operator1 no es igual a operator2; false en caso contrario. - /// - public static bool operator !=(DRIVE_LAYOUT_INFORMATION_GPT operator1, DRIVE_LAYOUT_INFORMATION_GPT operator2) - { - return !operator1.Equals(operator2); - } - #endregion + #region [public] {static} (bool) operator !=(DRIVE_LAYOUT_INFORMATION_GPT, DRIVE_LAYOUT_INFORMATION_GPT): Implementa el operador de desigualdad (!=). + /// + /// Implementa el operador de desigualdad (!=). + /// + /// Operando 1. + /// Operando 2. + /// + /// Devuelve true si operator1 no es igual a operator2; false en caso contrario. + /// + public static bool operator !=(DRIVE_LAYOUT_INFORMATION_GPT left, DRIVE_LAYOUT_INFORMATION_GPT right) => !left.Equals(right); #endregion + + #endregion + + #region public override methods + + #region [public] {override} (int) GetHashCode(): Devuelve un valor que repesenta al código hash de esta estructura. + /// + /// Devuelve un valor que repesenta al código hash de esta estructura. + /// + /// + /// Tipo: + /// Código Hash de esta estructura. + /// + public override int GetHashCode() + { + return ToString().GetHashCode(); + } + #endregion + + #region [public] {override} (bool) Equals(object): Devuelve un valor que indica si esta estructutra es igual a otra. + /// + /// Devuelve un valor que indica si esta estructutra es igual a otra. + /// + /// Estructura con la que comparar. + /// Resultado de la comparación de igualdad. + public override bool Equals(object obj) + { + if (obj == null) + return false; + + if (!(obj is DRIVE_LAYOUT_INFORMATION_GPT)) + return false; + + var other = (DRIVE_LAYOUT_INFORMATION_GPT)obj; + return (other.DiskId == DiskId) && + (other.MaxPartitionCount == MaxPartitionCount) && + (other.StartingUsableOffset == StartingUsableOffset) && + (other.UsableLength == UsableLength); + } + #endregion + + #region [public] {override} (string) ToString(): Devuelve una cadena que representa a la estructura actual. + /// + /// Devuelve una cadena que representa la estructura actual. + /// + /// + /// Cadena que representa la estructura actual. + /// + public override string ToString() => $"Count {MaxPartitionCount}"; + #endregion + + #endregion + } -} \ No newline at end of file +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/DRIVE_LAYOUT_INFORMATION_MBR.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/DRIVE_LAYOUT_INFORMATION_MBR.cs index 1befa1f..3b6c4cb 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/DRIVE_LAYOUT_INFORMATION_MBR.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/DRIVE_LAYOUT_INFORMATION_MBR.cs @@ -1,133 +1,115 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; - + namespace iTin.Core.Interop.Windows.Development.Storage.LocalFileSystems.DiskManagement { + using System; + /// - /// Proporciona información acerca de las particiones MBR. + /// Provides information about a drive's master boot record (MBR) partitions. /// /// - /// Para más información ver: http://msdn.microsoft.com/en-us/library/aa364004%28v=VS.85%29.aspx + /// For more information, please see https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ns-winioctl-drive_layout_information_mbr. /// - [SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "LAYOUT")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "DRIVE")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "INFORMATION")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "MBR")] - struct DRIVE_LAYOUT_INFORMATION_MBR : IEquatable + public struct DRIVE_LAYOUT_INFORMATION_MBR : IEquatable { - #region Atributos + #region public members /// - /// Firma de la unidad. + /// Signature of the unit. /// public uint Signature; #endregion - #region Interfaces - - #region [public] (bool) Equals(DRIVE_LAYOUT_INFORMATION_MBR): Indica si la estructura actual es igual a otra estructura del mismo tipo. - /// - /// Indica si la estructura actual es igual a otra estructura del mismo tipo. - /// - /// Estructura que se va a comparar con esta estructura. - /// - /// Devuelve true si la estructura actual es igual al parámetro other; en caso contrario, false. - /// - public bool Equals(DRIVE_LAYOUT_INFORMATION_MBR other) - { - return other.Equals((object)this); - } - #endregion + #region interfaces + #region [public] (bool) Equals(DRIVE_LAYOUT_INFORMATION_MBR): Indica si la estructura actual es igual a otra estructura del mismo tipo. + /// + /// Indica si la estructura actual es igual a otra estructura del mismo tipo. + /// + /// Estructura que se va a comparar con esta estructura. + /// + /// Devuelve true si la estructura actual es igual al parámetro other; en caso contrario, false. + /// + public bool Equals(DRIVE_LAYOUT_INFORMATION_MBR other) => other.Equals((object)this); #endregion - #region Overrides + #endregion - #region [public] {override} (int) GetHashCode(): Devuelve un valor que repesenta al código hash de esta estructura. - /// - /// Devuelve un valor que repesenta al código hash de esta estructura. - /// - /// - /// Tipo: - /// Código Hash de esta estructura. - /// - public override int GetHashCode() - { - return ToString().GetHashCode(); - } - #endregion + #region public operators - #region [public] {override} (bool) Equals(object): Devuelve un valor que indica si esta estructutra es igual a otra. - /// - /// Devuelve un valor que indica si esta estructutra es igual a otra. - /// - /// Estructura con la que comparar. - /// Resultado de la comparación de igualdad. - public override bool Equals(object obj) - { - if (obj == null) - return false; + #region [public] {static} (bool) operator ==(DRIVE_LAYOUT_INFORMATION_MBR, DRIVE_LAYOUT_INFORMATION_MBR): Implementa el operador de igualdad (==). + /// + /// Implementa el operador de igualdad (==). + /// + /// Operando 1. + /// Operando 2. + /// + /// Devuelve true si operator1 es igual a operator2; false en caso contrario. + /// + public static bool operator ==(DRIVE_LAYOUT_INFORMATION_MBR left, DRIVE_LAYOUT_INFORMATION_MBR right) => left.Equals(right); + #endregion - if (!(obj is DRIVE_LAYOUT_INFORMATION_MBR)) - return false; + #region [public] {static} (bool) operator !=(DRIVE_LAYOUT_INFORMATION_MBR, DRIVE_LAYOUT_INFORMATION_MBR): Implementa el operador de desigualdad (!=). + /// + /// Implementa el operador de desigualdad (!=). + /// + /// Operando 1. + /// Operando 2. + /// + /// Devuelve true si operator1 no es igual a operator2; false en caso contrario. + /// + public static bool operator !=(DRIVE_LAYOUT_INFORMATION_MBR left, DRIVE_LAYOUT_INFORMATION_MBR right) => !left.Equals(right); + #endregion - var other = (DRIVE_LAYOUT_INFORMATION_MBR)obj; - return other.Signature == Signature; - } - #endregion + #endregion - #region [public] {override} (string) ToString(): Devuelve una cadena que representa a la estructura actual. - /// - /// Devuelve una cadena que representa la estructura actual. - /// - /// - /// Tipo: - /// Cadena que representa la estructura actual. - /// - /// - /// El método devuelve una cadena que incluye la firma. - /// - public override string ToString() - { - return String.Format(CultureInfo.InvariantCulture, "Signature {0}", Signature); - } - #endregion + #region public override methods + #region [public] {override} (int) GetHashCode(): Devuelve un valor que repesenta al código hash de esta estructura. + /// + /// Devuelve un valor que repesenta al código hash de esta estructura. + /// + /// + /// Tipo: + /// Código Hash de esta estructura. + /// + public override int GetHashCode() + { + return ToString().GetHashCode(); + } #endregion - #region Operadores + #region [public] {override} (bool) Equals(object): Devuelve un valor que indica si esta estructutra es igual a otra. + /// + /// Devuelve un valor que indica si esta estructutra es igual a otra. + /// + /// Estructura con la que comparar. + /// Resultado de la comparación de igualdad. + public override bool Equals(object obj) + { + if (obj == null) + return false; - #region [public] {static} (bool) operator ==(DRIVE_LAYOUT_INFORMATION_MBR, DRIVE_LAYOUT_INFORMATION_MBR): Implementa el operador de igualdad (==). - /// - /// Implementa el operador de igualdad (==). - /// - /// Operando 1. - /// Operando 2. - /// - /// Devuelve true si operator1 es igual a operator2; false en caso contrario. - /// - public static bool operator ==(DRIVE_LAYOUT_INFORMATION_MBR operator1, DRIVE_LAYOUT_INFORMATION_MBR operator2) - { - return operator1.Equals(operator2); - } - #endregion + if (!(obj is DRIVE_LAYOUT_INFORMATION_MBR)) + return false; - #region [public] {static} (bool) operator !=(DRIVE_LAYOUT_INFORMATION_MBR, DRIVE_LAYOUT_INFORMATION_MBR): Implementa el operador de desigualdad (!=). - /// - /// Implementa el operador de desigualdad (!=). - /// - /// Operando 1. - /// Operando 2. - /// - /// Devuelve true si operator1 no es igual a operator2; false en caso contrario. - /// - public static bool operator !=(DRIVE_LAYOUT_INFORMATION_MBR operator1, DRIVE_LAYOUT_INFORMATION_MBR operator2) - { - return !operator1.Equals(operator2); - } - #endregion + var other = (DRIVE_LAYOUT_INFORMATION_MBR)obj; + return other.Signature == Signature; + } + #endregion + + #region [public] {override} (string) ToString(): Devuelve una cadena que representa a la estructura actual. + /// + /// Devuelve una cadena que representa la estructura actual. + /// + /// + /// Tipo: + /// Cadena que representa la estructura actual. + /// + /// + /// El método devuelve una cadena que incluye la firma. + /// + public override string ToString() => $"Signature {Signature}"; + #endregion #endregion } -} \ No newline at end of file +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/PARTITION_INFORMATION_EX.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/PARTITION_INFORMATION_EX.cs index bba3daa..5ece04e 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/PARTITION_INFORMATION_EX.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/PARTITION_INFORMATION_EX.cs @@ -1,23 +1,19 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.Runtime.InteropServices; - + namespace iTin.Core.Interop.Windows.Development.Storage.LocalFileSystems.DiskManagement { + using System; + using System.Runtime.InteropServices; + /// - /// Contiene información de particiones de tipo Master Boot Record (MBR) y discos de Extensible Firmware Interface (EFI). + /// Contains partition information for standard AT-style master boot record (MBR) and Extensible Firmware Interface (EFI) disks. /// /// - /// Para más información ver: http://msdn.microsoft.com/en-us/library/aa365448%28v=VS.85%29.aspx + /// For more information, please see https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ns-winioctl-partition_information_ex. /// [StructLayout(LayoutKind.Explicit)] - [SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "INFORMATION")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "PARTITION")] - struct PARTITION_INFORMATION_EX : IEquatable + public struct PARTITION_INFORMATION_EX : IEquatable { - #region Atributos + #region public members /// /// Uno de los valores de la enumeración que representa el formato de la partición. /// @@ -64,117 +60,107 @@ struct PARTITION_INFORMATION_EX : IEquatable public PARTITION_INFORMATION_GPT Gpt; #endregion - #region Interfaces - - #region [public] (bool) Equals(PARTITION_INFORMATION_EX): Indica si la estructura actual es igual a otra estructura del mismo tipo. - /// - /// Indica si la estructura actual es igual a otra estructura del mismo tipo. - /// - /// Estructura que se va a comparar con esta estructura. - /// - /// Devuelve true si la estructura actual es igual al parámetro other; en caso contrario, false. - /// - public bool Equals(PARTITION_INFORMATION_EX other) - { - return other.Equals((object)this); - } - #endregion + #region interfaces + #region [public] (bool) Equals(PARTITION_INFORMATION_EX): Indica si la estructura actual es igual a otra estructura del mismo tipo. + /// + /// Indica si la estructura actual es igual a otra estructura del mismo tipo. + /// + /// Estructura que se va a comparar con esta estructura. + /// + /// Devuelve true si la estructura actual es igual al parámetro other; en caso contrario, false. + /// + public bool Equals(PARTITION_INFORMATION_EX other) => other.Equals((object)this); #endregion - #region Overrides - - #region [public] {override} (int) GetHashCode(): Devuelve un valor que repesenta al código hash de esta estructura. - /// - /// Devuelve un valor que repesenta al código hash de esta estructura. - /// - /// - /// Tipo: - /// Código Hash de esta estructura. - /// - public override int GetHashCode() - { - return ToString().GetHashCode(); - } - #endregion - - #region [public] {override} (bool) Equals(object): Devuelve un valor que indica si esta estructutra es igual a otra. - /// - /// Devuelve un valor que indica si esta estructutra es igual a otra. - /// - /// Estructura con la que comparar. - /// Resultado de la comparación de igualdad. - public override bool Equals(object obj) - { - if (obj == null) - return false; - - if (!(obj is PARTITION_INFORMATION_EX)) - return false; - - var other = (PARTITION_INFORMATION_EX)obj; - return (other.Gpt == Gpt) && - (other.Mbr == Mbr) && - (other.PartitionLength == PartitionLength) && - (other.PartitionNumber == PartitionNumber) && - (other.PartitionStyle == PartitionStyle) && - (other.RewritePartition == RewritePartition) && - (other.StartingOffset == StartingOffset); - } - #endregion - - #region [public] {override} (string) ToString(): Devuelve una cadena que representa a la estructura actual. - /// - /// Devuelve una cadena que representa la estructura actual. - /// - /// - /// Tipo: - /// Cadena que representa la estructura actual. - /// - /// - /// El método devuelve una cadena que incluye el número de partición y su tipo. - /// - public override string ToString() - { - return String.Format(CultureInfo.InvariantCulture, "Number: {0}; Style {1}", PartitionNumber, PartitionStyle); - } - #endregion + #endregion + + #region public operators + #region [public] {static} (bool) operator ==(PARTITION_INFORMATION_EX, PARTITION_INFORMATION_EX): Implementa el operador de igualdad (==). + /// + /// Implementa el operador de igualdad (==). + /// + /// Operando 1. + /// Operando 2. + /// + /// Devuelve true si operator1 es igual a operator2; false en caso contrario. + /// + public static bool operator ==(PARTITION_INFORMATION_EX left, PARTITION_INFORMATION_EX rihgt) => left.Equals(rihgt); #endregion - #region Operadores - - #region [public] {static} (bool) operator ==(PARTITION_INFORMATION_EX, PARTITION_INFORMATION_EX): Implementa el operador de igualdad (==). - /// - /// Implementa el operador de igualdad (==). - /// - /// Operando 1. - /// Operando 2. - /// - /// Devuelve true si operator1 es igual a operator2; false en caso contrario. - /// - public static bool operator ==(PARTITION_INFORMATION_EX operator1, PARTITION_INFORMATION_EX operator2) + #region [public] {static} (bool) operator !=(PARTITION_INFORMATION_EX, PARTITION_INFORMATION_EX): Implementa el operador de desigualdad (!=). + /// + /// Implementa el operador de desigualdad (!=). + /// + /// Operando 1. + /// Operando 2. + /// + /// Devuelve true si operator1 no es igual a operator2; false en caso contrario. + /// + public static bool operator !=(PARTITION_INFORMATION_EX left, PARTITION_INFORMATION_EX rihgt) => !left.Equals(rihgt); + #endregion + + #endregion + + #region public override methods + + #region [public] {override} (int) GetHashCode(): Devuelve un valor que repesenta al código hash de esta estructura. + /// + /// Devuelve un valor que repesenta al código hash de esta estructura. + /// + /// + /// Código Hash de esta estructura. + /// + public override int GetHashCode() => ToString().GetHashCode(); + #endregion + + #region [public] {override} (bool) Equals(object): Devuelve un valor que indica si esta estructutra es igual a otra. + /// + /// Devuelve un valor que indica si esta estructutra es igual a otra. + /// + /// Estructura con la que comparar. + /// + /// Resultado de la comparación de igualdad. + /// + public override bool Equals(object obj) + { + if (obj == null) { - return operator1.Equals(operator2); + return false; } - #endregion - - #region [public] {static} (bool) operator !=(PARTITION_INFORMATION_EX, PARTITION_INFORMATION_EX): Implementa el operador de desigualdad (!=). - /// - /// Implementa el operador de desigualdad (!=). - /// - /// Operando 1. - /// Operando 2. - /// - /// Devuelve true si operator1 no es igual a operator2; false en caso contrario. - /// - public static bool operator !=(PARTITION_INFORMATION_EX operator1, PARTITION_INFORMATION_EX operator2) + + if (!(obj is PARTITION_INFORMATION_EX)) { - return !operator1.Equals(operator2); + return false; } - #endregion + var other = (PARTITION_INFORMATION_EX)obj; + + return + other.Gpt == Gpt && + other.Mbr == Mbr && + other.PartitionLength == PartitionLength && + other.PartitionNumber == PartitionNumber && + other.PartitionStyle == PartitionStyle && + other.RewritePartition == RewritePartition && + other.StartingOffset == StartingOffset; + } + #endregion + + #region [public] {override} (string) ToString(): Devuelve una cadena que representa a la estructura actual. + /// + /// Devuelve una cadena que representa la estructura actual. + /// + /// + /// Cadena que representa la estructura actual. + /// + /// + /// El método devuelve una cadena que incluye el número de partición y su tipo. + /// + public override string ToString() => $"Number: {PartitionNumber}; Style {PartitionStyle}"; #endregion + #endregion } -} \ No newline at end of file +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/PARTITION_INFORMATION_GPT.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/PARTITION_INFORMATION_GPT.cs index 12eb2b1..d43f47b 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/PARTITION_INFORMATION_GPT.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/PARTITION_INFORMATION_GPT.cs @@ -1,24 +1,19 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.Runtime.InteropServices; - + namespace iTin.Core.Interop.Windows.Development.Storage.LocalFileSystems.DiskManagement { + using System; + using System.Runtime.InteropServices; + /// - /// Contiene la tabla de particiones GUID (GPT). + /// Contains GUID partition table (GPT) partition information. /// /// - /// Para más información ver: http://msdn.microsoft.com/en-us/library/aa365449%28v=VS.85%29.aspx + /// For more information, please see https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ns-winioctl-partition_information_gpt. /// [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode)] - [SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "INFORMATION")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "GPT")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "PARTITION")] - struct PARTITION_INFORMATION_GPT : IEquatable + public struct PARTITION_INFORMATION_GPT : IEquatable { - #region Atributos + #region public members /// /// que identifica el tipo de partición. /// @@ -45,113 +40,105 @@ struct PARTITION_INFORMATION_GPT : IEquatable public string Name; #endregion - #region Interfaces - - #region [public] (bool) Equals(PARTITION_INFORMATION_GPT): Indica si la estructura actual es igual a otra estructura del mismo tipo. - /// - /// Indica si la estructura actual es igual a otra estructura del mismo tipo. - /// - /// Estructura que se va a comparar con esta estructura. - /// - /// Devuelve true si la estructura actual es igual al parámetro other; en caso contrario, false. - /// - public bool Equals(PARTITION_INFORMATION_GPT other) - { - return other.Equals((object)this); - } - #endregion + #region interfaces + #region [public] (bool) Equals(PARTITION_INFORMATION_GPT): Indica si la estructura actual es igual a otra estructura del mismo tipo. + /// + /// Indica si la estructura actual es igual a otra estructura del mismo tipo. + /// + /// Estructura que se va a comparar con esta estructura. + /// + /// Devuelve true si la estructura actual es igual al parámetro other; en caso contrario, false. + /// + public bool Equals(PARTITION_INFORMATION_GPT other) => other.Equals((object)this); #endregion - #region Overrides - - #region [public] {override} (int) GetHashCode(): Devuelve un valor que repesenta al código hash de esta estructura. - /// - /// Devuelve un valor que repesenta al código hash de esta estructura. - /// - /// - /// Tipo: - /// Código Hash de esta estructura. - /// - public override int GetHashCode() - { - return ToString().GetHashCode(); - } - #endregion - - #region [public] {override} (bool) Equals(object): Devuelve un valor que indica si esta estructutra es igual a otra. - /// - /// Devuelve un valor que indica si esta estructutra es igual a otra. - /// - /// Estructura con la que comparar. - /// Resultado de la comparación de igualdad. - public override bool Equals(object obj) - { - if (obj == null) - return false; + #endregion - if (!(obj is PARTITION_INFORMATION_GPT)) - return false; + #region public operators - var other = (PARTITION_INFORMATION_GPT)obj; - return (other.Attributes == Attributes) && - (other.Name == Name) && - (other.PartitionId == PartitionId) && - (other.PartitionType == PartitionType); - } - #endregion - - #region [public] {override} (string) ToString(): Devuelve una cadena que representa a la estructura actual. - /// - /// Devuelve una cadena que representa la estructura actual. - /// - /// - /// Tipo: - /// Cadena que representa la estructura actual. - /// - /// - /// El método devuelve una cadena que incluye el nombre de la partición. - /// - public override string ToString() - { - return string.Format(CultureInfo.InvariantCulture, "Name = {0}", Name); - } - #endregion + #region [public] {static} (bool) operator ==(PARTITION_INFORMATION_GPT, PARTITION_INFORMATION_GPT): Implementa el operador de igualdad (==). + /// + /// Implementa el operador de igualdad (==). + /// + /// Operando 1. + /// Operando 2. + /// + /// Devuelve true si operator1 es igual a operator2; false en caso contrario. + /// + public static bool operator ==(PARTITION_INFORMATION_GPT left, PARTITION_INFORMATION_GPT right) => left.Equals(right); + #endregion + #region [public] {static} (bool) operator !=(PARTITION_INFORMATION_GPT, PARTITION_INFORMATION_GPT): Implementa el operador de desigualdad (!=). + /// + /// Implementa el operador de desigualdad (!=). + /// + /// Operando 1. + /// Operando 2. + /// + /// Devuelve true si operator1 no es igual a operator2; false en caso contrario. + /// + public static bool operator !=(PARTITION_INFORMATION_GPT left, PARTITION_INFORMATION_GPT right) => !left.Equals(right); #endregion - #region Operadores - - #region [public] {static} (bool) operator ==(PARTITION_INFORMATION_GPT, PARTITION_INFORMATION_GPT): Implementa el operador de igualdad (==). - /// - /// Implementa el operador de igualdad (==). - /// - /// Operando 1. - /// Operando 2. - /// - /// Devuelve true si operator1 es igual a operator2; false en caso contrario. - /// - public static bool operator ==(PARTITION_INFORMATION_GPT operator1, PARTITION_INFORMATION_GPT operator2) + #endregion + + #region public override methods + + #region [public] {override} (int) GetHashCode(): Devuelve un valor que repesenta al código hash de esta estructura. + /// + /// Devuelve un valor que repesenta al código hash de esta estructura. + /// + /// + /// Tipo: + /// Código Hash de esta estructura. + /// + public override int GetHashCode() + { + return ToString().GetHashCode(); + } + #endregion + + #region [public] {override} (bool) Equals(object): Devuelve un valor que indica si esta estructutra es igual a otra. + /// + /// Devuelve un valor que indica si esta estructutra es igual a otra. + /// + /// Estructura con la que comparar. + /// + /// Resultado de la comparación de igualdad. + /// + public override bool Equals(object obj) + { + if (obj == null) { - return operator1.Equals(operator2); + return false; } - #endregion - - #region [public] {static} (bool) operator !=(PARTITION_INFORMATION_GPT, PARTITION_INFORMATION_GPT): Implementa el operador de desigualdad (!=). - /// - /// Implementa el operador de desigualdad (!=). - /// - /// Operando 1. - /// Operando 2. - /// - /// Devuelve true si operator1 no es igual a operator2; false en caso contrario. - /// - public static bool operator !=(PARTITION_INFORMATION_GPT operator1, PARTITION_INFORMATION_GPT operator2) + + if (!(obj is PARTITION_INFORMATION_GPT)) { - return !operator1.Equals(operator2); + return false; } - #endregion + + var other = (PARTITION_INFORMATION_GPT)obj; + + return + other.Attributes == Attributes && + other.Name == Name && + other.PartitionId == PartitionId && + other.PartitionType == PartitionType; + } + #endregion + + #region [public] {override} (string) ToString(): Devuelve una cadena que representa a la estructura actual. + /// + /// Devuelve una cadena que representa la estructura actual. + /// + /// + /// Cadena que representa la estructura actual. + /// + public override string ToString() => Name; + #endregion #endregion } -} \ No newline at end of file +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/PARTITION_INFORMATION_MBR.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/PARTITION_INFORMATION_MBR.cs index 964b18e..3a8a4e0 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/PARTITION_INFORMATION_MBR.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/DiskManagement/Structures/PARTITION_INFORMATION_MBR.cs @@ -1,22 +1,17 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.Runtime.InteropServices; - + namespace iTin.Core.Interop.Windows.Development.Storage.LocalFileSystems.DiskManagement { + using System; + using System.Runtime.InteropServices; + /// - /// Proporciona información acerca de las particiones de la unidad master boot record (MBR). + /// Contains partition information specific to master boot record (MBR) disks. /// /// - /// Para más información ver: http://msdn.microsoft.com/en-us/library/aa365450%28v=VS.85%29.aspx + /// For more information, please see https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ns-winioctl-partition_information_mbr. /// [StructLayout(LayoutKind.Sequential)] - [SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "MBR")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "INFORMATION")] - [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "PARTITION")] - struct PARTITION_INFORMATION_MBR : IEquatable + public struct PARTITION_INFORMATION_MBR : IEquatable { #region Atributos /// @@ -48,126 +43,111 @@ struct PARTITION_INFORMATION_MBR : IEquatable public UInt32 HiddenSectors; #endregion - #region Interfaces - - #region [public] (bool) Equals(PARTITION_INFORMATION_MBR): Indica si la estructura actual es igual a otra estructura del mismo tipo. - /// - /// Indica si la estructura actual es igual a otra estructura del mismo tipo. - /// - /// Estructura que se va a comparar con esta estructura. - /// - /// Devuelve true si la estructura actual es igual al parámetro other; en caso contrario, false. - /// - public bool Equals(PARTITION_INFORMATION_MBR other) - { - return other.Equals((object)this); - } - #endregion + #region interfaces + #region [public] (bool) Equals(PARTITION_INFORMATION_MBR): Indica si la estructura actual es igual a otra estructura del mismo tipo. + /// + /// Indica si la estructura actual es igual a otra estructura del mismo tipo. + /// + /// Estructura que se va a comparar con esta estructura. + /// + /// Devuelve true si la estructura actual es igual al parámetro other; en caso contrario, false. + /// + public bool Equals(PARTITION_INFORMATION_MBR other) => other.Equals((object)this); #endregion - #region Overrides - - #region [public] {override} (int) GetHashCode(): Devuelve un valor que repesenta al código hash de esta estructura. - /// - /// Devuelve un valor que repesenta al código hash de esta estructura. - /// - /// - /// Tipo: - /// Código Hash de esta estructura. - /// - public override int GetHashCode() - { - return ToString().GetHashCode(); - } - #endregion - - #region [public] {override} (bool) Equals(object): Devuelve un valor que indica si esta estructutra es igual a otra. - /// - /// Devuelve un valor que indica si esta estructutra es igual a otra. - /// - /// Estructura con la que comparar. - /// Resultado de la comparación de igualdad. - public override bool Equals(object obj) - { - if (obj == null) - return false; + #endregion - if (!(obj is PARTITION_INFORMATION_MBR)) - return false; + #region public operators - var other = (PARTITION_INFORMATION_MBR)obj; - return (other.BootIndicator == BootIndicator) && - (other.HiddenSectors == HiddenSectors) && - (other.PartitionType == PartitionType) && - (other.RecognizedPartition == RecognizedPartition); - } - #endregion - - #region [public] {override} (string) ToString(): Devuelve una cadena que representa a la estructura actual. - /// - /// Devuelve una cadena que representa la estructura actual. - /// - /// - /// Tipo: - /// Cadena que representa la estructura actual. - /// - /// - /// El método devuelve una cadena que incluye el tipo de la partición. - /// - public override string ToString() - { - return string.Format(CultureInfo.InvariantCulture, "Type = {0}", PartitionType); - } - #endregion + #region [public] {static} (bool) operator ==(PARTITION_INFORMATION_GPT, PARTITION_INFORMATION_GPT): Implementa el operador de igualdad (==). + /// + /// Implementa el operador de igualdad (==). + /// + /// Operando 1. + /// Operando 2. + /// + /// Devuelve true si operator1 es igual a operator2; false en caso contrario. + /// + public static bool operator ==(PARTITION_INFORMATION_MBR operator1, PARTITION_INFORMATION_MBR operator2) => operator1.Equals(operator2); + #endregion + + #region [public] {static} (bool) operator !=(PARTITION_INFORMATION_GPT, PARTITION_INFORMATION_GPT): Implementa el operador de desigualdad (!=). + /// + /// Implementa el operador de desigualdad (!=). + /// + /// Operando 1. + /// Operando 2. + /// + /// Devuelve true si operator1 no es igual a operator2; false en caso contrario. + /// + public static bool operator !=(PARTITION_INFORMATION_MBR operator1, PARTITION_INFORMATION_MBR operator2) => !operator1.Equals(operator2); + #endregion + + #endregion + #region public override methods + + #region [public] {override} (int) GetHashCode(): Devuelve un valor que repesenta al código hash de esta estructura. + /// + /// Devuelve un valor que repesenta al código hash de esta estructura. + /// + /// + /// Código Hash de esta estructura. + /// + public override int GetHashCode() => ToString().GetHashCode(); #endregion - #region Operadores - - #region [public] {static} (bool) operator ==(PARTITION_INFORMATION_GPT, PARTITION_INFORMATION_GPT): Implementa el operador de igualdad (==). - /// - /// Implementa el operador de igualdad (==). - /// - /// Operando 1. - /// Operando 2. - /// - /// Devuelve true si operator1 es igual a operator2; false en caso contrario. - /// - public static bool operator ==(PARTITION_INFORMATION_MBR operator1, PARTITION_INFORMATION_MBR operator2) + #region [public] {override} (bool) Equals(object): Devuelve un valor que indica si esta estructutra es igual a otra. + /// + /// Devuelve un valor que indica si esta estructutra es igual a otra. + /// + /// Estructura con la que comparar. + /// + /// Resultado de la comparación de igualdad. + /// + public override bool Equals(object obj) + { + if (obj == null) { - return operator1.Equals(operator2); + return false; } - #endregion - - #region [public] {static} (bool) operator !=(PARTITION_INFORMATION_GPT, PARTITION_INFORMATION_GPT): Implementa el operador de desigualdad (!=). - /// - /// Implementa el operador de desigualdad (!=). - /// - /// Operando 1. - /// Operando 2. - /// - /// Devuelve true si operator1 no es igual a operator2; false en caso contrario. - /// - public static bool operator !=(PARTITION_INFORMATION_MBR operator1, PARTITION_INFORMATION_MBR operator2) + + if (!(obj is PARTITION_INFORMATION_MBR)) { - return !operator1.Equals(operator2); + return false; } - #endregion + + var other = (PARTITION_INFORMATION_MBR)obj; + + return + other.BootIndicator == BootIndicator && + other.HiddenSectors == HiddenSectors && + other.PartitionType == PartitionType && + other.RecognizedPartition == RecognizedPartition; + } + #endregion + + #region [public] {override} (string) ToString(): Devuelve una cadena que representa a la estructura actual. + /// + /// Devuelve una cadena que representa la estructura actual. + /// + /// + /// Cadena que representa la estructura actual. + /// + /// + /// El método devuelve una cadena que incluye el tipo de la partición. + /// + public override string ToString() => $"Type = {PartitionType}"; + #endregion #endregion // helper method - is the hi bit valid - if so IsNTFT has meaning. - public bool IsValidNTFT() - { - return (PartitionType == (PARTITION_TYPE)0xc0);//.NTFT);// == 0xc0; - } + public bool IsValidNTFT() => PartitionType == (PARTITION_TYPE)0xc0; // is this NTFT - i.e. an NTFT raid or mirror. - public bool IsNTFT() - { - return (PartitionType == PARTITION_TYPE.NTFT);// & 0x80) == 0x80; - } + public bool IsNTFT() => PartitionType == PARTITION_TYPE.NTFT; // the actual partition type. /// @@ -182,7 +162,6 @@ public PARTITION_TYPE GetPartition return (PARTITION_TYPE) ((int) PartitionType & mask); } } - } } diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/FileManagement/NativeMethods.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/FileManagement/NativeMethods.cs index 5ead0be..b9ee22d 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/FileManagement/NativeMethods.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/FileManagement/NativeMethods.cs @@ -11,7 +11,7 @@ namespace iTin.Core.Interop.Windows.Development.Storage.LocalFileSystems.FileMan /// Funciones para la gestión del sistema de archivos. /// Un archivo es la representación de un recurso (ya sea un dispositivo físico o un recurso ubicado en un dispositivo físico) que pueden ser manejados por el sistema de E/S. /// - internal static class NativeMethods + public static class NativeMethods { #region Enums [StructLayout(LayoutKind.Sequential)] diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/VolumeManagement/NativeMethods.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/VolumeManagement/NativeMethods.cs index f3d971c..2907adf 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/VolumeManagement/NativeMethods.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/Storage/LocalFileSystems/VolumeManagement/NativeMethods.cs @@ -6,132 +6,132 @@ namespace iTin.Core.Interop.Windows.Development.Storage.LocalFileSystems.VolumeM using System.Text; /// - /// El nivel más alto de organización en el sistema de archivos es el volumen. - /// Un sistema de archivos reside en un volumen. - /// Un volumen contiene al menos una partición, lo cual es una división lógica de un disco físico (para obtener más información, vea Dispositivos de discos y particiones en http://msdn.microsoft.com/en-us/library/aa363966%28v=VS.85%29.aspx). - /// Un volumen que contiene los datos que existen en una partición que se llama un volumen simple, y un volumen - /// que contiene los datos que existen en más de una partición que se llama un volumen de varias particiones. + /// The highest level of organization in the file system is the volume. + /// A file system resides on a volume. + /// A volume contains at least one partition, which is a logical division of a physical disk (for more information, see Disk devices and partitions at http://msdn.microsoft.com/en-us/library/aa363966%28v=VS.85%29.aspx). + /// A volume that contains the data that exists in a partition called a simple volume, and a volume + /// which contains the data that exists in more than one partition called a volume of several partitions. /// - internal static class NativeMethods + public static class NativeMethods { #region Enums - #region [public] {enum} FileSystemFlags: - [Flags] - public enum FileSystemFlags : uint - { - /// - /// The specified volume supports case-sensitive file names. - /// - FILE_CASE_SENSITIVE_SEARCH = 0x00000001, - - /// - /// The specified volume supports preserved case of file names when it places a name on disk. - /// - FILE_CASE_PRESERVED_NAMES = 0x00000002, - - /// - /// The specified volume preserves and enforces access control lists (ACL). - /// For example, the NTFS file system preserves and enforces ACLs, and the FAT file system does not. - /// - FILE_PERSISTENT_ACLS = 0x00000008, - - /// - /// The specified volume supports file-based compression. - /// - FILE_FILE_COMPRESSION = 0x00000010, - - /// - /// The specified volume supports named streams. - /// - FILE_NAMED_STREAMS = 0x00040000, - - /// - /// The specified volume is read-only. - /// - FILE_READ_ONLY_VOLUME = 0x00080000, - - /// - /// The specified volume supports a single sequential write. - /// - FILE_SEQUENTIAL_WRITE_ONCE = 0x00100000, - - /// - /// The specified volume supports the Encrypted File System (EFS). - /// For more information, see File Encryption. - /// - FILE_SUPPORTS_ENCRYPTION = 0x00020000, - - /// - /// The specified volume supports extended attributes. - /// An extended attribute is a piece of application-specific metadata that an application can associate with a file and is not part of the file's data. - /// Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP: This value is not supported until Windows Server 2008 R2 and Windows 7. - /// - FILE_SUPPORTS_EXTENDED_ATTRIBUTES = 0x00800000, - - /// - /// The specified volume supports hard links. - /// For more information, see Hard Links and Junctions. - /// An extended attribute is a piece of application-specific metadata that an application can associate with a file and is not part of the file's data. - /// Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP: This value is not supported until Windows Server 2008 R2 and Windows 7. - /// - FILE_SUPPORTS_HARD_LINKS = 0x00400000, - - /// - /// The specified volume supports object identifiers. - /// For more information, see Hard Links and Junctions. - /// - FILE_SUPPORTS_OBJECT_IDS = 0x00010000, - - /// - /// The file system supports open by FileID. - /// For more information, see FILE_ID_BOTH_DIR_INFO. - /// Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP: This value is not supported until Windows Server 2008 R2 and Windows 7. - /// - FILE_SUPPORTS_OPEN_BY_FILE_ID = 0x01000000, - - /// - /// The specified volume supports re-parse points. - /// - FILE_SUPPORTS_REPARSE_POINTS = 0x00000080, - - /// - /// The specified volume supports sparse files. - /// - FILE_SUPPORTS_SPARSE_FILES = 0x00000040, - - /// - /// The specified volume supports transactions. - /// For more information, see About KTM. - /// - FILE_SUPPORTS_TRANSACTIONS = 0x00200000, - - /// - /// The specified volume supports update sequence number (USN) journals. - /// For more information, see Change Journal Records. - /// Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP: This value is not supported until Windows Server 2008 R2 and Windows 7. - /// - FILE_SUPPORTS_USN_JOURNAL = 0x02000000, - - /// - /// The specified volume supports Unicode in file names as they appear on disk. - /// For more information, see Change Journal Records. - /// Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP: This value is not supported until Windows Server 2008 R2 and Windows 7. - /// - FILE_UNICODE_ON_DISK = 0x00000004, - - /// - /// The specified volume supports Unicode in file names as they appear on disk. - /// The specified volume is a compressed volume, for example, a DoubleSpace volume. - /// - FILE_VOLUME_IS_COMPRESSED = 0x00008000, - - /// - /// The specified volume supports disk quotas. - /// - FILE_VOLUME_QUOTAS = 0x00000020, - } - #endregion + #region [public] {enum} FileSystemFlags: + [Flags] + public enum FileSystemFlags : uint + { + /// + /// The specified volume supports case-sensitive file names. + /// + FILE_CASE_SENSITIVE_SEARCH = 0x00000001, + + /// + /// The specified volume supports preserved case of file names when it places a name on disk. + /// + FILE_CASE_PRESERVED_NAMES = 0x00000002, + + /// + /// The specified volume preserves and enforces access control lists (ACL). + /// For example, the NTFS file system preserves and enforces ACLs, and the FAT file system does not. + /// + FILE_PERSISTENT_ACLS = 0x00000008, + + /// + /// The specified volume supports file-based compression. + /// + FILE_FILE_COMPRESSION = 0x00000010, + + /// + /// The specified volume supports named streams. + /// + FILE_NAMED_STREAMS = 0x00040000, + + /// + /// The specified volume is read-only. + /// + FILE_READ_ONLY_VOLUME = 0x00080000, + + /// + /// The specified volume supports a single sequential write. + /// + FILE_SEQUENTIAL_WRITE_ONCE = 0x00100000, + + /// + /// The specified volume supports the Encrypted File System (EFS). + /// For more information, see File Encryption. + /// + FILE_SUPPORTS_ENCRYPTION = 0x00020000, + + /// + /// The specified volume supports extended attributes. + /// An extended attribute is a piece of application-specific metadata that an application can associate with a file and is not part of the file's data. + /// Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP: This value is not supported until Windows Server 2008 R2 and Windows 7. + /// + FILE_SUPPORTS_EXTENDED_ATTRIBUTES = 0x00800000, + + /// + /// The specified volume supports hard links. + /// For more information, see Hard Links and Junctions. + /// An extended attribute is a piece of application-specific metadata that an application can associate with a file and is not part of the file's data. + /// Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP: This value is not supported until Windows Server 2008 R2 and Windows 7. + /// + FILE_SUPPORTS_HARD_LINKS = 0x00400000, + + /// + /// The specified volume supports object identifiers. + /// For more information, see Hard Links and Junctions. + /// + FILE_SUPPORTS_OBJECT_IDS = 0x00010000, + + /// + /// The file system supports open by FileID. + /// For more information, see FILE_ID_BOTH_DIR_INFO. + /// Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP: This value is not supported until Windows Server 2008 R2 and Windows 7. + /// + FILE_SUPPORTS_OPEN_BY_FILE_ID = 0x01000000, + + /// + /// The specified volume supports re-parse points. + /// + FILE_SUPPORTS_REPARSE_POINTS = 0x00000080, + + /// + /// The specified volume supports sparse files. + /// + FILE_SUPPORTS_SPARSE_FILES = 0x00000040, + + /// + /// The specified volume supports transactions. + /// For more information, see About KTM. + /// + FILE_SUPPORTS_TRANSACTIONS = 0x00200000, + + /// + /// The specified volume supports update sequence number (USN) journals. + /// For more information, see Change Journal Records. + /// Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP: This value is not supported until Windows Server 2008 R2 and Windows 7. + /// + FILE_SUPPORTS_USN_JOURNAL = 0x02000000, + + /// + /// The specified volume supports Unicode in file names as they appear on disk. + /// For more information, see Change Journal Records. + /// Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP: This value is not supported until Windows Server 2008 R2 and Windows 7. + /// + FILE_UNICODE_ON_DISK = 0x00000004, + + /// + /// The specified volume supports Unicode in file names as they appear on disk. + /// The specified volume is a compressed volume, for example, a DoubleSpace volume. + /// + FILE_VOLUME_IS_COMPRESSED = 0x00008000, + + /// + /// The specified volume supports disk quotas. + /// + FILE_VOLUME_QUOTAS = 0x00000020, + } + #endregion #endregion diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/UI/WindowsAndMessages/configuration/NativeMethods.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/UI/WindowsAndMessages/configuration/NativeMethods.cs index 43ee9c0..df77d83 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/UI/WindowsAndMessages/configuration/NativeMethods.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/UI/WindowsAndMessages/configuration/NativeMethods.cs @@ -6,1756 +6,1856 @@ namespace iTin.Core.Interop.Windows.Development.UI.WindowsAndMessages.Configurat using System.Runtime.InteropServices; /// - /// Funciones que se pueden utilizar para controlar la configuración de parámetros del sistema y los diversos atributos del sistema, como el tiempo del doble clic, - /// el tiempo de espera del protector de pantalla, el ancho del borde de las ventanas. + /// Functions that can be used to control the configuration of system parameters and various system attributes, such as double click time, the screen saver timeout, the width of the window border. /// - internal static class NativeMethods + public static class NativeMethods { - #region Enums + #region public enumerations + + #region [public] (enum) SystemMetricIndex: Represents a feature or configuration value of the system to recover + /// + /// Represents a feature or configuration value of the system to recover. + /// Note that all SM_CX* values are wide and SM_CY* height values. + /// Also note that the settings designed to return data , the value true + /// is represented with a non-zero value and false with zero value. + /// + public enum SystemMetricIndex + { + /// + /// Screen width of the main screen monitor, in pixels. + /// This value is the same value that is obtained by calling GetDeviceCaps as follows: GetDeviceCaps (hdcPrimaryMonitor, HORZRES). + /// + SM_CXSCREEN = 0, + + /// + /// Screen height of the main screen monitor, in pixels. + /// This value is the same value that is obtained by calling GetDeviceCaps as follows: GetDeviceCaps (hdcPrimaryMonitor, VERTRES). + /// + SM_CYSCREEN = 1, + + /// + /// Vertical scroll bar width, in pixels. + /// + SM_CXVSCROLL = 2, + + /// + /// Height of a horizontal scroll bar, in pixels. + /// + SM_CYHSCROLL = 3, + + /// + /// Title area height, in pixels. + /// + SM_CYCAPTION = 4, + + /// + /// Window border width, in pixels. This is equivalent to the value for windows with the 3D appearance. + /// + SM_CXBORDER = 5, + + /// + /// + /// + SM_CYBORDER = 6, + + /// + /// Please see, . + /// + SM_CXDLGFRAME = 7, + + /// + /// + /// + SM_CYDLGFRAME = 8, + + /// + /// + /// + SM_CYVTHUMB = 9, + + /// + /// + /// + SM_CXHTHUMB = 10, + + /// + /// + /// + SM_CXICON = 11, + + /// + /// + /// + SM_CYICON = 12, + + /// + /// + /// + SM_CXCURSOR = 13, + + /// + /// + /// + SM_CYCURSOR = 14, + + /// + /// Height of a one-line menu bar, in pixels. + /// + SM_CYMENU = 15, + + /// + /// + /// + SM_CXFULLSCREEN = 16, + + /// + /// + /// + SM_CYFULLSCREEN = 17, + + /// + /// + /// + SM_CYKANJIWINDOW = 18, + + /// + /// + /// + SM_MOUSEPRESENT = 19, + + /// + /// + /// + SM_CYVSCROLL = 20, + + /// + /// + /// + SM_CXHSCROLL = 21, + + /// + /// + /// + SM_DEBUG = 22, + + /// + /// + /// + SM_SWAPBUTTON = 23, + + /// + /// + /// + SM_RESERVED1 = 24, + + /// + /// + /// + SM_RESERVED2 = 25, + + /// + /// + /// + SM_RESERVED3 = 26, + + /// + /// + /// + SM_RESERVED4 = 27, + + /// + /// Minimum width of a window, in pixels. + /// + SM_CXMIN = 28, + + /// + /// Minimum height of a window, in pixels. + /// + SM_CYMIN = 29, + + /// + /// Width of a button on a bar or window title, in pixels. + /// + SM_CXSIZE = 30, + + /// + /// Height of a button on a bar or window title, in pixels. + /// + SM_CYSIZE = 31, + + /// + /// + /// + SM_CXFRAME = 32, + + /// + /// + /// + SM_CYFRAME = 33, + + /// + /// + /// + SM_CXMINTRACK = 34, + + /// + /// + /// + SM_CYMINTRACK = 35, + + /// + /// + /// + SM_CXDOUBLECLK = 36, + + /// + /// + /// + SM_CYDOUBLECLK = 37, + + /// + /// + /// + SM_CXICONSPACING = 38, + + /// + /// + /// + SM_CYICONSPACING = 39, + + /// + /// + /// + SM_MENUDROPALIGNMENT = 40, + + /// + /// + /// + SM_PENWINDOWS = 41, + + /// + /// + /// + SM_DBCSENABLED = 42, + + /// + /// Number of mouse buttons, returns zero if the mouse is not installed. + /// + SM_CMOUSEBUTTONS = 43, + + /*#if(WINVER >= 0x0400)*/ + /// + /// + /// + SM_CXFIXEDFRAME = SM_CXDLGFRAME, /* ;win40 name change */ + + /// + /// + /// + SM_CYFIXEDFRAME = SM_CYDLGFRAME, /* ;win40 name change */ + + /// + /// + /// + SM_CXSIZEFRAME = SM_CXFRAME, /* ;win40 name change */ + + /// + /// + /// + SM_CYSIZEFRAME = SM_CYFRAME, /* ;win40 name change */ + + /// + /// + /// + SM_SECURE = 44, + + /// + /// + /// + SM_CXEDGE = 45, + + /// + /// + /// + SM_CYEDGE = 46, + + /// + /// + /// + SM_CXMINSPACING = 47, + + /// + /// + /// + SM_CYMINSPACING = 48, + + /// + /// + /// + SM_CXSMICON = 49, + + /// + /// + /// + SM_CYSMICON = 50, + + /// + /// + /// + SM_CYSMCAPTION = 51, + + /// + /// + /// + SM_CXSMSIZE = 52, + + /// + /// + /// + SM_CYSMSIZE = 53, + + /// + /// + /// + SM_CXMENUSIZE = 54, + + /// + /// + /// + SM_CYMENUSIZE = 55, + + /// + /// + /// + SM_ARRANGE = 56, + + /// + /// + /// + SM_CXMINIMIZED = 57, + + /// + /// + /// + SM_CYMINIMIZED = 58, + + /// + /// + /// + SM_CXMAXTRACK = 59, + + /// + /// + /// + SM_CYMAXTRACK = 60, + + /// + /// + /// + SM_CXMAXIMIZED = 61, + + /// + /// + /// + SM_CYMAXIMIZED = 62, + + /// + /// + /// + SM_NETWORK = 63, + + /// + /// + /// + SM_CLEANBOOT = 67, + + /// + /// + /// + SM_CXDRAG = 68, + + /// + /// + /// + SM_CYDRAG = 69, + + /*#endif /* WINVER >= 0x0400 */ + /// + /// + /// + SM_SHOWSOUNDS = 70, + /*#if(WINVER >= 0x0400)*/ + + /// + /// + /// + SM_CXMENUCHECK = 71, /* Use instead of GetMenuCheckMarkDimensions()! */ + /// + /// + /// + SM_CYMENUCHECK = 72, + /// + /// + /// + SM_SLOWMACHINE = 73, + /// + /// + /// + SM_MIDEASTENABLED = 74, + /*#endif /* WINVER >= 0x0400 */ + + /*#if (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400)*/ + /// + /// + /// + SM_MOUSEWHEELPRESENT = 75, + + /*#endif*/ + /*#if(WINVER >= 0x0500)*/ + /// + /// + /// + SM_XVIRTUALSCREEN = 76, + + /// + /// + /// + SM_YVIRTUALSCREEN = 77, + + /// + /// + /// + SM_CXVIRTUALSCREEN = 78, + + /// + /// + /// + SM_CYVIRTUALSCREEN = 79, + + /// + /// Number of monitors on a computer screen. For more information, see the Comments section of this topic. + /// + SM_CMONITORS = 80, + + /// + /// + /// + SM_SAMEDISPLAYFORMAT = 81, + + /*#endif /* WINVER >= 0x0500 */ + /*#if(_WIN32_WINNT >= 0x0500)*/ + /// + /// + /// + SM_IMMENABLED = 82, + + /*#endif /* _WIN32_WINNT >= 0x0500 */ + /*#if(_WIN32_WINNT >= 0x0501)*/ + /// + /// + /// + SM_CXFOCUSBORDER = 83, + + /// + /// + /// + SM_CYFOCUSBORDER = 84, + + /*#endif /* _WIN32_WINNT >= 0x0501 */ + + /*#if(_WIN32_WINNT >= 0x0501)*/ + /// + /// + /// + SM_TABLETPC = 86, + + /// + /// + /// + SM_MEDIACENTER = 87, + + /*#endif /* _WIN32_WINNT >= 0x0501 */ + + /*#if (WINVER < 0x0500) && (!defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0400))*/ + /// + /// + /// + SM_CMETRICS_OTHER = 76, + + /*#elif WINVER == 0x500*/ + /// + /// + /// + SM_CMETRICS_2000 = 83, + + /*#else*/ + /// + /// A nonzero value indicates that the current operating system is Windows 7 Starter Edition, Windows Vista Starter or Windows XP Starter Edition; otherwise, 0. + /// + SM_CMETRICS_NT = 88, + + /*#endif*/ + + /*#if(WINVER >= 0x0500)*/ + /// + /// + /// + SM_REMOTESESSION = 0x1000, + + /*#if(_WIN32_WINNT >= 0x0501)*/ + /// + /// + /// + SM_SHUTTINGDOWN = 0x2000, + /*#endif /* _WIN32_WINNT >= 0x0501 */ + + /*#if(WINVER >= 0x0501)*/ + /// + /// + /// + SM_REMOTECONTROL = 0x2001, + /*#endif /* WINVER >= 0x0501 */ + + /*#endif /* WINVER >= 0x0500 */ + } + #endregion + + #region [public] (enum) SPI: Represents a feature or configuration value of the system to recover + /// + /// Represents a feature or configuration value of the system to recover. + /// Note that all SM_CX* values are wide and SM_CY* height values. + /// Also note that the settings designed to return data , the value true is represented with a non-zero value and false with zero value. + /// + [Description("SPI_(System-wide parameter - Used in SystemParametersInfo function )")] + public enum SPI : uint + { + /// + /// Determines whether the warning beeper is on. + /// The pvParam parameter must point to a BOOL variable that receives TRUE if the beeper is on, or FALSE if it is off. + /// + GetBeep = 0x0001, + + /// + /// Turns the warning beeper on or off. The uiParam parameter specifies TRUE for on, or FALSE for off. + /// + SetBeep = 0x0002, + + /// + /// Retrieves the two mouse threshold values and the mouse speed. + /// + GetMouse = 0x0003, + + /// + /// Establece los valores de umbral y la velocidad del ratón. + /// + SetMouse = 0x0004, + + /// + /// Retrieves the border multiplier factor that determines the width of a window's sizing border. + /// The pvParam parameter must point to an integer variable that receives this value. + /// + GetBorder = 0x0005, + + /// + /// Sets the border multiplier factor that determines the width of a window's sizing border. + /// The uiParam parameter specifies the new value. + /// + SetBorder = 0x0006, + + /// + /// Retrieves the keyboard repeat-speed setting, which is a value in the range from 0 (approximately 2.5 repetitions per second) + /// through 31 (approximately 30 repetitions per second). The actual repeat rates are hardware-dependent and may vary from + /// a linear scale by as much as 20%. The pvParam parameter must point to a DWORD variable that receives the setting + /// + GetKeyboardSpeed = 0x000A, + + /// + /// Sets the keyboard repeat-speed setting. The uiParam parameter must specify a value in the range from 0 + /// (approximately 2.5 repetitions per second) through 31 (approximately 30 repetitions per second). + /// The actual repeat rates are hardware-dependent and may vary from a linear scale by as much as 20%. + /// If uiParam is greater than 31, the parameter is set to 31. + /// + SetKeyboardSpeed = 0x000B, + + /// + /// Not implemented. + /// + LangDriver = 0x000C, + + /// + /// Sets or retrieves the width, in pixels, of an icon cell. The system uses this rectangle to arrange icons in large icon view. + /// To set this value, set uiParam to the new value and set pvParam to null. You cannot set this value to less than SM_CXICON. + /// To retrieve this value, pvParam must point to an integer that receives the current value. + /// + IconhorizontalSpacing = 0x000D, + + /// + /// Retrieves the screen saver time-out value, in seconds. The pvParam parameter must point to an integer variable that receives the value. + /// + GetScreenSaveTimeout = 0x000E, + + /// + /// Sets the screen saver time-out value to the value of the uiParam parameter. This value is the amount of time, in seconds, + /// that the system must be idle before the screen saver activates. + /// + SetScreenSaveTimeout = 0x000F, + + /// + /// Determines whether screen saving is enabled. The pvParam parameter must point to a bool variable that receives TRUE + /// if screen saving is enabled, or FALSE otherwise. + /// + GetScreenSaveActive = 0x0010, + /// + /// Sets the state of the screen saver. The uiParam parameter specifies TRUE to activate screen saving, or FALSE to deactivate it. + /// + SetScreenSaveActive = 0x0011, + + /// + /// Retrieves the current granularity value of the desktop sizing grid. The pvParam parameter must point to an integer variable + /// that receives the granularity. + /// + GetGridGranularity = 0x0012, + + /// + /// Sets the granularity of the desktop sizing grid to the value of the uiParam parameter. + /// + SetGridGranularity = 0x0013, + + /// + /// Sets the desktop wallpaper. The value of the pvParam parameter determines the new wallpaper. To specify a wallpaper bitmap, + /// set pvParam to point to a null-terminated string containing the name of a bitmap file. Setting pvParam to "" removes the wallpaper. + /// Setting pvParam to SETWALLPAPER_DEFAULT or null reverts to the default wallpaper. + /// + SetDeskWallpaper = 0x0014, + + /// + /// Sets the current desktop pattern by causing Windows to read the Pattern= setting from the WIN.INI file. + /// + SetDeskPattern = 0x0015, + + /// + /// Retrieves the keyboard repeat-delay setting, which is a value in the range from 0 (approximately 250 ms delay) through 3 + /// (approximately 1 second delay). The actual delay associated with each value may vary depending on the hardware. The pvParam parameter must point to an integer variable that receives the setting. + /// + GetKeyboardDelay = 0x0016, + + /// + /// Sets the keyboard repeat-delay setting. The uiParam parameter must specify 0, 1, 2, or 3, where zero sets the shortest delay + /// (approximately 250 ms) and 3 sets the longest delay (approximately 1 second). The actual delay associated with each value may + /// vary depending on the hardware. + /// + SetKeyboardDelay = 0x0017, + + /// + /// Sets or retrieves the height, in pixels, of an icon cell. + /// To set this value, set uiParam to the new value and set pvParam to null. You cannot set this value to less than SM_CYICON. + /// To retrieve this value, pvParam must point to an integer that receives the current value. + /// + IconVerticalSpacing = 0x0018, + + /// + /// Determine if full window dragging is enabled (view content when dragging). + /// The pvParam parameter must point to a variable of type that will receive true if the feature is activated or false otherwise. + /// + GetIconTitleWrap = 0x0019, + + /// + /// Activate or deactivate the feature. See . + /// + SetIconTitleWrap = 0x001A, + + /// + /// Determines whether pop-up menus are left-aligned or right-aligned, relative to the corresponding menu-bar item. + /// The pvParam parameter must point to a bool variable that receives TRUE if left-aligned, or FALSE otherwise. + /// + GetMenuDropAlignment = 0x001B, + + /// + /// Sets the alignment value of pop-up menus. The uiParam parameter specifies TRUE for right alignment, or FALSE for left alignment. + /// + SetMenuDropAlignment = 0x001C, + + /// + /// Sets the width of the double-click rectangle to the value of the uiParam parameter. + /// The double-click rectangle is the rectangle within which the second click of a double-click must fall for it to be registered + /// as a double-click. + /// To retrieve the width of the double-click rectangle, call GetSystemMetrics with the SM_CXDOUBLECLK flag. + /// + SetDoubleClkWidth = 0x001D, + + /// + /// Sets the height of the double-click rectangle to the value of the uiParam parameter. + /// The double-click rectangle is the rectangle within which the second click of a double-click must fall for it to be registered + /// as a double-click. + /// To retrieve the height of the double-click rectangle, call GetSystemMetrics with the SM_CYDOUBLECLK flag. + /// + SetDoubleClkHeight = 0x001E, + + /// + /// Retrieves the logical font information for the current icon-title font. The uiParam parameter specifies the size of a LOGFONT structure, + /// and the pvParam parameter must point to the LOGFONT structure to fill in. + /// + GetIconTitleLogFont = 0x001F, + + /// + /// Sets the double-click time for the mouse to the value of the uiParam parameter. The double-click time is the maximum number + /// of milliseconds that can occur between the first and second clicks of a double-click. You can also call the SetDoubleClickTime + /// function to set the double-click time. To get the current double-click time, call the GetDoubleClickTime function. + /// + SetDoubleClickTime = 0x0020, + + /// + /// Swaps or restores the meaning of the left and right mouse buttons. The uiParam parameter specifies TRUE to swap the meanings + /// of the buttons, or FALSE to restore their original meanings. + /// + SetMouseButtonSwap = 0x0021, + + /// + /// Sets the font that is used for icon titles. The uiParam parameter specifies the size of a LOGFONT structure, + /// and the pvParam parameter must point to a LOGFONT structure. + /// + SetIconTitleLogFont = 0x0022, + + /// + /// This flag is obsolete. Previous versions of the system use this flag to determine whether ALT+TAB fast task switching is enabled. + /// For Windows 95, Windows 98, and Windows NT version 4.0 and later, fast task switching is always enabled. + /// + GetFastTaskWitch = 0x0023, + /// + /// This flag is obsolete. Previous versions of the system use this flag to enable or disable ALT+TAB fast task switching. + /// For Windows 95, Windows 98, and Windows NT version 4.0 and later, fast task switching is always enabled. + /// + SetFastTaskWitch = 0x0024, + + /// + /// Activate or deactivate the feature. See . + /// + SetDragFullWindows = 0x0025, + + /// + /// Determine if full window dragging is enabled (view content when dragging). + /// The pvParam parameter must point to a variable of type that will receive true + /// if the feature is activated or false otherwise. + /// + /// + /// For Windows 95, this feature is only supported if you have Windows Plus! See . + /// + GetDragFullWindows = 0x0026, + + /// + /// Retrieves the metrics associated with the nonclient area of nonminimized windows. The pvParam parameter must point + /// to a NONCLIENTMETRICS structure that receives the information. Set the cbSize member of this structure and the uiParam parameter + /// to sizeof(NONCLIENTMETRICS). + /// + GetNonClientMetrics = 0x0029, + + /// + /// Sets the metrics associated with the nonclient area of nonminimized windows. The pvParam parameter must point + /// to a NONCLIENTMETRICS structure that contains the new parameters. Set the cbSize member of this structure + /// and the uiParam parameter to sizeof(NONCLIENTMETRICS). Also, the lfHeight member of the LOGFONT structure must be a negative value. + /// + SetNonClientMetrics = 0x002A, + + /// + /// Retrieves the metrics associated with minimized windows. The pvParam parameter must point to a MINIMIZEDMETRICS structure + /// that receives the information. Set the cbSize member of this structure and the uiParam parameter to sizeof(MINIMIZEDMETRICS). + /// + GetMinimizedMetrics = 0x002B, + + /// + /// Sets the metrics associated with minimized windows. The pvParam parameter must point to a MINIMIZEDMETRICS structure + /// that contains the new parameters. Set the cbSize member of this structure and the uiParam parameter to sizeof(MINIMIZEDMETRICS). + /// + SetMinimizedMetrics = 0x002C, + + /// + /// Retrieves the metrics associated with icons. The pvParam parameter must point to an ICONMETRICS structure that receives + /// the information. Set the cbSize member of this structure and the uiParam parameter to sizeof(ICONMETRICS). + /// + GetIconMetrics = 0x002D, + + /// + /// Sets the metrics associated with icons. The pvParam parameter must point to an ICONMETRICS structure that contains + /// the new parameters. Set the cbSize member of this structure and the uiParam parameter to sizeof(ICONMETRICS). + /// + SetIconMetrics = 0x002E, + + /// + /// Sets the size of the work area. The work area is the portion of the screen not obscured by the system taskbar + /// or by application desktop toolbars. The pvParam parameter is a pointer to a RECT structure that specifies the new work area rectangle, + /// expressed in virtual screen coordinates. In a system with multiple display monitors, the function sets the work area + /// of the monitor that contains the specified rectangle. + /// + SetWorkArea = 0x002F, + + /// + /// Retrieves the size of the work area on the primary display monitor. The work area is the portion of the screen not obscured + /// by the system taskbar or by application desktop toolbars. The pvParam parameter must point to a RECT structure that receives + /// the coordinates of the work area, expressed in virtual screen coordinates. + /// To get the work area of a monitor other than the primary display monitor, call the GetMonitorInfo function. + /// + GetWorkArea = 0x0030, + + /// + /// Windows Me/98/95: Pen windows is being loaded or unloaded. The uiParam parameter is TRUE when loading and FALSE + /// when unloading pen windows. The pvParam parameter is null. + /// + SetPenWindows = 0x0031, + + /// + /// Retrieves information about the HighContrast accessibility feature. The pvParam parameter must point to a HIGHCONTRAST structure + /// that receives the information. Set the cbSize member of this structure and the uiParam parameter to sizeof(HIGHCONTRAST). + /// For a general discussion, see remarks. + /// Windows NT: This value is not supported. + /// + /// + /// There is a difference between the High Contrast color scheme and the High Contrast Mode. The High Contrast color scheme changes + /// the system colors to colors that have obvious contrast; you switch to this color scheme by using the Display Options in the control panel. + /// The High Contrast Mode, which uses SPI_GETHIGHCONTRAST and SPI_SETHIGHCONTRAST, advises applications to modify their appearance + /// for visually-impaired users. It involves such things as audible warning to users and customized color scheme + /// (using the Accessibility Options in the control panel). For more information, see HIGHCONTRAST on MSDN. + /// For more information on general accessibility features, see Accessibility on MSDN. + /// + GetHighContrast = 0x0042, + + /// + /// Sets the parameters of the HighContrast accessibility feature. The pvParam parameter must point to a HIGHCONTRAST structure + /// that contains the new parameters. Set the cbSize member of this structure and the uiParam parameter to sizeof(HIGHCONTRAST). + /// Windows NT: This value is not supported. + /// + SetHighContrast = 0x0043, + + /// + /// Determines whether the user relies on the keyboard instead of the mouse, and wants applications to display keyboard interfaces + /// that would otherwise be hidden. The pvParam parameter must point to a BOOL variable that receives TRUE + /// if the user relies on the keyboard; or FALSE otherwise. + /// Windows NT: This value is not supported. + /// + GetKeyboardPref = 0x0044, + + /// + /// Sets the keyboard preference. The uiParam parameter specifies TRUE if the user relies on the keyboard instead of the mouse, + /// and wants applications to display keyboard interfaces that would otherwise be hidden; uiParam is FALSE otherwise. + /// Windows NT: This value is not supported. + /// + SetKeyboardPref = 0x0045, + + /// + /// Determines whether a screen reviewer utility is running. A screen reviewer utility directs textual information to an output device, + /// such as a speech synthesizer or Braille display. When this flag is set, an application should provide textual information + /// in situations where it would otherwise present the information graphically. + /// The pvParam parameter is a pointer to a BOOL variable that receives TRUE if a screen reviewer utility is running, or FALSE otherwise. + /// Windows NT: This value is not supported. + /// + GetScreenReader = 0x0046, + /// + /// Determines whether a screen review utility is running. The uiParam parameter specifies TRUE for on, or FALSE for off. + /// Windows NT: This value is not supported. + /// + SetScreenReader = 0x0047, + + /// + /// Retrieves the animation effects associated with user actions. The pvParam parameter must point to an ANIMATIONINFO structure + /// that receives the information. Set the cbSize member of this structure and the uiParam parameter to sizeof(ANIMATIONINFO). + /// + GetAnimation = 0x0048, + + /// + /// Sets the animation effects associated with user actions. The pvParam parameter must point to an ANIMATIONINFO structure + /// that contains the new parameters. Set the cbSize member of this structure and the uiParam parameter to sizeof(ANIMATIONINFO). + /// + SetAnimation = 0x0049, + + /// + /// Determines whether the font smoothing function is enabled. + /// This function uses the smoothing of fonts so that the curves of the font are drawn softer at different gray levels. + /// The pvParam parameter must point to a variable of type that will receive true + /// if the feature is activated or false otherwise. + /// + /// + /// For Windows 95, this feature is only supported if you have Windows Plus! See . + /// + GetFontSmoothing = 0x004A, + + /// + /// Activate or deactivate the feature. See . + /// + SetFontSmoothing = 0x004B, + + /// + /// Sets the width, in pixels, of the rectangle used to detect the start of a drag operation. Set uiParam to the new value. + /// To retrieve the drag width, call GetSystemMetrics with the SM_CXDRAG flag. + /// + SetDragWidth = 0x004C, + + /// + /// Sets the height, in pixels, of the rectangle used to detect the start of a drag operation. Set uiParam to the new value. + /// To retrieve the drag height, call GetSystemMetrics with the SM_CYDRAG flag. + /// + SetDragHeight = 0x004D, + + /// + /// Used internally; applications should not use this value. + /// + SetHandled = 0x004E, + + /// + /// Retrieves the time-out value for the low-power phase of screen saving. The pvParam parameter must point to an integer variable + /// that receives the value. This flag is supported for 32-bit applications only. + /// Windows NT, Windows Me/98: This flag is supported for 16-bit and 32-bit applications. + /// Windows 95: This flag is supported for 16-bit applications only. + /// + GetLowPowerTimeout = 0x004F, + + /// + /// Retrieves the time-out value for the power-off phase of screen saving. The pvParam parameter must point to an integer variable + /// that receives the value. This flag is supported for 32-bit applications only. + /// Windows NT, Windows Me/98: This flag is supported for 16-bit and 32-bit applications. + /// Windows 95: This flag is supported for 16-bit applications only. + /// + GetPowerOffTimeout = 0x0050, + + /// + /// Sets the time-out value, in seconds, for the low-power phase of screen saving. The uiParam parameter specifies the new value. + /// The pvParam parameter must be null. This flag is supported for 32-bit applications only. + /// Windows NT, Windows Me/98: This flag is supported for 16-bit and 32-bit applications. + /// Windows 95: This flag is supported for 16-bit applications only. + /// + SetLowPowerTimeout = 0x0051, + + /// + /// Sets the time-out value, in seconds, for the power-off phase of screen saving. The uiParam parameter specifies the new value. + /// The pvParam parameter must be null. This flag is supported for 32-bit applications only. + /// Windows NT, Windows Me/98: This flag is supported for 16-bit and 32-bit applications. + /// Windows 95: This flag is supported for 16-bit applications only. + /// + SetPowerOffTimeout = 0x0052, + + /// + /// Determines whether the low-power phase of screen saving is enabled. The pvParam parameter must point to a BOOL variable + /// that receives TRUE if enabled, or FALSE if disabled. This flag is supported for 32-bit applications only. + /// Windows NT, Windows Me/98: This flag is supported for 16-bit and 32-bit applications. + /// Windows 95: This flag is supported for 16-bit applications only. + /// + GetLowPowerActive = 0x0053, + + /// + /// Determines whether the power-off phase of screen saving is enabled. The pvParam parameter must point to a BOOL variable + /// that receives TRUE if enabled, or FALSE if disabled. This flag is supported for 32-bit applications only. + /// Windows NT, Windows Me/98: This flag is supported for 16-bit and 32-bit applications. + /// Windows 95: This flag is supported for 16-bit applications only. + /// + GetPowerOffActive = 0x0054, + + /// + /// Activates or deactivates the low-power phase of screen saving. Set uiParam to 1 to activate, or zero to deactivate. + /// The pvParam parameter must be null. This flag is supported for 32-bit applications only. + /// Windows NT, Windows Me/98: This flag is supported for 16-bit and 32-bit applications. + /// Windows 95: This flag is supported for 16-bit applications only. + /// + SetLowPowerActive = 0x0055, + + /// + /// Activates or deactivates the power-off phase of screen saving. Set uiParam to 1 to activate, or zero to deactivate. + /// The pvParam parameter must be null. This flag is supported for 32-bit applications only. + /// Windows NT, Windows Me/98: This flag is supported for 16-bit and 32-bit applications. + /// Windows 95: This flag is supported for 16-bit applications only. + /// + SetPowerOfActive = 0x0056, + + /// + /// Reloads the system cursors. Set the uiParam parameter to zero and the pvParam parameter to null. + /// + SetCursors = 0x0057, + + /// + /// Reloads the system icons. Set the uiParam parameter to zero and the pvParam parameter to null. + /// + SetIcons = 0x0058, + + /// + /// Retrieves the input locale identifier for the system default input language. The pvParam parameter must point + /// to an HKL variable that receives this value. For more information, see Languages, Locales, and Keyboard Layouts on MSDN. + /// + GetDefaultInputLang = 0x0059, + + /// + /// Sets the default input language for the system shell and applications. The specified language must be displayable + /// using the current system character set. The pvParam parameter must point to an HKL variable that contains + /// the input locale identifier for the default language. For more information, see Languages, Locales, and Keyboard Layouts on MSDN. + /// + SetDefaultInputLang = 0x005A, + + /// + /// Sets the hot key set for switching between input languages. The uiParam and pvParam parameters are not used. + /// The value sets the shortcut keys in the keyboard property sheets by reading the registry again. The registry must be set before this flag is used. the path in the registry is \HKEY_CURRENT_USER\keyboard layout\toggle. Valid values are "1" = ALT+SHIFT, "2" = CTRL+SHIFT, and "3" = none. + /// + SetLangToggle = 0x005B, + + /// + /// Windows 95: Determines whether the Windows extension, Windows Plus!, is installed. Set the uiParam parameter to 1. + /// The pvParam parameter is not used. The function returns TRUE if the extension is installed, or FALSE if it is not. + /// + GetWindowsExtension = 0x005C, + + /// + /// Enables or disables the Mouse Trails feature, which improves the visibility of mouse cursor movements by briefly showing + /// a trail of cursors and quickly erasing them. + /// To disable the feature, set the uiParam parameter to zero or 1. To enable the feature, set uiParam to a value greater than 1 + /// to indicate the number of cursors drawn in the trail. + /// Windows 2000/NT: This value is not supported. + /// + SetMouseTrails = 0x005D, + + /// + /// Determines whether the Mouse Trails feature is enabled. This feature improves the visibility of mouse cursor movements + /// by briefly showing a trail of cursors and quickly erasing them. + /// The pvParam parameter must point to an integer variable that receives a value. If the value is zero or 1, the feature is disabled. + /// If the value is greater than 1, the feature is enabled and the value indicates the number of cursors drawn in the trail. + /// The uiParam parameter is not used. + /// Windows 2000/NT: This value is not supported. + /// + GetMouseTrails = 0x005E, + + /// + /// Windows Me/98: Used internally; applications should not use this flag. + /// + SetScreenSaverRunning = 0x0061, + + /// + /// Same as SPI_SETSCREENSAVERRUNNING. + /// + ScreenSaverRunning = SetScreenSaverRunning, + + /// + /// Retrieves information about the FilterKeys accessibility feature. The pvParam parameter must point to a FILTERKEYS structure + /// that receives the information. Set the cbSize member of this structure and the uiParam parameter to sizeof(FILTERKEYS). + /// + GetFilterKeys = 0x0032, + + /// + /// Sets the parameters of the FilterKeys accessibility feature. The pvParam parameter must point to a FILTERKEYS structure + /// that contains the new parameters. Set the cbSize member of this structure and the uiParam parameter to sizeof(FILTERKEYS). + /// + SetFilterKeys = 0x0033, + + /// + /// Retrieves information about the ToggleKeys accessibility feature. The pvParam parameter must point to a TOGGLEKEYS structure + /// that receives the information. Set the cbSize member of this structure and the uiParam parameter to sizeof(TOGGLEKEYS). + /// + GetToggleKeys = 0x0034, + + /// + /// Sets the parameters of the ToggleKeys accessibility feature. The pvParam parameter must point to a TOGGLEKEYS structure + /// that contains the new parameters. Set the cbSize member of this structure and the uiParam parameter to sizeof(TOGGLEKEYS). + /// + SetToggleKeys = 0x0035, + + /// + /// Retrieves information about the MouseKeys accessibility feature. The pvParam parameter must point to a MOUSEKEYS structure + /// that receives the information. Set the cbSize member of this structure and the uiParam parameter to sizeof(MOUSEKEYS). + /// + GetMouseKeys = 0x0036, + + /// + /// Sets the parameters of the MouseKeys accessibility feature. The pvParam parameter must point to a MOUSEKEYS structure + /// that contains the new parameters. Set the cbSize member of this structure and the uiParam parameter to sizeof(MOUSEKEYS). + /// + SetMouseKeys = 0x0037, + + /// + /// Determina si la opción sonido de la característica de accesibilidad esta activado los eventos se muestran de forma audible. + /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true + /// si la caracteristíca está activada ó false en caso contrario. + /// + GetShowSounds = 0x0038, + + /// + /// Activa o desactiva la característica. Ver . + /// + SetShowSounds = 0x0039, + + /// + /// Retrieves information about the StickyKeys accessibility feature. The pvParam parameter must point to a STICKYKEYS structure + /// that receives the information. Set the cbSize member of this structure and the uiParam parameter to sizeof(STICKYKEYS). + /// + GetStickyKeys = 0x003A, + + /// + /// Sets the parameters of the StickyKeys accessibility feature. The pvParam parameter must point to a STICKYKEYS structure + /// that contains the new parameters. Set the cbSize member of this structure and the uiParam parameter to sizeof(STICKYKEYS). + /// + SetStickyKeys = 0x003B, + + /// + /// Retrieves information about the time-out period associated with the accessibility features. The pvParam parameter must point + /// to an ACCESSTIMEOUT structure that receives the information. Set the cbSize member of this structure and the uiParam parameter + /// to sizeof(ACCESSTIMEOUT). + /// + GetAccessTimeout = 0x003C, + + /// + /// Sets the time-out period associated with the accessibility features. The pvParam parameter must point to an ACCESSTIMEOUT + /// structure that contains the new parameters. Set the cbSize member of this structure and the uiParam parameter to sizeof(ACCESSTIMEOUT). + /// + SetAccessTimeout = 0x003D, + + /// + /// Windows Me/98/95: Retrieves information about the SerialKeys accessibility feature. The pvParam parameter must point + /// to a SERIALKEYS structure that receives the information. Set the cbSize member of this structure and the uiParam parameter + /// to sizeof(SERIALKEYS). + /// Windows Server 2003, Windows XP/2000/NT: Not supported. The user controls this feature through the control panel. + /// + GetSerialKeys = 0x003E, + + /// + /// Windows Me/98/95: Sets the parameters of the SerialKeys accessibility feature. The pvParam parameter must point + /// to a SERIALKEYS structure that contains the new parameters. Set the cbSize member of this structure and the uiParam parameter + /// to sizeof(SERIALKEYS). + /// Windows Server 2003, Windows XP/2000/NT: Not supported. The user controls this feature through the control panel. + /// + SetSerialKeys = 0x003F, + + /// + /// Retrieves information about the SoundSentry accessibility feature. The pvParam parameter must point to a SOUNDSENTRY structure + /// that receives the information. Set the cbSize member of this structure and the uiParam parameter to sizeof(SOUNDSENTRY). + /// + GetSoundEntry = 0x0040, + + /// + /// Sets the parameters of the SoundSentry accessibility feature. The pvParam parameter must point to a SOUNDSENTRY structure + /// that contains the new parameters. Set the cbSize member of this structure and the uiParam parameter to sizeof(SOUNDSENTRY). + /// + SetSoundEntry = 0x0041, + + //#if(_WIN32_WINNT >= 0x0400) + /// + /// Determines whether the snap-to-default-button feature is enabled. If enabled, the mouse cursor automatically moves + /// to the default button, such as OK or Apply, of a dialog box. The pvParam parameter must point to a BOOL variable + /// that receives TRUE if the feature is on, or FALSE if it is off. + /// Windows 95: Not supported. + /// + GetSnapToDefButton = 0x005F, + + /// + /// Enables or disables the snap-to-default-button feature. If enabled, the mouse cursor automatically moves to the default button, + /// such as OK or Apply, of a dialog box. Set the uiParam parameter to TRUE to enable the feature, or FALSE to disable it. + /// Applications should use the ShowWindow function when displaying a dialog box so the dialog manager can position the mouse cursor. + /// Windows 95: Not supported. + /// + SetSnapToDefButton = 0x0060, + + /// + /// Retrieves the width, in pixels, of the rectangle within which the mouse pointer has to stay for TrackMouseEvent + /// to generate a WM_MOUSEHOVER message. The pvParam parameter must point to a UINT variable that receives the width. + /// Windows 95: Not supported. + /// + GetMouseHoverWidth = 0x0062, + + /// + /// Retrieves the width, in pixels, of the rectangle within which the mouse pointer has to stay for TrackMouseEvent + /// to generate a WM_MOUSEHOVER message. The pvParam parameter must point to a UINT variable that receives the width. + /// Windows 95: Not supported. + /// + SetMouseHoverWidth = 0x0063, + + /// + /// Retrieves the height, in pixels, of the rectangle within which the mouse pointer has to stay for TrackMouseEvent + /// to generate a WM_MOUSEHOVER message. The pvParam parameter must point to a UINT variable that receives the height. + /// Windows 95: Not supported. + /// + GetMouseHoverHeight = 0x0064, + + /// + /// Sets the height, in pixels, of the rectangle within which the mouse pointer has to stay for TrackMouseEvent + /// to generate a WM_MOUSEHOVER message. Set the uiParam parameter to the new height. + /// Windows 95: Not supported. + /// + SetMouseHoverHeight = 0x0065, + + /// + /// Retrieves the time, in milliseconds, that the mouse pointer has to stay in the hover rectangle for TrackMouseEvent + /// to generate a WM_MOUSEHOVER message. The pvParam parameter must point to a UINT variable that receives the time. + /// Windows 95: Not supported. + /// + GetMouseHoverTime = 0x0066, + + /// + /// Sets the time, in milliseconds, that the mouse pointer has to stay in the hover rectangle for TrackMouseEvent + /// to generate a WM_MOUSEHOVER message. This is used only if you pass HOVER_DEFAULT in the dwHoverTime parameter in the call to TrackMouseEvent. Set the uiParam parameter to the new time. + /// Windows 95: Not supported. + /// + SetMouseHoverTime = 0x0067, + + /// + /// Retrieves the number of lines to scroll when the mouse wheel is rotated. The pvParam parameter must point + /// to a UINT variable that receives the number of lines. The default value is 3. + /// Windows 95: Not supported. + /// + GetWheelScrollLines = 0x0068, + + /// + /// Sets the number of lines to scroll when the mouse wheel is rotated. The number of lines is set from the uiParam parameter. + /// The number of lines is the suggested number of lines to scroll when the mouse wheel is rolled without using modifier keys. + /// If the number is 0, then no scrolling should occur. If the number of lines to scroll is greater than the number of lines viewable, + /// and in particular if it is WHEEL_PAGESCROLL (#defined as UINT_MAX), the scroll operation should be interpreted + /// as clicking once in the page down or page up regions of the scroll bar. + /// Windows 95: Not supported. + /// + SetWheelScrollLines = 0x0069, + /// + /// Retrieves the time, in milliseconds, that the system waits before displaying a shortcut menu when the mouse cursor is + /// over a submenu item. The pvParam parameter must point to a DWORD variable that receives the time of the delay. + /// Windows 95: Not supported. + /// + GetMenuShowDelay = 0x006A, + /// + /// Sets uiParam to the time, in milliseconds, that the system waits before displaying a shortcut menu when the mouse cursor is + /// over a submenu item. + /// Windows 95: Not supported. + /// + SetMenuShowDelay = 0x006B, + + /// + /// Determines whether the IME status window is visible (on a per-user basis). The pvParam parameter must point to a BOOL variable + /// that receives TRUE if the status window is visible, or FALSE if it is not. + /// Windows NT, Windows 95: This value is not supported. + /// + GetShowImeUI = 0x006E, + + /// + /// Sets whether the IME status window is visible or not on a per-user basis. The uiParam parameter specifies TRUE for on or FALSE for off. + /// Windows NT, Windows 95: This value is not supported. + /// + SetShowImeUI = 0x006F, + + /// + /// Retrieves the current mouse speed. The mouse speed determines how far the pointer will move based on the distance the mouse moves. + /// The pvParam parameter must point to an integer that receives a value which ranges between 1 (slowest) and 20 (fastest). + /// A value of 10 is the default. The value can be set by an end user using the mouse control panel application or + /// by an application using SPI_SETMOUSESPEED. + /// Windows NT, Windows 95: This value is not supported. + /// + GetMouseSpeed = 0x0070, + + /// + /// Sets the current mouse speed. The pvParam parameter is an integer between 1 (slowest) and 20 (fastest). A value of 10 is the default. + /// This value is typically set using the mouse control panel application. + /// Windows NT, Windows 95: This value is not supported. + /// + SetMouseSpeed = 0x0071, - #region [public] (enum) SystemMetricIndex: Representa una característica o valor de configuración del sistema a recuperar. /// - /// Representa una característica o valor de configuración del sistema a recuperar. - /// Tener en cuenta que todos los valores SM_CX* son anchos y SM_CY* los valores de altura. - /// También tener en cuenta que los ajustes diseñados para devolver datos , el valor true - /// se representa con un valor distinto de cero y false con valor cero. + /// Determines whether a screen saver is currently running on the window station of the calling process. + /// The pvParam parameter must point to a BOOL variable that receives TRUE if a screen saver is currently running, or FALSE otherwise. + /// Note that only the interactive window station, "WinSta0", can have a screen saver running. /// - public enum SystemMetricIndex - { - /// - /// Ancho de la pantalla del monitor de pantalla principal, en píxeles. - /// Este valor es el mismo valor que se obtiene mediante una llamada a GetDeviceCaps como sigue: GetDeviceCaps (hdcPrimaryMonitor, HORZRES). - /// - SM_CXSCREEN = 0, - /// - /// Altura de la pantalla del monitor de pantalla principal, en píxeles. - /// Este valor es el mismo valor que se obtiene mediante una llamada a GetDeviceCaps como sigue: GetDeviceCaps (hdcPrimaryMonitor, VERTRES). - /// - SM_CYSCREEN = 1, - /// - /// Ancho de la barra de desplazamiento vertical, en píxeles. - /// - SM_CXVSCROLL = 2, - /// - /// Altura de una barra de desplazamiento horizontal, en píxeles. - /// - SM_CYHSCROLL = 3, - /// - /// Altura del área de título, en píxeles. - /// - SM_CYCAPTION = 4, - /// - /// Ancho del borde de ventana, en píxeles. Esto es equivalente al valor para windows con la apariencia 3D. - /// - SM_CXBORDER = 5, - /// - /// - /// - SM_CYBORDER = 6, - /// - /// Ver . - /// - SM_CXDLGFRAME = 7, - /// - /// - /// - SM_CYDLGFRAME = 8, - /// - /// - /// - SM_CYVTHUMB = 9, - /// - /// - /// - SM_CXHTHUMB = 10, - /// - /// - /// - SM_CXICON = 11, - /// - /// - /// - SM_CYICON = 12, - /// - /// - /// - SM_CXCURSOR = 13, - /// - /// - /// - SM_CYCURSOR = 14, - /// - /// Altura de una barra de menú de una línea, en píxeles. - /// - SM_CYMENU = 15, - /// - /// - /// - SM_CXFULLSCREEN = 16, - /// - /// - /// - SM_CYFULLSCREEN = 17, - /// - /// - /// - SM_CYKANJIWINDOW = 18, - /// - /// - /// - SM_MOUSEPRESENT = 19, - /// - /// - /// - SM_CYVSCROLL = 20, - /// - /// - /// - SM_CXHSCROLL = 21, - /// - /// - /// - SM_DEBUG = 22, - /// - /// - /// - SM_SWAPBUTTON = 23, - /// - /// - /// - SM_RESERVED1 = 24, - /// - /// - /// - SM_RESERVED2 = 25, - /// - /// - /// - SM_RESERVED3 = 26, - /// - /// - /// - SM_RESERVED4 = 27, - /// - /// Anchura mínima de una ventana, en píxeles. - /// - SM_CXMIN = 28, - /// - /// Altura mínima de una ventana, en píxeles. - /// - SM_CYMIN = 29, - /// - /// Anchura de un botón de una barra o título de ventana, en píxeles. - /// - SM_CXSIZE = 30, - /// - /// Altura de un botón de una barra o título de ventana, en píxeles. - /// - SM_CYSIZE = 31, - /// - /// - /// - SM_CXFRAME = 32, - /// - /// - /// - SM_CYFRAME = 33, - /// - /// - /// - SM_CXMINTRACK = 34, - /// - /// - /// - SM_CYMINTRACK = 35, - /// - /// - /// - SM_CXDOUBLECLK = 36, - /// - /// - /// - SM_CYDOUBLECLK = 37, - /// - /// - /// - SM_CXICONSPACING = 38, - /// - /// - /// - SM_CYICONSPACING = 39, - /// - /// - /// - SM_MENUDROPALIGNMENT = 40, - /// - /// - /// - SM_PENWINDOWS = 41, - /// - /// - /// - SM_DBCSENABLED = 42, - /// - /// Número de botones del ratón , devuelve cero si el ratón no está instalado. - /// - SM_CMOUSEBUTTONS = 43, - - /*#if(WINVER >= 0x0400)*/ - /// - /// - /// - SM_CXFIXEDFRAME = SM_CXDLGFRAME, /* ;win40 name change */ - /// - /// - /// - SM_CYFIXEDFRAME = SM_CYDLGFRAME, /* ;win40 name change */ - /// - /// - /// - SM_CXSIZEFRAME = SM_CXFRAME, /* ;win40 name change */ - /// - /// - /// - SM_CYSIZEFRAME = SM_CYFRAME, /* ;win40 name change */ - - /// - /// - /// - SM_SECURE = 44, - /// - /// - /// - SM_CXEDGE = 45, - /// - /// - /// - SM_CYEDGE = 46, - /// - /// - /// - SM_CXMINSPACING = 47, - /// - /// - /// - SM_CYMINSPACING = 48, - /// - /// - /// - SM_CXSMICON = 49, - /// - /// - /// - SM_CYSMICON = 50, - /// - /// - /// - SM_CYSMCAPTION = 51, - /// - /// - /// - SM_CXSMSIZE = 52, - /// - /// - /// - SM_CYSMSIZE = 53, - /// - /// - /// - SM_CXMENUSIZE = 54, - /// - /// - /// - SM_CYMENUSIZE = 55, - /// - /// - /// - SM_ARRANGE = 56, - /// - /// - /// - SM_CXMINIMIZED = 57, - /// - /// - /// - SM_CYMINIMIZED = 58, - /// - /// - /// - SM_CXMAXTRACK = 59, - /// - /// - /// - SM_CYMAXTRACK = 60, - /// - /// - /// - SM_CXMAXIMIZED = 61, - /// - /// - /// - SM_CYMAXIMIZED = 62, - /// - /// - /// - SM_NETWORK = 63, - /// - /// - /// - SM_CLEANBOOT = 67, - /// - /// - /// - SM_CXDRAG = 68, - /// - /// - /// - SM_CYDRAG = 69, - /*#endif /* WINVER >= 0x0400 */ - /// - /// - /// - SM_SHOWSOUNDS = 70, - /*#if(WINVER >= 0x0400)*/ - /// - /// - /// - SM_CXMENUCHECK = 71, /* Use instead of GetMenuCheckMarkDimensions()! */ - /// - /// - /// - SM_CYMENUCHECK = 72, - /// - /// - /// - SM_SLOWMACHINE = 73, - /// - /// - /// - SM_MIDEASTENABLED = 74, - /*#endif /* WINVER >= 0x0400 */ - - /*#if (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400)*/ - /// - /// - /// - SM_MOUSEWHEELPRESENT = 75, - /*#endif*/ - /*#if(WINVER >= 0x0500)*/ - /// - /// - /// - SM_XVIRTUALSCREEN = 76, - /// - /// - /// - SM_YVIRTUALSCREEN = 77, - /// - /// - /// - SM_CXVIRTUALSCREEN = 78, - /// - /// - /// - SM_CYVIRTUALSCREEN = 79, - /// - /// Número de monitores de pantalla de un ordenador. Para obtener más información, vea la sección Comentarios de este tema. - /// - SM_CMONITORS = 80, - /// - /// - /// - SM_SAMEDISPLAYFORMAT = 81, - /*#endif /* WINVER >= 0x0500 */ - /*#if(_WIN32_WINNT >= 0x0500)*/ - /// - /// - /// - SM_IMMENABLED = 82, - /*#endif /* _WIN32_WINNT >= 0x0500 */ - /*#if(_WIN32_WINNT >= 0x0501)*/ - /// - /// - /// - SM_CXFOCUSBORDER = 83, - /// - /// - /// - SM_CYFOCUSBORDER = 84, - /*#endif /* _WIN32_WINNT >= 0x0501 */ - - /*#if(_WIN32_WINNT >= 0x0501)*/ - /// - /// - /// - SM_TABLETPC = 86, - /// - /// - /// - SM_MEDIACENTER = 87, - /*#endif /* _WIN32_WINNT >= 0x0501 */ - - /*#if (WINVER < 0x0500) && (!defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0400))*/ - /// - /// - /// - SM_CMETRICS_OTHER = 76, - /*#elif WINVER == 0x500*/ - /// - /// - /// - SM_CMETRICS_2000 = 83, - /*#else*/ - /// - /// Un valor distinto de cero indica que el sistema operativo actual es Windows 7 Starter Edition, Windows Vista Starter o Windows XP Starter Edition; caso contrario, 0. - /// - SM_CMETRICS_NT = 88, - /*#endif*/ - - /*#if(WINVER >= 0x0500)*/ - /// - /// - /// - SM_REMOTESESSION = 0x1000, - - /*#if(_WIN32_WINNT >= 0x0501)*/ - /// - /// - /// - SM_SHUTTINGDOWN = 0x2000, - /*#endif /* _WIN32_WINNT >= 0x0501 */ - - /*#if(WINVER >= 0x0501)*/ - /// - /// - /// - SM_REMOTECONTROL = 0x2001, - /*#endif /* WINVER >= 0x0501 */ - - - /*#endif /* WINVER >= 0x0500 */ - } - #endregion - - #region [internal] (enum) SPI: Representa una característica o valor de configuración del sistema a recuperar. - /// - /// Representa una característica o valor de configuración del sistema a recuperar. - /// Tener en cuenta que todos los valores SM_CX* son anchos y SM_CY* los valores de altura. - /// También tener en cuenta que los ajustes diseñados para devolver datos , el valor true - /// se representa con un valor distinto de cero y false con valor cero. - /// SPI_ System-wide parameter - Used in SystemParametersInfo function - /// - [Description("SPI_(System-wide parameter - Used in SystemParametersInfo function )")] - internal enum SPI : uint - { - /// - /// Determines whether the warning beeper is on. - /// The pvParam parameter must point to a BOOL variable that receives TRUE if the beeper is on, or FALSE if it is off. - /// - GetBeep = 0x0001, - /// - /// Turns the warning beeper on or off. The uiParam parameter specifies TRUE for on, or FALSE for off. - /// - SetBeep = 0x0002, - /// - /// Retrieves the two mouse threshold values and the mouse speed. - /// - GetMouse = 0x0003, - /// - /// Establece los valores de umbral y la velocidad del ratón. - /// - SetMouse = 0x0004, - /// - /// Retrieves the border multiplier factor that determines the width of a window's sizing border. - /// The pvParam parameter must point to an integer variable that receives this value. - /// - GetBorder = 0x0005, - /// - /// Sets the border multiplier factor that determines the width of a window's sizing border. - /// The uiParam parameter specifies the new value. - /// - SetBorder = 0x0006, - /// - /// Retrieves the keyboard repeat-speed setting, which is a value in the range from 0 (approximately 2.5 repetitions per second) - /// through 31 (approximately 30 repetitions per second). The actual repeat rates are hardware-dependent and may vary from - /// a linear scale by as much as 20%. The pvParam parameter must point to a DWORD variable that receives the setting - /// - GetKeyboardSpeed = 0x000A, - /// - /// Sets the keyboard repeat-speed setting. The uiParam parameter must specify a value in the range from 0 - /// (approximately 2.5 repetitions per second) through 31 (approximately 30 repetitions per second). - /// The actual repeat rates are hardware-dependent and may vary from a linear scale by as much as 20%. - /// If uiParam is greater than 31, the parameter is set to 31. - /// - SetKeyboardSpeed = 0x000B, - /// - /// Not implemented. - /// - LangDriver = 0x000C, - /// - /// Sets or retrieves the width, in pixels, of an icon cell. The system uses this rectangle to arrange icons in large icon view. - /// To set this value, set uiParam to the new value and set pvParam to null. You cannot set this value to less than SM_CXICON. - /// To retrieve this value, pvParam must point to an integer that receives the current value. - /// - IconhorizontalSpacing = 0x000D, - /// - /// Retrieves the screen saver time-out value, in seconds. The pvParam parameter must point to an integer variable that receives the value. - /// - GetScreenSaveTimeout = 0x000E, - /// - /// Sets the screen saver time-out value to the value of the uiParam parameter. This value is the amount of time, in seconds, - /// that the system must be idle before the screen saver activates. - /// - SetScreenSaveTimeout = 0x000F, - /// - /// Determines whether screen saving is enabled. The pvParam parameter must point to a bool variable that receives TRUE - /// if screen saving is enabled, or FALSE otherwise. - /// - GetScreenSaveActive = 0x0010, - /// - /// Sets the state of the screen saver. The uiParam parameter specifies TRUE to activate screen saving, or FALSE to deactivate it. - /// - SetScreenSaveActive = 0x0011, - /// - /// Retrieves the current granularity value of the desktop sizing grid. The pvParam parameter must point to an integer variable - /// that receives the granularity. - /// - GetGridGranularity = 0x0012, - /// - /// Sets the granularity of the desktop sizing grid to the value of the uiParam parameter. - /// - SetGridGranularity = 0x0013, - /// - /// Sets the desktop wallpaper. The value of the pvParam parameter determines the new wallpaper. To specify a wallpaper bitmap, - /// set pvParam to point to a null-terminated string containing the name of a bitmap file. Setting pvParam to "" removes the wallpaper. - /// Setting pvParam to SETWALLPAPER_DEFAULT or null reverts to the default wallpaper. - /// - SetDeskWallpaper = 0x0014, - /// - /// Sets the current desktop pattern by causing Windows to read the Pattern= setting from the WIN.INI file. - /// - SetDeskPattern = 0x0015, - /// - /// Retrieves the keyboard repeat-delay setting, which is a value in the range from 0 (approximately 250 ms delay) through 3 - /// (approximately 1 second delay). The actual delay associated with each value may vary depending on the hardware. The pvParam parameter must point to an integer variable that receives the setting. - /// - GetKeyboardDelay = 0x0016, - /// - /// Sets the keyboard repeat-delay setting. The uiParam parameter must specify 0, 1, 2, or 3, where zero sets the shortest delay - /// (approximately 250 ms) and 3 sets the longest delay (approximately 1 second). The actual delay associated with each value may - /// vary depending on the hardware. - /// - SetKeyboardDelay = 0x0017, - /// - /// Sets or retrieves the height, in pixels, of an icon cell. - /// To set this value, set uiParam to the new value and set pvParam to null. You cannot set this value to less than SM_CYICON. - /// To retrieve this value, pvParam must point to an integer that receives the current value. - /// - IconVerticalSpacing = 0x0018, - - #region GetIconTitleWrap. Determina si se habilita el ajuste de icono-título. - /// - /// Determina si está habilitada el arrastre completo de las ventanas (ver contenido al arrastrar). - /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true - /// si la caracteristíca está activada ó false en caso contrario. - /// - GetIconTitleWrap = 0x0019, - #endregion - - #region SetIconTitleWrap. Activa o desactiva la característica. Ver GetIconTitleWrap. - /// - /// Activa o desactiva la característica. Ver . - /// - SetIconTitleWrap = 0x001A, - #endregion - - /// - /// Determines whether pop-up menus are left-aligned or right-aligned, relative to the corresponding menu-bar item. - /// The pvParam parameter must point to a bool variable that receives TRUE if left-aligned, or FALSE otherwise. - /// - GetMenuDropAlignment = 0x001B, - /// - /// Sets the alignment value of pop-up menus. The uiParam parameter specifies TRUE for right alignment, or FALSE for left alignment. - /// - SetMenuDropAlignment = 0x001C, - /// - /// Sets the width of the double-click rectangle to the value of the uiParam parameter. - /// The double-click rectangle is the rectangle within which the second click of a double-click must fall for it to be registered - /// as a double-click. - /// To retrieve the width of the double-click rectangle, call GetSystemMetrics with the SM_CXDOUBLECLK flag. - /// - SetDoubleClkWidth = 0x001D, - /// - /// Sets the height of the double-click rectangle to the value of the uiParam parameter. - /// The double-click rectangle is the rectangle within which the second click of a double-click must fall for it to be registered - /// as a double-click. - /// To retrieve the height of the double-click rectangle, call GetSystemMetrics with the SM_CYDOUBLECLK flag. - /// - SetDoubleClkHeight = 0x001E, - /// - /// Retrieves the logical font information for the current icon-title font. The uiParam parameter specifies the size of a LOGFONT structure, - /// and the pvParam parameter must point to the LOGFONT structure to fill in. - /// - GetIconTitleLogFont = 0x001F, - /// - /// Sets the double-click time for the mouse to the value of the uiParam parameter. The double-click time is the maximum number - /// of milliseconds that can occur between the first and second clicks of a double-click. You can also call the SetDoubleClickTime - /// function to set the double-click time. To get the current double-click time, call the GetDoubleClickTime function. - /// - SetDoubleClickTime = 0x0020, - /// - /// Swaps or restores the meaning of the left and right mouse buttons. The uiParam parameter specifies TRUE to swap the meanings - /// of the buttons, or FALSE to restore their original meanings. - /// - SetMouseButtonSwap = 0x0021, - /// - /// Sets the font that is used for icon titles. The uiParam parameter specifies the size of a LOGFONT structure, - /// and the pvParam parameter must point to a LOGFONT structure. - /// - SetIconTitleLogFont = 0x0022, - /// - /// This flag is obsolete. Previous versions of the system use this flag to determine whether ALT+TAB fast task switching is enabled. - /// For Windows 95, Windows 98, and Windows NT version 4.0 and later, fast task switching is always enabled. - /// - GetFastTaskWitch = 0x0023, - /// - /// This flag is obsolete. Previous versions of the system use this flag to enable or disable ALT+TAB fast task switching. - /// For Windows 95, Windows 98, and Windows NT version 4.0 and later, fast task switching is always enabled. - /// - SetFastTaskWitch = 0x0024, - - - //#if(WINVER >= 0x0400) - - #region SetDragFullWindows. Activa o desactiva la característica. Ver GetDragFullWindows. - /// - /// Activa o desactiva la característica. Ver . - /// - SetDragFullWindows = 0x0025, - #endregion - - #region GetDragFullWindows. Determina si está habilitada el arrastre completo de las ventanas (ver contenido al arrastrar). - /// - /// Determina si está habilitada el arrastre completo de las ventanas (ver contenido al arrastrar). - /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true - /// si la caracteristíca está activada ó false en caso contrario. - /// - /// - /// Para Windows 95, está característica sólo está soportada si tiene instalado Windows Plus!. Ver . - /// - GetDragFullWindows = 0x0026, - #endregion - - /// - /// Retrieves the metrics associated with the nonclient area of nonminimized windows. The pvParam parameter must point - /// to a NONCLIENTMETRICS structure that receives the information. Set the cbSize member of this structure and the uiParam parameter - /// to sizeof(NONCLIENTMETRICS). - /// - GetNonClientMetrics = 0x0029, - /// - /// Sets the metrics associated with the nonclient area of nonminimized windows. The pvParam parameter must point - /// to a NONCLIENTMETRICS structure that contains the new parameters. Set the cbSize member of this structure - /// and the uiParam parameter to sizeof(NONCLIENTMETRICS). Also, the lfHeight member of the LOGFONT structure must be a negative value. - /// - SetNonClientMetrics = 0x002A, - /// - /// Retrieves the metrics associated with minimized windows. The pvParam parameter must point to a MINIMIZEDMETRICS structure - /// that receives the information. Set the cbSize member of this structure and the uiParam parameter to sizeof(MINIMIZEDMETRICS). - /// - GetMinimizedMetrics = 0x002B, - /// - /// Sets the metrics associated with minimized windows. The pvParam parameter must point to a MINIMIZEDMETRICS structure - /// that contains the new parameters. Set the cbSize member of this structure and the uiParam parameter to sizeof(MINIMIZEDMETRICS). - /// - SetMinimizedMetrics = 0x002C, - /// - /// Retrieves the metrics associated with icons. The pvParam parameter must point to an ICONMETRICS structure that receives - /// the information. Set the cbSize member of this structure and the uiParam parameter to sizeof(ICONMETRICS). - /// - GetIconMetrics = 0x002D, - /// - /// Sets the metrics associated with icons. The pvParam parameter must point to an ICONMETRICS structure that contains - /// the new parameters. Set the cbSize member of this structure and the uiParam parameter to sizeof(ICONMETRICS). - /// - SetIconMetrics = 0x002E, - /// - /// Sets the size of the work area. The work area is the portion of the screen not obscured by the system taskbar - /// or by application desktop toolbars. The pvParam parameter is a pointer to a RECT structure that specifies the new work area rectangle, - /// expressed in virtual screen coordinates. In a system with multiple display monitors, the function sets the work area - /// of the monitor that contains the specified rectangle. - /// - SetWorkArea = 0x002F, - /// - /// Retrieves the size of the work area on the primary display monitor. The work area is the portion of the screen not obscured - /// by the system taskbar or by application desktop toolbars. The pvParam parameter must point to a RECT structure that receives - /// the coordinates of the work area, expressed in virtual screen coordinates. - /// To get the work area of a monitor other than the primary display monitor, call the GetMonitorInfo function. - /// - GetWorkArea = 0x0030, - /// - /// Windows Me/98/95: Pen windows is being loaded or unloaded. The uiParam parameter is TRUE when loading and FALSE - /// when unloading pen windows. The pvParam parameter is null. - /// - SetPenWindows = 0x0031, - /// - /// Retrieves information about the HighContrast accessibility feature. The pvParam parameter must point to a HIGHCONTRAST structure - /// that receives the information. Set the cbSize member of this structure and the uiParam parameter to sizeof(HIGHCONTRAST). - /// For a general discussion, see remarks. - /// Windows NT: This value is not supported. - /// - /// - /// There is a difference between the High Contrast color scheme and the High Contrast Mode. The High Contrast color scheme changes - /// the system colors to colors that have obvious contrast; you switch to this color scheme by using the Display Options in the control panel. - /// The High Contrast Mode, which uses SPI_GETHIGHCONTRAST and SPI_SETHIGHCONTRAST, advises applications to modify their appearance - /// for visually-impaired users. It involves such things as audible warning to users and customized color scheme - /// (using the Accessibility Options in the control panel). For more information, see HIGHCONTRAST on MSDN. - /// For more information on general accessibility features, see Accessibility on MSDN. - /// - GetHighContrast = 0x0042, - /// - /// Sets the parameters of the HighContrast accessibility feature. The pvParam parameter must point to a HIGHCONTRAST structure - /// that contains the new parameters. Set the cbSize member of this structure and the uiParam parameter to sizeof(HIGHCONTRAST). - /// Windows NT: This value is not supported. - /// - SetHighContrast = 0x0043, - /// - /// Determines whether the user relies on the keyboard instead of the mouse, and wants applications to display keyboard interfaces - /// that would otherwise be hidden. The pvParam parameter must point to a BOOL variable that receives TRUE - /// if the user relies on the keyboard; or FALSE otherwise. - /// Windows NT: This value is not supported. - /// - GetKeyboardPref = 0x0044, - /// - /// Sets the keyboard preference. The uiParam parameter specifies TRUE if the user relies on the keyboard instead of the mouse, - /// and wants applications to display keyboard interfaces that would otherwise be hidden; uiParam is FALSE otherwise. - /// Windows NT: This value is not supported. - /// - SetKeyboardPref = 0x0045, - /// - /// Determines whether a screen reviewer utility is running. A screen reviewer utility directs textual information to an output device, - /// such as a speech synthesizer or Braille display. When this flag is set, an application should provide textual information - /// in situations where it would otherwise present the information graphically. - /// The pvParam parameter is a pointer to a BOOL variable that receives TRUE if a screen reviewer utility is running, or FALSE otherwise. - /// Windows NT: This value is not supported. - /// - GetScreenReader = 0x0046, - /// - /// Determines whether a screen review utility is running. The uiParam parameter specifies TRUE for on, or FALSE for off. - /// Windows NT: This value is not supported. - /// - SetScreenReader = 0x0047, - /// - /// Retrieves the animation effects associated with user actions. The pvParam parameter must point to an ANIMATIONINFO structure - /// that receives the information. Set the cbSize member of this structure and the uiParam parameter to sizeof(ANIMATIONINFO). - /// - GetAnimation = 0x0048, - /// - /// Sets the animation effects associated with user actions. The pvParam parameter must point to an ANIMATIONINFO structure - /// that contains the new parameters. Set the cbSize member of this structure and the uiParam parameter to sizeof(ANIMATIONINFO). - /// - SetAnimation = 0x0049, - - - #region GetFontSmoothing. Determina si está habilitada la función de suavizado de fuentes. - /// - /// Determina si está habilitada la función de suavizado de fuentes. - /// Esta función utiliza el suavizado de fuentes para las curvas de la fuente se dibujan más suaves en diferentes niveles de gris. - /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true - /// si la caracteristíca está activada ó false en caso contrario. - /// - /// - /// Para Windows 95, está característica sólo está soportada si tiene instalado Windows Plus!. Ver . - /// - GetFontSmoothing = 0x004A, - #endregion - - #region SetFontSmoothing. Activa o desactiva la característica. Ver GetFontSmoothing. - /// - /// Activa o desactiva la característica. Ver . - /// - SetFontSmoothing = 0x004B, - #endregion - - /// - /// Sets the width, in pixels, of the rectangle used to detect the start of a drag operation. Set uiParam to the new value. - /// To retrieve the drag width, call GetSystemMetrics with the SM_CXDRAG flag. - /// - SetDragWidth = 0x004C, - /// - /// Sets the height, in pixels, of the rectangle used to detect the start of a drag operation. Set uiParam to the new value. - /// To retrieve the drag height, call GetSystemMetrics with the SM_CYDRAG flag. - /// - SetDragHeight = 0x004D, - /// - /// Used internally; applications should not use this value. - /// - SetHandled = 0x004E, - /// - /// Retrieves the time-out value for the low-power phase of screen saving. The pvParam parameter must point to an integer variable - /// that receives the value. This flag is supported for 32-bit applications only. - /// Windows NT, Windows Me/98: This flag is supported for 16-bit and 32-bit applications. - /// Windows 95: This flag is supported for 16-bit applications only. - /// - GetLowPowerTimeout = 0x004F, - /// - /// Retrieves the time-out value for the power-off phase of screen saving. The pvParam parameter must point to an integer variable - /// that receives the value. This flag is supported for 32-bit applications only. - /// Windows NT, Windows Me/98: This flag is supported for 16-bit and 32-bit applications. - /// Windows 95: This flag is supported for 16-bit applications only. - /// - GetPowerOffTimeout = 0x0050, - /// - /// Sets the time-out value, in seconds, for the low-power phase of screen saving. The uiParam parameter specifies the new value. - /// The pvParam parameter must be null. This flag is supported for 32-bit applications only. - /// Windows NT, Windows Me/98: This flag is supported for 16-bit and 32-bit applications. - /// Windows 95: This flag is supported for 16-bit applications only. - /// - SetLowPowerTimeout = 0x0051, - /// - /// Sets the time-out value, in seconds, for the power-off phase of screen saving. The uiParam parameter specifies the new value. - /// The pvParam parameter must be null. This flag is supported for 32-bit applications only. - /// Windows NT, Windows Me/98: This flag is supported for 16-bit and 32-bit applications. - /// Windows 95: This flag is supported for 16-bit applications only. - /// - SetPowerOffTimeout = 0x0052, - /// - /// Determines whether the low-power phase of screen saving is enabled. The pvParam parameter must point to a BOOL variable - /// that receives TRUE if enabled, or FALSE if disabled. This flag is supported for 32-bit applications only. - /// Windows NT, Windows Me/98: This flag is supported for 16-bit and 32-bit applications. - /// Windows 95: This flag is supported for 16-bit applications only. - /// - GetLowPowerActive = 0x0053, - /// - /// Determines whether the power-off phase of screen saving is enabled. The pvParam parameter must point to a BOOL variable - /// that receives TRUE if enabled, or FALSE if disabled. This flag is supported for 32-bit applications only. - /// Windows NT, Windows Me/98: This flag is supported for 16-bit and 32-bit applications. - /// Windows 95: This flag is supported for 16-bit applications only. - /// - GetPowerOffActive = 0x0054, - /// - /// Activates or deactivates the low-power phase of screen saving. Set uiParam to 1 to activate, or zero to deactivate. - /// The pvParam parameter must be null. This flag is supported for 32-bit applications only. - /// Windows NT, Windows Me/98: This flag is supported for 16-bit and 32-bit applications. - /// Windows 95: This flag is supported for 16-bit applications only. - /// - SetLowPowerActive = 0x0055, - /// - /// Activates or deactivates the power-off phase of screen saving. Set uiParam to 1 to activate, or zero to deactivate. - /// The pvParam parameter must be null. This flag is supported for 32-bit applications only. - /// Windows NT, Windows Me/98: This flag is supported for 16-bit and 32-bit applications. - /// Windows 95: This flag is supported for 16-bit applications only. - /// - SetPowerOfActive = 0x0056, - /// - /// Reloads the system cursors. Set the uiParam parameter to zero and the pvParam parameter to null. - /// - SetCursors = 0x0057, - /// - /// Reloads the system icons. Set the uiParam parameter to zero and the pvParam parameter to null. - /// - SetIcons = 0x0058, - /// - /// Retrieves the input locale identifier for the system default input language. The pvParam parameter must point - /// to an HKL variable that receives this value. For more information, see Languages, Locales, and Keyboard Layouts on MSDN. - /// - GetDefaultInputLang = 0x0059, - /// - /// Sets the default input language for the system shell and applications. The specified language must be displayable - /// using the current system character set. The pvParam parameter must point to an HKL variable that contains - /// the input locale identifier for the default language. For more information, see Languages, Locales, and Keyboard Layouts on MSDN. - /// - SetDefaultInputLang = 0x005A, - /// - /// Sets the hot key set for switching between input languages. The uiParam and pvParam parameters are not used. - /// The value sets the shortcut keys in the keyboard property sheets by reading the registry again. The registry must be set before this flag is used. the path in the registry is \HKEY_CURRENT_USER\keyboard layout\toggle. Valid values are "1" = ALT+SHIFT, "2" = CTRL+SHIFT, and "3" = none. - /// - SetLangToggle = 0x005B, - /// - /// Windows 95: Determines whether the Windows extension, Windows Plus!, is installed. Set the uiParam parameter to 1. - /// The pvParam parameter is not used. The function returns TRUE if the extension is installed, or FALSE if it is not. - /// - GetWindowsExtension = 0x005C, - /// - /// Enables or disables the Mouse Trails feature, which improves the visibility of mouse cursor movements by briefly showing - /// a trail of cursors and quickly erasing them. - /// To disable the feature, set the uiParam parameter to zero or 1. To enable the feature, set uiParam to a value greater than 1 - /// to indicate the number of cursors drawn in the trail. - /// Windows 2000/NT: This value is not supported. - /// - SetMouseTrails = 0x005D, - /// - /// Determines whether the Mouse Trails feature is enabled. This feature improves the visibility of mouse cursor movements - /// by briefly showing a trail of cursors and quickly erasing them. - /// The pvParam parameter must point to an integer variable that receives a value. If the value is zero or 1, the feature is disabled. - /// If the value is greater than 1, the feature is enabled and the value indicates the number of cursors drawn in the trail. - /// The uiParam parameter is not used. - /// Windows 2000/NT: This value is not supported. - /// - GetMouseTrails = 0x005E, - /// - /// Windows Me/98: Used internally; applications should not use this flag. - /// - SetScreenSaverRunning = 0x0061, - /// - /// Same as SPI_SETSCREENSAVERRUNNING. - /// - ScreenSaverRunning = SetScreenSaverRunning, - //#endif /* WINVER >= 0x0400 */ - - /// - /// Retrieves information about the FilterKeys accessibility feature. The pvParam parameter must point to a FILTERKEYS structure - /// that receives the information. Set the cbSize member of this structure and the uiParam parameter to sizeof(FILTERKEYS). - /// - GetFilterKeys = 0x0032, - /// - /// Sets the parameters of the FilterKeys accessibility feature. The pvParam parameter must point to a FILTERKEYS structure - /// that contains the new parameters. Set the cbSize member of this structure and the uiParam parameter to sizeof(FILTERKEYS). - /// - SetFilterKeys = 0x0033, - /// - /// Retrieves information about the ToggleKeys accessibility feature. The pvParam parameter must point to a TOGGLEKEYS structure - /// that receives the information. Set the cbSize member of this structure and the uiParam parameter to sizeof(TOGGLEKEYS). - /// - GetToggleKeys = 0x0034, - /// - /// Sets the parameters of the ToggleKeys accessibility feature. The pvParam parameter must point to a TOGGLEKEYS structure - /// that contains the new parameters. Set the cbSize member of this structure and the uiParam parameter to sizeof(TOGGLEKEYS). - /// - SetToggleKeys = 0x0035, - /// - /// Retrieves information about the MouseKeys accessibility feature. The pvParam parameter must point to a MOUSEKEYS structure - /// that receives the information. Set the cbSize member of this structure and the uiParam parameter to sizeof(MOUSEKEYS). - /// - GetMouseKeys = 0x0036, - /// - /// Sets the parameters of the MouseKeys accessibility feature. The pvParam parameter must point to a MOUSEKEYS structure - /// that contains the new parameters. Set the cbSize member of this structure and the uiParam parameter to sizeof(MOUSEKEYS). - /// - SetMouseKeys = 0x0037, - - #region GetShowSounds. Determina si la opción sonido de la característica de accesibilidad esta activado los eventos se muestran de forma audible. - /// - /// Determina si la opción sonido de la característica de accesibilidad esta activado los eventos se muestran de forma audible. - /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true - /// si la caracteristíca está activada ó false en caso contrario. - /// - GetShowSounds = 0x0038, - #endregion - - #region SetShowSounds. Activa o desactiva la característica. Ver GetShowSounds. - /// - /// Activa o desactiva la característica. Ver . - /// - SetShowSounds = 0x0039, - #endregion - - /// - /// Retrieves information about the StickyKeys accessibility feature. The pvParam parameter must point to a STICKYKEYS structure - /// that receives the information. Set the cbSize member of this structure and the uiParam parameter to sizeof(STICKYKEYS). - /// - GetStickyKeys = 0x003A, - /// - /// Sets the parameters of the StickyKeys accessibility feature. The pvParam parameter must point to a STICKYKEYS structure - /// that contains the new parameters. Set the cbSize member of this structure and the uiParam parameter to sizeof(STICKYKEYS). - /// - SetStickyKeys = 0x003B, - /// - /// Retrieves information about the time-out period associated with the accessibility features. The pvParam parameter must point - /// to an ACCESSTIMEOUT structure that receives the information. Set the cbSize member of this structure and the uiParam parameter - /// to sizeof(ACCESSTIMEOUT). - /// - GetAccessTimeout = 0x003C, - /// - /// Sets the time-out period associated with the accessibility features. The pvParam parameter must point to an ACCESSTIMEOUT - /// structure that contains the new parameters. Set the cbSize member of this structure and the uiParam parameter to sizeof(ACCESSTIMEOUT). - /// - SetAccessTimeout = 0x003D, - - //#if(WINVER >= 0x0400) - /// - /// Windows Me/98/95: Retrieves information about the SerialKeys accessibility feature. The pvParam parameter must point - /// to a SERIALKEYS structure that receives the information. Set the cbSize member of this structure and the uiParam parameter - /// to sizeof(SERIALKEYS). - /// Windows Server 2003, Windows XP/2000/NT: Not supported. The user controls this feature through the control panel. - /// - GetSerialKeys = 0x003E, - /// - /// Windows Me/98/95: Sets the parameters of the SerialKeys accessibility feature. The pvParam parameter must point - /// to a SERIALKEYS structure that contains the new parameters. Set the cbSize member of this structure and the uiParam parameter - /// to sizeof(SERIALKEYS). - /// Windows Server 2003, Windows XP/2000/NT: Not supported. The user controls this feature through the control panel. - /// - SetSerialKeys = 0x003F, - //#endif /* WINVER >= 0x0400 */ - - /// - /// Retrieves information about the SoundSentry accessibility feature. The pvParam parameter must point to a SOUNDSENTRY structure - /// that receives the information. Set the cbSize member of this structure and the uiParam parameter to sizeof(SOUNDSENTRY). - /// - GetSoundEntry = 0x0040, - /// - /// Sets the parameters of the SoundSentry accessibility feature. The pvParam parameter must point to a SOUNDSENTRY structure - /// that contains the new parameters. Set the cbSize member of this structure and the uiParam parameter to sizeof(SOUNDSENTRY). - /// - SetSoundEntry = 0x0041, - - //#if(_WIN32_WINNT >= 0x0400) - /// - /// Determines whether the snap-to-default-button feature is enabled. If enabled, the mouse cursor automatically moves - /// to the default button, such as OK or Apply, of a dialog box. The pvParam parameter must point to a BOOL variable - /// that receives TRUE if the feature is on, or FALSE if it is off. - /// Windows 95: Not supported. - /// - GetSnapToDefButton = 0x005F, - /// - /// Enables or disables the snap-to-default-button feature. If enabled, the mouse cursor automatically moves to the default button, - /// such as OK or Apply, of a dialog box. Set the uiParam parameter to TRUE to enable the feature, or FALSE to disable it. - /// Applications should use the ShowWindow function when displaying a dialog box so the dialog manager can position the mouse cursor. - /// Windows 95: Not supported. - /// - SetSnapToDefButton = 0x0060, - //#endif /* _WIN32_WINNT >= 0x0400 */ - - //#if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400) - /// - /// Retrieves the width, in pixels, of the rectangle within which the mouse pointer has to stay for TrackMouseEvent - /// to generate a WM_MOUSEHOVER message. The pvParam parameter must point to a UINT variable that receives the width. - /// Windows 95: Not supported. - /// - GetMouseHoverWidth = 0x0062, - /// - /// Retrieves the width, in pixels, of the rectangle within which the mouse pointer has to stay for TrackMouseEvent - /// to generate a WM_MOUSEHOVER message. The pvParam parameter must point to a UINT variable that receives the width. - /// Windows 95: Not supported. - /// - SetMouseHoverWidth = 0x0063, - /// - /// Retrieves the height, in pixels, of the rectangle within which the mouse pointer has to stay for TrackMouseEvent - /// to generate a WM_MOUSEHOVER message. The pvParam parameter must point to a UINT variable that receives the height. - /// Windows 95: Not supported. - /// - GetMouseHoverHeight = 0x0064, - /// - /// Sets the height, in pixels, of the rectangle within which the mouse pointer has to stay for TrackMouseEvent - /// to generate a WM_MOUSEHOVER message. Set the uiParam parameter to the new height. - /// Windows 95: Not supported. - /// - SetMouseHoverHeight = 0x0065, - /// - /// Retrieves the time, in milliseconds, that the mouse pointer has to stay in the hover rectangle for TrackMouseEvent - /// to generate a WM_MOUSEHOVER message. The pvParam parameter must point to a UINT variable that receives the time. - /// Windows 95: Not supported. - /// - GetMouseHoverTime = 0x0066, - /// - /// Sets the time, in milliseconds, that the mouse pointer has to stay in the hover rectangle for TrackMouseEvent - /// to generate a WM_MOUSEHOVER message. This is used only if you pass HOVER_DEFAULT in the dwHoverTime parameter in the call to TrackMouseEvent. Set the uiParam parameter to the new time. - /// Windows 95: Not supported. - /// - SetMouseHoverTime = 0x0067, - /// - /// Retrieves the number of lines to scroll when the mouse wheel is rotated. The pvParam parameter must point - /// to a UINT variable that receives the number of lines. The default value is 3. - /// Windows 95: Not supported. - /// - GetWheelScrollLines = 0x0068, - /// - /// Sets the number of lines to scroll when the mouse wheel is rotated. The number of lines is set from the uiParam parameter. - /// The number of lines is the suggested number of lines to scroll when the mouse wheel is rolled without using modifier keys. - /// If the number is 0, then no scrolling should occur. If the number of lines to scroll is greater than the number of lines viewable, - /// and in particular if it is WHEEL_PAGESCROLL (#defined as UINT_MAX), the scroll operation should be interpreted - /// as clicking once in the page down or page up regions of the scroll bar. - /// Windows 95: Not supported. - /// - SetWheelScrollLines = 0x0069, - /// - /// Retrieves the time, in milliseconds, that the system waits before displaying a shortcut menu when the mouse cursor is - /// over a submenu item. The pvParam parameter must point to a DWORD variable that receives the time of the delay. - /// Windows 95: Not supported. - /// - GetMenuShowDelay = 0x006A, - /// - /// Sets uiParam to the time, in milliseconds, that the system waits before displaying a shortcut menu when the mouse cursor is - /// over a submenu item. - /// Windows 95: Not supported. - /// - SetMenuShowDelay = 0x006B, - /// - /// Determines whether the IME status window is visible (on a per-user basis). The pvParam parameter must point to a BOOL variable - /// that receives TRUE if the status window is visible, or FALSE if it is not. - /// Windows NT, Windows 95: This value is not supported. - /// - GetShowImeUI = 0x006E, - /// - /// Sets whether the IME status window is visible or not on a per-user basis. The uiParam parameter specifies TRUE for on or FALSE for off. - /// Windows NT, Windows 95: This value is not supported. - /// - SetShowImeUI = 0x006F, - //#endif - - //#if(WINVER >= 0x0500) - /// - /// Retrieves the current mouse speed. The mouse speed determines how far the pointer will move based on the distance the mouse moves. - /// The pvParam parameter must point to an integer that receives a value which ranges between 1 (slowest) and 20 (fastest). - /// A value of 10 is the default. The value can be set by an end user using the mouse control panel application or - /// by an application using SPI_SETMOUSESPEED. - /// Windows NT, Windows 95: This value is not supported. - /// - GetMouseSpeed = 0x0070, - /// - /// Sets the current mouse speed. The pvParam parameter is an integer between 1 (slowest) and 20 (fastest). A value of 10 is the default. - /// This value is typically set using the mouse control panel application. - /// Windows NT, Windows 95: This value is not supported. - /// - SetMouseSpeed = 0x0071, - /// - /// Determines whether a screen saver is currently running on the window station of the calling process. - /// The pvParam parameter must point to a BOOL variable that receives TRUE if a screen saver is currently running, or FALSE otherwise. - /// Note that only the interactive window station, "WinSta0", can have a screen saver running. - /// - /// - /// Está opción no está soportada por Windows NT, Windows Me/98/95. - /// - GetScreenSaverRunning = 0x0072, - /// - /// Recupera la ruta de acceso completa del archivo de mapa de bits para el fondo de escritorio. - /// El parámetro pvParam debe apuntar a un búfer para recibir la cadena de ruta terminada en null. - /// Establezca el parámetro uiParam con el tamaño, en carácteres del buffer de pvParam. - /// La cadena devuelta no podrá superar la longitud MAX_PATH. - /// Si no hay ningún tapiz, se devolverá una cadena vacía. - /// - /// - /// Está opción no está soportada por Windows NT, Windows Me/98/95. - /// - GetDeskWallPaper = 0x0073, - //#endif /* WINVER >= 0x0500 */ - - //#if(WINVER >= 0x0500) - /// - /// Determines whether active window tracking (activating the window the mouse is on) is on or off. The pvParam parameter must point - /// to a BOOL variable that receives TRUE for on, or FALSE for off. - /// Windows NT, Windows 95: This value is not supported. - /// - GetActiveWindowTracking = 0x1000, - /// - /// Sets active window tracking (activating the window the mouse is on) either on or off. Set pvParam to TRUE for on or FALSE for off. - /// Windows NT, Windows 95: This value is not supported. - /// - SetActiveWindowTracking = 0x1001, - - #region GetMenuAnimation. Determina si está habilitada la característica de animación de menú. - /// - /// Determina si está habilitada la característica de animación de menú. - /// Sí la característica está activada indica si los menús usan atenuación o animación. - /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true - /// si la caracteristíca está activada ó false en caso contrario. - /// - GetMenuAnimation = 0x1002, - #endregion - - #region SetMenuAnimation. Activa o desactiva la característica. Ver GetMenuAnimation. - /// - /// Activa o desactiva la característica. Ver . - /// - SetMenuAnimation = 0x1003, - #endregion - - #region GetComboboxAnimation. Determina si está habilitado el efecto de apertura para los cuadros combinados. - /// - /// Determina si está habilitado el efecto de apertura para los cuadros combinados. - /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true - /// para indicar que está activado o false si está desactivado. - /// - /// - /// Está característica no está soportada por Windows NT, Windows 95. - /// - GetComboboxAnimation = 0x1004, - #endregion - - #region SetComboboxAnimation. Activa o desactiva la característica. Ver GetComboboxAnimation. - /// - /// Activa o desactiva la característica. Ver . - /// - SetComboboxAnimation = 0x1005, - #endregion - - #region GetListBoxSmoothScrolling. Determina si está habilitado el efecto de desplazamiento suave para cuadros de lista. - /// - /// Determina si está habilitado el efecto de desplazamiento suave para cuadros de lista. - /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true - /// si la caracteristíca está activada ó false en caso contrario. - /// - /// - /// Está característica no está soportada por Windows 95. - /// - GetListBoxSmoothScrolling = 0x1006, - #endregion - - #region SetListBoxSmoothScrolling. Activa o desactiva la característica. Ver GetListBoxSmoothScrolling. - /// - /// Activa o desactiva la característica. Ver . - /// - SetListBoxSmoothScrolling = 0x1007, - #endregion - - /// - /// Determines whether the gradient effect for window title bars is enabled. The pvParam parameter must point to a BOOL variable - /// that receives TRUE for enabled, or FALSE for disabled. For more information about the gradient effect, see the GetSysColor function. - /// Windows NT, Windows 95: This value is not supported. - /// - GetGradientCaptions = 0x1008, - /// - /// Enables or disables the gradient effect for window title bars. Set the pvParam parameter to TRUE to enable it, or FALSE to disable it. - /// The gradient effect is possible only if the system has a color depth of more than 256 colors. For more information about - /// the gradient effect, see the GetSysColor function. - /// Windows NT, Windows 95: This value is not supported. - /// - SetGradientCaptions = 0x1009, - /// - /// Determines whether menu access keys are always underlined. The pvParam parameter must point to a BOOL variable that receives TRUE - /// if menu access keys are always underlined, and FALSE if they are underlined only when the menu is activated by the keyboard. - /// Windows NT, Windows 95: This value is not supported. - /// - GetKeyboardCues = 0x100A, - /// - /// Sets the underlining of menu access key letters. The pvParam parameter is a BOOL variable. Set pvParam to TRUE to always underline menu - /// access keys, or FALSE to underline menu access keys only when the menu is activated from the keyboard. - /// Windows NT, Windows 95: This value is not supported. - /// - SetKeyboardCues = 0x100B, - /// - /// Same as SPI_GETKEYBOARDCUES. - /// - GetMenuUnderlines = GetKeyboardCues, - /// - /// Same as SPI_SETKEYBOARDCUES. - /// - SetMenuUnderlines = SetKeyboardCues, - /// - /// Determines whether windows activated through active window tracking will be brought to the top. The pvParam parameter must point - /// to a BOOL variable that receives TRUE for on, or FALSE for off. - /// Windows NT, Windows 95: This value is not supported. - /// - GetActiveWndTrkZorder = 0x100C, - /// - /// Determines whether or not windows activated through active window tracking should be brought to the top. Set pvParam to TRUE - /// for on or FALSE for off. - /// Windows NT, Windows 95: This value is not supported. - /// - SetActiveWndTrkZorder = 0x100D, - - #region GetHotTracking. Determina si está habilitado el seguimiento activo de los elementos de la interfaz de usuario, como barras de menús, los nombres de menú. - /// - /// Determina si está habilitado el seguimiento activo de los elementos de la interfaz de usuario, como barras de menús, los nombres de menú. - /// Seguimiento activo significa que cuando el cursor se mueve sobre un elemento, este se dibuja con relieve pero no está seleccionado. - /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true - /// si la caracteristíca está activada ó false en caso contrario. - /// - /// - /// Está característica no está soportada por Windows NT, Windows 95. - /// - GetHotTracking = 0x100E, - #endregion - - #region SetHotTracking. Activa o desactiva la característica. Ver GetHotTracking. - /// - /// Activa o desactiva la característica. Ver . - /// - SetHotTracking = 0x100F, - #endregion - - #region GetMenuFade. Determina si está habilitada la animación del cierre de menú. - /// - /// Determina si está habilitada la animación del cierre de menú. - /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true - /// si la caracteristíca está activada ó false en caso contrario. - /// - /// - /// Está característica no está soportada por Windows NT, Windows Me/98/95. - /// - GetMenuFade = 0x1012, - #endregion - - #region SetMenuFade. Activa o desactiva la característica. Ver GetMenuFade. - /// - /// Activa o desactiva la característica. Ver . - /// - SetMenuFade = 0x1013, - #endregion - - #region GetSelectionFade. Determina si está habilitado el efecto de desvanecimiento de la selección. - /// - /// Determina si está habilitado el efecto de desvanecimiento de la selección. - /// El efecto de desvanecimiento de la selección hace que el elemento de menú seleccionado por el usuario permanezca en la pantalla brevemente mientras desaparece lentamente. - /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true - /// si la caracteristíca está activada ó false en caso contrario. - /// - /// - /// Está característica no está soportada por Windows NT, Windows Me/98/95. - /// - GetSelectionFade = 0x1014, - #endregion - - #region SetSelectionFade. Activa o desactiva la característica. Ver GetSelectionFade. - /// - /// Activa o desactiva la característica. Ver . - /// - SetSelectionFade = 0x1015, - #endregion - - #region GetTooltipAnimation. Determina si está habilitada la animación de los globos de ayuda sobre herramientas. - /// - /// Determina si está habilitada la animación de los globos de ayuda sobre herramientas. - /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true - /// si la caracteristíca está activada ó false en caso contrario. - /// - /// - /// Está característica no está soportada por Windows NT, Windows Me/98/95. - /// - GetTooltipAnimation = 0x1016, - #endregion - - #region SetTooltipAnimation. Activa o desactiva la característica. Ver GetTooltipAnimation. - /// - /// Activa o desactiva la característica. Ver . - /// - SetTooltipAnimation = 0x1017, - #endregion - - #region GetTooltipFade. Si está habilitada la SetTooltipAnimation, GetTooltipFade indica si los globos de ayuda utilizan un efecto de transición o no. - /// - /// Si está habilitada la , GetTooltipFade indica si los globos de ayuda utilizan un efecto de transición o no. - /// El efecto de desvanecimiento de la selección hace que el elemento de menú seleccionado por el usuario permanezca en la pantalla brevemente mientras desaparece lentamente. - /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true - /// si la caracteristíca está activada ó false en caso contrario. - /// - /// - /// Está característica no está soportada por Windows NT, Windows Me/98/95. - /// - GetTooltipFade = 0x1018, - #endregion - - #region SetTooltipFade. Activa o desactiva la característica. Ver GetTooltipFade. - /// - /// Activa o desactiva la característica. Ver . - /// - SetTooltipFade = 0x1019, - #endregion - - #region GetCursorShadow. Determina si el cursor del ratón tiene una sombra alrededor. - /// - /// Determina si el cursor del ratón tiene una sombra alrededor. - /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true - /// si la sombra del cursor está activada ó false si está deshabilitado. - /// - /// - /// El efecto sólo es apreciable en sistemas que tengan como mínimo 256 colores de profundidad de color. - /// Está característica no está soportada por Windows NT, Windows Me/98/95. - /// - GetCursorShadow = 0x101A, - #endregion - - #region SetCursorShadow. Activa o desactiva la característica. Ver GetCursorShadow. - /// - /// Activa o desactiva la característica. Ver . - /// - SetCursorShadow = 0x101B, - #endregion - - /// - /// Retrieves the state of the Mouse Sonar feature. The pvParam parameter must point to a BOOL variable that receives TRUE - /// if enabled or FALSE otherwise. For more information, see About Mouse Input on MSDN. - /// Windows 2000/NT, Windows 98/95: This value is not supported. - /// - GetMouseSonar = 0x101C, - /// - /// Turns the Sonar accessibility feature on or off. This feature briefly shows several concentric circles around the mouse pointer - /// when the user presses and releases the CTRL key. The pvParam parameter specifies TRUE for on and FALSE for off. The default is off. - /// For more information, see About Mouse Input. - /// Windows 2000/NT, Windows 98/95: This value is not supported. - /// - SetMouseSonar = 0x101D, - /// - /// Retrieves the state of the Mouse ClickLock feature. The pvParam parameter must point to a BOOL variable that receives TRUE - /// if enabled, or FALSE otherwise. For more information, see About Mouse Input. - /// Windows 2000/NT, Windows 98/95: This value is not supported. - /// - GetMouseClickLock = 0x101E, - /// - /// Turns the Mouse ClickLock accessibility feature on or off. This feature temporarily locks down the primary mouse button - /// when that button is clicked and held down for the time specified by SPI_SETMOUSECLICKLOCKTIME. The uiParam parameter specifies - /// TRUE for on, - /// or FALSE for off. The default is off. For more information, see Remarks and About Mouse Input on MSDN. - /// Windows 2000/NT, Windows 98/95: This value is not supported. - /// - SetMouseClickLock = 0x101F, - /// - /// Retrieves the state of the Mouse Vanish feature. The pvParam parameter must point to a BOOL variable that receives TRUE - /// if enabled or FALSE otherwise. For more information, see About Mouse Input on MSDN. - /// Windows 2000/NT, Windows 98/95: This value is not supported. - /// - GetMouseVanish = 0x1020, - /// - /// Turns the Vanish feature on or off. This feature hides the mouse pointer when the user types; the pointer reappears - /// when the user moves the mouse. The pvParam parameter specifies TRUE for on and FALSE for off. The default is off. - /// For more information, see About Mouse Input on MSDN. - /// Windows 2000/NT, Windows 98/95: This value is not supported. - /// - SetMouseVanish = 0x1021, - - #region GetFlatMenu. Determina si los menús de usuario nativos tienen apariencia de menú plano. - /// - /// Determina si los menús de usuario nativos tienen apariencia de menú plano. - /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true - /// si se establece la apariencia;false en caso contrario. - /// - /// - /// Está característica no está soportada por Windows 2000. - /// - GetFlatMenu = 0x1022, - #endregion - - #region SetFlatMenu. Activa o desactiva la característica. Ver GetFlatMenu. - /// - /// Activa o desactiva la característica. Ver . - /// - SetFlatMenu = 0x1023, - #endregion - - #region GetDropShadow. Determina si está habilitado el efecto de sombra paralela. - /// - /// Determina si está habilitado el efecto de sombra paralela. - /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true - /// si está habilitada;false si está deshabilitado. - /// - /// - /// Está característica no está soportada por Windows 2000/NT, Windows Me/98/95. - /// - GetDropShadow = 0x1024, - #endregion - - #region SetDropShadow. Activa o desactiva la característica. Ver GetDropShadow. - /// - /// Activa o desactiva la característica. Ver . - /// - SetDropShadow = 0x1025, - #endregion - - /// - /// Retrieves a BOOL indicating whether an application can reset the screensaver's timer by calling the SendInput function - /// to simulate keyboard or mouse input. The pvParam parameter must point to a BOOL variable that receives TRUE - /// if the simulated input will be blocked, or FALSE otherwise. - /// - GetBlockSendInputResets = 0x1026, - /// - /// Determines whether an application can reset the screensaver's timer by calling the SendInput function to simulate keyboard - /// or mouse input. The uiParam parameter specifies TRUE if the screensaver will not be deactivated by simulated input, - /// or FALSE if the screensaver will be deactivated by simulated input. - /// - SetBlockSendInputResets = 0x1027, - - #region GetClearType. Determina si está habilitada la característica. - /// - /// Determina si está habilitada la característica. - /// ClearType es una tecnología de software que mejora la legibilidad del texto en monitores con pantalla de cristal líquido (LCD). - /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true - /// si está habilitada;false si está deshabilitado. - /// - /// - /// Está característica no está soportada por Windows Server 2003 y Windows XP/2000 - /// - GetClearType = 0x1048, - #endregion - - #region SetClearType. Activa o desactiva la característica. Ver GetClearType. - /// - /// Activa o desactiva la característica. Ver . - /// - SetClearType = 0x1049, - #endregion - - #region GetUiEffects. Determina si todos los efectos de la interfaz de usuario están habilitados o desactivados. - /// - /// Determina si todos los efectos de la interfaz de usuario están habilitados o desactivados. - /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true - /// si está habilitada;false si está deshabilitado. - /// - GetUiEffects = 0x103E, - #endregion - - #region SetUiEffects. Activa o desactiva la característica. Ver GetUiEffects. - /// - /// Activa o desactiva la característica. Ver . - /// - SetUiEffects = 0x103F, - #endregion - - - /// - /// Retrieves the amount of time following user input, in milliseconds, during which the system will not allow applications - /// to force themselves into the foreground. The pvParam parameter must point to a DWORD variable that receives the time. - /// Windows NT, Windows 95: This value is not supported. - /// - GetForegroundLockTimeout = 0x2000, - /// - /// Sets the amount of time following user input, in milliseconds, during which the system does not allow applications - /// to force themselves into the foreground. Set pvParam to the new timeout value. - /// The calling thread must be able to change the foreground window, otherwise the call fails. - /// Windows NT, Windows 95: This value is not supported. - /// - SetForegroundLockTimeout = 0x2001, - /// - /// Retrieves the active window tracking delay, in milliseconds. The pvParam parameter must point to a DWORD variable - /// that receives the time. - /// Windows NT, Windows 95: This value is not supported. - /// - GetActiveWndTrkTimeout = 0x2002, - /// - /// Sets the active window tracking delay. Set pvParam to the number of milliseconds to delay before activating the window - /// under the mouse pointer. - /// Windows NT, Windows 95: This value is not supported. - /// - SetActiveWndTrkTimeout = 0x2003, - /// - /// Retrieves the number of times SetForegroundWindow will flash the taskbar button when rejecting a foreground switch request. - /// The pvParam parameter must point to a DWORD variable that receives the value. - /// Windows NT, Windows 95: This value is not supported. - /// - GetForegroundFlashCount = 0x2004, - /// - /// Sets the number of times SetForegroundWindow will flash the taskbar button when rejecting a foreground switch request. - /// Set pvParam to the number of times to flash. - /// Windows NT, Windows 95: This value is not supported. - /// - SetForegroundFlashCount = 0x2005, - /// - /// Retrieves the caret width in edit controls, in pixels. The pvParam parameter must point to a DWORD that receives this value. - /// Windows NT, Windows Me/98/95: This value is not supported. - /// - GetCaretWidth = 0x2006, - /// - /// Sets the caret width in edit controls. Set pvParam to the desired width, in pixels. The default and minimum value is 1. - /// Windows NT, Windows Me/98/95: This value is not supported. - /// - SetCaretWidth = 0x2007, - - //#if(_WIN32_WINNT >= 0x0501) - /// - /// Retrieves the time delay before the primary mouse button is locked. The pvParam parameter must point to DWORD that receives - /// the time delay. This is only enabled if SPI_SETMOUSECLICKLOCK is set to TRUE. For more information, see About Mouse Input on MSDN. - /// Windows 2000/NT, Windows 98/95: This value is not supported. - /// - GetMouseClickLockTime = 0x2008, - /// - /// Turns the Mouse ClickLock accessibility feature on or off. This feature temporarily locks down the primary mouse button - /// when that button is clicked and held down for the time specified by SPI_SETMOUSECLICKLOCKTIME. The uiParam parameter - /// specifies TRUE for on, or FALSE for off. The default is off. For more information, see Remarks and About Mouse Input on MSDN. - /// Windows 2000/NT, Windows 98/95: This value is not supported. - /// - SetMouseClickLockTime = 0x2009, - /// - /// Retrieves the type of font smoothing. The pvParam parameter must point to a UINT that receives the information. - /// Windows 2000/NT, Windows Me/98/95: This value is not supported. - /// - GetFontSmoothingType = 0x200A, - /// - /// Sets the font smoothing type. The pvParam parameter points to a UINT that contains either FE_FONTSMOOTHINGSTANDARD, - /// if standard anti-aliasing is used, or FE_FONTSMOOTHINGCLEARTYPE, if ClearType is used. The default is FE_FONTSMOOTHINGSTANDARD. - /// When using this option, the fWinIni parameter must be set to SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE; otherwise, - /// SystemParametersInfo fails. - /// - SetFontSmoothingType = 0x200B, - /// - /// Retrieves a contrast value that is used in ClearType™ smoothing. The pvParam parameter must point to a UINT - /// that receives the information. - /// Windows 2000/NT, Windows Me/98/95: This value is not supported. - /// - GetFontSmoothingContrast = 0x200C, - /// - /// Sets the contrast value used in ClearType smoothing. The pvParam parameter points to a UINT that holds the contrast value. - /// Valid contrast values are from 1000 to 2200. The default value is 1400. - /// When using this option, the fWinIni parameter must be set to SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE; otherwise, - /// SystemParametersInfo fails. - /// SPI_SETFONTSMOOTHINGTYPE must also be set to FE_FONTSMOOTHINGCLEARTYPE. - /// Windows 2000/NT, Windows Me/98/95: This value is not supported. - /// - SetFontSmoothingContrast = 0x200D, - /// - /// Retrieves the width, in pixels, of the left and right edges of the focus rectangle drawn with DrawFocusRect. - /// The pvParam parameter must point to a UINT. - /// Windows 2000/NT, Windows Me/98/95: This value is not supported. - /// - GetFocusBorderWidth = 0x200E, - /// - /// Sets the height of the left and right edges of the focus rectangle drawn with DrawFocusRect to the value of the pvParam parameter. - /// Windows 2000/NT, Windows Me/98/95: This value is not supported. - /// - SetFocusBorderWidth = 0x200F, - /// - /// Retrieves the height, in pixels, of the top and bottom edges of the focus rectangle drawn with DrawFocusRect. - /// The pvParam parameter must point to a UINT. - /// Windows 2000/NT, Windows Me/98/95: This value is not supported. - /// - GetFocusBorderHeight = 0x2010, - /// - /// Sets the height of the top and bottom edges of the focus rectangle drawn with DrawFocusRect to the value of the pvParam parameter. - /// Windows 2000/NT, Windows Me/98/95: This value is not supported. - /// - SetFocusBorderHeight = 0x2011, - /// - /// Not implemented. - /// - GetFontSmoothingOrientation = 0x2012, - /// - /// Not implemented. - /// - SetFontSmoothingOrientation = 0x2013, - } - #endregion + /// + /// Está opción no está soportada por Windows NT, Windows Me/98/95. + /// + GetScreenSaverRunning = 0x0072, - #region [internal] (enum) SPIF: Representa una característica o valor de configuración del sistema a recuperar. /// - /// Especifica si es necesario actualizar el perfil de usuario, y si es así, indicar que se envie el mensaje WM_SETTINGCHANGE a todas las - /// ventanas de nivel superior para notificarles el cambio. - /// Este parámetro puede ser cero si no desea actualizar el perfil de usuario o el mensaje de WM_SETTINGCHANGE, o puede ser uno o más de - /// los siguientes valores. + /// Recupera la ruta de acceso completa del archivo de mapa de bits para el fondo de escritorio. + /// El parámetro pvParam debe apuntar a un búfer para recibir la cadena de ruta terminada en null. + /// Establezca el parámetro uiParam con el tamaño, en carácteres del buffer de pvParam. + /// La cadena devuelta no podrá superar la longitud MAX_PATH. + /// Si no hay ningún tapiz, se devolverá una cadena vacía. /// - [Flags] - internal enum SPIF - { - /// - /// No hay acción. - /// - Zero = 0x00, - /// - /// Escribe el nuevo valor de parámetro en el perfil de usuario. - /// - UpdateIniFile = 0x01, - /// - /// Enviar mensaje WM_SETTINGCHANGE después de actualizar el perfil de usuario. - /// - SendChange = 0x02, - /// - /// Igual que a la opción - /// - SendWinIniChange = 0x02 - } - #endregion + /// + /// Está opción no está soportada por Windows NT, Windows Me/98/95. + /// + GetDeskWallPaper = 0x0073, + + /// + /// Determines whether active window tracking (activating the window the mouse is on) is on or off. The pvParam parameter must point + /// to a BOOL variable that receives TRUE for on, or FALSE for off. + /// Windows NT, Windows 95: This value is not supported. + /// + GetActiveWindowTracking = 0x1000, + + /// + /// Sets active window tracking (activating the window the mouse is on) either on or off. Set pvParam to TRUE for on or FALSE for off. + /// Windows NT, Windows 95: This value is not supported. + /// + SetActiveWindowTracking = 0x1001, + + /// + /// Determina si está habilitada la característica de animación de menú. + /// Sí la característica está activada indica si los menús usan atenuación o animación. + /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true + /// si la caracteristíca está activada ó false en caso contrario. + /// + GetMenuAnimation = 0x1002, + + /// + /// Activa o desactiva la característica. Ver . + /// + SetMenuAnimation = 0x1003, + + /// + /// Determina si está habilitado el efecto de apertura para los cuadros combinados. + /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true + /// para indicar que está activado o false si está desactivado. + /// + /// + /// Está característica no está soportada por Windows NT, Windows 95. + /// + GetComboboxAnimation = 0x1004, + + /// + /// Activa o desactiva la característica. Ver . + /// + SetComboboxAnimation = 0x1005, + + /// + /// Determina si está habilitado el efecto de desplazamiento suave para cuadros de lista. + /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true + /// si la caracteristíca está activada ó false en caso contrario. + /// + /// + /// Está característica no está soportada por Windows 95. + /// + GetListBoxSmoothScrolling = 0x1006, + + /// + /// Activa o desactiva la característica. Ver . + /// + SetListBoxSmoothScrolling = 0x1007, + + /// + /// Determines whether the gradient effect for window title bars is enabled. The pvParam parameter must point to a BOOL variable + /// that receives TRUE for enabled, or FALSE for disabled. For more information about the gradient effect, see the GetSysColor function. + /// Windows NT, Windows 95: This value is not supported. + /// + GetGradientCaptions = 0x1008, + + /// + /// Enables or disables the gradient effect for window title bars. Set the pvParam parameter to TRUE to enable it, or FALSE to disable it. + /// The gradient effect is possible only if the system has a color depth of more than 256 colors. For more information about + /// the gradient effect, see the GetSysColor function. + /// Windows NT, Windows 95: This value is not supported. + /// + SetGradientCaptions = 0x1009, + + /// + /// Determines whether menu access keys are always underlined. The pvParam parameter must point to a BOOL variable that receives TRUE + /// if menu access keys are always underlined, and FALSE if they are underlined only when the menu is activated by the keyboard. + /// Windows NT, Windows 95: This value is not supported. + /// + GetKeyboardCues = 0x100A, + + /// + /// Sets the underlining of menu access key letters. The pvParam parameter is a BOOL variable. Set pvParam to TRUE to always underline menu + /// access keys, or FALSE to underline menu access keys only when the menu is activated from the keyboard. + /// Windows NT, Windows 95: This value is not supported. + /// + SetKeyboardCues = 0x100B, + + /// + /// Same as SPI_GETKEYBOARDCUES. + /// + GetMenuUnderlines = GetKeyboardCues, + + /// + /// Same as SPI_SETKEYBOARDCUES. + /// + SetMenuUnderlines = SetKeyboardCues, + + /// + /// Determines whether windows activated through active window tracking will be brought to the top. The pvParam parameter must point + /// to a BOOL variable that receives TRUE for on, or FALSE for off. + /// Windows NT, Windows 95: This value is not supported. + /// + GetActiveWndTrkZorder = 0x100C, + + /// + /// Determines whether or not windows activated through active window tracking should be brought to the top. Set pvParam to TRUE + /// for on or FALSE for off. + /// Windows NT, Windows 95: This value is not supported. + /// + SetActiveWndTrkZorder = 0x100D, + + /// + /// Determina si está habilitado el seguimiento activo de los elementos de la interfaz de usuario, como barras de menús, los nombres de menú. + /// Seguimiento activo significa que cuando el cursor se mueve sobre un elemento, este se dibuja con relieve pero no está seleccionado. + /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true + /// si la caracteristíca está activada ó false en caso contrario. + /// + /// + /// Está característica no está soportada por Windows NT, Windows 95. + /// + GetHotTracking = 0x100E, + + /// + /// Activate or deactivate the feature. See . + /// + SetHotTracking = 0x100F, + + /// + /// Determina si está habilitada la animación del cierre de menú. + /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true + /// si la caracteristíca está activada ó false en caso contrario. + /// + /// + /// Está característica no está soportada por Windows NT, Windows Me/98/95. + /// + GetMenuFade = 0x1012, + + /// + /// Activate or deactivate the feature. See . + /// + SetMenuFade = 0x1013, + + /// + /// Determina si está habilitado el efecto de desvanecimiento de la selección. + /// El efecto de desvanecimiento de la selección hace que el elemento de menú seleccionado por el usuario permanezca en la pantalla brevemente mientras desaparece lentamente. + /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true + /// si la caracteristíca está activada ó false en caso contrario. + /// + /// + /// Está característica no está soportada por Windows NT, Windows Me/98/95. + /// + GetSelectionFade = 0x1014, + + /// + /// Activate or deactivate the feature. See . + /// + SetSelectionFade = 0x1015, + + /// + /// Determina si está habilitada la animación de los globos de ayuda sobre herramientas. + /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true + /// si la caracteristíca está activada ó false en caso contrario. + /// + /// + /// Está característica no está soportada por Windows NT, Windows Me/98/95. + /// + GetTooltipAnimation = 0x1016, + + /// + /// Activate or deactivate the feature. See . + /// + SetTooltipAnimation = 0x1017, + + /// + /// Si está habilitada la , GetTooltipFade indica si los globos de ayuda utilizan un efecto de transición o no. + /// El efecto de desvanecimiento de la selección hace que el elemento de menú seleccionado por el usuario permanezca en la pantalla brevemente mientras desaparece lentamente. + /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true + /// si la caracteristíca está activada ó false en caso contrario. + /// + /// + /// Está característica no está soportada por Windows NT, Windows Me/98/95. + /// + GetTooltipFade = 0x1018, + + /// + /// Activate or deactivate the feature. See . + /// + SetTooltipFade = 0x1019, + + /// + /// Determina si el cursor del ratón tiene una sombra alrededor. + /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true + /// si la sombra del cursor está activada ó false si está deshabilitado. + /// + /// + /// El efecto sólo es apreciable en sistemas que tengan como mínimo 256 colores de profundidad de color. + /// Está característica no está soportada por Windows NT, Windows Me/98/95. + /// + GetCursorShadow = 0x101A, + + /// + /// Activate or deactivate the feature. See . + /// + SetCursorShadow = 0x101B, + + /// + /// Retrieves the state of the Mouse Sonar feature. The pvParam parameter must point to a BOOL variable that receives TRUE + /// if enabled or FALSE otherwise. For more information, see About Mouse Input on MSDN. + /// Windows 2000/NT, Windows 98/95: This value is not supported. + /// + GetMouseSonar = 0x101C, + + /// + /// Turns the Sonar accessibility feature on or off. This feature briefly shows several concentric circles around the mouse pointer + /// when the user presses and releases the CTRL key. The pvParam parameter specifies TRUE for on and FALSE for off. The default is off. + /// For more information, see About Mouse Input. + /// Windows 2000/NT, Windows 98/95: This value is not supported. + /// + SetMouseSonar = 0x101D, + + /// + /// Retrieves the state of the Mouse ClickLock feature. The pvParam parameter must point to a BOOL variable that receives TRUE + /// if enabled, or FALSE otherwise. For more information, see About Mouse Input. + /// Windows 2000/NT, Windows 98/95: This value is not supported. + /// + GetMouseClickLock = 0x101E, + + /// + /// Turns the Mouse ClickLock accessibility feature on or off. This feature temporarily locks down the primary mouse button + /// when that button is clicked and held down for the time specified by SPI_SETMOUSECLICKLOCKTIME. The uiParam parameter specifies + /// TRUE for on, + /// or FALSE for off. The default is off. For more information, see Remarks and About Mouse Input on MSDN. + /// Windows 2000/NT, Windows 98/95: This value is not supported. + /// + SetMouseClickLock = 0x101F, + + /// + /// Retrieves the state of the Mouse Vanish feature. The pvParam parameter must point to a BOOL variable that receives TRUE + /// if enabled or FALSE otherwise. For more information, see About Mouse Input on MSDN. + /// Windows 2000/NT, Windows 98/95: This value is not supported. + /// + GetMouseVanish = 0x1020, + + /// + /// Turns the Vanish feature on or off. This feature hides the mouse pointer when the user types; the pointer reappears + /// when the user moves the mouse. The pvParam parameter specifies TRUE for on and FALSE for off. The default is off. + /// For more information, see About Mouse Input on MSDN. + /// Windows 2000/NT, Windows 98/95: This value is not supported. + /// + SetMouseVanish = 0x1021, + + /// + /// Determina si los menús de usuario nativos tienen apariencia de menú plano. + /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true + /// si se establece la apariencia;false en caso contrario. + /// + /// + /// Está característica no está soportada por Windows 2000. + /// + GetFlatMenu = 0x1022, + + /// + /// Activa o desactiva la característica. Ver . + /// + SetFlatMenu = 0x1023, + + /// + /// Determina si está habilitado el efecto de sombra paralela. + /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true + /// si está habilitada;false si está deshabilitado. + /// + /// + /// Está característica no está soportada por Windows 2000/NT, Windows Me/98/95. + /// + GetDropShadow = 0x1024, + + /// + /// Activa o desactiva la característica. Ver . + /// + SetDropShadow = 0x1025, + + /// + /// Retrieves a BOOL indicating whether an application can reset the screensaver's timer by calling the SendInput function + /// to simulate keyboard or mouse input. The pvParam parameter must point to a BOOL variable that receives TRUE + /// if the simulated input will be blocked, or FALSE otherwise. + /// + GetBlockSendInputResets = 0x1026, + + /// + /// Determines whether an application can reset the screensaver's timer by calling the SendInput function to simulate keyboard + /// or mouse input. The uiParam parameter specifies TRUE if the screensaver will not be deactivated by simulated input, + /// or FALSE if the screensaver will be deactivated by simulated input. + /// + SetBlockSendInputResets = 0x1027, + /// + /// Determina si está habilitada la característica. + /// ClearType es una tecnología de software que mejora la legibilidad del texto en monitores con pantalla de cristal líquido (LCD). + /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true + /// si está habilitada;false si está deshabilitado. + /// + /// + /// Está característica no está soportada por Windows Server 2003 y Windows XP/2000 + /// + GetClearType = 0x1048, + + /// + /// Activa o desactiva la característica. Ver . + /// + SetClearType = 0x1049, + + /// + /// Determina si todos los efectos de la interfaz de usuario están habilitados o desactivados. + /// El parámetro pvParam debe apuntar a una variable de tipo que recibirá true + /// si está habilitada;false si está deshabilitado. + /// + GetUiEffects = 0x103E, + + /// + /// Activa o desactiva la característica. Ver . + /// + SetUiEffects = 0x103F, + + /// + /// Retrieves the amount of time following user input, in milliseconds, during which the system will not allow applications + /// to force themselves into the foreground. The pvParam parameter must point to a DWORD variable that receives the time. + /// Windows NT, Windows 95: This value is not supported. + /// + GetForegroundLockTimeout = 0x2000, + + /// + /// Sets the amount of time following user input, in milliseconds, during which the system does not allow applications + /// to force themselves into the foreground. Set pvParam to the new timeout value. + /// The calling thread must be able to change the foreground window, otherwise the call fails. + /// Windows NT, Windows 95: This value is not supported. + /// + SetForegroundLockTimeout = 0x2001, + + /// + /// Retrieves the active window tracking delay, in milliseconds. The pvParam parameter must point to a DWORD variable + /// that receives the time. + /// Windows NT, Windows 95: This value is not supported. + /// + GetActiveWndTrkTimeout = 0x2002, + /// + /// Sets the active window tracking delay. Set pvParam to the number of milliseconds to delay before activating the window + /// under the mouse pointer. + /// Windows NT, Windows 95: This value is not supported. + /// + SetActiveWndTrkTimeout = 0x2003, + + /// + /// Retrieves the number of times SetForegroundWindow will flash the taskbar button when rejecting a foreground switch request. + /// The pvParam parameter must point to a DWORD variable that receives the value. + /// Windows NT, Windows 95: This value is not supported. + /// + GetForegroundFlashCount = 0x2004, + + /// + /// Sets the number of times SetForegroundWindow will flash the taskbar button when rejecting a foreground switch request. + /// Set pvParam to the number of times to flash. + /// Windows NT, Windows 95: This value is not supported. + /// + SetForegroundFlashCount = 0x2005, + + /// + /// Retrieves the caret width in edit controls, in pixels. The pvParam parameter must point to a DWORD that receives this value. + /// Windows NT, Windows Me/98/95: This value is not supported. + /// + GetCaretWidth = 0x2006, + + /// + /// Sets the caret width in edit controls. Set pvParam to the desired width, in pixels. The default and minimum value is 1. + /// Windows NT, Windows Me/98/95: This value is not supported. + /// + SetCaretWidth = 0x2007, + + //#if(_WIN32_WINNT >= 0x0501) + /// + /// Retrieves the time delay before the primary mouse button is locked. The pvParam parameter must point to DWORD that receives + /// the time delay. This is only enabled if SPI_SETMOUSECLICKLOCK is set to TRUE. For more information, see About Mouse Input on MSDN. + /// Windows 2000/NT, Windows 98/95: This value is not supported. + /// + GetMouseClickLockTime = 0x2008, + + /// + /// Turns the Mouse ClickLock accessibility feature on or off. This feature temporarily locks down the primary mouse button + /// when that button is clicked and held down for the time specified by SPI_SETMOUSECLICKLOCKTIME. The uiParam parameter + /// specifies TRUE for on, or FALSE for off. The default is off. For more information, see Remarks and About Mouse Input on MSDN. + /// Windows 2000/NT, Windows 98/95: This value is not supported. + /// + SetMouseClickLockTime = 0x2009, + + /// + /// Retrieves the type of font smoothing. The pvParam parameter must point to a UINT that receives the information. + /// Windows 2000/NT, Windows Me/98/95: This value is not supported. + /// + GetFontSmoothingType = 0x200A, + + /// + /// Sets the font smoothing type. The pvParam parameter points to a UINT that contains either FE_FONTSMOOTHINGSTANDARD, + /// if standard anti-aliasing is used, or FE_FONTSMOOTHINGCLEARTYPE, if ClearType is used. The default is FE_FONTSMOOTHINGSTANDARD. + /// When using this option, the fWinIni parameter must be set to SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE; otherwise, + /// SystemParametersInfo fails. + /// + SetFontSmoothingType = 0x200B, + + /// + /// Retrieves a contrast value that is used in ClearType™ smoothing. The pvParam parameter must point to a UINT + /// that receives the information. + /// Windows 2000/NT, Windows Me/98/95: This value is not supported. + /// + GetFontSmoothingContrast = 0x200C, + + /// + /// Sets the contrast value used in ClearType smoothing. The pvParam parameter points to a UINT that holds the contrast value. + /// Valid contrast values are from 1000 to 2200. The default value is 1400. + /// When using this option, the fWinIni parameter must be set to SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE; otherwise, + /// SystemParametersInfo fails. + /// SPI_SETFONTSMOOTHINGTYPE must also be set to FE_FONTSMOOTHINGCLEARTYPE. + /// Windows 2000/NT, Windows Me/98/95: This value is not supported. + /// + SetFontSmoothingContrast = 0x200D, + + /// + /// Retrieves the width, in pixels, of the left and right edges of the focus rectangle drawn with DrawFocusRect. + /// The pvParam parameter must point to a UINT. + /// Windows 2000/NT, Windows Me/98/95: This value is not supported. + /// + GetFocusBorderWidth = 0x200E, + + /// + /// Sets the height of the left and right edges of the focus rectangle drawn with DrawFocusRect to the value of the pvParam parameter. + /// Windows 2000/NT, Windows Me/98/95: This value is not supported. + /// + SetFocusBorderWidth = 0x200F, + + /// + /// Retrieves the height, in pixels, of the top and bottom edges of the focus rectangle drawn with DrawFocusRect. + /// The pvParam parameter must point to a UINT. + /// Windows 2000/NT, Windows Me/98/95: This value is not supported. + /// + GetFocusBorderHeight = 0x2010, + + /// + /// Sets the height of the top and bottom edges of the focus rectangle drawn with DrawFocusRect to the value of the pvParam parameter. + /// Windows 2000/NT, Windows Me/98/95: This value is not supported. + /// + SetFocusBorderHeight = 0x2011, + + /// + /// Not implemented. + /// + GetFontSmoothingOrientation = 0x2012, + + /// + /// Not implemented. + /// + SetFontSmoothingOrientation = 0x2013 + } #endregion - #region Estructuras + #region [public] (enum) SPIF: Represents a feature or configuration value of the system to recover /// - /// ANIMATIONINFO specifies animation effects associated with user actions. - /// Used with SystemParametersInfo when SPI_GETANIMATION or SPI_SETANIMATION action is specified. + /// Specify whether it is necessary to update the user profile, and if so, indicate that the message WM_SETTINGCHANGE is sent to all upper level windows to notify them of the change. + /// This parameter can be zero if you do not want to update the user profile or the WM_SETTINGCHANGE message, or it can be one or more of the following values. /// - /// - /// The uiParam value must be set to (System.UInt32)Marshal.SizeOf(typeof(ANIMATIONINFO)) when using this structure. - /// - [StructLayout(LayoutKind.Sequential)] - internal struct ANIMATIONINFO + [Flags] + public enum SPIF { /// - /// Creates an AMINMATIONINFO structure. - /// - /// If non-zero and SPI_SETANIMATION is specified, enables minimize/restore animation. - public ANIMATIONINFO(int iMinAnimate) - { - cbSize = (uint)Marshal.SizeOf(typeof(ANIMATIONINFO)); - this.iMinAnimate = iMinAnimate; - } + /// No action. + /// + Zero = 0x00, /// - /// Always must be set to (System.UInt32)Marshal.SizeOf(typeof(ANIMATIONINFO)). - /// - public uint cbSize; + /// Write the new parameter value in the user profile. + /// + UpdateIniFile = 0x01, /// - /// If non-zero, minimize/restore animation is enabled, otherwise disabled. + /// Send message WM_SETTINGCHANGE after updating the user profile. + /// + SendChange = 0x02, + + /// + /// Same as option . /// - public int iMinAnimate; + SendWinIniChange = 0x02 } #endregion + #endregion + #region P/Invoke - #region [public] {static} (int) GetSystemMetrics(SystemMetricIndex): Recupera un valor de configuración ó una característica del sistema. + #region [public] {static} (int) GetSystemMetrics(SystemMetricIndex): Retrieves a configuration value or a system characteristic /// - /// Recupera un valor de configuración ó una característica del sistema. - /// Todas las valores de medida obtenidos por GetSystemMetrics están en píxeles. + /// Retrieves a configuration value or a system characteristic. + /// All measurement values obtained by GetSystemMetrics are in pixels. For more information, please see http://msdn.microsoft.com/en-us/library/ms724385%28v=VS.85%29.aspx. /// - /// - /// Para más información, ver http://msdn.microsoft.com/en-us/library/ms724385%28v=VS.85%29.aspx - /// [DllImport(ExternDll.Win.User32, ExactSpelling = true)] public static extern int GetSystemMetrics(SystemMetricIndex smIndex); #endregion - #region [public] {static} (bool) SystemParametersInfo(SPI, UInt32, IntPtr, SPIF): Recupera o establece el valor de uno de los parámetros del sistema. + #region [public] {static} (bool) SystemParametersInfo(SPI, uint, IntPtr, SPIF): Retrieves or sets the value of one of the system parameters /// - /// Recupera o establece el valor de uno de los parámetros del sistema. - /// Esta función también puede actualizar el perfil de usuario al establecer un parámetro. + /// Retrieves or sets the value of one of the system parameters. + /// This function can also update the user profile by setting a parameter. For more information, please see http://msdn.microsoft.com/en-us/library/ms724947%28v=VS.85%29.aspx. /// - /// - /// Para más información, ver http://msdn.microsoft.com/en-us/library/ms724947%28v=VS.85%29.aspx - /// [DllImport(ExternDll.Win.User32, CharSet = CharSet.Unicode, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool SystemParametersInfo(SPI uiAction, UInt32 uiParam, IntPtr pvParam, SPIF fWinIni); + public static extern bool SystemParametersInfo(SPI uiAction, uint uiParam, IntPtr pvParam, SPIF fWinIni); #endregion - #region [public] {static} (bool) SystemParametersInfo(SPI, UInt32, ref Boolean, SPIF): Recupera o establece el valor de uno de los parámetros del sistema. + #region [public] {static} (bool) SystemParametersInfo(SPI, uint, ref Boolean, SPIF): Retrieves or sets the value of one of the system parameters /// - /// Recupera o establece el valor de uno de los parámetros del sistema. - /// Esta función también puede actualizar el perfil de usuario al establecer un parámetro. + /// Retrieves or sets the value of one of the system parameters. + /// This function can also update the user profile by setting a parameter. For more information, please see http://msdn.microsoft.com/en-us/library/ms724947%28v=VS.85%29.aspx. /// - /// - /// Para más información, ver http://msdn.microsoft.com/en-us/library/ms724947%28v=VS.85%29.aspx - /// [DllImport(ExternDll.Win.User32, CharSet = CharSet.Unicode, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool SystemParametersInfo(SPI uiAction, UInt32 uiParam, [MarshalAs(UnmanagedType.Bool)] ref Boolean pvParam, SPIF fWinIni); + public static extern bool SystemParametersInfo(SPI uiAction, uint uiParam, [MarshalAs(UnmanagedType.Bool)] ref bool pvParam, SPIF fWinIni); #endregion - #region [public] {static} (bool) SystemParametersInfo(SPI, UInt32, Boolean, SPIF): Recupera o establece el valor de uno de los parámetros del sistema. + #region [public] {static} (bool) SystemParametersInfo(SPI, uint, Boolean, SPIF): Retrieves or sets the value of one of the system parameters /// - /// Recupera o establece el valor de uno de los parámetros del sistema. - /// Esta función también puede actualizar el perfil de usuario al establecer un parámetro. + /// Retrieves or sets the value of one of the system parameters. + /// This function can also update the user profile by setting a parameter. For more information, please see http://msdn.microsoft.com/en-us/library/ms724947%28v=VS.85%29.aspx. /// - /// - /// Para más información, ver http://msdn.microsoft.com/en-us/library/ms724947%28v=VS.85%29.aspx - /// [DllImport(ExternDll.Win.User32, CharSet = CharSet.Unicode, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool SystemParametersInfo(SPI uiAction, UInt32 uiParam, [MarshalAs(UnmanagedType.Bool)] Boolean pvParam, SPIF fWinIni); + public static extern bool SystemParametersInfo(SPI uiAction, uint uiParam, [MarshalAs(UnmanagedType.Bool)] bool pvParam, SPIF fWinIni); #endregion - #region [public] {static} (bool) SystemParametersInfo(SPI, UInt32, String, SPIF): Recupera o establece el valor de uno de los parámetros del sistema. + #region [public] {static} (bool) SystemParametersInfo(SPI, uint, string, SPIF): Retrieves or sets the value of one of the system parameters /// - /// Recupera o establece el valor de uno de los parámetros del sistema. - /// Esta función también puede actualizar el perfil de usuario al establecer un parámetro. + /// Retrieves or sets the value of one of the system parameters. + /// This function can also update the user profile by setting a parameter. For more information, please see http://msdn.microsoft.com/en-us/library/ms724947%28v=VS.85%29.aspx. /// - /// - /// Para más información, ver http://msdn.microsoft.com/en-us/library/ms724947%28v=VS.85%29.aspx - /// [DllImport(ExternDll.Win.User32, CharSet = CharSet.Unicode, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool SystemParametersInfo(SPI uiAction, UInt32 uiParam, String pvParam, SPIF fWinIni); + public static extern bool SystemParametersInfo(SPI uiAction, uint uiParam, string pvParam, SPIF fWinIni); #endregion - #region [public] {static} (bool) SystemParametersInfo(SPI, UInt32, ref ANIMATIONINFO, SPIF): Recupera o establece el valor de uno de los parámetros del sistema. + #region [public] {static} (bool) SystemParametersInfo(SPI, uint, ref ANIMATIONINFO, SPIF): Retrieves or sets the value of one of the system parameters /// - /// Recupera o establece el valor de uno de los parámetros del sistema. - /// Esta función también puede actualizar el perfil de usuario al establecer un parámetro. + /// Retrieves or sets the value of one of the system parameters. + /// This function can also update the user profile by setting a parameter. For more information, please see http://msdn.microsoft.com/en-us/library/ms724947%28v=VS.85%29.aspx. /// - /// - /// Para más información, ver http://msdn.microsoft.com/en-us/library/ms724947%28v=VS.85%29.aspx - /// [DllImport(ExternDll.Win.User32, ExactSpelling = true)] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool SystemParametersInfo(SPI uiAction, UInt32 uiParam, ref ANIMATIONINFO pvParam, SPIF fWinIni); + public static extern bool SystemParametersInfo(SPI uiAction, uint uiParam, ref ANIMATIONINFO pvParam, SPIF fWinIni); + #endregion + #endregion + + #region nested structures + + /// + /// ANIMATIONINFO specifies animation effects associated with user actions. + /// Used with SystemParametersInfo when SPI_GETANIMATION or SPI_SETANIMATION action is specified. + /// + /// + /// The uiParam value must be set to (System.UInt32)Marshal.SizeOf(typeof(ANIMATIONINFO)) when using this structure. + /// + [StructLayout(LayoutKind.Sequential)] + public struct ANIMATIONINFO + { + /// + /// Creates an AMINMATIONINFO structure. + /// + /// If non-zero and SPI_SETANIMATION is specified, enables minimize/restore animation. + public ANIMATIONINFO(int iMinAnimate) + { + cbSize = (uint)Marshal.SizeOf(typeof(ANIMATIONINFO)); + this.iMinAnimate = iMinAnimate; + } + + /// + /// Always must be set to (System.UInt32)Marshal.SizeOf(typeof(ANIMATIONINFO)). + /// + public uint cbSize; + + /// + /// If non-zero, minimize/restore animation is enabled, otherwise disabled. + /// + public int iMinAnimate; + } + #endregion } } diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Enums/AtaCommand.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Enums/AtaCommand.cs new file mode 100644 index 0000000..8825732 --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Enums/AtaCommand.cs @@ -0,0 +1,160 @@ + +namespace iTin.Core.Interop.Windows.Hardware.DriverKit.Storage.Ata +{ + public enum AtaCommand : byte + { + CfaEraseSectors = 0xC0, + + CfaRequestExtendedError = 0x03, + + CfaTranslateSector = 0x87, + + CfaWriteMultipleWithoutErase = 0xCD, + + CfaWriteSectorsWithoutErase = 0xCD, + + CheckMediaCardType = 0xD1, + + CheckPowerMode = 0xE5, + + ConfigureStream = 0x51, + + DataSetManagement = 0x06, + + DeviceConfigurationOverlay = 0xB1, + + DeviceReset = 0x08, + + DownloadMicrocode = 0x92, + + DownloadMicrocodeDma = 0x93, + + ExecuteDeviceDiagnostic = 0x90, + + FlushCache = 0xE7, + + FlushCacheExt = 0xEA, + + IdentifyDevice = 0xEC, + + IdentifyPacketDevice = 0xA1, + + Idle = 0xE3, + + IdleImmediate = 0xE1, + + Nop = 0x00, + + NonvolatileCache = 0xB6, + + Packet = 0xA0, + + ReadBuffer = 0xE4, + + ReadBufferDma = 0xE9, + + ReadDma = 0xC8, + + ReadDmaExt = 0x25, + + ReadFpDmaQueued = 0x60, + + ReadLogDmaExt = 0x47, + + ReadLogExt = 0x2F, + + ReadMultiple = 0xC4, + + ReadMultipleExt = 0x29, + + ReadNativeMaxAddress = 0xF8, + + ReadNativeMaxAddressExt = 0x27, + + ReadSectors = 0x20, + + ReadSectorsExt = 0x24, + + ReadStreamDmaExt = 0x2A, + + ReadStreamExt = 0x2A, + + ReadVerifySectors = 0x40, + + ReadVerifySectorsExt = 0x42, + + RequestSenseDataExt = 0x0B, + + SanitizeDevice = 0xB4, + + SecurityDisablePassword = 0xF6, + + SecurityErasePrepare = 0xF3, + + SecurityEraseUnit = 0xF4, + + SecurityFreezeLock = 0xF5, + + SecuritySetPassword = 0xF1, + + SecurityUnlock = 0xF2, + + SetFeatures = 0xEF, + + SetMaxAddress = 0xF9, + + SetMaxAddressExt = 0x37, + + SetMultipleMode = 0xC6, + + Sleep = 0xE6, + + Smart = 0xB0, + + Standby = 0xE2, + + StandbyImmediate = 0xE0, + + TrustedNonData = 0x5B, + + TrustedReceive = 0x5C, + + TrustedReceiveDma = 0x5D, + + TrustedSend = 0x5E, + + TrustedSendDma = 0x5F, + + WriteBuffer = 0xE8, + + WriteBufferDma = 0xEB, + + WriteDma = 0xCA, + + WriteDmaExt = 0x35, + + WriteDmaForceUnitAccessExt = 0x3D, + + WriteFpDmaQueued = 0x61, + + WriteLogDmaExt = 0x57, + + WriteLogExt = 0x3F, + + WriteMultiple = 0xC5, + + WriteMultipleExt = 0x39, + + WriteMultipleForceUnitAccessExt = 0xCE, + + WriteSectors = 0x30, + + WriteSectorsExt = 0x34, + + WriteStreamDmaExt = 0x3A, + + WriteStreamExt = 0x3B, + + WriteUncorrectableExt = 0x45, + } +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Enums/AtaError.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Enums/AtaError.cs new file mode 100644 index 0000000..b8f36c2 --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Enums/AtaError.cs @@ -0,0 +1,23 @@ + +namespace iTin.Core.Interop.Windows.Hardware.DriverKit.Storage.Ata +{ + using System; + + [Flags] + public enum AtaError : byte + { + None = 0, + + IllegalLengthOrTimeoutOrMediaErrorOrOther = 1, + + EndOfMedium = 1 << 1, + + Abort = 1 << 2, + + IdNotFound = 1 << 4, + + UncorrectableError = 1 << 6, + + InterfaceCrc = 1 << 7 + } +} \ No newline at end of file diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Enums/AtaFlags.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Enums/AtaFlags.cs new file mode 100644 index 0000000..65b2ff9 --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Enums/AtaFlags.cs @@ -0,0 +1,48 @@ + +namespace iTin.Core.Interop.Windows.Hardware.DriverKit.Storage.Ata +{ + using System; + + /// + /// Indicates the address of the data transfer and specifies the type of operation to be performed. + /// + [Flags] + public enum AtaFlags : ushort + { + /// + /// None. + /// + None = 0, + + /// + /// Wait for the device to be ready before sending the command. + /// + DriveReadyRequired = 1, + + /// + /// Read device data. + /// + ReceiveData = 1 << 1, + + /// + /// Send data to the device. + /// + SendData = 1 << 2, + + /// + /// The ATA command to be sent uses the 48-bit logical block address (LBA) feature set. + /// When this flag is set, the contents of the PreviousTaskFile member in the ATA_PASS_THROUGH_EX structure should be valid. + /// + Command48Bit = 1 << 3, + + /// + /// Set transfer mode to DMA. + /// + UseDma = 1 << 4, + + /// + /// Read a single sector and only on the device. + /// + NoMultiple = 1 << 5 + } +} \ No newline at end of file diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Enums/AtaStatus.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Enums/AtaStatus.cs new file mode 100644 index 0000000..4042837 --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Enums/AtaStatus.cs @@ -0,0 +1,29 @@ + +namespace iTin.Core.Interop.Windows.Hardware.DriverKit.Storage.Ata +{ + using System; + + [Flags] + public enum AtaStatus : byte + { + None = 0, + + CheckCondition = 1 << 0, + + SenseDataAvailable = 1 << 1, + + AlignmentError = 1 << 2, + + DataRequest = 1 << 3, + + DeferredWriteError = 1 << 4, + + StreamError = 1 << 5, + + DeviceFault = 1 << 5, + + DeviceReady = 1 << 6, + + Busy = 1 << 7 + } +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Structures/ATA_PASS_THROUGH_DIRECT.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Structures/ATA_PASS_THROUGH_DIRECT.cs new file mode 100644 index 0000000..c105ba3 --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Structures/ATA_PASS_THROUGH_DIRECT.cs @@ -0,0 +1,86 @@ + +namespace iTin.Core.Interop.Windows.Hardware.DriverKit.Storage.Ata +{ + using System.Runtime.InteropServices; + + using UCHAR = System.Byte; + using ULONG = System.UInt32; + using PVOID = System.IntPtr; + using USHORT = System.UInt16; + + /// + /// The ATA_PASS_THROUGH_DIRECT structure is used in conjunction with an request to instruct the port driver to send an embedded ATA command to the target device. + /// + /// + /// For more information, please see https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/ntddscsi/ns-ntddscsi-_ata_pass_through_direct. + /// + [StructLayout(LayoutKind.Sequential)] + public struct ATA_PASS_THROUGH_DIRECT + { + /// + /// Specify the length in bytes of the structure. + /// + public USHORT Length; + + /// + /// Indicates the address of the data transfer and specifies the type of operation to be performed. + /// + public AtaFlags AtaFlags; + + /// + /// Contains an integer that indicates the IDE port or the request bus. + /// This value is set by the port controller. + /// + public UCHAR PathId; + + /// + /// Contains an integer that indicates the target device on the bus. + /// This value is set by the port controller. + /// + public UCHAR TargetId; + + /// + /// Indicates the logical unit number of the device. + /// This value is set by the port controller. + /// + public UCHAR Lun; + + /// + /// Reservad. + /// + public UCHAR ReservedAsUchar; + + /// + /// Indicates the size, in bytes, of the data buffer. + /// If there is insufficient data, the miniport driver must update this member in the number of bytes that are actually transferred. + /// + public ULONG DataTransferLength; + + /// + /// Indicates the number of seconds allowed for the execution request before the operating system specific port driver determines that the request has expired. + /// + public ULONG TimeOutValue; + + /// + /// Reservad. + /// + public ULONG ReservedAsUlong; + + /// + /// Specifies the offset, in bytes, from the beginning of this structure to the data buffer. + /// + public PVOID DataBuffer; + + /// + /// Specifies the contents of the task file input registers prior to the current pass-through command. + /// This member is not used when the ATA_FLAGS_48BIT_COMMAND flag is not set. + /// + public ATA_TASK_FILE PreviousTaskFile; + + /// + /// Specifies the content of the task file register on both input and output. + /// On input, the array values in CurrentTaskFile map to the task file input registers in the following manner. + /// + public ATA_TASK_FILE CurrentTaskFile; + } +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Structures/ATA_PASS_THROUGH_EX.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Structures/ATA_PASS_THROUGH_EX.cs new file mode 100644 index 0000000..38f703e --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Structures/ATA_PASS_THROUGH_EX.cs @@ -0,0 +1,86 @@ + +namespace iTin.Core.Interop.Windows.Hardware.DriverKit.Storage.Ata +{ + using System.Runtime.InteropServices; + + using UCHAR = System.Byte; + using ULONG = System.UInt32; + using ULONG_PTR = System.IntPtr; + using USHORT = System.UInt16; + + /// + /// The ATA_PASS_THROUGH_EX structure is used in conjunction with an IOCTL_ATA_PASS_THROUGH request to instruct the port driver to send an embedded ATA command to the target device. + /// + /// + /// For more information, please see https://docs.microsoft.com/es-es/windows-hardware/drivers/ddi/content/ntddscsi/ns-ntddscsi-_ata_pass_through_ex. + /// + [StructLayout(LayoutKind.Sequential)] + public struct ATA_PASS_THROUGH_EX + { + /// + /// Specify the length in bytes of the structure. + /// + public USHORT Length; + + /// + /// Indicates the address of the data transfer and specifies the type of operation to be performed. + /// + public AtaFlags AtaFlags; + + /// + /// Contains an integer that indicates the IDE port or the request bus. + /// This value is set by the port controller. + /// + public UCHAR PathId; + + /// + /// Contains an integer that indicates the target device on the bus. + /// This value is set by the port controller. + /// + public UCHAR TargetId; + + /// + /// Indicates the logical unit number of the device. + /// This value is set by the port controller. + /// + public UCHAR Lun; + + /// + /// Reservad. + /// + public UCHAR ReservedAsUchar; + + /// + /// Indicates the size, in bytes, of the data buffer. + /// If there is insufficient data, the miniport driver must update this member in the number of bytes that are actually transferred. + /// + public ULONG DataTransferLength; + + /// + /// Indicates the number of seconds allowed for the execution request before the operating system specific port driver determines that the request has expired. + /// + public ULONG TimeOutValue; + + /// + /// Reservad. + /// + public ULONG ReservedAsUlong; + + /// + /// Specifies the offset, in bytes, from the beginning of this structure to the data buffer. + /// + public ULONG_PTR DataBufferOffset; + + /// + /// Specifies the contents of the task file input registers prior to the current pass-through command. + /// This member is not used when the ATA_FLAGS_48BIT_COMMAND flag is not set. + /// + public ATA_TASK_FILE PreviousTaskFile; + + /// + /// Specifies the content of the task file register on both input and output. + /// On input, the array values in CurrentTaskFile map to the task file input registers in the following manner. + /// + public ATA_TASK_FILE CurrentTaskFile; + } +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Structures/ATA_PASS_THROUGH_EX_WITH_BUFFER.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Structures/ATA_PASS_THROUGH_EX_WITH_BUFFER.cs new file mode 100644 index 0000000..9c473e6 --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Structures/ATA_PASS_THROUGH_EX_WITH_BUFFER.cs @@ -0,0 +1,26 @@ + +namespace iTin.Core.Interop.Windows.Hardware.DriverKit.Storage.Ata +{ + using System.Runtime.InteropServices; + + /// + /// The ATA_PASS_THROUGH_EX structure is used in conjunction with an request to instruct the port driver to send an embedded ATA command to the target device. + /// + /// + /// For more information, please see https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/ntddscsi/ns-ntddscsi-_ata_pass_through_ex. + /// + [StructLayout(LayoutKind.Sequential)] + public struct ATA_PASS_THROUGH_EX_WITH_BUFFER + { + /// + /// Especifica la longitud en bytes de la estructura. + /// + public ATA_PASS_THROUGH_EX Apt; + + /// + /// Indica la dirección de la transferencia de datos y especifica el tipo de operación a realizar. + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] + public byte[] Data; + } +} \ No newline at end of file diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Structures/ATA_TASK_FILE.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Structures/ATA_TASK_FILE.cs new file mode 100644 index 0000000..15f1dea --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Structures/ATA_TASK_FILE.cs @@ -0,0 +1,95 @@ + +namespace iTin.Core.Interop.Windows.Hardware.DriverKit.Storage.Ata +{ + using System; + using System.Runtime.InteropServices; + + /// + /// + /// + [StructLayout(LayoutKind.Explicit, Pack = 1)] + public struct ATA_TASK_FILE + { + #region public members + + [FieldOffset(0)]public readonly byte Features; + [FieldOffset(0)]public readonly AtaError Error; + [FieldOffset(1)]public readonly byte Count; + [FieldOffset(2)]public readonly byte Sector; + [FieldOffset(3)]public readonly ushort Cylinder; + [FieldOffset(5)]public readonly byte DeviceOrHead; + [FieldOffset(6)]public readonly AtaCommand Command; + [FieldOffset(6)]public readonly AtaStatus Status; + [FieldOffset(7)]public readonly byte Reserved; + + #endregion + + #region constructor/s + + #region [public] ATA_TASK_FILE(AtaCommand): + /// + /// + /// + /// + public ATA_TASK_FILE(AtaCommand command) : this(0, 0, 0, 0, 0, command, 0) + { + } + #endregion + + #region [public] ATA_TASK_FILE(byte, byte, uint, byte, AtaCommand, byte): + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public ATA_TASK_FILE(byte featuresOrError, byte count, uint logicalBlockAddress, byte deviceOrHead, AtaCommand command, byte reserved) : this(featuresOrError, count, (byte)(logicalBlockAddress & 0xFF), (ushort)((logicalBlockAddress >> 8) & 0xFFFF), deviceOrHead, command, reserved) + { + if ((logicalBlockAddress & unchecked(0xFF000000)) != 0) + { + throw new ArgumentOutOfRangeException(nameof(logicalBlockAddress), logicalBlockAddress, @"Logical block address must only use the lower 3 bytes."); + } + } + #endregion + + #region [public] ATA_TASK_FILE(byte, byte, byte, ushort, byte, AtaCommand, byte): + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public ATA_TASK_FILE(byte featuresOrError, byte count, byte sector, ushort cylinder, byte deviceOrHead, AtaCommand command, byte reserved) + { + Error = (AtaError)(Features = featuresOrError); + Count = count; + Sector = sector; + Cylinder = cylinder; + DeviceOrHead = deviceOrHead; + Status = (AtaStatus)(Command = command); + Reserved = reserved; + } + #endregion + + #endregion + + #region public properties + + #region [public] (uint) LogicalBlockAddress: + /// + /// + /// + public uint LogicalBlockAddress => Sector | ((uint)Cylinder << 8); + #endregion + + #endregion + } +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Structures/IDENTIFY_DEVICE_DATA.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Structures/IDENTIFY_DEVICE_DATA.cs new file mode 100644 index 0000000..d5b0b94 --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Ata/Structures/IDENTIFY_DEVICE_DATA.cs @@ -0,0 +1,423 @@ + +namespace iTin.Core.Interop.Windows.Hardware.DriverKit.Storage.Ata +{ + using System.Collections.Specialized; + using System.Runtime.InteropServices; + + using Helpers; + using Helpers.Enumerations; + + using UCHAR = System.Byte; + using USHORT = System.UInt16; + + /// + /// The IDENTIFY_DEVICE_DATA structure contains the identification data of an ATA device by the command (0xEC). + /// + /// + /// For more information, please see https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/ata/ns-ata-_identify_device_data + /// + //[StructLayout(LayoutKind.Sequential)] + //[StructLayout(LayoutKind.Explicit, Size = 512, Pack = sizeof(ushort))] + public struct IDENTIFY_DEVICE_DATA + { + #region public enumerations + + public enum StateFeature + { + Bit48Lba = 0x00000001, + + AdvancedPowerManagement = 0x00000002, + + AutomaticAcousticManagement = 0x00000004, + + DeviceConfigurationOverlay = 0x00000008, + + DmaSetupAutoActivate = 0x00000010, + + GeneralPurposeLogging = 0x00000020, + + HostProtectedArea = 0x00000040, + + InOrderDataDelivery = 0x00000080, + + NativeCommandQueuing = 0x00000100, + + PhyEventCounters = 0x00000200, + + PowerManagement = 0x00000400, + + PowerUpInStandby = 0x00000800, + + ReadLookAhead = 0x00001000, + + ReleaseInterrupt = 0x00002000, + + SecurityMode = 0x00004000, + + Smart = 0x00008000, + + SmartErrorLogging = 0x00010000, + + SmartSelfTest = 0x00020000, + + SoftwareSettingsPreservation = 0x00040000, + + Streaming = 0x00080000, + + TaggedCommandQueuing = 0x00100000, + + WriteCache = 0x00200000, + } + + #endregion + + #region public members + + public USHORT word000; + public USHORT word001; + public USHORT word002; + + /// + /// word003: Number of heads in default translate mode + /// + public USHORT word003; + + /// + /// Word 004-005: Reserved for the CompactFlash Association + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public USHORT[] Retired1; + + /// + /// word006: Number of sectors per track in default translate mode + /// + public USHORT word006; + + /// + /// Word 007-008: Reserved for the CompactFlash Association + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public USHORT[] CompactFlashAssociation; + + /// + /// word 009: Reserved + /// + public USHORT word009; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] + public UCHAR[] SerialNumber; + + public USHORT word020; + public USHORT word021; + public USHORT word022; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public UCHAR[] FirmwareRevision; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 40)] + public UCHAR[] ModelNumber; + + public USHORT word047; + public USHORT word048; + public USHORT word049; + public USHORT word050; + public USHORT word051; + public USHORT word052; + public USHORT word053; + public USHORT word054; + public USHORT word055; + public USHORT word056; + public USHORT word057; + public USHORT word058; + public USHORT word059; + public USHORT word060; + public USHORT word061; + public USHORT word062; + public USHORT word063; + public USHORT word064; + public USHORT word065; + public USHORT word066; + public USHORT word067; + public USHORT word068; + public USHORT word069; + public USHORT word070; + public USHORT word071; + public USHORT word072; + public USHORT word073; + public USHORT word074; + public USHORT word075; + + /// + /// Word076 : Serial ATA Capabilities + /// + public USHORT word076; + + /// + /// Word 77: Reserved for Serial ATA + /// + public USHORT word077; + + /// + /// Word078: Serial ATA features supported + /// + public USHORT word078; + + /// + /// Word079: Serial ATA features enabled + /// //| "number" | "table" + /// + /// Bits + /// Description + /// + /// + /// 15:07 + /// Reserved for Serial ATA + /// + /// + /// 06 + /// Software Settings Preservation enabled + /// + /// + /// + public USHORT word079; + + /// + /// Word080: Major version number + /// + public USHORT word080; + + public USHORT word081; + public USHORT word082; + public USHORT word083; + public USHORT word084; + public USHORT word085; + public USHORT word086; + public USHORT word087; + public USHORT word088; + public USHORT word089; + public USHORT word090; + public USHORT word091; + public USHORT word092; + public USHORT word093; + public USHORT word094; + public USHORT word095; + public USHORT word096; + public USHORT word097; + public USHORT word098; + public USHORT word099; + public USHORT word100; + public USHORT word101; + public USHORT word102; + public USHORT word103; + public USHORT word104; + public USHORT word105; + public USHORT word106; + public USHORT word107; + public USHORT word108; + public USHORT word109; + public USHORT word110; + public USHORT word111; + public USHORT word112; + public USHORT word113; + public USHORT word114; + public USHORT word115; + public USHORT word116; + public USHORT word117; + public USHORT word118; + public USHORT word119; + public USHORT word120; + public USHORT word121; + public USHORT word122; + public USHORT word123; + public USHORT word124; + public USHORT word125; + public USHORT word126; + public USHORT word127; + public USHORT word128; + public USHORT word129; + public USHORT word130; + public USHORT word131; + public USHORT word132; + public USHORT word133; + public USHORT word134; + public USHORT word135; + public USHORT word136; + public USHORT word137; + public USHORT word138; + public USHORT word139; + public USHORT word140; + public USHORT word141; + public USHORT word142; + public USHORT word143; + public USHORT word144; + public USHORT word145; + public USHORT word146; + public USHORT word147; + public USHORT word148; + public USHORT word149; + public USHORT word150; + public USHORT word151; + public USHORT word152; + public USHORT word153; + public USHORT word154; + public USHORT word155; + public USHORT word156; + public USHORT word157; + public USHORT word158; + public USHORT word159; + public USHORT word160; + public USHORT word161; + public USHORT word162; + public USHORT word163; + public USHORT word164; + public USHORT word165; + public USHORT word166; + public USHORT word167; + public USHORT word168; + public USHORT word169; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public UCHAR[] AdditionalProductIdentifier; + + public USHORT word174; + public USHORT word175; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 60)] + public UCHAR[] CurrentMediaSerialNumber; + + public USHORT word206; + public USHORT word207; + public USHORT word208; + public USHORT word209; + public USHORT word210; + public USHORT word211; + public USHORT word212; + public USHORT word213; + public USHORT word214; + public USHORT word215; + public USHORT word216; + public USHORT NominalMediaRotationRate; + public USHORT word218; + public USHORT word219; + public USHORT word220; + public USHORT word221; + public USHORT word222; + public USHORT word223; + public USHORT word224; + public USHORT word225; + public USHORT word226; + public USHORT word227; + public USHORT word228; + public USHORT word229; + public USHORT word230; + public USHORT word231; + public USHORT word232; + public USHORT word233; + public USHORT word234; + public USHORT word235; + public USHORT word236; + public USHORT word237; + public USHORT word238; + public USHORT word239; + public USHORT word240; + public USHORT word241; + public USHORT word242; + public USHORT word243; + public USHORT word244; + public USHORT word245; + public USHORT word246; + public USHORT word247; + public USHORT word248; + public USHORT word249; + public USHORT word250; + public USHORT word251; + public USHORT word252; + public USHORT word253; + public USHORT word254; + public USHORT word255; + + #endregion + + #region private members + private BitVector32 _StateFeatures;// = new BitVector32(-1); + private BitVector32 _SupportedFeatures;// = new BitVector32(-1); + #endregion + + #region public methods + + #region [public] (bool) GetSupportedFeature(StateFeature): + /// + /// Gets the supported feature. + /// + /// The feature. + /// + public bool GetSupportedFeature(StateFeature feature) + { + if (_SupportedFeatures.Data == 0x0000) + { + FillSupportedFeatures(); + } + + return _SupportedFeatures[(int)feature]; + } + #endregion + + #endregion + + #region private methods + + private void FillSupportedFeatures() + { + _SupportedFeatures[(int)StateFeature.NativeCommandQueuing] = LogicHelper.CheckBit(word076, Bits.Bit08); + _SupportedFeatures[(int)StateFeature.PhyEventCounters] = LogicHelper.CheckBit(word076, Bits.Bit10); + + _SupportedFeatures[(int)StateFeature.DmaSetupAutoActivate] = LogicHelper.CheckBit(word078, Bits.Bit02); + _SupportedFeatures[(int)StateFeature.InOrderDataDelivery] = LogicHelper.CheckBit(word078, Bits.Bit04); + _SupportedFeatures[(int)StateFeature.SoftwareSettingsPreservation] = LogicHelper.CheckBit(word078, Bits.Bit06); + + _SupportedFeatures[(int)StateFeature.Smart] = LogicHelper.CheckBit(word082, Bits.Bit00); + _SupportedFeatures[(int)StateFeature.SecurityMode] = LogicHelper.CheckBit(word082, Bits.Bit01); + _SupportedFeatures[(int)StateFeature.WriteCache] = LogicHelper.CheckBit(word082, Bits.Bit05); + _SupportedFeatures[(int)StateFeature.ReadLookAhead] = LogicHelper.CheckBit(word082, Bits.Bit06); + _SupportedFeatures[(int)StateFeature.ReleaseInterrupt] = LogicHelper.CheckBit(word082, Bits.Bit07); + + _SupportedFeatures[(int)StateFeature.AdvancedPowerManagement] = LogicHelper.CheckBit(word083, Bits.Bit03); + _SupportedFeatures[(int)StateFeature.PowerUpInStandby] = LogicHelper.CheckBit(word083, Bits.Bit05); + _SupportedFeatures[(int)StateFeature.AutomaticAcousticManagement] = LogicHelper.CheckBit(word083, Bits.Bit09); + _SupportedFeatures[(int)StateFeature.Bit48Lba] = LogicHelper.CheckBit(word083, Bits.Bit10); + _SupportedFeatures[(int)StateFeature.DeviceConfigurationOverlay] = LogicHelper.CheckBit(word083, Bits.Bit11); + + _SupportedFeatures[(int)StateFeature.SmartErrorLogging] = LogicHelper.CheckBit(word084, Bits.Bit00); + _SupportedFeatures[(int)StateFeature.SmartSelfTest] = LogicHelper.CheckBit(word084, Bits.Bit01); + _SupportedFeatures[(int)StateFeature.Streaming] = LogicHelper.CheckBit(word084, Bits.Bit04); + + _SupportedFeatures[(int)StateFeature.PowerManagement] = LogicHelper.CheckBit(word085, Bits.Bit03); + _SupportedFeatures[(int)StateFeature.HostProtectedArea] = LogicHelper.CheckBit(word085, Bits.Bit10); + + _SupportedFeatures[(int)StateFeature.GeneralPurposeLogging] = LogicHelper.CheckBit(word087, Bits.Bit05); + + _SupportedFeatures[(int)StateFeature.TaggedCommandQueuing] = false; + } + + #endregion + } +} + +//#region public properties + +//public string ModelNumber +//{ +// get +// { +// byte[] mnArray = new byte[modelNumber.Length]; + +// Array.Copy(modelNumber, 0, mnArray, 0, modelNumber.Length - 1); +// mnArray.SwapBytes(); +// var model = new StringBuilder(); +// model.Append(Encoding.ASCII.GetString(mnArray, 0, mnArray.Length)); + +// return model.ToString().Trim(); +// } +//} + +//#endregion diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/IDE/Structures/DRIVERSTATUS.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/IDE/Structures/DRIVERSTATUS.cs new file mode 100644 index 0000000..e8a15dc --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/IDE/Structures/DRIVERSTATUS.cs @@ -0,0 +1,40 @@ + +namespace iTin.Core.Interop.Windows.Hardware.DriverKit.Storage.Ide +{ + using System.Runtime.InteropServices; + + using BYTE = System.Byte; + using DWORD = System.UInt32; + + /// + /// The DRIVERSTATUS structure is used in conjunction with the SENDCMDOUTPARAMS structure and the request to retrieve data returned by a Self-Monitoring Analysis and Reporting Technology (SMART) command. + /// + /// + /// For more information, please see https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/ntdddisk/ns-ntdddisk-_driverstatus. + /// + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct DRIVERSTATUS + { + /// + /// Error code from driver, or 0 if no error. + /// + public BYTE bDriverError; + + /// + /// Contents of IDE Error register. Only valid when bDriverError is SMART_IDE_ERROR. + /// + public BYTE bIDEStatus; + + /// + /// Reserved for future expansion. + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public BYTE[] bReserved; + + /// + /// Reserved for future expansion. + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public DWORD[] dwReserved; + } +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/IDE/Structures/GETVERSIONINPARAMS.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/IDE/Structures/GETVERSIONINPARAMS.cs new file mode 100644 index 0000000..630c421 --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/IDE/Structures/GETVERSIONINPARAMS.cs @@ -0,0 +1,241 @@ + +namespace iTin.Core.Interop.Windows.Hardware.DriverKit.Storage.Ide +{ + using System; + using System.Runtime.InteropServices; + + using Helpers; + using Helpers.Enumerations; + + using UCHAR = System.Byte; + using ULONG = System.UInt32; + + /// + /// The GETVERSIONINPARAMS structure is used in conjunction with the SMART_GET_VERSION request to retrieve version information, a capabilities mask, and a bitmask for the indicated device. + /// + /// + /// For more information, please see https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/ntdddisk/ns-ntdddisk-_getversioninparams. + /// + [StructLayout(LayoutKind.Sequential)] + public struct GETVERSIONINPARAMS : IEquatable + { + #region public enumerations + + #region [public] (enum) Capabilities: Contains the bitmask of driver capabilities. + /// + /// Contains the bitmask of driver capabilities. + /// + [Flags] + public enum Capabilities : uint + { + /// + /// ATA ID command supported + /// + CAP_ATA_ID_CMD = 1, + + /// + /// ATAPI ID command supported + /// + CAP_ATAPI_ID_CMD = 2, + + /// + /// SMART commannds supported + /// + CAP_SMART_CMD = 4, + } + #endregion + + #region [public] (enum) IdeDeviceLocation: Contains the bitmask of driver capabilities. + /// + /// Contains the bitmask of driver capabilities. + /// + [Flags] + public enum IdeDeviceLocation + { + Unknown = -1, + + IdeMasterPrimaryChannel, + + IdeSlavePrimaryChannel, + + IdeMasterSecondaryChannel, + + IdeSlaveSecondaryChannel, + + AtapiMasterPrimaryChannel, + + AtapiSlavePrimaryChannel, + + AtapiMasterSecondaryChannel, + + AtapiSlaveSecondaryChannel, + } + #endregion + + #endregion + + #region public members + /// + /// Version number of the binary driver. + /// + public UCHAR Version; + + /// + /// Binary controller revision number. + /// + public UCHAR Revision; + + /// + /// Reservad. + /// + public UCHAR Reserved; + + /// + /// Mapeado de dispositivos. + /// + public UCHAR IdeDeviceMap; + + /// + /// Máscara de bits con las capacidades del driver. + /// + [CLSCompliant(false)] + public Capabilities fCapabilities; + + /// + /// Reservado. + /// + [CLSCompliant(false)] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public ULONG[] wReserved; + #endregion + + #region interfaces + + #region [public] (bool) Equals(GETVERSIONINPARAMS): Indicates whether the current structure is the same as another structure of the same type + /// + /// Indicates whether the current structure is the same as another structure of the same type. + /// + /// Structure to be compared with this structure. + /// + /// Returns true if the current structure is equal to the other parameter; otherwise, false. + /// + public bool Equals(GETVERSIONINPARAMS other) => other.Equals((object)this); + #endregion + + #endregion + + #region public operatos + + #region [public] {static} (bool) operator ==(GETVERSIONINPARAMS, GETVERSIONINPARAMS): Implements the equality operator (==) + /// + /// Implements the equality operator (==). + /// + /// Operating 1. + /// Operating 2. + /// + /// Returns true if operator1 is equal to operator2 ; false otherwise. + /// + public static bool operator ==(GETVERSIONINPARAMS left, GETVERSIONINPARAMS right) => left.Equals(right); + #endregion + + #region [public] {static} (bool) operator !=(GETVERSIONINPARAMS, GETVERSIONINPARAMS): Implements the inequality operator (!=) + /// + /// Implements the inequality operator (!=). + /// + /// Operand 1. + /// Operand 2. + /// + /// Returns true if deviceInfo1 is not equal to deviceInfo2; false otherwise. + /// + public static bool operator !=(GETVERSIONINPARAMS left, GETVERSIONINPARAMS right) => !left.Equals(right); + #endregion + + #endregion + + #region public static properties + public static GETVERSIONINPARAMS Empty => new GETVERSIONINPARAMS(); + #endregion + + #region public properties + + #region [public] (IdeDeviceLocation) DeviceLocation: + + public IdeDeviceLocation DeviceLocation + { + get + { + var location = IdeDeviceLocation.Unknown; + for (int i = 0; i <= 7; i++) + { + var found = LogicHelper.CheckBit(IdeDeviceMap, (Bits)i); + if (!found) + { + continue; + } + + location = (IdeDeviceLocation) i; + break; + } + + return location; + } + } + #endregion + + #endregion + + #region public override methods + + #region [public] {override} (int) GetHashCode(): Returns a value that represents the hash code of this structure + /// + /// Returns a value that represents the hash code of this structure. + /// + /// + /// Hash code of this structure. + /// + public override int GetHashCode() => ToString().GetHashCode(); + #endregion + + #region [public] {override} (bool) Equals(object): Returns a value that indicates whether this structure is the same as another + /// + /// Returns a value that indicates whether this structure is the same as another. + /// + /// Structure to compare. + /// + /// Result of the equality comparison. + /// + public override bool Equals(object obj) + { + if (obj == null) + { + return false; + } + + if (!(obj is GETVERSIONINPARAMS)) + { + return false; + } + + var other = (GETVERSIONINPARAMS)obj; + + return + other.Version == Version && + other.Revision == Revision && + other.fCapabilities == fCapabilities && + other.IdeDeviceMap == IdeDeviceMap; + } + #endregion + + #region [public] {override} (string) ToString(): Returns a string that represents the current structure + /// + /// Returns a string that represents the current structure. + /// + /// + /// String representing the current structure. + /// + public override string ToString() => $"Version = {Version}; Revision = {Revision}; Location = {DeviceLocation}"; + #endregion + + #endregion + } +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/IDE/Structures/IDEREGS.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/IDE/Structures/IDEREGS.cs new file mode 100644 index 0000000..e745f9a --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/IDE/Structures/IDEREGS.cs @@ -0,0 +1,57 @@ + +namespace iTin.Core.Interop.Windows.Hardware.DriverKit.Storage.Ide +{ + using System.Runtime.InteropServices; + + using BYTE = System.Byte; + + /// + /// The IDEREGS structure is used to report the contents of the IDE controller registers. + /// + /// + /// For more information, please see https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/ntdddisk/ns-ntdddisk-_ideregs. + /// + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct IDEREGS + { + /// + /// Used for specifying SMART "commands". + /// + public BYTE bFeaturesReg; + + /// + /// IDE sector count register + /// + public BYTE bSectorCountReg; + + /// + /// IDE sector number register + /// + public BYTE bSectorNumberReg; + + /// + /// IDE low order cylinder value + /// + public BYTE bCylLowReg; + + /// + /// IDE high order cylinder value + /// + public BYTE bCylHighReg; + + /// + /// IDE drive/head register + /// + public BYTE bDriveHeadReg; + + /// + /// Actual IDE command. + /// + public BYTE bCommandReg; + + /// + /// Reserved for future use. Must be zero. + /// + public BYTE bReserved; + } +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/IDE/Structures/IDSECTOR.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/IDE/Structures/IDSECTOR.cs new file mode 100644 index 0000000..685052b --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/IDE/Structures/IDSECTOR.cs @@ -0,0 +1,175 @@ + +namespace iTin.Core.Interop.Windows.Hardware.DriverKit.Storage.Ide +{ + using System.Runtime.InteropServices; + + using ULONG = System.UInt32; + using USHORT = System.UInt16; + using BYTE = System.Byte; + using CHAR = System.Char; + + /// + /// + /// + /// + /// Para más información, ver http://msdn.microsoft.com/en-us/library/ff554977%28v=VS.85%29.aspx + /// + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct IDSECTOR + { + /// + /// + /// + public USHORT wGenConfig; + + /// + /// + /// + public USHORT wNumCyls; + + /// + /// + /// + public USHORT wReserved; + + /// + /// + /// + public USHORT wNumHeads; + + /// + /// + /// + public ushort wBytesPerTrack; + + /// + /// + /// + public USHORT wBytesPerSector; + + /// + /// + /// + public USHORT wSectorsPerTrack; + + /// + /// + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public USHORT[] wVendorUnique; + + /// + /// + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)] + public CHAR[] sSerialNumber; + + /// + /// + /// + public USHORT wBufferType; + + /// + /// + /// + public USHORT wBufferSize; + + /// + /// + /// + public USHORT wECCSize; + + /// + /// + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] + public CHAR[] sFirmwareRev; + + /// + /// + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 39)] + public CHAR[] sModelNumber; + + /// + /// + /// + public USHORT wMoreVendorUnique; + + /// + /// + /// + public USHORT wDoubleWordIO; + + /// + /// + /// + public USHORT wCapabilities; + + /// + /// + /// + public USHORT wReserved1; + + /// + /// + /// + public USHORT wPIOTiming; + + /// + /// + /// + public USHORT wDMATiming; + + /// + /// + /// + public USHORT wBS; + + /// + /// + /// + public USHORT wNumCurrentCyls; + + /// + /// + /// + public USHORT wNumCurrentHeads; + + /// + /// + /// + public USHORT wNumCurrentSectorsPerTrack; + + /// + /// + /// + public ULONG ulCurrentSectorCapacity; + + /// + /// + /// + public USHORT wMultSectorStuff; + + /// + /// + /// + public ULONG ulTotalAddressableSectors; + + /// + /// + /// + public USHORT wSingleWordDMA; + + /// + /// + /// + public USHORT wMultiWordDMA; + + /// + /// + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 127)] + public BYTE[] bReserved; + } +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/IDE/Structures/SENDCMDINPARAMS.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/IDE/Structures/SENDCMDINPARAMS.cs new file mode 100644 index 0000000..fc25ab6 --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/IDE/Structures/SENDCMDINPARAMS.cs @@ -0,0 +1,55 @@ + +namespace iTin.Core.Interop.Windows.Hardware.DriverKit.Storage.Ide +{ + using System.Runtime.InteropServices; + + using BYTE = System.Byte; + using DWORD = System.UInt32; + + /// + /// The SENDCMDINPARAMS structure contains the input parameters for the request. + /// + /// + /// The SENDCMDINPARAMS structure is also used with the request . + /// For more information, please see https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/ntdddisk/ns-ntdddisk-_sendcmdinparams. + /// + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct SENDCMDINPARAMS + { + /// + /// Buffer size in bytes. + /// + public DWORD cBufferSize; + + /// + /// Structure that contains the IDE controller register. + /// + public IDEREGS irDriveRegs; + + /// + /// Physical unit number to which the command is sent (0, 1, 2, 3). + /// + /// + /// This opaque ws member. Do not use, the operating system ignores this member, because the physical unit that receives the request depends on the handle that identifies the unit. + /// + public BYTE bDriveNumber; + + /// + /// Reserved for future extensions. + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public BYTE[] bReserved; + + /// + /// Reserved for future extensions. + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public DWORD[] dwReserved; + + /// + /// Pointer to the input buffer. + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] + public BYTE[] bBuffer; + } +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/IDE/Structures/SENDCMDOUTPARAMS.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/IDE/Structures/SENDCMDOUTPARAMS.cs new file mode 100644 index 0000000..8034269 --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/IDE/Structures/SENDCMDOUTPARAMS.cs @@ -0,0 +1,35 @@ + +namespace iTin.Core.Interop.Windows.Hardware.DriverKit.Storage.Ide +{ + using System.Runtime.InteropServices; + + using BYTE = System.Byte; + using DWORD = System.UInt32; + + /// + /// The SENDCMDOUTPARAMS structure is used in conjunction with the request to retrieve data returned by a Self-Monitoring Analysis and Reporting Technology (SMART) command. + /// + /// + /// The SENDCMDOUTPARAMS structure is also used with the request . + /// For more information, see https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/ntdddisk/ns-ntdddisk-_sendcmdoutparams. + /// + [StructLayout(LayoutKind.Sequential)] + public struct SENDCMDOUTPARAMS + { + /// + /// Buffer size in bytes. + /// + public DWORD cBufferSize; + + /// + /// Structure that indicates the status of the driver. + /// + public DRIVERSTATUS DriverStatus; + + /// + /// Pointer to a buffer that stores the data read from the disk. + /// + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] + public BYTE[] bBuffer; + } +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Shared/Enums/DiskIoControlCodes.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Shared/Enums/DiskIoControlCodes.cs new file mode 100644 index 0000000..07889de --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Shared/Enums/DiskIoControlCodes.cs @@ -0,0 +1,49 @@ + +namespace iTin.Core.Interop.Windows.Hardware.DriverKit.Storage +{ + using System; + + // ------------------------------------------------------------------------------- + // | Control Code Format = (type << 16) | function << 2 | method | access << 14) | + // ------------------------------------------------------------------------------- + + /// + /// Códigos de control. + /// + [Flags] + public enum DiskIoControlCode : uint + { + /// + /// Returns version information, capabilities, and a bit mask for the device. + /// This IOCTL must be managed by drivers who support supervision, analysis and Information Technology (SMART). + /// + /// + /// For more information, see https://docs.microsoft.com/en-us/previous-versions/windows/hardware/drivers/ff566202(v=vs.85). + /// + SMART_GET_VERSION = (Constants.IOCTL_DISK_BASE << 16) | (0x0020 << 2) | DeviceMethod.Buffered | (DeviceAccess.Read << 14), + + /// + /// Returns the ATA-2 identify data, the Self-Monitoring Analysis and Reporting Technology (SMART) thresholds, or the SMART attributes for the device. + /// This IOCTL must be handled by drivers that support SMART. + /// + /// + /// For more information, see https://docs.microsoft.com/en-us/previous-versions/windows/hardware/drivers/ff566204(v=vs.85). + /// + SMART_RCV_DRIVE_DATA = (Constants.IOCTL_DISK_BASE << 16) | (0x0022 << 2) | DeviceMethod.Buffered | ((DeviceAccess.Read | DeviceAccess.Write) << 14), + + /// + /// Sends one of the following Self-Monitoring Analysis and Reporting Technology (SMART) commands to the device: + /// Enable or disable reporting on the device + /// Enable or disable autosaving of attributes + /// Save current attributes now + /// Execute offline diagnostics + /// Get current SMART status + /// Write to SMART log + /// This IOCTL must be handled by drivers that support SMART. + /// + /// + /// For more information, see https://docs.microsoft.com/en-us/previous-versions/windows/hardware/drivers/ff566206(v=vs.85). + /// + SMART_SEND_DRIVE_COMMAND = (Constants.IOCTL_DISK_BASE << 16) | (0x0021 << 2) | DeviceMethod.Buffered | ((DeviceAccess.Read | DeviceAccess.Write) << 14), + } +} diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Shared/Enums/IdeIoCodes.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Shared/Enums/IdeIoCodes.cs new file mode 100644 index 0000000..f90bc9b --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Hardware/DriverKit/Storage/Shared/Enums/IdeIoCodes.cs @@ -0,0 +1,31 @@ +using System; + +namespace iTin.Core.Interop.Windows.Hardware.DriverKit.Storage +{ + // ------------------------------------------------------------------------------- + // | Control Code Format = (type << 16) | function << 2 | method | access << 14) | + // ------------------------------------------------------------------------------- + + /// + /// Esta sección contiene información sobre las solicitudes de E / S para dispositivos IDE. + /// + [Flags] + public enum IdeIoControlCode : uint + { + /// + /// Allows an application to send almost any ATA command to a target device. + /// + /// + /// For more information, see https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/ntddscsi/ni-ntddscsi-ioctl_ata_pass_through. + /// + IOCTL_ATA_PASS_THROUGH = (Constants.IOCTL_SCSI_BASE << 16) | (0x040b << 2) | DeviceMethod.Buffered | ((DeviceAccess.Read | DeviceAccess.Write) << 14), + + /// + /// Allows an application to send almost any ATA command to a target device. + /// + /// + /// For more information, see https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/ntddscsi/ni-ntddscsi-ioctl_ata_pass_through_direct. + /// + IOCTL_ATA_PASS_THROUGH_DIRECT = (Constants.IOCTL_SCSI_BASE << 16) | (0x040c << 2) | DeviceMethod.Buffered | ((DeviceAccess.Read | DeviceAccess.Write) << 14), + } +} \ No newline at end of file diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Shared/Constants.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Shared/Constants.cs index df5fb63..a1c2ada 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Shared/Constants.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Shared/Constants.cs @@ -1,7 +1,7 @@  namespace iTin.Core.Interop.Windows { - internal static class Constants + public static class Constants { public const int MAX_PATH = 260; diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/NativeMethods.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Shared/DeviceControlCode.cs similarity index 99% rename from src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/NativeMethods.cs rename to src/lib/iTin.Core/iTin.Core.Interop/Windows/Shared/DeviceControlCode.cs index 0539b81..3f41201 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Development/NativeMethods.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Shared/DeviceControlCode.cs @@ -1,7 +1,8 @@ -using System; - -namespace iTin.Core.Interop.Windows.Development + +namespace iTin.Core.Interop.Windows { + using System; + /// /// /// diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Shared/GUID_DEVCLASS.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Shared/GuidDevClass.cs similarity index 99% rename from src/lib/iTin.Core/iTin.Core.Interop/Windows/Shared/GUID_DEVCLASS.cs rename to src/lib/iTin.Core/iTin.Core.Interop/Windows/Shared/GuidDevClass.cs index 9c5a18c..1dfec8f 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Shared/GUID_DEVCLASS.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Shared/GuidDevClass.cs @@ -3,7 +3,7 @@ namespace iTin.Core.Interop.Windows { using System; - public static class GUID_DEVCLASS + public static class GuidDevClass { public static readonly Guid GUID_DEVCLASS_1394 = new Guid("{0x6bdd1fc1, 0x810f, 0x11d0, {0xbe, 0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f}}"); public static readonly Guid GUID_DEVCLASS_1394DEBUG = new Guid("{0x66f250d6, 0x7801, 0x4a64, {0xb1, 0x39, 0xee, 0xa8, 0x0a, 0x45, 0x0b, 0x24}}"); diff --git a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Shared/SystemErrorCodes.cs b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Shared/Win32ErrorCode.cs similarity index 99% rename from src/lib/iTin.Core/iTin.Core.Interop/Windows/Shared/SystemErrorCodes.cs rename to src/lib/iTin.Core/iTin.Core.Interop/Windows/Shared/Win32ErrorCode.cs index d03b76e..a030424 100644 --- a/src/lib/iTin.Core/iTin.Core.Interop/Windows/Shared/SystemErrorCodes.cs +++ b/src/lib/iTin.Core/iTin.Core.Interop/Windows/Shared/Win32ErrorCode.cs @@ -1,7 +1,7 @@  namespace iTin.Core.Interop.Windows { - static class SystemErrorCode + public static class Win32ErrorCode { public const int INVALID_HANDLE_VALUE = -1; public const int ERROR_ACCESS_DENIED = 5; diff --git a/src/lib/iTin.Core/iTin.Core/Extensions/ReadOnlyCollectionExtensions.cs b/src/lib/iTin.Core/iTin.Core/Extensions/ReadOnlyCollectionExtensions.cs index feb41a5..6ad0994 100644 --- a/src/lib/iTin.Core/iTin.Core/Extensions/ReadOnlyCollectionExtensions.cs +++ b/src/lib/iTin.Core/iTin.Core/Extensions/ReadOnlyCollectionExtensions.cs @@ -82,7 +82,7 @@ public static ReadOnlyCollection Extract(this ReadOnlyCollection dat var subArray = new byte[lenght]; Array.Copy(dataArray, start, subArray, 0x00, lenght); - return new ReadOnlyCollection(subArray); + return new ReadOnlyCollection((byte[])subArray.Clone()); } #endregion diff --git a/src/lib/iTin.Core/iTin.Core/Extensions/TypeExtensions.cs b/src/lib/iTin.Core/iTin.Core/Extensions/TypeExtensions.cs new file mode 100644 index 0000000..5671678 --- /dev/null +++ b/src/lib/iTin.Core/iTin.Core/Extensions/TypeExtensions.cs @@ -0,0 +1,28 @@ + +namespace iTin.Core +{ + using System; + + /// + /// Static class than contains extension methods for a . + /// + public static class TypeExtensions + { + /// + /// Returns default value for specified type. + /// + /// Target type + /// + /// Default value for specified type + /// + public static object GetDefaultValue(this Type t) + { + if (t.IsValueType && Nullable.GetUnderlyingType(t) == null) + { + return Activator.CreateInstance(t); + } + + return null; + } + } +} diff --git a/src/test/iEEDID.ConsoleAppCore/Program.cs b/src/test/iEEDID.ConsoleAppCore/Program.cs index 0156326..b209d34 100644 --- a/src/test/iEEDID.ConsoleAppCore/Program.cs +++ b/src/test/iEEDID.ConsoleAppCore/Program.cs @@ -14,39 +14,35 @@ class Program { static void Main(string[] args) { - Console.WriteLine(@" ——————————————————————————————————————————————————————————————"); - Console.WriteLine(@" Implemented Blocks"); - Console.WriteLine(@" ——————————————————————————————————————————————————————————————"); + Console.WriteLine(@" > Implemented Blocks"); EEDID eedid = EEDID.Parse(MacBookPro2018.IntegratedLaptopPanelEdidTable); DataBlockCollection blocks = eedid.Blocks; foreach (KnownDataBlock block in blocks.ImplementedBlocks) { - Console.WriteLine($@" > {block}"); + Console.WriteLine($@" > {block}"); } foreach (DataBlock block in blocks) { Console.WriteLine(); - Console.WriteLine(@" ——————————————————————————————————————————————————————————————"); - Console.WriteLine($@" {block.Key} Block"); - Console.WriteLine(@" ——————————————————————————————————————————————————————————————"); + Console.WriteLine($@" > {block.Key} Block"); var implSections = eedid.Blocks[block.Key].Sections.ImplementedSections; Console.WriteLine(); - Console.WriteLine(@" > Implemented Sections"); + Console.WriteLine(@" > Implemented Sections"); foreach (Enum section in implSections) { - Console.WriteLine($@" > {GetFriendlyName(section)}"); + Console.WriteLine($@" > {GetFriendlyName(section)}"); } Console.WriteLine(); - Console.WriteLine(@" > Sections detail"); + Console.WriteLine(@" > Sections detail"); BaseDataSectionCollection sections = block.Sections; foreach (DataSection section in sections) { Console.WriteLine(); - Console.WriteLine($@" > {GetFriendlyName(section.Key)} Section"); + Console.WriteLine($@" > {GetFriendlyName(section.Key)} Section"); SectionPropertiesTable sectionProperties = section.Properties.Values; foreach (KeyValuePair property in sectionProperties) @@ -63,79 +59,79 @@ static void Main(string[] args) if (value == null) { - Console.WriteLine($@" > {friendlyName} > NULL"); + Console.WriteLine($@" > {friendlyName} > NULL"); continue; } if (value is string) { - Console.WriteLine($@" > {friendlyName} > {value}{unit}"); + Console.WriteLine($@" > {friendlyName} > {value}{unit}"); } else if (value is bool) { - Console.WriteLine($@" > {friendlyName} > {value}{unit}"); + Console.WriteLine($@" > {friendlyName} > {value}{unit}"); } else if (value is double) { - Console.WriteLine($@" > {friendlyName} > {value}{unit}"); + Console.WriteLine($@" > {friendlyName} > {value}{unit}"); } else if (value is byte) { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X2}h]"); + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X2}h]"); } else if (value is short) { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); } else if (value is ushort) { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); } else if (value is int) { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); } else if (value is uint) { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X4}h]"); } else if (value is long) { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X8}h]"); + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X8}h]"); } else if (value is ulong) { - Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X8}h]"); + Console.WriteLine($@" > {friendlyName} > {value}{unit} [{value:X8}h]"); } else if (value is PointF) { - Console.WriteLine($@" > {friendlyName}"); - Console.WriteLine($@" > X > {((PointF)value).X}"); - Console.WriteLine($@" > Y > {((PointF)value).Y}"); + Console.WriteLine($@" > {friendlyName}"); + Console.WriteLine($@" > X > {((PointF)value).X}"); + Console.WriteLine($@" > Y > {((PointF)value).Y}"); } else if (value.GetType() == typeof(ReadOnlyCollection)) { - Console.WriteLine($@" > {friendlyName} > {string.Join(", ", (ReadOnlyCollection)value)}"); + Console.WriteLine($@" > {friendlyName} > {string.Join(", ", (ReadOnlyCollection)value)}"); } else if (value.GetType() == typeof(ReadOnlyCollection)) { - Console.WriteLine($@" > {friendlyName} > {string.Join(", ", (ReadOnlyCollection)value)}"); + Console.WriteLine($@" > {friendlyName} > {string.Join(", ", (ReadOnlyCollection)value)}"); } else if (value is StandardTimingIdentifierDescriptorItem) { - Console.WriteLine($@" > {(StandardTimingIdentifierDescriptorItem)value}"); + Console.WriteLine($@" > {(StandardTimingIdentifierDescriptorItem)value}"); } else if (value.GetType() == typeof(ReadOnlyCollection)) { var resolutions = (ReadOnlyCollection)value; foreach (MonitorResolutionInfo resolution in resolutions) { - Console.WriteLine($@" > {resolution}"); + Console.WriteLine($@" > {resolution}"); } } else if (value.GetType() == typeof(SectionPropertiesTable)) { - Console.WriteLine($@" > {friendlyName}"); + Console.WriteLine($@" > {friendlyName}"); var dataBlockProperties = (SectionPropertiesTable)value; foreach (KeyValuePair dataBlockProperty in dataBlockProperties) { @@ -149,21 +145,19 @@ static void Main(string[] args) ? string.Empty : dataBlockUnit.ToString(); - Console.WriteLine($@" > {dataName} > {dataValue} {dataUnit}"); + Console.WriteLine($@" > {dataName} > {dataValue} {dataUnit}"); } } else { - Console.WriteLine($@" > {friendlyName} > {value}{unit}"); + Console.WriteLine($@" > {friendlyName} > {value}{unit}"); } } } } Console.WriteLine(); - Console.WriteLine(@" ——————————————————————————————————————————————————————————————"); - Console.WriteLine(@" Gets A Single Property Directly"); - Console.WriteLine(@" ——————————————————————————————————————————————————————————————"); + Console.WriteLine(@" > Gets A Single Property Directly"); DataBlock edidBlock = eedid.Blocks[KnownDataBlock.EDID]; BaseDataSectionCollection edidSections = edidBlock.Sections; @@ -171,7 +165,7 @@ static void Main(string[] args) object gamma = basicDisplaySection.GetPropertyValue(EedidProperty.Edid.BasicDisplay.Gamma); if (gamma != null) { - Console.WriteLine($@" > Gamma > {gamma}"); + Console.WriteLine($@" > Gamma > {gamma}"); } Console.ReadLine();