diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a00394..39e96c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: windows-latest steps: - name: Checkout uses: actions/checkout@v2 @@ -20,7 +20,12 @@ jobs: 5.0.x 6.0.x - name: Decode the Pfx - run: echo "${{ secrets.SIGNING_KEY }}" | base64 --decode > ./sgKey.snk + run: | + $signing_keys_payload = [System.Convert]::FromBase64String("${{ secrets.SIGNING_KEY }}") + $currentDirectory = Get-Location + $certificatePath = Join-Path -Path $currentDirectory -ChildPath "sgKey.snk" + [IO.File]::WriteAllBytes("$certificatePath", $signing_keys_payload) + if (-! $?) { exit 1 } else { exit $LastExitCode } - name: Build run: dotnet build --configuration Release - name: Test diff --git a/Community.Wsl.Sdk/Strategies/NativeMethods/BaseNativeMethods.cs b/Community.Wsl.Sdk/Strategies/NativeMethods/BaseNativeMethods.cs index c07c417..61ad40e 100644 --- a/Community.Wsl.Sdk/Strategies/NativeMethods/BaseNativeMethods.cs +++ b/Community.Wsl.Sdk/Strategies/NativeMethods/BaseNativeMethods.cs @@ -67,14 +67,17 @@ public enum DistroFlags /// No flags are being supplied. /// None = 0x0, + /// /// Allow the distribution to interoperate with Windows processes (for example, the user can invoke "cmd.exe" or "notepad.exe" from within a WSL session). /// EnableInterop = 0x1, + /// /// Add the Windows %PATH% environment variable values to WSL sessions. /// AppendNtPath = 0x2, + /// /// Automatically mount Windows drives inside of WSL sessions (for example, "C:" will be available under "/mnt/c"). /// @@ -112,9 +115,7 @@ int nSize ); public const int STD_INPUT_HANDLE = -10; - public const int STD_OUTPUT_HANDLE = -11; - public const int STD_ERROR_HANDLE = -12; public abstract IntPtr GetStdHandle(int nStdHandle); @@ -123,10 +124,10 @@ int nSize public abstract int WaitForSingleObject(IntPtr hHandle, int dwMilliseconds); - public const int WAIT_ABANDONED = 0x00000080, - WAIT_OBJECT_0 = 0x00000000, - WAIT_TIMEOUT = 0x00000102, - WAIT_FAILED = unchecked((int)0xFFFFFFFF); + public const int WAIT_ABANDONED = 0x00000080; + public const int WAIT_OBJECT_0 = 0x00000000; + public const int WAIT_TIMEOUT = 0x00000102; + public const int WAIT_FAILED = unchecked((int)0xFFFFFFFF); public abstract bool GetExitCodeProcess(IntPtr hProcess, out int lpExitCode); @@ -135,13 +136,11 @@ int nSize [StructLayout(LayoutKind.Sequential)] public struct SECURITY_ATTRIBUTES { - [MarshalAs(UnmanagedType.U4)] - public int nLength; + [MarshalAs(UnmanagedType.U4)] public int nLength; public IntPtr lpSecurityDescriptor; - [MarshalAs(UnmanagedType.Bool)] - public bool bInheritHandle; + [MarshalAs(UnmanagedType.Bool)] public bool bInheritHandle; } public abstract bool DuplicateHandle( @@ -157,10 +156,13 @@ DuplicateOptions dwOptions [Flags] public enum DuplicateOptions : uint { - DUPLICATE_CLOSE_SOURCE = (0x00000001), // Closes the source handle. This occurs regardless of any error status returned. - DUPLICATE_SAME_ACCESS = (0x00000002) //Ignores the dwDesiredAccess parameter. The duplicate handle has the same access as the source handle. + DUPLICATE_CLOSE_SOURCE = + (0x00000001), // Closes the source handle. This occurs regardless of any error status returned. + + DUPLICATE_SAME_ACCESS = + (0x00000002) //Ignores the dwDesiredAccess parameter. The duplicate handle has the same access as the source handle. } public const uint STILL_ACTIVE = 0x00000103; } -} +} \ No newline at end of file diff --git a/README.md b/README.md index c9e21de..aa74ccb 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ features into existing Windows applications. You can enumerate, query, executing ## Supported Operating Systems -- Windows 10 x64 16299 or higher +- Windows 10 x64 16299 or higher - Windows 11 x64 ## How to use @@ -24,6 +24,15 @@ There are two different implementations of `IWslApi`: It's recommended to use the alternative because it's more versatile and easier to use. +## How to install + +This package is available on `nuget.org`: https://www.nuget.org/packages/Community.Wsl.Sdk +You can add a reference using `dotnet / nuget`: + +```shell +dotnet add package Community.Wsl.Sdk +``` + ## API ### WSL Api