From 28c209dc488dc695838ae17dd6840a64d253eb02 Mon Sep 17 00:00:00 2001 From: Krzysztof Wicher Date: Thu, 11 Apr 2019 12:20:40 -0700 Subject: [PATCH] Nullable: Interop: Kernel32 and few others (#23880) * Nullable: Interop: Kernel32 and few others * fix compile errors (new compiler) * address feedback --- .../BCrypt/Interop.BCryptGenRandom.GetRandomBytes.cs | 1 + .../Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs | 1 + .../shared/Interop/Windows/BCrypt/Interop.NTSTATUS.cs | 1 + .../Windows/Crypt32/Interop.CryptProtectMemory.cs | 1 + .../Kernel32/Interop.CREATEFILE2_EXTENDED_PARAMETERS.cs | 1 + .../Interop/Windows/Kernel32/Interop.CancelIoEx.cs | 1 + .../Interop/Windows/Kernel32/Interop.CloseHandle.cs | 1 + .../Interop/Windows/Kernel32/Interop.Constants.cs | 1 + .../Interop/Windows/Kernel32/Interop.CreateFile.cs | 7 +++++-- .../Interop/Windows/Kernel32/Interop.CreateFile2.cs | 1 + .../Kernel32/Interop.ExpandEnvironmentStrings.cs | 1 + .../Interop/Windows/Kernel32/Interop.FileAttributes.cs | 1 + .../Interop/Windows/Kernel32/Interop.FileTypes.cs | 1 + .../Interop/Windows/Kernel32/Interop.FindClose.cs | 1 + .../Interop/Windows/Kernel32/Interop.FindFirstFileEx.cs | 7 +++++-- .../Windows/Kernel32/Interop.FlushFileBuffers.cs | 1 + .../Interop/Windows/Kernel32/Interop.FormatMessage.cs | 1 + .../Windows/Kernel32/Interop.FreeEnvironmentStrings.cs | 1 + .../Interop/Windows/Kernel32/Interop.FreeLibrary.cs | 1 + .../Interop/Windows/Kernel32/Interop.GetCPInfo.cs | 1 + .../Interop/Windows/Kernel32/Interop.GetComputerName.cs | 3 ++- .../Windows/Kernel32/Interop.GetCurrentDirectory.cs | 1 + .../Windows/Kernel32/Interop.GetCurrentProcessId.cs | 1 + .../Kernel32/Interop.GetCurrentProcess_IntPtr.cs | 1 + .../Windows/Kernel32/Interop.GetEnvironmentStrings.cs | 1 + .../Windows/Kernel32/Interop.GetEnvironmentVariable.cs | 1 + .../Windows/Kernel32/Interop.GetFileAttributesEx.cs | 11 +++++++---- .../Kernel32/Interop.GetFileInformationByHandleEx.cs | 1 + .../Windows/Kernel32/Interop.GetFileType_SafeHandle.cs | 1 + .../Windows/Kernel32/Interop.GetFullPathNameW.cs | 1 + .../Windows/Kernel32/Interop.GetLogicalDrives.cs | 1 + .../Windows/Kernel32/Interop.GetLongPathNameW.cs | 1 + .../Interop/Windows/Kernel32/Interop.GetProcessTimes.cs | 3 ++- .../Interop/Windows/Kernel32/Interop.GetStdHandle.cs | 1 + .../Windows/Kernel32/Interop.GetSystemDirectoryW.cs | 1 + .../Interop/Windows/Kernel32/Interop.GetSystemInfo.cs | 1 + .../Interop/Windows/Kernel32/Interop.GetSystemTimes.cs | 3 ++- .../Windows/Kernel32/Interop.GetTempFileNameW.cs | 1 + .../Interop/Windows/Kernel32/Interop.GetTempPathW.cs | 1 + .../Interop/Windows/Kernel32/Interop.GetVersionExW.cs | 1 + .../Windows/Kernel32/Interop.GlobalMemoryStatusEx.cs | 1 + .../Interop/Windows/Kernel32/Interop.Globalization.cs | 7 ++++--- .../Interop/Windows/Kernel32/Interop.HandleTypes.cs | 1 + .../Windows/Kernel32/Interop.IsWow64Process_IntPtr.cs | 1 + .../Interop/Windows/Kernel32/Interop.LoadLibraryEx.cs | 1 + .../Interop/Windows/Kernel32/Interop.LocalAlloc.cs | 1 + .../shared/Interop/Windows/Kernel32/Interop.LockFile.cs | 1 + .../shared/Interop/Windows/Kernel32/Interop.MAX_PATH.cs | 1 + .../Interop/Windows/Kernel32/Interop.MEMORYSTATUSEX.cs | 1 + .../Kernel32/Interop.MEMORY_BASIC_INFORMATION.cs | 1 + .../shared/Interop/Windows/Kernel32/Interop.MUI.cs | 1 + .../Windows/Kernel32/Interop.MultiByteToWideChar.cs | 1 + .../Interop/Windows/Kernel32/Interop.OSVERSIONINFOEX.cs | 1 + .../Windows/Kernel32/Interop.OutputDebugString.cs | 1 + .../Windows/Kernel32/Interop.QueryPerformanceCounter.cs | 1 + .../Kernel32/Interop.QueryPerformanceFrequency.cs | 1 + .../Kernel32/Interop.QueryUnbiasedInterruptTime.cs | 1 + .../Kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs | 1 + .../Interop.ReadFile_SafeHandle_NativeOverlapped.cs | 1 + .../Windows/Kernel32/Interop.ResolveLocaleName.cs | 1 + .../Windows/Kernel32/Interop.SECURITY_ATTRIBUTES.cs | 1 + .../Interop/Windows/Kernel32/Interop.SYSTEM_INFO.cs | 1 + .../Interop/Windows/Kernel32/Interop.SecurityOptions.cs | 1 + .../Windows/Kernel32/Interop.SetCurrentDirectory.cs | 1 + .../Interop/Windows/Kernel32/Interop.SetEndOfFile.cs | 1 + .../Windows/Kernel32/Interop.SetEnvironmentVariable.cs | 3 ++- .../Windows/Kernel32/Interop.SetFilePointerEx.cs | 1 + .../Windows/Kernel32/Interop.SetThreadErrorMode.cs | 1 + .../Windows/Kernel32/Interop.TimeZone.Registry.cs | 1 + .../shared/Interop/Windows/Kernel32/Interop.TimeZone.cs | 1 + .../Windows/Kernel32/Interop.VerSetConditionMask.cs | 1 + .../Windows/Kernel32/Interop.VerifyVersionExW.cs | 1 + .../Interop/Windows/Kernel32/Interop.VirtualAlloc.cs | 1 + .../Interop/Windows/Kernel32/Interop.VirtualFree.cs | 1 + .../Interop/Windows/Kernel32/Interop.VirtualQuery.cs | 1 + .../Windows/Kernel32/Interop.WideCharToMultiByte.cs | 1 + .../Kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs | 1 + .../Interop.WriteFile_SafeHandle_NativeOverlapped.cs | 1 + .../shared/Interop/Windows/Normaliz/Interop.Idna.cs | 1 + .../Interop/Windows/Normaliz/Interop.Normalization.cs | 3 ++- .../Windows/NtDll/Interop.NtQuerySystemInformation.cs | 1 + .../Interop/Windows/NtDll/NtQueryInformationFile.cs | 1 + .../Interop/Windows/Ole32/Interop.CoCreateGuid.cs | 1 + .../Interop/Windows/Ole32/Interop.CoTaskMemAlloc.cs | 1 + .../Windows/OleAut32/Interop.SysAllocStringByteLen.cs | 3 ++- .../Windows/OleAut32/Interop.SysAllocStringLen.cs | 3 ++- .../Interop/Windows/OleAut32/Interop.SysFreeString.cs | 1 + .../Interop/Windows/OleAut32/Interop.SysStringLen.cs | 1 + .../Interop/Windows/Secur32/Interop.GetUserNameExW.cs | 1 + .../Windows/Shell32/Interop.SHGetKnownFolderPath.cs | 1 + .../shared/Interop/Windows/User32/Interop.Constants.cs | 1 + .../shared/Interop/Windows/User32/Interop.LoadString.cs | 1 + .../Windows/User32/Interop.SendMessageTimeout.cs | 1 + .../shared/System/IO/FileStream.Win32.cs | 1 + .../shared/System/IO/PathInternal.Windows.cs | 17 ----------------- 95 files changed, 118 insertions(+), 35 deletions(-) diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/BCrypt/Interop.BCryptGenRandom.GetRandomBytes.cs b/src/System.Private.CoreLib/shared/Interop/Windows/BCrypt/Interop.BCryptGenRandom.GetRandomBytes.cs index 4d75163..50bc528 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/BCrypt/Interop.BCryptGenRandom.GetRandomBytes.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/BCrypt/Interop.BCryptGenRandom.GetRandomBytes.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Diagnostics; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs b/src/System.Private.CoreLib/shared/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs index 9d072a3..d877dd2 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Diagnostics; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/BCrypt/Interop.NTSTATUS.cs b/src/System.Private.CoreLib/shared/Interop/Windows/BCrypt/Interop.NTSTATUS.cs index 29aaa29..74079f8 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/BCrypt/Interop.NTSTATUS.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/BCrypt/Interop.NTSTATUS.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; internal partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Crypt32/Interop.CryptProtectMemory.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Crypt32/Interop.CryptProtectMemory.cs index b10cb6a..a60dc8e 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Crypt32/Interop.CryptProtectMemory.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Crypt32/Interop.CryptProtectMemory.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; using System.Security; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CREATEFILE2_EXTENDED_PARAMETERS.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CREATEFILE2_EXTENDED_PARAMETERS.cs index 16365ee..3330d32 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CREATEFILE2_EXTENDED_PARAMETERS.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CREATEFILE2_EXTENDED_PARAMETERS.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using Microsoft.Win32.SafeHandles; using System; using System.IO; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CancelIoEx.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CancelIoEx.cs index fc99e30..85809e1 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CancelIoEx.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CancelIoEx.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using Microsoft.Win32.SafeHandles; using System.Runtime.InteropServices; using System.Threading; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CloseHandle.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CloseHandle.cs index ff41f93..fd19416 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CloseHandle.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CloseHandle.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.Constants.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.Constants.cs index b13cdfd..dc7dfef 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.Constants.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.Constants.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable internal static partial class Interop { internal static partial class Kernel32 diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile.cs index 9ee1e16..99ef2b2 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile.cs @@ -2,8 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using Microsoft.Win32.SafeHandles; using System; +using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; @@ -33,8 +35,9 @@ internal partial class Interop int dwFlagsAndAttributes, IntPtr hTemplateFile) { - lpFileName = PathInternal.EnsureExtendedPrefixOverMaxPath(lpFileName); - return CreateFilePrivate(lpFileName, dwDesiredAccess, dwShareMode, ref securityAttrs, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); + string? lpFileNameWithPrefix = PathInternal.EnsureExtendedPrefixIfNeeded(lpFileName); + Debug.Assert(lpFileNameWithPrefix != null, "null not expected when non-null passed"); // TODO-NULLABLE: https://github.com/dotnet/roslyn/issues/26761 + return CreateFilePrivate(lpFileNameWithPrefix, dwDesiredAccess, dwShareMode, ref securityAttrs, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); } } } diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs index ddc18f6..fc98061 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using Microsoft.Win32.SafeHandles; using System.IO; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ExpandEnvironmentStrings.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ExpandEnvironmentStrings.cs index ce3db6f..67804d4 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ExpandEnvironmentStrings.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ExpandEnvironmentStrings.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FileAttributes.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FileAttributes.cs index 725a25a..8103870 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FileAttributes.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FileAttributes.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable internal partial class Interop { internal partial class Kernel32 diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FileTypes.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FileTypes.cs index 9d52f1f..a4330f5 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FileTypes.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FileTypes.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable internal partial class Interop { internal partial class Kernel32 diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FindClose.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FindClose.cs index fcf9254..de11958 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FindClose.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FindClose.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using Microsoft.Win32.SafeHandles; using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FindFirstFileEx.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FindFirstFileEx.cs index dcb86ec..80fb2e7 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FindFirstFileEx.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FindFirstFileEx.cs @@ -2,8 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using Microsoft.Win32.SafeHandles; using System; +using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; @@ -19,10 +21,11 @@ internal partial class Interop internal static SafeFindHandle FindFirstFile(string fileName, ref WIN32_FIND_DATA data) { - fileName = PathInternal.EnsureExtendedPrefixIfNeeded(fileName); + string? fileNameWithPrefix = PathInternal.EnsureExtendedPrefixIfNeeded(fileName); + Debug.Assert(fileNameWithPrefix != null, "null not expected when non-null passed"); // TODO-NULLABLE: https://github.com/dotnet/roslyn/issues/26761 // use FindExInfoBasic since we don't care about short name and it has better perf - return FindFirstFileExPrivate(fileName, FINDEX_INFO_LEVELS.FindExInfoBasic, ref data, FINDEX_SEARCH_OPS.FindExSearchNameMatch, IntPtr.Zero, 0); + return FindFirstFileExPrivate(fileNameWithPrefix, FINDEX_INFO_LEVELS.FindExInfoBasic, ref data, FINDEX_SEARCH_OPS.FindExSearchNameMatch, IntPtr.Zero, 0); } internal enum FINDEX_INFO_LEVELS : uint diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FlushFileBuffers.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FlushFileBuffers.cs index e10a227..5d0f0dc 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FlushFileBuffers.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FlushFileBuffers.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using Microsoft.Win32.SafeHandles; using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FormatMessage.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FormatMessage.cs index 09001e8..bfa4081 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FormatMessage.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FormatMessage.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FreeEnvironmentStrings.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FreeEnvironmentStrings.cs index c372a85..7c317e2 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FreeEnvironmentStrings.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FreeEnvironmentStrings.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FreeLibrary.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FreeLibrary.cs index c708653..b6b8ed6 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FreeLibrary.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FreeLibrary.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCPInfo.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCPInfo.cs index 8d523e4..98537ec 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCPInfo.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCPInfo.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetComputerName.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetComputerName.cs index 34a26c1..620fe83 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetComputerName.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetComputerName.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; @@ -15,7 +16,7 @@ internal partial class Interop // maximum length of the NETBIOS name (not including NULL) private const int MAX_COMPUTERNAME_LENGTH = 15; - internal static unsafe string GetComputerName() + internal static unsafe string? GetComputerName() { Span buffer = stackalloc char[MAX_COMPUTERNAME_LENGTH + 1]; uint length = (uint)buffer.Length; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentDirectory.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentDirectory.cs index 611cc70..2f2eb48 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentDirectory.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentDirectory.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentProcessId.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentProcessId.cs index 3a1a353..b71fb4e 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentProcessId.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentProcessId.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentProcess_IntPtr.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentProcess_IntPtr.cs index c993519..7b9ea66 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentProcess_IntPtr.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentProcess_IntPtr.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetEnvironmentStrings.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetEnvironmentStrings.cs index 29a6860..9d25bed 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetEnvironmentStrings.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetEnvironmentStrings.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetEnvironmentVariable.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetEnvironmentVariable.cs index 13adefc..d591219 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetEnvironmentVariable.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetEnvironmentVariable.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileAttributesEx.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileAttributesEx.cs index 181fb10..6244049 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileAttributesEx.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileAttributesEx.cs @@ -2,8 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using Microsoft.Win32.SafeHandles; using System; +using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; @@ -19,8 +21,9 @@ internal partial class Interop internal static bool GetFileAttributesEx(string name, GET_FILEEX_INFO_LEVELS fileInfoLevel, ref WIN32_FILE_ATTRIBUTE_DATA lpFileInformation) { - name = PathInternal.EnsureExtendedPrefixOverMaxPath(name); - return GetFileAttributesExPrivate(name, fileInfoLevel, ref lpFileInformation); + string? nameWithExtendedPrefix = PathInternal.EnsureExtendedPrefixIfNeeded(name); + Debug.Assert(nameWithExtendedPrefix != null, "null not expected when non-null is passed"); // TODO-NULLABLE: https://github.com/dotnet/roslyn/issues/26761 + return GetFileAttributesExPrivate(nameWithExtendedPrefix, fileInfoLevel, ref lpFileInformation); } internal enum GET_FILEEX_INFO_LEVELS : uint @@ -69,9 +72,9 @@ internal partial class Interop internal uint dwReserved0; internal uint dwReserved1; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] - internal string cFileName; + internal string? cFileName; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)] - internal string cAlternateFileName; + internal string? cAlternateFileName; } internal struct FILE_TIME diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileInformationByHandleEx.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileInformationByHandleEx.cs index 1106cff..78c9e70 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileInformationByHandleEx.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileInformationByHandleEx.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using Microsoft.Win32.SafeHandles; using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileType_SafeHandle.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileType_SafeHandle.cs index faa57cc..3f9e627 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileType_SafeHandle.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileType_SafeHandle.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using Microsoft.Win32.SafeHandles; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFullPathNameW.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFullPathNameW.cs index 197b0a9..38b7cdd 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFullPathNameW.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFullPathNameW.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetLogicalDrives.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetLogicalDrives.cs index 657188f..c69f7d3 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetLogicalDrives.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetLogicalDrives.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetLongPathNameW.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetLongPathNameW.cs index 81b4d09..dd497bf 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetLongPathNameW.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetLongPathNameW.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetProcessTimes.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetProcessTimes.cs index 22ec793..7b72ca7 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetProcessTimes.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetProcessTimes.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; @@ -12,4 +13,4 @@ internal partial class Interop [DllImport(Libraries.Kernel32, SetLastError = true)] internal extern static bool GetProcessTimes(IntPtr handleProcess, out long creation, out long exit, out long kernel, out long user); } -} \ No newline at end of file +} diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetStdHandle.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetStdHandle.cs index f2b54c9..ae54f64 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetStdHandle.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetStdHandle.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemDirectoryW.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemDirectoryW.cs index 197f6f5..a7cd273 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemDirectoryW.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemDirectoryW.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal static partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemInfo.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemInfo.cs index cbf07ea..5621055 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemInfo.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemInfo.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTimes.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTimes.cs index ff26978..12d5a4a 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTimes.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTimes.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; @@ -12,4 +13,4 @@ internal partial class Interop [DllImport(Libraries.Kernel32, SetLastError = true)] internal extern static bool GetSystemTimes(out long idle, out long kernel, out long user); } -} \ No newline at end of file +} diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetTempFileNameW.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetTempFileNameW.cs index 97e1d82..0afc448 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetTempFileNameW.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetTempFileNameW.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetTempPathW.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetTempPathW.cs index 7f7bb77..68ff9ac 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetTempPathW.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetTempPathW.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetVersionExW.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetVersionExW.cs index 13a997a..ab79ed2 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetVersionExW.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetVersionExW.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GlobalMemoryStatusEx.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GlobalMemoryStatusEx.cs index 6a87ec3..99dde85 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GlobalMemoryStatusEx.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GlobalMemoryStatusEx.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.Globalization.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.Globalization.cs index 80b52e6..1797cec 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.Globalization.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.Globalization.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; @@ -40,7 +41,7 @@ internal static partial class Interop [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] internal static extern unsafe int LCMapStringEx( - string lpLocaleName, + string? lpLocaleName, uint dwMapFlags, char* lpSrcStr, int cchSrc, @@ -102,7 +103,7 @@ internal static partial class Interop #if !ENABLE_WINRT [DllImport("Kernel32.dll", CharSet = CharSet.Auto)] - internal static extern bool GetUserPreferredUILanguages(uint dwFlags, out uint pulNumLanguages, char [] pwszLanguagesBuffer, ref uint pcchLanguagesBuffer); + internal static extern bool GetUserPreferredUILanguages(uint dwFlags, out uint pulNumLanguages, char[]? pwszLanguagesBuffer, ref uint pcchLanguagesBuffer); #endif //!ENABLE_WINRT [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] @@ -125,7 +126,7 @@ internal static partial class Interop internal static extern int GetCalendarInfoEx(string lpLocaleName, uint Calendar, IntPtr lpReserved, uint CalType, IntPtr lpCalData, int cchData, IntPtr lpValue); [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] - internal static extern bool EnumCalendarInfoExEx(EnumCalendarInfoProcExEx pCalInfoEnumProcExEx, string lpLocaleName, uint Calendar, string lpReserved, uint CalType, void* lParam); + internal static extern bool EnumCalendarInfoExEx(EnumCalendarInfoProcExEx pCalInfoEnumProcExEx, string lpLocaleName, uint Calendar, string? lpReserved, uint CalType, void* lParam); internal delegate BOOL EnumCalendarInfoProcExEx(char* lpCalendarInfoString, uint Calendar, IntPtr lpReserved, void* lParam); diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.HandleTypes.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.HandleTypes.cs index c2096aa..51f7c92 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.HandleTypes.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.HandleTypes.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable internal partial class Interop { internal partial class Kernel32 diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.IsWow64Process_IntPtr.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.IsWow64Process_IntPtr.cs index 7953da6..5d06478 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.IsWow64Process_IntPtr.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.IsWow64Process_IntPtr.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LoadLibraryEx.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LoadLibraryEx.cs index 4eef585..c3c6fcc 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LoadLibraryEx.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LoadLibraryEx.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using Microsoft.Win32.SafeHandles; using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LocalAlloc.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LocalAlloc.cs index 9c74adb..55f76b4 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LocalAlloc.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LocalAlloc.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LockFile.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LockFile.cs index a21d00f..7d0a55c 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LockFile.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LockFile.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using Microsoft.Win32.SafeHandles; using System; using System.IO; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MAX_PATH.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MAX_PATH.cs index f7fa326..0a05230 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MAX_PATH.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MAX_PATH.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable internal partial class Interop { internal partial class Kernel32 diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MEMORYSTATUSEX.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MEMORYSTATUSEX.cs index 45f57aa..8ddac8e 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MEMORYSTATUSEX.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MEMORYSTATUSEX.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MEMORY_BASIC_INFORMATION.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MEMORY_BASIC_INFORMATION.cs index 0744d53..a14157f 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MEMORY_BASIC_INFORMATION.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MEMORY_BASIC_INFORMATION.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MUI.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MUI.cs index 509d9a2..024dd1f 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MUI.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MUI.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MultiByteToWideChar.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MultiByteToWideChar.cs index 158e4db..edabe9f 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MultiByteToWideChar.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MultiByteToWideChar.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.OSVERSIONINFOEX.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.OSVERSIONINFOEX.cs index 1bfe00c..19c32e0 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.OSVERSIONINFOEX.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.OSVERSIONINFOEX.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.OutputDebugString.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.OutputDebugString.cs index 8da50ff..bc7c1c8 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.OutputDebugString.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.OutputDebugString.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryPerformanceCounter.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryPerformanceCounter.cs index ddc9797..e0959f7 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryPerformanceCounter.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryPerformanceCounter.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryPerformanceFrequency.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryPerformanceFrequency.cs index 72a48ba..71fd3db 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryPerformanceFrequency.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryPerformanceFrequency.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryUnbiasedInterruptTime.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryUnbiasedInterruptTime.cs index 87ca7fd..bdd77c1 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryUnbiasedInterruptTime.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryUnbiasedInterruptTime.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs index 076f7f1..67e317a 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using Microsoft.Win32.SafeHandles; using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs index 3ae65a8..0687830 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using Microsoft.Win32.SafeHandles; using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ResolveLocaleName.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ResolveLocaleName.cs index 2d6b6c3..1a0e613 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ResolveLocaleName.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ResolveLocaleName.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SECURITY_ATTRIBUTES.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SECURITY_ATTRIBUTES.cs index 8d31f86..16e9fec 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SECURITY_ATTRIBUTES.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SECURITY_ATTRIBUTES.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using Microsoft.Win32.SafeHandles; using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SYSTEM_INFO.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SYSTEM_INFO.cs index 16e5bfd..ab793a3 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SYSTEM_INFO.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SYSTEM_INFO.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SecurityOptions.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SecurityOptions.cs index 4a44024..4e94e3e 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SecurityOptions.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SecurityOptions.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable internal partial class Interop { internal partial class Kernel32 diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetCurrentDirectory.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetCurrentDirectory.cs index b30e5d7..5cf23a8 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetCurrentDirectory.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetCurrentDirectory.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetEndOfFile.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetEndOfFile.cs index e5d6004..2233e1f 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetEndOfFile.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetEndOfFile.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using Microsoft.Win32.SafeHandles; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetEnvironmentVariable.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetEnvironmentVariable.cs index cff406f..6a0fc1d 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetEnvironmentVariable.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetEnvironmentVariable.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal partial class Interop @@ -9,6 +10,6 @@ internal partial class Interop internal partial class Kernel32 { [DllImport(Libraries.Kernel32, EntryPoint = "SetEnvironmentVariableW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)] - internal static extern bool SetEnvironmentVariable(string lpName, string lpValue); + internal static extern bool SetEnvironmentVariable(string lpName, string? lpValue); } } diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetFilePointerEx.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetFilePointerEx.cs index c0e5247..dbedf85 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetFilePointerEx.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetFilePointerEx.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using Microsoft.Win32.SafeHandles; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetThreadErrorMode.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetThreadErrorMode.cs index 123eb75..b5bd945 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetThreadErrorMode.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetThreadErrorMode.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.TimeZone.Registry.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.TimeZone.Registry.cs index 062d1ca..30299ae 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.TimeZone.Registry.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.TimeZone.Registry.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.TimeZone.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.TimeZone.cs index 68d4583..dc89af4 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.TimeZone.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.TimeZone.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VerSetConditionMask.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VerSetConditionMask.cs index 385e48a..931faf5 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VerSetConditionMask.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VerSetConditionMask.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VerifyVersionExW.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VerifyVersionExW.cs index 5c2471c..90f5bdb 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VerifyVersionExW.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VerifyVersionExW.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VirtualAlloc.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VirtualAlloc.cs index a97dc1a..944fb4e 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VirtualAlloc.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VirtualAlloc.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VirtualFree.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VirtualFree.cs index 574cd93..2b940a4 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VirtualFree.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VirtualFree.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VirtualQuery.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VirtualQuery.cs index faab1cc..c7c02d6 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VirtualQuery.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VirtualQuery.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WideCharToMultiByte.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WideCharToMultiByte.cs index a06c915..6e523e5 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WideCharToMultiByte.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WideCharToMultiByte.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs index 69651ca..4694809 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using Microsoft.Win32.SafeHandles; using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs index dc1e975..6816d59 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using Microsoft.Win32.SafeHandles; using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Normaliz/Interop.Idna.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Normaliz/Interop.Idna.cs index f49ce8d..61b107b 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Normaliz/Interop.Idna.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Normaliz/Interop.Idna.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Normaliz/Interop.Normalization.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Normaliz/Interop.Normalization.cs index 3e49f1f..d7f639b 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Normaliz/Interop.Normalization.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Normaliz/Interop.Normalization.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; @@ -18,7 +19,7 @@ internal partial class Interop string source, int sourceLength, [System.Runtime.InteropServices.OutAttribute()] - char[] destination, + char[]? destination, int destinationLength); } } diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/NtDll/Interop.NtQuerySystemInformation.cs b/src/System.Private.CoreLib/shared/Interop/Windows/NtDll/Interop.NtQuerySystemInformation.cs index 16f05e33..1115926 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/NtDll/Interop.NtQuerySystemInformation.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/NtDll/Interop.NtQuerySystemInformation.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/NtDll/NtQueryInformationFile.cs b/src/System.Private.CoreLib/shared/Interop/Windows/NtDll/NtQueryInformationFile.cs index 4ba39a7..96bc298 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/NtDll/NtQueryInformationFile.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/NtDll/NtQueryInformationFile.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using Microsoft.Win32.SafeHandles; using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Ole32/Interop.CoCreateGuid.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Ole32/Interop.CoCreateGuid.cs index 57accbe..db5c04a 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Ole32/Interop.CoCreateGuid.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Ole32/Interop.CoCreateGuid.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Ole32/Interop.CoTaskMemAlloc.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Ole32/Interop.CoTaskMemAlloc.cs index 9119ee7..335531d 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Ole32/Interop.CoTaskMemAlloc.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Ole32/Interop.CoTaskMemAlloc.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysAllocStringByteLen.cs b/src/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysAllocStringByteLen.cs index 5249689..6cec249 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysAllocStringByteLen.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysAllocStringByteLen.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; @@ -10,6 +11,6 @@ internal partial class Interop internal partial class OleAut32 { [DllImport(Libraries.OleAut32)] - internal static extern IntPtr SysAllocStringByteLen(byte[] str, uint len); + internal static extern IntPtr SysAllocStringByteLen(byte[]? str, uint len); } } diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysAllocStringLen.cs b/src/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysAllocStringLen.cs index be902b0..67bd4f0 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysAllocStringLen.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysAllocStringLen.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; using System.Security; @@ -14,6 +15,6 @@ internal partial class Interop internal static extern SafeBSTRHandle SysAllocStringLen(IntPtr src, uint len); [DllImport(Libraries.OleAut32, CharSet = CharSet.Unicode)] - internal static extern IntPtr SysAllocStringLen(string src, int len); + internal static extern IntPtr SysAllocStringLen(string? src, int len); } } diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysFreeString.cs b/src/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysFreeString.cs index 8673cc6..8e1c9d8 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysFreeString.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysFreeString.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysStringLen.cs b/src/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysStringLen.cs index cf65d6b..7bd214a 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysStringLen.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysStringLen.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; using System.Security; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Secur32/Interop.GetUserNameExW.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Secur32/Interop.GetUserNameExW.cs index cf0dd5f..e91506b 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Secur32/Interop.GetUserNameExW.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Secur32/Interop.GetUserNameExW.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; internal partial class Interop diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Shell32/Interop.SHGetKnownFolderPath.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Shell32/Interop.SHGetKnownFolderPath.cs index 1090805..c6bc10a 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Shell32/Interop.SHGetKnownFolderPath.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Shell32/Interop.SHGetKnownFolderPath.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.Constants.cs b/src/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.Constants.cs index f1f0974..2cc835f 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.Constants.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.Constants.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable internal partial class Interop { internal partial class User32 diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.LoadString.cs b/src/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.LoadString.cs index 078ebd4..d7239a3 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.LoadString.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.LoadString.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.InteropServices; using Microsoft.Win32.SafeHandles; diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.SendMessageTimeout.cs b/src/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.SendMessageTimeout.cs index c8a97e6..2c1bcc6 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.SendMessageTimeout.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.SendMessageTimeout.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System; using System.Runtime.InteropServices; diff --git a/src/System.Private.CoreLib/shared/System/IO/FileStream.Win32.cs b/src/System.Private.CoreLib/shared/System/IO/FileStream.Win32.cs index e3361ae..f97f531 100644 --- a/src/System.Private.CoreLib/shared/System/IO/FileStream.Win32.cs +++ b/src/System.Private.CoreLib/shared/System/IO/FileStream.Win32.cs @@ -41,6 +41,7 @@ namespace System.IO using (DisableMediaInsertionPrompt.Create()) { + Debug.Assert(_path != null); return ValidateFileHandle( Interop.Kernel32.CreateFile(_path, fAccess, share, ref secAttrs, mode, flagsAndAttributes, IntPtr.Zero)); } diff --git a/src/System.Private.CoreLib/shared/System/IO/PathInternal.Windows.cs b/src/System.Private.CoreLib/shared/System/IO/PathInternal.Windows.cs index 99aa021..40ed96f 100644 --- a/src/System.Private.CoreLib/shared/System/IO/PathInternal.Windows.cs +++ b/src/System.Private.CoreLib/shared/System/IO/PathInternal.Windows.cs @@ -100,23 +100,6 @@ namespace System.IO } /// - /// DO NOT USE- Use EnsureExtendedPrefixIfNeeded. This will be removed shortly. - /// Adds the extended path prefix (\\?\) if not already a device path, IF the path is not relative, - /// AND the path is more than 259 characters. (> MAX_PATH + null) - /// - internal static string? EnsureExtendedPrefixOverMaxPath(string? path) - { - if (path != null && path.Length >= MaxShortPath) - { - return EnsureExtendedPrefix(path); - } - else - { - return path; - } - } - - /// /// Adds the extended path prefix (\\?\) if not relative or already a device path. /// internal static string EnsureExtendedPrefix(string path) -- 2.7.4