Skip to content

Commit

Permalink
Infrastructure Preparation 277
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Jun 6, 2024
1 parent 4a4054e commit 413dc28
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Skylark" Version="3.1.4.2" />
<PackageReference Include="Skylark.Wing" Version="3.1.5.1" />
<PackageReference Include="Skylark.Wing" Version="3.1.5.2" />
</ItemGroup>
</Project>
5 changes: 4 additions & 1 deletion src/Skylark.Wing/Extension/OperatingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,10 @@ public static SWPMV10P MajorVersion10Provider()

private static SWNM.OSVERSIONINFOEX DetectWindowsVersion(SWIIW32API win32ApiProvider)
{
SWNM.OSVERSIONINFOEX osVersionInfo = new() { OSVersionInfoSize = Marshal.SizeOf(typeof(SWNM.OSVERSIONINFOEX)) };
SWNM.OSVERSIONINFOEX osVersionInfo = new()
{
OSVersionInfoSize = Marshal.SizeOf<SWNM.OSVERSIONINFOEX>()
};

if (win32ApiProvider.RtlGetVersion(ref osVersionInfo) != SWNM.NTSTATUS.STATUS_SUCCESS)
{
Expand Down
17 changes: 15 additions & 2 deletions src/Skylark.Wing/Native/Methods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@ public enum SuiteMask : ushort
//VER_SUITE_MULTIUSERTS = 0x00020000
}

/// <summary>
///
/// </summary>
public enum NTSTATUS : uint
{
/// <summary>
Expand All @@ -429,7 +432,17 @@ public enum NTSTATUS : uint
STATUS_SUCCESS = 0x00000000
}

[StructLayout(LayoutKind.Sequential)]
/// <summary>
/// Contains operating system version information. The information includes major and
/// minor version numbers, a build number, a platform identifier, and information about
/// product suites and the latest Service Pack installed on the system.
/// </summary>
/// <example>
/// <code>
/// var osVersionInfo = new OSVERSIONINFOEX { OSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFOEX)) };
/// </code>
/// </example>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct OSVERSIONINFOEX
{
// The OSVersionInfoSize field must be set to Marshal.SizeOf(typeof(OSVERSIONINFOEX))
Expand Down Expand Up @@ -480,7 +493,7 @@ public struct LASTINPUTINFO
/// <param name="fullPathToKey"></param>
/// <param name="valueName"></param>
/// <param name="defaultValue"></param>
public struct RegistryEntry(string fullPathToKey, string valueName, string defaultValue)
public readonly struct RegistryEntry(string fullPathToKey, string valueName, string defaultValue)
{
/// <summary>
/// The name of the name/value pair.
Expand Down
8 changes: 2 additions & 6 deletions src/Skylark.Wing/Provider/Win32APIProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,21 @@ namespace Skylark.Wing.Provider
/// <remarks>CLR wrapper https://github.com/microsoft/referencesource/blob/master/mscorlib/microsoft/win32/win32native.cs </remarks>
public class Win32APIProvider : SWIIW32API
{
private const string NTDLL = "ntdll.dll";

private const string USER32 = "user32.dll";

/// <summary>
///
/// </summary>
/// <param name="versionInfo"></param>
/// <returns></returns>
[SecurityCritical]
[DllImport(NTDLL, EntryPoint = "RtlGetVersion", SetLastError = true, CharSet = CharSet.Unicode)]
[DllImport("ntdll.dll", EntryPoint = "RtlGetVersion", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern SWNM.NTSTATUS ntdll_RtlGetVersion(ref SWNM.OSVERSIONINFOEX versionInfo);

/// <summary>
///
/// </summary>
/// <param name="smIndex"></param>
/// <returns></returns>
[DllImport(USER32, EntryPoint = "GetSystemMetrics")]
[DllImport("user32.dll", EntryPoint = "GetSystemMetrics")]
internal static extern int ntdll_GetSystemMetrics(SWNM.SystemMetric smIndex);

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Skylark.Wing/Skylark.Wing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// Website: www.Vegalya.com
// Created: 17.Jun.2023
// Changed: 06.Jun.2024
// Version: 3.1.5.2
// Version: 3.1.5.3
//
// |---------DO-NOT-REMOVE---------|

Expand Down
2 changes: 1 addition & 1 deletion src/Skylark.Wing/Skylark.Wing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<PropertyGroup>
<ApplicationIcon>Resources\Skylark.Wing.ico</ApplicationIcon>
<Version>3.1.5.2</Version>
<Version>3.1.5.3</Version>
<AssemblyVersion>$(Version)</AssemblyVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Title>Skylark.Wing</Title>
Expand Down

0 comments on commit 413dc28

Please sign in to comment.