Nullable: Interop.Adavapi32 (#23875)
authorAnirudh Agnihotry <anirudhagnihotry098@gmail.com>
Fri, 12 Apr 2019 01:05:42 +0000 (18:05 -0700)
committerStephen Toub <stoub@microsoft.com>
Fri, 12 Apr 2019 01:05:42 +0000 (21:05 -0400)
* interop definations nullified

* reverting null check and adding arguments nullable to match win32 function definations

13 files changed:
src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.LookupAccountNameW.cs
src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegCloseKey.cs
src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegCreateKeyEx.cs
src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegDeleteKeyEx.cs
src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegDeleteValue.cs
src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegEnumKeyEx.cs
src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegEnumValue.cs
src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegFlushKey.cs
src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegOpenKeyEx.cs
src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegQueryInfoKey.cs
src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegQueryValueEx.cs
src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegSetValueEx.cs
src/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegistryConstants.cs

index 3554665..bef8afa 100644 (file)
@@ -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
@@ -10,7 +11,7 @@ internal partial class Interop
     {
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
         internal static extern bool LookupAccountNameW(
-            string lpSystemName,
+            string? lpSystemName,
             ref char lpAccountName,
             ref byte Sid,
             ref uint cbSid,
index 375376d..e279669 100644 (file)
@@ -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;
 
index b6c6d98..7f3dcbe 100644 (file)
@@ -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
 #if REGISTRY_ASSEMBLY
 using Microsoft.Win32.SafeHandles;
 #else
@@ -21,7 +22,7 @@ internal partial class Interop
             SafeRegistryHandle hKey,
             string lpSubKey,
             int Reserved,
-            string lpClass,
+            string? lpClass,
             int dwOptions,
             int samDesired,
             ref Interop.Kernel32.SECURITY_ATTRIBUTES secAttrs,
index c949cc1..01c4cea 100644 (file)
@@ -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
 #if REGISTRY_ASSEMBLY
 using Microsoft.Win32.SafeHandles;
 #else
index 3786669..4e0fdd9 100644 (file)
@@ -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
 #if REGISTRY_ASSEMBLY
 using Microsoft.Win32.SafeHandles;
 #else
@@ -15,6 +16,6 @@ internal partial class Interop
     internal partial class Advapi32
     {
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegDeleteValueW")]
-        internal static extern int RegDeleteValue(SafeRegistryHandle hKey, string lpValueName);
+        internal static extern int RegDeleteValue(SafeRegistryHandle hKey, string? lpValueName);
     }
 }
index 8e37b8e..b2873fa 100644 (file)
@@ -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
 #if REGISTRY_ASSEMBLY
 using Microsoft.Win32.SafeHandles;
 #else
@@ -21,9 +22,9 @@ internal partial class Interop
             int dwIndex,
             char[] lpName,
             ref int lpcbName,
-            int[] lpReserved,
-            [Out] char[] lpClass,
-            int[] lpcbClass,
-            long[] lpftLastWriteTime);
+            int[]? lpReserved,
+            [Out] char[]? lpClass,
+            int[]? lpcbClass,
+            long[]? lpftLastWriteTime);
     }
 }
index 28d24e2..3d455d0 100644 (file)
@@ -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
 #if REGISTRY_ASSEMBLY
 using Microsoft.Win32.SafeHandles;
 #else
@@ -21,8 +22,8 @@ internal partial class Interop
             char[] lpValueName,
             ref int lpcbValueName,
             IntPtr lpReserved_MustBeZero,
-            int[] lpType,
-            byte[] lpData,
-            int[] lpcbData);
+            int[]? lpType,
+            byte[]? lpData,
+            int[]? lpcbData);
     }
 }
index fa56f48..3a867a2 100644 (file)
@@ -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
 #if REGISTRY_ASSEMBLY
 using Microsoft.Win32.SafeHandles;
 #else
index d186d98..32cbbfc 100644 (file)
@@ -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
 #if REGISTRY_ASSEMBLY
 using Microsoft.Win32.SafeHandles;
 #else
@@ -17,7 +18,7 @@ internal partial class Interop
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegOpenKeyExW")]
         internal static extern int RegOpenKeyEx(
             SafeRegistryHandle hKey,
-            string lpSubKey,
+            string? lpSubKey,
             int ulOptions,
             int samDesired,
             out SafeRegistryHandle hkResult);
@@ -26,7 +27,7 @@ internal partial class Interop
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegOpenKeyExW")]
         internal static extern int RegOpenKeyEx(
             IntPtr hKey,
-            string lpSubKey,
+            string? lpSubKey,
             int ulOptions,
             int samDesired,
             out SafeRegistryHandle hkResult);
index 2d220a1..24eeb1f 100644 (file)
@@ -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
 #if REGISTRY_ASSEMBLY
 using Microsoft.Win32.SafeHandles;
 #else
@@ -18,16 +19,16 @@ internal partial class Interop
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegQueryInfoKeyW")]
         internal static extern int RegQueryInfoKey(
             SafeRegistryHandle hKey,
-            [Out] char[] lpClass,
-            int[] lpcbClass,
+            [Out] char[]? lpClass,
+            int[]? lpcbClass,
             IntPtr lpReserved_MustBeZero,
             ref int lpcSubKeys,
-            int[] lpcbMaxSubKeyLen,
-            int[] lpcbMaxClassLen,
+            int[]? lpcbMaxSubKeyLen,
+            int[]? lpcbMaxClassLen,
             ref int lpcValues,
-            int[] lpcbMaxValueNameLen,
-            int[] lpcbMaxValueLen,
-            int[] lpcbSecurityDescriptor,
-            int[] lpftLastWriteTime);
+            int[]? lpcbMaxValueNameLen,
+            int[]? lpcbMaxValueLen,
+            int[]? lpcbSecurityDescriptor,
+            int[]? lpftLastWriteTime);
     }
 }
index f8ad82a..0ed94b2 100644 (file)
@@ -19,7 +19,7 @@ internal partial class Interop
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegQueryValueExW")]
         internal static extern int RegQueryValueEx(
             SafeRegistryHandle hKey,
-            string lpValueName,
+            string? lpValueName,
             int[]? lpReserved,
             ref int lpType,
             [Out] byte[]? lpData,
@@ -28,7 +28,7 @@ internal partial class Interop
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegQueryValueExW")]
         internal static extern int RegQueryValueEx(
             SafeRegistryHandle hKey,
-            string lpValueName,
+            string? lpValueName,
             int[]? lpReserved,
             ref int lpType,
             ref int lpData,
@@ -37,7 +37,7 @@ internal partial class Interop
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegQueryValueExW")]
         internal static extern int RegQueryValueEx(
             SafeRegistryHandle hKey,
-            string lpValueName,
+            string? lpValueName,
             int[]? lpReserved,
             ref int lpType,
             ref long lpData,
@@ -46,10 +46,10 @@ internal partial class Interop
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegQueryValueExW")]
         internal static extern int RegQueryValueEx(
             SafeRegistryHandle hKey,
-            string lpValueName,
+            string? lpValueName,
             int[]? lpReserved,
             ref int lpType,
-            [Out] char[] lpData,
+            [Out] char[]? lpData,
             ref int lpcbData);
     }
 }
index 7fb479e..64a4056 100644 (file)
@@ -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
 #if REGISTRY_ASSEMBLY
 using Microsoft.Win32.SafeHandles;
 #else
@@ -17,25 +18,25 @@ internal partial class Interop
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegSetValueExW")]
         internal static extern int RegSetValueEx(
             SafeRegistryHandle hKey,
-            string lpValueName,
+            string? lpValueName,
             int Reserved,
             int dwType,
-            byte[] lpData,
+            byte[]? lpData,
             int cbData);
 
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegSetValueExW")]
         internal static extern int RegSetValueEx(
             SafeRegistryHandle hKey,
-            string lpValueName,
+            string? lpValueName,
             int Reserved,
             int dwType,
-            char[] lpData,
+            char[]? lpData,
             int cbData);
 
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegSetValueExW")]
         internal static extern int RegSetValueEx(
             SafeRegistryHandle hKey,
-            string lpValueName,
+            string? lpValueName,
             int Reserved,
             int dwType,
             ref int lpData,
@@ -44,7 +45,7 @@ internal partial class Interop
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegSetValueExW")]
         internal static extern int RegSetValueEx(
             SafeRegistryHandle hKey,
-            string lpValueName,
+            string? lpValueName,
             int Reserved,
             int dwType,
             ref long lpData,
@@ -53,10 +54,10 @@ internal partial class Interop
         [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegSetValueExW")]
         internal static extern int RegSetValueEx(
             SafeRegistryHandle hKey,
-            string lpValueName,
+            string? lpValueName,
             int Reserved,
             int dwType,
-            string lpData,
+            string? lpData,
             int cbData);
     }
 }
index bdb8970..b358f9f 100644 (file)
@@ -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 Advapi32