diff --git a/AppType.cs b/AppType.cs new file mode 100644 index 0000000..8c27002 --- /dev/null +++ b/AppType.cs @@ -0,0 +1,33 @@ +/* +* MIT License +* +* Copyright (c) 2024 The DuoWOA authors +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ +namespace UnifiedFlashingPlatform +{ + public enum AppType : byte + { + Min, + UEFI, + BOOT, + Max + }; +} \ No newline at end of file diff --git a/DeviceLogType.cs b/DeviceLogType.cs new file mode 100644 index 0000000..bde23d6 --- /dev/null +++ b/DeviceLogType.cs @@ -0,0 +1,33 @@ +/* +* MIT License +* +* Copyright (c) 2024 The DuoWOA authors +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ +namespace UnifiedFlashingPlatform +{ + public enum DeviceLogType + { + Min, + Flashing, + Servicing, + Max + } +} \ No newline at end of file diff --git a/DeviceTargetingInfo.cs b/DeviceTargetingInfo.cs new file mode 100644 index 0000000..fb0d5c3 --- /dev/null +++ b/DeviceTargetingInfo.cs @@ -0,0 +1,47 @@ +/* +* MIT License +* +* Copyright (c) 2024 The DuoWOA authors +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ +namespace UnifiedFlashingPlatform +{ + public struct DeviceTargetingInfo + { + public string Manufacturer; + public string Family; + public string ProductName; + public string ProductVersion; + public string SKUNumber; + public string BaseboardManufacturer; + public string BaseboardProduct; + + public override readonly string ToString() + { + return "Manufacturer: " + Manufacturer + + " - Family: " + Family + + " - Product Name: " + ProductName + + " - Product Version: " + ProductVersion + + " - SKU Number: " + SKUNumber + + " - Baseboard Manufacturer: " + BaseboardManufacturer + + " - Baseboard Product: " + BaseboardProduct; + } + } +} \ No newline at end of file diff --git a/FlashAppInfo.cs b/FlashAppInfo.cs new file mode 100644 index 0000000..3914521 --- /dev/null +++ b/FlashAppInfo.cs @@ -0,0 +1,41 @@ +/* +* MIT License +* +* Copyright (c) 2024 The DuoWOA authors +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ +namespace UnifiedFlashingPlatform +{ + public struct FlashAppInfo + { + public byte ProtocolMajorVersion; + public byte ProtocolMinorVersion; + public byte ImplementationMajorVersion; + public byte ImplementationMinorVersion; + + public override readonly string ToString() + { + return "ProtocolMajorVersion: " + ProtocolMajorVersion + + " - ProtocolMinorVersion: " + ProtocolMinorVersion + + " - ImplementationMajorVersion: " + ImplementationMajorVersion + + " - ImplementationMinorVersion: " + ImplementationMinorVersion; + } + } +} \ No newline at end of file diff --git a/Mode.cs b/Mode.cs new file mode 100644 index 0000000..ca1304d --- /dev/null +++ b/Mode.cs @@ -0,0 +1,31 @@ +/* +* MIT License +* +* Copyright (c) 2024 The DuoWOA authors +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ +namespace UnifiedFlashingPlatform +{ + public enum Mode : byte + { + DiagnosticMode, + Max + } +} \ No newline at end of file diff --git a/ResetProtectionInfo.cs b/ResetProtectionInfo.cs new file mode 100644 index 0000000..9d7cdaa --- /dev/null +++ b/ResetProtectionInfo.cs @@ -0,0 +1,39 @@ +/* +* MIT License +* +* Copyright (c) 2024 The DuoWOA authors +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ +namespace UnifiedFlashingPlatform +{ + public struct ResetProtectionInfo + { + public bool IsResetProtectionEnabled; + public uint MajorVersion; + public uint MinorVersion; + + public override readonly string ToString() + { + return "IsResetProtectionEnabled: " + IsResetProtectionEnabled + + " - MajorVersion: " + MajorVersion + + " - MinorVersion: " + MinorVersion; + } + } +} \ No newline at end of file diff --git a/USBSpeed.cs b/USBSpeed.cs new file mode 100644 index 0000000..2423744 --- /dev/null +++ b/USBSpeed.cs @@ -0,0 +1,37 @@ +/* +* MIT License +* +* Copyright (c) 2024 The DuoWOA authors +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ +namespace UnifiedFlashingPlatform +{ + public struct USBSpeed + { + public byte CurrentUSBSpeed; + public byte MaxUSBSpeed; + + public override readonly string ToString() + { + return "CurrentUSBSpeed: " + CurrentUSBSpeed + + " - MaxUSBSpeed: " + MaxUSBSpeed; + } + } +} \ No newline at end of file diff --git a/UefiVariable.cs b/UefiVariable.cs new file mode 100644 index 0000000..4afc516 --- /dev/null +++ b/UefiVariable.cs @@ -0,0 +1,41 @@ +/* +* MIT License +* +* Copyright (c) 2024 The DuoWOA authors +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ +using System; + +namespace UnifiedFlashingPlatform +{ + public struct UefiVariable + { + public UefiVariableAttributes Attributes; + public uint DataSize; + public byte[] Data; + + public override readonly string ToString() + { + return "Attributes: " + Attributes + + " - DataSize: " + DataSize + + " - Data: " + BitConverter.ToString(Data); + } + } +} \ No newline at end of file diff --git a/UefiVariableAttributes.cs b/UefiVariableAttributes.cs new file mode 100644 index 0000000..7676e71 --- /dev/null +++ b/UefiVariableAttributes.cs @@ -0,0 +1,41 @@ +/* +* MIT License +* +* Copyright (c) 2024 The DuoWOA authors +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in all +* copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +*/ +using System; + +namespace UnifiedFlashingPlatform +{ + [Flags] + public enum UefiVariableAttributes : uint + { + EfiVariableNone, + EfiVariableNonVolatile, + EfiVariableBootServiceAccess, + EfiVariableRuntimeAccess = 4U, + EfiVariableHardwareErrorRecord = 8U, + EfiVariableAuthenticatedWriteAccess = 16U, + EfiVariableTimeBasedAuthenticatedWriteAccess = 32U, + EfiVariableAppendWrite = 64U, + EfiVariableEnhancedAuthenticatedAccess = 128U + } +} \ No newline at end of file diff --git a/UnifiedFlashingPlatformTransport.cs b/UnifiedFlashingPlatformTransport.cs index 8e32d3d..08d012a 100644 --- a/UnifiedFlashingPlatformTransport.cs +++ b/UnifiedFlashingPlatformTransport.cs @@ -125,14 +125,6 @@ namespace UnifiedFlashingPlatform return Encoding.ASCII.GetString(Bytes).Trim('\0'); } - public enum AppType : byte - { - Min, - UEFI, - BOOT, - Max - }; - public AppType ReadAppType() { byte[] Bytes = ReadParam("APPT"); @@ -149,20 +141,6 @@ namespace UnifiedFlashingPlatform return AppType.Min; } - public struct ResetProtectionInfo - { - public bool IsResetProtectionEnabled; - public uint MajorVersion; - public uint MinorVersion; - - public override readonly string ToString() - { - return "IsResetProtectionEnabled: " + IsResetProtectionEnabled + - " - MajorVersion: " + MajorVersion + - " - MinorVersion: " + MinorVersion; - } - } - public ResetProtectionInfo? ReadResetProtection() { byte[] Bytes = ReadParam("ATRP"); @@ -263,28 +241,6 @@ namespace UnifiedFlashingPlatform return ReadStringParam("DPR\0"); } - public struct DeviceTargetingInfo - { - public string Manufacturer; - public string Family; - public string ProductName; - public string ProductVersion; - public string SKUNumber; - public string BaseboardManufacturer; - public string BaseboardProduct; - - public override readonly string ToString() - { - return "Manufacturer: " + Manufacturer + - " - Family: " + Family + - " - Product Name: " + ProductName + - " - Product Version: " + ProductVersion + - " - SKU Number: " + SKUNumber + - " - Baseboard Manufacturer: " + BaseboardManufacturer + - " - Baseboard Product: " + BaseboardProduct; - } - } - public DeviceTargetingInfo? ReadDeviceTargetInfo() { byte[] Bytes = ReadParam("DTI\0"); @@ -398,22 +354,6 @@ namespace UnifiedFlashingPlatform return BitConverter.ToUInt32(Bytes.Reverse().ToArray()); } - public struct FlashAppInfo - { - public byte ProtocolMajorVersion; - public byte ProtocolMinorVersion; - public byte ImplementationMajorVersion; - public byte ImplementationMinorVersion; - - public override readonly string ToString() - { - return "ProtocolMajorVersion: " + ProtocolMajorVersion + - " - ProtocolMinorVersion: " + ProtocolMinorVersion + - " - ImplementationMajorVersion: " + ImplementationMajorVersion + - " - ImplementationMinorVersion: " + ImplementationMinorVersion; - } - } - public FlashAppInfo? ReadFlashAppInfo() { byte[] Bytes = ReadParam("FAI\0"); @@ -494,34 +434,6 @@ namespace UnifiedFlashingPlatform return Bytes[0] == 1; } - [Flags] - public enum UefiVariableAttributes : uint - { - EfiVariableNone, - EfiVariableNonVolatile, - EfiVariableBootServiceAccess, - EfiVariableRuntimeAccess = 4U, - EfiVariableHardwareErrorRecord = 8U, - EfiVariableAuthenticatedWriteAccess = 16U, - EfiVariableTimeBasedAuthenticatedWriteAccess = 32U, - EfiVariableAppendWrite = 64U, - EfiVariableEnhancedAuthenticatedAccess = 128U - } - - public struct UefiVariable - { - public UefiVariableAttributes Attributes; - public uint DataSize; - public byte[] Data; - - public override readonly string ToString() - { - return "Attributes: " + Attributes + - " - DataSize: " + DataSize + - " - Data: " + BitConverter.ToString(Data); - } - } - public UefiVariable? ReadUEFIVariable(Guid Guid, string Name, uint Size) { byte[] Request = new byte[39 + (Name.Length + 1) * 2]; @@ -601,14 +513,6 @@ namespace UnifiedFlashingPlatform return BitConverter.ToUInt64(Bytes.Reverse().ToArray()); } - public enum DeviceLogType - { - Min, - Flashing, - Servicing, - Max - } - public UInt64? ReadLogSize(DeviceLogType LogType) { byte[] Request = new byte[0x10]; @@ -640,12 +544,6 @@ namespace UnifiedFlashingPlatform return ReadStringParam("MAC\0"); } - public enum Mode : byte - { - DiagnosticMode, - Max - } - public UInt32? ReadModeData(Mode Mode) { byte[] Request = new byte[0x10]; @@ -781,18 +679,6 @@ namespace UnifiedFlashingPlatform return ReadStringParam("UKTF"); } - public struct USBSpeed - { - public byte CurrentUSBSpeed; - public byte MaxUSBSpeed; - - public override readonly string ToString() - { - return "CurrentUSBSpeed: " + CurrentUSBSpeed + - " - MaxUSBSpeed: " + MaxUSBSpeed; - } - } - public USBSpeed? ReadUSBSpeed() { byte[] Bytes = ReadParam("USBS");