diff --git a/eng/CodeAnalysis.src.globalconfig b/eng/CodeAnalysis.src.globalconfig index e4153fff865feb..9b2f117d8a7e97 100644 --- a/eng/CodeAnalysis.src.globalconfig +++ b/eng/CodeAnalysis.src.globalconfig @@ -60,6 +60,9 @@ dotnet_diagnostic.SYSLIB1060.severity = error # SYSLIB1061: Marshaller type has incompatible method signatures dotnet_diagnostic.SYSLIB1061.severity = error +# SYSLIB1092: The usage of 'LibraryImportAttribute' does not follow recommendations. It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters +dotnet_diagnostic.SYSLIB1092.severity = error + # CA1000: Do not declare static members on generic types dotnet_diagnostic.CA1000.severity = none diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/RuntimeModuleBuilder.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/RuntimeModuleBuilder.cs index 5c5bc5d0e52217..95d62bde81e77e 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/RuntimeModuleBuilder.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/RuntimeModuleBuilder.cs @@ -113,7 +113,7 @@ private int GetMemberRef(Module? refedModule, int tr, int defToken) } [LibraryImport(RuntimeHelpers.QCall, EntryPoint = "ModuleBuilder_GetMemberRefFromSignature", StringMarshalling = StringMarshalling.Utf16)] - private static partial int GetMemberRefFromSignature(QCallModule module, int tr, string methodName, byte[] signature, int length); + private static partial int GetMemberRefFromSignature(QCallModule module, int tr, string methodName, [In] byte[] signature, int length); private int GetMemberRefFromSignature(int tr, string methodName, byte[] signature, int length) { @@ -156,7 +156,7 @@ private int GetMemberRefOfFieldInfo(int tkType, RuntimeTypeHandle declaringType, } [LibraryImport(RuntimeHelpers.QCall, EntryPoint = "ModuleBuilder_GetTokenFromTypeSpec")] - private static partial int GetTokenFromTypeSpec(QCallModule pModule, byte[] signature, int length); + private static partial int GetTokenFromTypeSpec(QCallModule pModule, [In] byte[] signature, int length); private int GetTokenFromTypeSpec(byte[] signature, int length) { @@ -165,13 +165,13 @@ private int GetTokenFromTypeSpec(byte[] signature, int length) } [LibraryImport(RuntimeHelpers.QCall, EntryPoint = "ModuleBuilder_GetArrayMethodToken", StringMarshalling = StringMarshalling.Utf16)] - private static partial int GetArrayMethodToken(QCallModule module, int tkTypeSpec, string methodName, byte[] signature, int sigLength); + private static partial int GetArrayMethodToken(QCallModule module, int tkTypeSpec, string methodName, [In] byte[] signature, int sigLength); [LibraryImport(RuntimeHelpers.QCall, EntryPoint = "ModuleBuilder_GetStringConstant", StringMarshalling = StringMarshalling.Utf16)] private static partial int GetStringConstant(QCallModule module, string str, int length); [LibraryImport(RuntimeHelpers.QCall, EntryPoint = "ModuleBuilder_SetFieldRVAContent")] - internal static partial void SetFieldRVAContent(QCallModule module, int fdToken, byte[]? data, int length); + internal static partial void SetFieldRVAContent(QCallModule module, int fdToken, [In] byte[]? data, int length); #endregion diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/RuntimeTypeBuilder.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/RuntimeTypeBuilder.cs index 58fe7960ab3c6d..e7e24037342ddc 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/RuntimeTypeBuilder.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/RuntimeTypeBuilder.cs @@ -66,23 +66,23 @@ public void Bake(RuntimeModuleBuilder module, int token) #region Internal Static FCalls [LibraryImport(RuntimeHelpers.QCall, EntryPoint = "TypeBuilder_DefineMethod", StringMarshalling = StringMarshalling.Utf16)] - internal static partial int DefineMethod(QCallModule module, int tkParent, string name, byte[] signature, int sigLength, + internal static partial int DefineMethod(QCallModule module, int tkParent, string name, [In] byte[] signature, int sigLength, MethodAttributes attributes); [LibraryImport(RuntimeHelpers.QCall, EntryPoint = "TypeBuilder_DefineMethodSpec")] - internal static partial int DefineMethodSpec(QCallModule module, int tkParent, byte[] signature, int sigLength); + internal static partial int DefineMethodSpec(QCallModule module, int tkParent, [In] byte[] signature, int sigLength); [LibraryImport(RuntimeHelpers.QCall, EntryPoint = "TypeBuilder_DefineField", StringMarshalling = StringMarshalling.Utf16)] - internal static partial int DefineField(QCallModule module, int tkParent, string name, byte[] signature, int sigLength, + internal static partial int DefineField(QCallModule module, int tkParent, string name, [In] byte[] signature, int sigLength, FieldAttributes attributes); [LibraryImport(RuntimeHelpers.QCall, EntryPoint = "TypeBuilder_SetMethodIL")] private static partial void SetMethodIL(QCallModule module, int tk, [MarshalAs(UnmanagedType.Bool)] bool isInitLocals, - byte[]? body, int bodyLength, - byte[] LocalSig, int sigLength, + [In] byte[]? body, int bodyLength, + [In] byte[] LocalSig, int sigLength, int maxStackSize, - ExceptionHandler[]? exceptions, int numExceptions, - int[]? tokenFixups, int numTokenFixups); + [In] ExceptionHandler[]? exceptions, int numExceptions, + [In] int[]? tokenFixups, int numTokenFixups); [LibraryImport(RuntimeHelpers.QCall, EntryPoint = "TypeBuilder_DefineCustomAttribute")] private static partial void DefineCustomAttribute(QCallModule module, int tkAssociate, int tkConstructor, @@ -97,7 +97,7 @@ internal static void DefineCustomAttribute(RuntimeModuleBuilder module, int tkAs [LibraryImport(RuntimeHelpers.QCall, EntryPoint = "TypeBuilder_DefineProperty", StringMarshalling = StringMarshalling.Utf16)] internal static partial int DefineProperty(QCallModule module, int tkParent, string name, PropertyAttributes attributes, - byte[] signature, int sigLength); + [In] byte[] signature, int sigLength); [LibraryImport(RuntimeHelpers.QCall, EntryPoint = "TypeBuilder_DefineEvent", StringMarshalling = StringMarshalling.Utf16)] internal static partial int DefineEvent(QCallModule module, int tkParent, string name, EventAttributes attributes, int tkEventType); @@ -117,7 +117,7 @@ internal static partial int SetParamInfo(QCallModule module, int tkMethod, int i ParameterAttributes iParamAttributes, string? strParamName); [LibraryImport(RuntimeHelpers.QCall, EntryPoint = "TypeBuilder_GetTokenFromSig")] - internal static partial int GetTokenFromSig(QCallModule module, byte[] signature, int sigLength); + internal static partial int GetTokenFromSig(QCallModule module, [In] byte[] signature, int sigLength); [LibraryImport(RuntimeHelpers.QCall, EntryPoint = "TypeBuilder_SetFieldLayoutOffset")] internal static partial void SetFieldLayoutOffset(QCallModule module, int fdToken, int iOffset); @@ -535,11 +535,11 @@ protected override bool IsCreatedCore() #region FCalls [LibraryImport(RuntimeHelpers.QCall, EntryPoint = "TypeBuilder_DefineType", StringMarshalling = StringMarshalling.Utf16)] private static partial int DefineType(QCallModule module, - string fullname, int tkParent, TypeAttributes attributes, int tkEnclosingType, int[] interfaceTokens); + string fullname, int tkParent, TypeAttributes attributes, int tkEnclosingType, [In] int[] interfaceTokens); [LibraryImport(RuntimeHelpers.QCall, EntryPoint = "TypeBuilder_DefineGenericParam", StringMarshalling = StringMarshalling.Utf16)] private static partial int DefineGenericParam(QCallModule module, - string name, int tkParent, GenericParameterAttributes attributes, int position, int[] constraints); + string name, int tkParent, GenericParameterAttributes attributes, int position, [In] int[] constraints); [LibraryImport(RuntimeHelpers.QCall, EntryPoint = "TypeBuilder_TermCreateClass")] private static partial void TermCreateClass(QCallModule module, int tk, ObjectHandleOnStack type); diff --git a/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs b/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs index 1d77e1beca4a7c..979c901e2db46c 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs @@ -1773,7 +1773,7 @@ public bool Equals(ModuleHandle handle) private static partial void GetDynamicMethod( QCallModule module, string name, - byte[] sig, + [In] byte[] sig, int sigLen, ObjectHandleOnStack resolver, ObjectHandleOnStack result); diff --git a/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.Dsa.cs b/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.Dsa.cs index fbfd47f14dfcfe..283f5bb79dff03 100644 --- a/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.Dsa.cs +++ b/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.Dsa.cs @@ -155,15 +155,15 @@ private static partial bool GetDsaParameters( [return: MarshalAs(UnmanagedType.Bool)] internal static partial bool DsaKeyCreateByExplicitParameters( out SafeDsaHandle dsa, - byte[] p, + [In] byte[] p, int pLength, - byte[] q, + [In] byte[] q, int qLength, - byte[] g, + [In] byte[] g, int gLength, - byte[] y, + [In] byte[] y, int yLength, - byte[]? x, + [In] byte[]? x, int xLength); } } diff --git a/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.EcDsa.ImportExport.cs b/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.EcDsa.ImportExport.cs index e731a47c39aa41..a348d6fd064e29 100644 --- a/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.EcDsa.ImportExport.cs +++ b/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.EcDsa.ImportExport.cs @@ -14,9 +14,9 @@ internal static partial class AndroidCrypto private static partial int EcKeyCreateByKeyParameters( out SafeEcKeyHandle key, string oid, - byte[]? qx, int qxLength, - byte[]? qy, int qyLength, - byte[]? d, int dLength); + [In] byte[]? qx, int qxLength, + [In] byte[]? qy, int qyLength, + [In] byte[]? d, int dLength); internal static SafeEcKeyHandle EcKeyCreateByKeyParameters( string oid, @@ -38,17 +38,17 @@ internal static SafeEcKeyHandle EcKeyCreateByKeyParameters( [LibraryImport(Libraries.AndroidCryptoNative, EntryPoint = "AndroidCryptoNative_EcKeyCreateByExplicitParameters")] internal static partial SafeEcKeyHandle EcKeyCreateByExplicitParameters( ECCurve.ECCurveType curveType, - byte[]? qx, int qxLength, - byte[]? qy, int qyLength, - byte[]? d, int dLength, - byte[] p, int pLength, - byte[] a, int aLength, - byte[] b, int bLength, - byte[] gx, int gxLength, - byte[] gy, int gyLength, - byte[] order, int nLength, - byte[]? cofactor, int cofactorLength, - byte[]? seed, int seedLength); + [In] byte[]? qx, int qxLength, + [In] byte[]? qy, int qyLength, + [In] byte[]? d, int dLength, + [In] byte[] p, int pLength, + [In] byte[] a, int aLength, + [In] byte[] b, int bLength, + [In] byte[] gx, int gxLength, + [In] byte[] gy, int gyLength, + [In] byte[] order, int nLength, + [In] byte[]? cofactor, int cofactorLength, + [In] byte[]? seed, int seedLength); internal static SafeEcKeyHandle EcKeyCreateByExplicitCurve(ECCurve curve) { diff --git a/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.Rsa.cs b/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.Rsa.cs index 4234a1aa8902d4..db3914a8eadc7e 100644 --- a/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.Rsa.cs +++ b/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.Rsa.cs @@ -176,21 +176,21 @@ private static partial bool GetRsaParameters( [return: MarshalAs(UnmanagedType.Bool)] internal static partial bool SetRsaParameters( SafeRsaHandle key, - byte[]? n, + [In] byte[]? n, int nLength, - byte[]? e, + [In] byte[]? e, int eLength, - byte[]? d, + [In] byte[]? d, int dLength, - byte[]? p, + [In] byte[]? p, int pLength, - byte[]? dmp1, + [In] byte[]? dmp1, int dmp1Length, - byte[]? q, + [In] byte[]? q, int qLength, - byte[]? dmq1, + [In] byte[]? dmq1, int dmq1Length, - byte[]? iqmp, + [In] byte[]? iqmp, int iqmpLength); internal enum RsaPadding : int diff --git a/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.Ssl.cs b/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.Ssl.cs index 91b7136059f24d..d1af81c34a236a 100644 --- a/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.Ssl.cs +++ b/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.Ssl.cs @@ -39,7 +39,7 @@ private static partial SafeSslHandle SSLStreamCreateWithCertificates( ref byte pkcs8PrivateKey, int pkcs8PrivateKeyLen, PAL_KeyAlgorithm algorithm, - IntPtr[] certs, + [In] IntPtr[] certs, int certsLen); internal static SafeSslHandle SSLStreamCreateWithCertificates( SslStream.JavaProxy sslStreamProxy, @@ -126,7 +126,7 @@ private unsafe struct ApplicationProtocolData } [LibraryImport(Interop.Libraries.AndroidCryptoNative, EntryPoint = "AndroidCryptoNative_SSLStreamSetApplicationProtocols")] - private static unsafe partial int SSLStreamSetApplicationProtocols(SafeSslHandle sslHandle, ApplicationProtocolData[] protocolData, int count); + private static unsafe partial int SSLStreamSetApplicationProtocols(SafeSslHandle sslHandle, [In] ApplicationProtocolData[] protocolData, int count); internal static unsafe void SSLStreamSetApplicationProtocols(SafeSslHandle sslHandle, List protocols) { int count = protocols.Count; @@ -172,7 +172,7 @@ internal static void SSLStreamSetEnabledProtocols(SafeSslHandle sslHandle, ReadO internal static partial PAL_SSLStreamStatus SSLStreamHandshake(SafeSslHandle sslHandle); [LibraryImport(Libraries.AndroidCryptoNative, EntryPoint = "AndroidCryptoNative_SSLStreamGetApplicationProtocol")] - private static partial int SSLStreamGetApplicationProtocol(SafeSslHandle ssl, byte[]? buf, ref int len); + private static partial int SSLStreamGetApplicationProtocol(SafeSslHandle ssl, [Out] byte[]? buf, ref int len); internal static byte[]? SSLStreamGetApplicationProtocol(SafeSslHandle ssl) { int len = 0; diff --git a/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.X509.cs b/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.X509.cs index 973c0040dd7687..cd3b97ca4af971 100644 --- a/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.X509.cs +++ b/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.X509.cs @@ -17,7 +17,7 @@ internal static partial class AndroidCrypto internal static partial SafeX509Handle X509Decode(ref byte buf, int len); [LibraryImport(Libraries.AndroidCryptoNative, EntryPoint = "AndroidCryptoNative_X509Encode")] - private static partial int X509Encode(SafeX509Handle x, byte[]? buf, ref int len); + private static partial int X509Encode(SafeX509Handle x, [Out] byte[]? buf, ref int len); internal static byte[] X509Encode(SafeX509Handle x) { int len = 0; @@ -59,7 +59,7 @@ internal static SafeX509Handle GetPrivateKeyEntryCertificate(SafeHandle privatKe } [LibraryImport(Libraries.AndroidCryptoNative, EntryPoint = "AndroidCryptoNative_X509DecodeCollection")] - private static partial int X509DecodeCollection(ref byte buf, int bufLen, IntPtr[]? ptrs, ref int handlesLen); + private static partial int X509DecodeCollection(ref byte buf, int bufLen, [Out] IntPtr[]? ptrs, ref int handlesLen); internal static SafeX509Handle[] X509DecodeCollection(ReadOnlySpan data) { ref byte buf = ref MemoryMarshal.GetReference(data); @@ -98,7 +98,7 @@ internal static SafeX509Handle[] X509DecodeCollection(ReadOnlySpan data) } [LibraryImport(Libraries.AndroidCryptoNative, EntryPoint = "AndroidCryptoNative_X509ExportPkcs7")] - private static partial int X509ExportPkcs7(IntPtr[] certs, int certsLen, byte[]? buf, ref int len); + private static partial int X509ExportPkcs7([In] IntPtr[] certs, int certsLen, [Out] byte[]? buf, ref int len); internal static byte[] X509ExportPkcs7(IntPtr[] certHandles) { int len = 0; diff --git a/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.X509Chain.cs b/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.X509Chain.cs index 0e5a9a7e724266..9f03c87f3acb3b 100644 --- a/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.X509Chain.cs +++ b/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.X509Chain.cs @@ -15,7 +15,7 @@ internal static partial class AndroidCrypto [LibraryImport(Libraries.AndroidCryptoNative, EntryPoint = "AndroidCryptoNative_X509ChainCreateContext")] internal static partial SafeX509ChainContextHandle X509ChainCreateContext( SafeX509Handle cert, - IntPtr[] extraStore, + [In] IntPtr[] extraStore, int extraStoreLen); [LibraryImport(Libraries.AndroidCryptoNative, EntryPoint = "AndroidCryptoNative_X509ChainDestroyContext")] @@ -33,7 +33,7 @@ internal static partial bool X509ChainBuild( [LibraryImport(Libraries.AndroidCryptoNative, EntryPoint = "AndroidCryptoNative_X509ChainGetCertificates")] private static partial int X509ChainGetCertificates( SafeX509ChainContextHandle ctx, - IntPtr[] certs, + [Out] IntPtr[] certs, int certsLen); internal static X509Certificate2[] X509ChainGetCertificates(SafeX509ChainContextHandle ctx) @@ -75,7 +75,7 @@ internal struct ValidationError [LibraryImport(Libraries.AndroidCryptoNative, EntryPoint = "AndroidCryptoNative_X509ChainGetErrors")] private static unsafe partial int X509ChainGetErrors( SafeX509ChainContextHandle ctx, - ValidationError[] errors, + [Out] ValidationError[] errors, int errorsLen); internal static ValidationError[] X509ChainGetErrors(SafeX509ChainContextHandle ctx) @@ -95,7 +95,7 @@ internal static ValidationError[] X509ChainGetErrors(SafeX509ChainContextHandle [LibraryImport(Libraries.AndroidCryptoNative, EntryPoint = "AndroidCryptoNative_X509ChainSetCustomTrustStore")] internal static partial int X509ChainSetCustomTrustStore( SafeX509ChainContextHandle ctx, - IntPtr[] customTrustStore, + [In] IntPtr[] customTrustStore, int customTrustStoreLen); [LibraryImport(Libraries.AndroidCryptoNative, EntryPoint = "AndroidCryptoNative_X509ChainValidate")] diff --git a/src/libraries/Common/src/Interop/Interop.Calendar.cs b/src/libraries/Common/src/Interop/Interop.Calendar.cs index 622ecc65220442..a52601713423bd 100644 --- a/src/libraries/Common/src/Interop/Interop.Calendar.cs +++ b/src/libraries/Common/src/Interop/Interop.Calendar.cs @@ -10,7 +10,7 @@ internal static partial class Interop internal static partial class Globalization { [LibraryImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetCalendars", StringMarshalling = StringMarshalling.Utf16)] - internal static partial int GetCalendars(string localeName, CalendarId[] calendars, int calendarsCapacity); + internal static partial int GetCalendars(string localeName, [Out] CalendarId[] calendars, int calendarsCapacity); [LibraryImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetCalendarInfo", StringMarshalling = StringMarshalling.Utf16)] internal static unsafe partial ResultCode GetCalendarInfo(string localeName, CalendarId calendarId, CalendarDataType calendarDataType, char* result, int resultCapacity); diff --git a/src/libraries/Common/src/Interop/Interop.Calendar.iOS.cs b/src/libraries/Common/src/Interop/Interop.Calendar.iOS.cs index 985e55b604e4fe..15936fa6b9b28c 100644 --- a/src/libraries/Common/src/Interop/Interop.Calendar.iOS.cs +++ b/src/libraries/Common/src/Interop/Interop.Calendar.iOS.cs @@ -10,7 +10,7 @@ internal static partial class Interop internal static partial class Globalization { [LibraryImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetCalendarsNative", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int GetCalendarsNative(string localeName, CalendarId[] calendars, int calendarsCapacity); + internal static partial int GetCalendarsNative(string localeName, [Out] CalendarId[] calendars, int calendarsCapacity); [LibraryImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetCalendarInfoNative", StringMarshalling = StringMarshalling.Utf8)] internal static partial string GetCalendarInfoNative(string localeName, CalendarId calendarId, CalendarDataType calendarDataType); diff --git a/src/libraries/Common/src/Interop/Interop.Odbc.cs b/src/libraries/Common/src/Interop/Interop.Odbc.cs index 3e751856262025..c09c3862c7dcb9 100644 --- a/src/libraries/Common/src/Interop/Interop.Odbc.cs +++ b/src/libraries/Common/src/Interop/Interop.Odbc.cs @@ -169,7 +169,7 @@ internal static partial ODBC32.SQLRETURN SQLFreeStmt( internal static partial ODBC32.SQLRETURN SQLGetConnectAttrW( /*SQLHBDC*/OdbcConnectionHandle ConnectionHandle, /*SQLINTEGER*/ODBC32.SQL_ATTR Attribute, - /*SQLPOINTER*/byte[] Value, + /*SQLPOINTER*/[Out] byte[] Value, /*SQLINTEGER*/int BufferLength, /*SQLINTEGER* */out int StringLength); @@ -196,9 +196,9 @@ internal static partial ODBC32.SQLRETURN SQLGetDiagRecW( /*SQLSMALLINT*/ODBC32.SQL_HANDLE HandleType, /*SQLHANDLE*/OdbcHandle Handle, /*SQLSMALLINT*/short RecNumber, - /*SQLCHAR* */ char[] rchState, + /*SQLCHAR* */ [Out] char[] rchState, /*SQLINTEGER* */out int NativeError, - /*SQLCHAR* */ char[] MessageText, + /*SQLCHAR* */ [Out] char[] MessageText, /*SQLSMALLINT*/short BufferLength, /*SQLSMALLINT* */out short TextLength); @@ -208,7 +208,7 @@ internal static partial ODBC32.SQLRETURN SQLGetDiagFieldW( /*SQLHANDLE*/ OdbcHandle Handle, /*SQLSMALLINT*/ short RecNumber, /*SQLSMALLINT*/ short DiagIdentifier, - /*SQLPOINTER*/ char[] rchState, + /*SQLPOINTER*/ [Out] char[] rchState, /*SQLSMALLINT*/ short BufferLength, /*SQLSMALLINT* */ out short StringLength); @@ -222,7 +222,7 @@ internal static partial ODBC32.SQLRETURN SQLGetFunctions( internal static partial ODBC32.SQLRETURN SQLGetInfoW( /*SQLHBDC*/OdbcConnectionHandle hdbc, /*SQLUSMALLINT*/ODBC32.SQL_INFO fInfoType, - /*SQLPOINTER*/byte[] rgbInfoValue, + /*SQLPOINTER*/[Out] byte[] rgbInfoValue, /*SQLSMALLINT*/short cbInfoValueMax, /*SQLSMALLINT* */out short pcbInfoValue); @@ -230,7 +230,7 @@ internal static partial ODBC32.SQLRETURN SQLGetInfoW( internal static partial ODBC32.SQLRETURN SQLGetInfoW( /*SQLHBDC*/OdbcConnectionHandle hdbc, /*SQLUSMALLINT*/ODBC32.SQL_INFO fInfoType, - /*SQLPOINTER*/byte[] rgbInfoValue, + /*SQLPOINTER*/[Out] byte[] rgbInfoValue, /*SQLSMALLINT*/short cbInfoValueMax, /*SQLSMALLINT* */IntPtr pcbInfoValue); diff --git a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Keychain.macOS.cs b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Keychain.macOS.cs index a4d68625580dce..4c148693c5adbf 100644 --- a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Keychain.macOS.cs +++ b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Keychain.macOS.cs @@ -31,7 +31,7 @@ private static unsafe partial int AppleCryptoNative_SecKeychainCreateTemporary( private static partial int AppleCryptoNative_SecKeychainCreate( string path, int utf8PassphraseLength, - byte[] utf8Passphrase, + [In] byte[] utf8Passphrase, out SafeKeychainHandle keychain); [LibraryImport(Libraries.AppleCryptoNative)] @@ -49,7 +49,7 @@ private static partial int AppleCryptoNative_SecKeychainOpen( private static partial int AppleCryptoNative_SecKeychainUnlock( SafeKeychainHandle keychain, int utf8PassphraseLength, - byte[] utf8Passphrase); + [In] byte[] utf8Passphrase); [LibraryImport(Libraries.AppleCryptoNative)] private static partial int AppleCryptoNative_SetKeychainNeverLock(SafeKeychainHandle keychain); diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetUnixVersion.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetUnixVersion.cs index 5e60df46572c2a..62751e3874b9b9 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetUnixVersion.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetUnixVersion.cs @@ -12,7 +12,7 @@ internal static partial class Interop internal static partial class Sys { [LibraryImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetUnixVersion", StringMarshalling = StringMarshalling.Utf8, SetLastError = true)] - private static partial int GetUnixVersion(byte[] version, ref int capacity); + private static partial int GetUnixVersion([Out] byte[] version, ref int capacity); internal static string GetUnixVersion() { diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.ASN1.GetIntegerBytes.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.ASN1.GetIntegerBytes.cs index a61fe76025cdc0..efea53c29f00f4 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.ASN1.GetIntegerBytes.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.ASN1.GetIntegerBytes.cs @@ -15,7 +15,7 @@ internal static partial class Crypto private static partial int GetAsn1IntegerDerSize(SafeSharedAsn1IntegerHandle i); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_EncodeAsn1Integer")] - private static partial int EncodeAsn1Integer(SafeSharedAsn1IntegerHandle i, byte[] buf); + private static partial int EncodeAsn1Integer(SafeSharedAsn1IntegerHandle i, [Out] byte[] buf); internal static byte[] GetAsn1IntegerBytes(SafeSharedAsn1IntegerHandle asn1Integer) { diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.ASN1.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.ASN1.cs index 8281eba356cce2..eeb5a39050a800 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.ASN1.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.ASN1.cs @@ -45,7 +45,7 @@ internal static IntPtr GetObjectDefinitionByName(string friendlyName) [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_Asn1OctetStringSet")] [return: MarshalAs(UnmanagedType.Bool)] - internal static partial bool Asn1OctetStringSet(SafeAsn1OctetStringHandle o, byte[] d, int len); + internal static partial bool Asn1OctetStringSet(SafeAsn1OctetStringHandle o, [In] byte[] d, int len); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_Asn1OctetStringFree")] internal static partial void Asn1OctetStringFree(IntPtr o); diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.BIO.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.BIO.cs index 32a706922b2fbf..83201806a1a9ba 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.BIO.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.BIO.cs @@ -31,14 +31,14 @@ internal static unsafe int BioGets(SafeBioHandle b, Span buf) } [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_BioRead")] - internal static partial int BioRead(SafeBioHandle b, byte[] data, int len); + internal static partial int BioRead(SafeBioHandle b, [Out] byte[] data, int len); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_BioRead")] private static partial int BioRead(SafeBioHandle b, Span data, int len); internal static int BioRead(SafeBioHandle b, Span data) => BioRead(b, data, data.Length); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_BioWrite")] - internal static partial int BioWrite(SafeBioHandle b, byte[] data, int len); + internal static partial int BioWrite(SafeBioHandle b, [In] byte[] data, int len); internal static int BioWrite(SafeBioHandle b, ReadOnlySpan data) => BioWrite(b, ref MemoryMarshal.GetReference(data), data.Length); diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Crypto.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Crypto.cs index a451e0d9e918e3..4a47338da8fca0 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Crypto.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Crypto.cs @@ -36,10 +36,10 @@ internal static int BioTell(SafeBioHandle bio) internal static partial int BioSeek(SafeBioHandle bio, int pos); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509Thumbprint")] - private static partial int GetX509Thumbprint(SafeX509Handle x509, byte[]? buf, int cBuf); + private static partial int GetX509Thumbprint(SafeX509Handle x509, [Out] byte[]? buf, int cBuf); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509NameRawBytes")] - private static partial int GetX509NameRawBytes(IntPtr x509Name, byte[]? buf, int cBuf); + private static partial int GetX509NameRawBytes(IntPtr x509Name, [Out] byte[]? buf, int cBuf); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_ReadX509AsDerFromBio")] internal static partial SafeX509Handle ReadX509AsDerFromBio(SafeBioHandle bio); @@ -51,13 +51,13 @@ internal static int BioTell(SafeBioHandle bio) internal static partial int GetX509Version(SafeX509Handle x509); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509PublicKeyParameterBytes")] - private static partial int GetX509PublicKeyParameterBytes(SafeX509Handle x509, byte[]? buf, int cBuf); + private static partial int GetX509PublicKeyParameterBytes(SafeX509Handle x509, [Out] byte[]? buf, int cBuf); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509NameInfo")] internal static partial SafeBioHandle GetX509NameInfo(SafeX509Handle x509, int nameType, [MarshalAs(UnmanagedType.Bool)] bool forIssuer); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetAsn1StringBytes")] - private static partial int GetAsn1StringBytes(IntPtr asn1, byte[]? buf, int cBuf); + private static partial int GetAsn1StringBytes(IntPtr asn1, [Out] byte[]? buf, int cBuf); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_PushX509StackField")] [return: MarshalAs(UnmanagedType.Bool)] @@ -99,7 +99,7 @@ private static partial int CryptoNative_X509StoreSetVerifyTime( [MarshalAs(UnmanagedType.Bool)] bool isDst); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_CheckX509IpAddress", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int CheckX509IpAddress(SafeX509Handle x509, byte[] addressBytes, int addressLen, string hostname, int cchHostname); + internal static partial int CheckX509IpAddress(SafeX509Handle x509, [In] byte[] addressBytes, int addressLen, string hostname, int cchHostname); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_CheckX509Hostname", StringMarshalling = StringMarshalling.Utf8)] internal static partial int CheckX509Hostname(SafeX509Handle x509, string hostname, int cchHostname); diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Dsa.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Dsa.cs index 8b299a12219e6e..9466f51c4c204b 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Dsa.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Dsa.cs @@ -158,15 +158,15 @@ private static partial bool GetDsaParameters( [return: MarshalAs(UnmanagedType.Bool)] internal static partial bool DsaKeyCreateByExplicitParameters( out SafeDsaHandle dsa, - byte[] p, + [In] byte[] p, int pLength, - byte[] q, + [In] byte[] q, int qLength, - byte[] g, + [In] byte[] g, int gLength, - byte[] y, + [In] byte[] y, int yLength, - byte[]? x, + [In] byte[]? x, int xLength); /// diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EcDsa.ImportExport.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EcDsa.ImportExport.cs index b5cf5295e47872..da92588a899b7d 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EcDsa.ImportExport.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EcDsa.ImportExport.cs @@ -15,9 +15,9 @@ internal static partial class Crypto private static partial int EcKeyCreateByKeyParameters( out SafeEcKeyHandle key, string oid, - byte[]? qx, int qxLength, - byte[]? qy, int qyLength, - byte[]? d, int dLength); + [In] byte[]? qx, int qxLength, + [In] byte[]? qy, int qyLength, + [In] byte[]? d, int dLength); internal static SafeEcKeyHandle EcKeyCreateByKeyParameters( string oid, @@ -40,17 +40,17 @@ internal static SafeEcKeyHandle EcKeyCreateByKeyParameters( [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_EcKeyCreateByExplicitParameters")] internal static partial SafeEcKeyHandle EcKeyCreateByExplicitParameters( ECCurve.ECCurveType curveType, - byte[]? qx, int qxLength, - byte[]? qy, int qyLength, - byte[]? d, int dLength, - byte[] p, int pLength, - byte[] a, int aLength, - byte[] b, int bLength, - byte[] gx, int gxLength, - byte[] gy, int gyLength, - byte[] order, int nLength, - byte[]? cofactor, int cofactorLength, - byte[]? seed, int seedLength); + [In] byte[]? qx, int qxLength, + [In] byte[]? qy, int qyLength, + [In] byte[]? d, int dLength, + [In] byte[] p, int pLength, + [In] byte[] a, int aLength, + [In] byte[] b, int bLength, + [In] byte[] gx, int gxLength, + [In] byte[] gy, int gyLength, + [In] byte[] order, int nLength, + [In] byte[]? cofactor, int cofactorLength, + [In] byte[]? seed, int seedLength); internal static SafeEcKeyHandle EcKeyCreateByExplicitCurve(ECCurve curve) { diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OCSP.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OCSP.cs index 8b07660a3fb657..864d4809e7460f 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OCSP.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OCSP.cs @@ -18,7 +18,7 @@ internal static partial class Crypto internal static partial int GetOcspRequestDerSize(SafeOcspRequestHandle req); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_EncodeOcspRequest")] - internal static partial int EncodeOcspRequest(SafeOcspRequestHandle req, byte[] buf); + internal static partial int EncodeOcspRequest(SafeOcspRequestHandle req, [Out] byte[] buf); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_X509BuildOcspRequest")] internal static partial SafeOcspRequestHandle X509BuildOcspRequest(IntPtr subject, IntPtr issuer); diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Pkcs7.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Pkcs7.cs index bf922ca4f6852b..01e37d0d613e7e 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Pkcs7.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Pkcs7.cs @@ -34,7 +34,7 @@ internal static SafePkcs7Handle DecodePkcs7(ReadOnlySpan buf) => internal static partial int GetPkcs7DerSize(SafePkcs7Handle p7); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_EncodePkcs7")] - internal static partial int EncodePkcs7(SafePkcs7Handle p7, byte[] buf); + internal static partial int EncodePkcs7(SafePkcs7Handle p7, [Out] byte[] buf); internal static SafeSharedX509StackHandle GetPkcs7Certificates(SafePkcs7Handle p7) { diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509.cs index 975940df1cf7c8..451b8a01d9821a 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509.cs @@ -32,7 +32,7 @@ internal static partial class Crypto internal static partial SafeEvpPKeyHandle GetX509EvpPublicKey(SafeX509Handle x509); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_DecodeX509Crl")] - internal static partial SafeX509CrlHandle DecodeX509Crl(byte[] buf, int len); + internal static partial SafeX509CrlHandle DecodeX509Crl([In] byte[] buf, int len); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_DecodeX509")] internal static partial SafeX509Handle DecodeX509(ref byte buf, int len); @@ -44,7 +44,7 @@ internal static partial class Crypto internal static partial int GetX509DerSize(SafeX509Handle x); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_EncodeX509")] - internal static partial int EncodeX509(SafeX509Handle x, byte[] buf); + internal static partial int EncodeX509(SafeX509Handle x, [Out] byte[] buf); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_X509Destroy")] internal static partial void X509Destroy(IntPtr a); @@ -272,7 +272,7 @@ internal static unsafe string GetX509VerifyCertErrorString(int n) internal static partial int GetX509SubjectPublicKeyInfoDerSize(SafeX509Handle x509); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_EncodeX509SubjectPublicKeyInfo")] - internal static partial int EncodeX509SubjectPublicKeyInfo(SafeX509Handle x509, byte[] buf); + internal static partial int EncodeX509SubjectPublicKeyInfo(SafeX509Handle x509, [Out] byte[] buf); internal enum X509VerifyStatusCodeUniversal { diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509Name.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509Name.cs index 9cd1e9e8bd2540..c4af93116b02d2 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509Name.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509Name.cs @@ -18,7 +18,7 @@ private static partial SafeSharedX509NameHandle GetX509NameStackField_private(Sa int loc); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_GetX509NameRawBytes")] - private static partial int GetX509NameRawBytes(SafeSharedX509NameHandle x509Name, byte[]? buf, int cBuf); + private static partial int GetX509NameRawBytes(SafeSharedX509NameHandle x509Name, [Out] byte[]? buf, int cBuf); internal static X500DistinguishedName LoadX500Name(SafeSharedX509NameHandle namePtr) { diff --git a/src/libraries/Common/src/Interop/Windows/Activeds/Interop.ADsEncodeBinaryData.cs b/src/libraries/Common/src/Interop/Windows/Activeds/Interop.ADsEncodeBinaryData.cs index 1e1dae76291cd4..ae80655501281c 100644 --- a/src/libraries/Common/src/Interop/Windows/Activeds/Interop.ADsEncodeBinaryData.cs +++ b/src/libraries/Common/src/Interop/Windows/Activeds/Interop.ADsEncodeBinaryData.cs @@ -9,6 +9,6 @@ internal static partial class Interop internal static partial class Activeds { [LibraryImport(Libraries.Activeds)] - internal static partial int ADsEncodeBinaryData(byte[] data, int length, ref IntPtr result); + internal static partial int ADsEncodeBinaryData([In] byte[] data, int length, ref IntPtr result); } } diff --git a/src/libraries/Common/src/Interop/Windows/Activeds/Interop.ADsGetLastError.cs b/src/libraries/Common/src/Interop/Windows/Activeds/Interop.ADsGetLastError.cs index acff74ad589761..090208e4f38934 100644 --- a/src/libraries/Common/src/Interop/Windows/Activeds/Interop.ADsGetLastError.cs +++ b/src/libraries/Common/src/Interop/Windows/Activeds/Interop.ADsGetLastError.cs @@ -9,6 +9,6 @@ internal static partial class Interop internal static partial class Activeds { [LibraryImport(Libraries.Activeds)] - internal static partial int ADsGetLastError(out int error, char[] errorBuffer, int errorBufferLength, char[] nameBuffer, int nameBufferLength); + internal static partial int ADsGetLastError(out int error, [Out] char[] errorBuffer, int errorBufferLength, [Out] char[] nameBuffer, int nameBufferLength); } } diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CheckTokenMembership.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CheckTokenMembership.cs index 9ab0dbb4ec660f..9508266829fc41 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CheckTokenMembership.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CheckTokenMembership.cs @@ -13,7 +13,7 @@ internal static partial class Advapi32 [return: MarshalAs(UnmanagedType.Bool)] internal static partial bool CheckTokenMembership( SafeAccessTokenHandle TokenHandle, - byte[] SidToCheck, + [In] byte[] SidToCheck, [MarshalAs(UnmanagedType.Bool)] ref bool IsMember); } } diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.ConvertSdToStringSd.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.ConvertSdToStringSd.cs index cc38bce888cd8d..4201f9dd2e3fcf 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.ConvertSdToStringSd.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.ConvertSdToStringSd.cs @@ -12,7 +12,7 @@ internal static partial class Advapi32 SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] internal static partial bool ConvertSdToStringSd( - byte[] securityDescriptor, + [In] byte[] securityDescriptor, /* DWORD */ uint requestedRevision, uint securityInformation, out IntPtr resultString, diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CreateWellKnownSid.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CreateWellKnownSid.cs index 9cec916f5a1032..b9b2932d87096d 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CreateWellKnownSid.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CreateWellKnownSid.cs @@ -15,8 +15,8 @@ internal static partial class Advapi32 [LibraryImport(Libraries.Advapi32, SetLastError = true)] internal static partial int CreateWellKnownSid( int sidType, - byte[]? domainSid, - byte[] resultSid, + [In] byte[]? domainSid, + [Out] byte[] resultSid, ref uint resultSidLength); [LibraryImport(Libraries.Advapi32, SetLastError = true)] diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptDecrypt.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptDecrypt.cs index 1178b4977aa34f..d5547de42b80a6 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptDecrypt.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptDecrypt.cs @@ -21,7 +21,7 @@ public static partial bool CryptDecrypt( SafeHashHandle hHash, [MarshalAs(UnmanagedType.Bool)] bool Final, int dwFlags, - byte[] pbData, + [In, Out] byte[] pbData, ref int pdwDataLen); } } diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptEncrypt.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptEncrypt.cs index fc35d9cde95c88..4c9a2189119b2d 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptEncrypt.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptEncrypt.cs @@ -15,7 +15,7 @@ public static partial bool CryptEncrypt( SafeHashHandle hHash, [MarshalAs(UnmanagedType.Bool)] bool Final, int dwFlags, - byte[]? pbData, + [In, Out] byte[]? pbData, ref int pdwDataLen, int dwBufLen); } diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptExportKey.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptExportKey.cs index ffcc0b0e3a1ee6..4524cb6892e9be 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptExportKey.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptExportKey.cs @@ -15,7 +15,7 @@ public static partial bool CryptExportKey( SafeCapiKeyHandle hExpKey, int dwBlobType, int dwFlags, - byte[]? pbData, + [Out] byte[]? pbData, ref int dwDataLen); } } diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptGetHashParam.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptGetHashParam.cs index cbf469011ba49a..2b5fd0385d6a5e 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptGetHashParam.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptGetHashParam.cs @@ -29,6 +29,6 @@ public static partial bool CryptGetHashParam( [LibraryImport(Libraries.Advapi32, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - public static partial bool CryptSetHashParam(SafeHashHandle hHash, CryptHashProperty dwParam, byte[] buffer, int dwFlags); + public static partial bool CryptSetHashParam(SafeHashHandle hHash, CryptHashProperty dwParam, [In] byte[] buffer, int dwFlags); } } diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptGetKeyParam.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptGetKeyParam.cs index 58a360cbd6ff5e..6cfff56bc35be6 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptGetKeyParam.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptGetKeyParam.cs @@ -22,7 +22,7 @@ internal enum CryptGetKeyParamFlags : int public static partial bool CryptGetKeyParam( SafeCapiKeyHandle hKey, CryptGetKeyParamFlags dwParam, - byte[]? pbData, + [Out] byte[]? pbData, ref int pdwDataLen, int dwFlags); } diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptHashData.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptHashData.cs index 4d120afcc53e97..d2a5c6ffd7b5af 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptHashData.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptHashData.cs @@ -10,6 +10,6 @@ internal static partial class Advapi32 { [LibraryImport(Libraries.Advapi32, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - public static partial bool CryptHashData(SafeHashHandle hHash, byte[] pbData, int dwDataLen, int dwFlags); + public static partial bool CryptHashData(SafeHashHandle hHash, [In] byte[] pbData, int dwDataLen, int dwFlags); } } diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptSetKeyParam.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptSetKeyParam.cs index d48acdc9ffb5d9..28e63ec124d368 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptSetKeyParam.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptSetKeyParam.cs @@ -10,7 +10,7 @@ internal static partial class Advapi32 { [LibraryImport(Libraries.Advapi32, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - public static partial bool CryptSetKeyParam(SafeCapiKeyHandle hKey, int dwParam, byte[] pbData, int dwFlags); + public static partial bool CryptSetKeyParam(SafeCapiKeyHandle hKey, int dwParam, [In] byte[] pbData, int dwFlags); [LibraryImport(Libraries.Advapi32, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptSignHash.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptSignHash.cs index 408c9254c851f4..a2a1315787bc5c 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptSignHash.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CryptSignHash.cs @@ -31,14 +31,14 @@ public static partial bool CryptSignHash( KeySpec dwKeySpec, string? szDescription, CryptSignAndVerifyHashFlags dwFlags, - byte[]? pbSignature, + [Out] byte[]? pbSignature, ref int pdwSigLen); [LibraryImport(Libraries.Advapi32, EntryPoint = "CryptVerifySignatureW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)] [return: MarshalAs(UnmanagedType.Bool)] public static partial bool CryptVerifySignature( SafeHashHandle hHash, - byte[] pbSignature, + [In] byte[] pbSignature, int dwSigLen, SafeCapiKeyHandle hPubKey, string? szDescription, diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.GetWindowsAccountDomainSid.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.GetWindowsAccountDomainSid.cs index 5d5bc2b1f78c23..770afeedad8433 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.GetWindowsAccountDomainSid.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.GetWindowsAccountDomainSid.cs @@ -10,8 +10,8 @@ internal static partial class Advapi32 { [LibraryImport(Interop.Libraries.Advapi32, EntryPoint = "GetWindowsAccountDomainSid", SetLastError = true)] internal static partial int GetWindowsAccountDomainSid( - byte[] sid, - byte[] resultSid, + [In] byte[] sid, + [Out] byte[] resultSid, ref uint resultSidLength); } } diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.IsEqualDomainSid.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.IsEqualDomainSid.cs index f7cfc286077896..4fa2af48081cb8 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.IsEqualDomainSid.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.IsEqualDomainSid.cs @@ -10,8 +10,8 @@ internal static partial class Advapi32 { [LibraryImport(Interop.Libraries.Advapi32, EntryPoint = "EqualDomainSid", SetLastError = true)] internal static partial int IsEqualDomainSid( - byte[] sid1, - byte[] sid2, + [In] byte[] sid1, + [In] byte[] sid2, [MarshalAs(UnmanagedType.Bool)] out bool result); } } diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.IsWellKnownSid.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.IsWellKnownSid.cs index 04c1381f8f2be7..7ce47f416dff78 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.IsWellKnownSid.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.IsWellKnownSid.cs @@ -10,7 +10,7 @@ internal static partial class Advapi32 { [LibraryImport(Interop.Libraries.Advapi32, EntryPoint = "IsWellKnownSid", SetLastError = true)] internal static partial int IsWellKnownSid( - byte[] sid, + [In] byte[] sid, int type); } } diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.LookupAccountSid.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.LookupAccountSid.cs index accca1e6ba055a..ddd250146d093f 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.LookupAccountSid.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.LookupAccountSid.cs @@ -11,7 +11,7 @@ internal static partial class Advapi32 [LibraryImport(Interop.Libraries.Advapi32, EntryPoint = "LookupAccountSidW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)] public static unsafe partial int LookupAccountSid( string lpSystemName, - byte[] Sid, + [In] byte[] Sid, char* Name, ref int cchName, char* ReferencedDomainName, diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.LsaLookupNames2.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.LsaLookupNames2.cs index 59f0f9382cb7cd..da3a74085492e7 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.LsaLookupNames2.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.LsaLookupNames2.cs @@ -15,7 +15,7 @@ internal static partial uint LsaLookupNames2( SafeLsaPolicyHandle handle, int flags, int count, - MARSHALLED_UNICODE_STRING[] names, + [In] MARSHALLED_UNICODE_STRING[] names, out SafeLsaMemoryHandle referencedDomains, out SafeLsaMemoryHandle sids ); diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.LsaLookupSids.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.LsaLookupSids.cs index 9b7a72001fc285..0ee2bcf7a1c4c1 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.LsaLookupSids.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.LsaLookupSids.cs @@ -13,7 +13,7 @@ internal static partial class Advapi32 internal static partial uint LsaLookupSids( SafeLsaPolicyHandle handle, int count, - IntPtr[] sids, + [In] IntPtr[] sids, out SafeLsaMemoryHandle referencedDomains, out SafeLsaMemoryHandle names ); diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.ReadEventLog.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.ReadEventLog.cs index 5818fbc5cbf5f5..23e28faab18d9d 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.ReadEventLog.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.ReadEventLog.cs @@ -18,7 +18,7 @@ public static partial bool ReadEventLog( SafeEventLogReadHandle hEventLog, int dwReadFlags, int dwRecordOffset, - byte[] lpBuffer, + [Out] byte[] lpBuffer, int nNumberOfBytesRead, out int pnBytesRead, out int pnMinNumberOfBytesNeeded); diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegEnumKeyEx.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegEnumKeyEx.cs index cbcf4dbf05c25c..1115cc553377d9 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegEnumKeyEx.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegEnumKeyEx.cs @@ -18,9 +18,9 @@ internal static unsafe partial int RegEnumKeyEx( int dwIndex, ref char lpName, ref int lpcbName, - int[]? lpReserved, + [In] int[]? lpReserved, [Out] char[]? lpClass, - int[]? lpcbClass, - long[]? lpftLastWriteTime); + [In, Out] int[]? lpcbClass, + [Out] long[]? lpftLastWriteTime); } } diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegEnumValue.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegEnumValue.cs index 2823ee33abff24..b62da5f051281f 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegEnumValue.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegEnumValue.cs @@ -20,8 +20,8 @@ internal static partial int RegEnumValue( [Out] char[] lpValueName, ref int lpcbValueName, IntPtr lpReserved_MustBeZero, - int[]? lpType, - byte[]? lpData, - int[]? lpcbData); + [Out] int[]? lpType, + [Out] byte[]? lpData, + [In, Out] int[]? lpcbData); } } diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegQueryInfoKey.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegQueryInfoKey.cs index d0a0eaf75a5aca..10c4c7b8f4be3c 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegQueryInfoKey.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegQueryInfoKey.cs @@ -18,15 +18,15 @@ internal static partial class Advapi32 internal static partial int RegQueryInfoKey( SafeRegistryHandle hKey, [Out] char[]? lpClass, - int[]? lpcbClass, + [In, Out] int[]? lpcbClass, IntPtr lpReserved_MustBeZero, ref int lpcSubKeys, - int[]? lpcbMaxSubKeyLen, - int[]? lpcbMaxClassLen, + [Out] int[]? lpcbMaxSubKeyLen, + [Out] int[]? lpcbMaxClassLen, ref int lpcValues, - int[]? lpcbMaxValueNameLen, - int[]? lpcbMaxValueLen, - int[]? lpcbSecurityDescriptor, - int[]? lpftLastWriteTime); + [Out] int[]? lpcbMaxValueNameLen, + [Out] int[]? lpcbMaxValueLen, + [Out] int[]? lpcbSecurityDescriptor, + [Out] int[]? lpftLastWriteTime); } } diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegQueryValueEx.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegQueryValueEx.cs index aee1aac4dcb6b1..32984da43f891d 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegQueryValueEx.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegQueryValueEx.cs @@ -16,9 +16,9 @@ internal static partial class Advapi32 internal static partial int RegQueryValueEx( SafeRegistryHandle hKey, string? lpValueName, - int[]? lpReserved, + [In] int[]? lpReserved, ref int lpType, - byte[]? lpData, + [Out] byte[]? lpData, ref int lpcbData); [LibraryImport(Libraries.Advapi32, EntryPoint = "RegQueryValueExW", StringMarshalling = StringMarshalling.Utf16)] diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegSetValueEx.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegSetValueEx.cs index 315fd5c6f8a879..37368a80200b71 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegSetValueEx.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegSetValueEx.cs @@ -18,7 +18,7 @@ internal static partial int RegSetValueEx( string? lpValueName, int Reserved, int dwType, - byte[]? lpData, + [In] byte[]? lpData, int cbData); [LibraryImport(Libraries.Advapi32, EntryPoint = "RegSetValueExW", StringMarshalling = StringMarshalling.Utf16)] @@ -27,7 +27,7 @@ internal static partial int RegSetValueEx( string? lpValueName, int Reserved, int dwType, - char[]? lpData, + [In] char[]? lpData, int cbData); [LibraryImport(Libraries.Advapi32, EntryPoint = "RegSetValueExW", StringMarshalling = StringMarshalling.Utf16)] diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.ReportEvent.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.ReportEvent.cs index ee8ad9e93a5643..948f558a223b81 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.ReportEvent.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.ReportEvent.cs @@ -16,10 +16,10 @@ public static partial bool ReportEvent( short wType, ushort wcategory, uint dwEventID, - byte[] lpUserSid, + [In] byte[] lpUserSid, short wNumStrings, int dwDataSize, IntPtr lpStrings, - byte[] lpRawData); + [In] byte[] lpRawData); } } diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.ReportEvent_IntPtr.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.ReportEvent_IntPtr.cs index d605a21a4c923e..0841b6476e6321 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.ReportEvent_IntPtr.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.ReportEvent_IntPtr.cs @@ -15,10 +15,10 @@ public static partial bool ReportEvent( short wType, ushort wcategory, uint dwEventID, - byte[] lpUserSid, + [In] byte[] lpUserSid, short wNumStrings, int dwDataSize, IntPtr lpStrings, - byte[] lpRawData); + [In] byte[] lpRawData); } } diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.SetSecurityInfoByHandle.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.SetSecurityInfoByHandle.cs index 8e6e8aca26aa1f..d4c36f09171269 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.SetSecurityInfoByHandle.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.SetSecurityInfoByHandle.cs @@ -13,9 +13,9 @@ internal static partial uint SetSecurityInfoByHandle( SafeHandle handle, /*DWORD*/ uint objectType, /*DWORD*/ uint securityInformation, - byte[]? owner, - byte[]? group, - byte[]? dacl, - byte[]? sacl); + [In] byte[]? owner, + [In] byte[]? group, + [In] byte[]? dacl, + [In] byte[]? sacl); } } diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.SetSecurityInfoByName.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.SetSecurityInfoByName.cs index 95e9c17074790c..9175d9820d7457 100644 --- a/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.SetSecurityInfoByName.cs +++ b/src/libraries/Common/src/Interop/Windows/Advapi32/Interop.SetSecurityInfoByName.cs @@ -14,9 +14,9 @@ internal static partial uint SetSecurityInfoByName( string name, /*DWORD*/ uint objectType, /*DWORD*/ uint securityInformation, - byte[]? owner, - byte[]? group, - byte[]? dacl, - byte[]? sacl); + [In] byte[]? owner, + [In] byte[]? group, + [In] byte[]? dacl, + [In] byte[]? sacl); } } diff --git a/src/libraries/Common/src/Interop/Windows/BCrypt/Interop.BCryptEncryptDecrypt.cs b/src/libraries/Common/src/Interop/Windows/BCrypt/Interop.BCryptEncryptDecrypt.cs index 45d977995b11a5..cac7d5f6ef7b6d 100644 --- a/src/libraries/Common/src/Interop/Windows/BCrypt/Interop.BCryptEncryptDecrypt.cs +++ b/src/libraries/Common/src/Interop/Windows/BCrypt/Interop.BCryptEncryptDecrypt.cs @@ -54,9 +54,9 @@ internal static int BCryptDecrypt(SafeKeyHandle hKey, ReadOnlySpan input, } [LibraryImport(Libraries.BCrypt)] - public static unsafe partial NTSTATUS BCryptEncrypt(SafeKeyHandle hKey, byte* pbInput, int cbInput, IntPtr paddingInfo, byte[]? pbIV, int cbIV, byte* pbOutput, int cbOutput, out int cbResult, int dwFlags); + public static unsafe partial NTSTATUS BCryptEncrypt(SafeKeyHandle hKey, byte* pbInput, int cbInput, IntPtr paddingInfo, [In, Out] byte[]? pbIV, int cbIV, byte* pbOutput, int cbOutput, out int cbResult, int dwFlags); [LibraryImport(Libraries.BCrypt)] - public static unsafe partial NTSTATUS BCryptDecrypt(SafeKeyHandle hKey, byte* pbInput, int cbInput, IntPtr paddingInfo, byte[]? pbIV, int cbIV, byte* pbOutput, int cbOutput, out int cbResult, int dwFlags); + public static unsafe partial NTSTATUS BCryptDecrypt(SafeKeyHandle hKey, byte* pbInput, int cbInput, IntPtr paddingInfo, [In, Out] byte[]? pbIV, int cbIV, byte* pbOutput, int cbOutput, out int cbResult, int dwFlags); } } diff --git a/src/libraries/Common/src/Interop/Windows/BCrypt/Interop.BCryptExportKey.cs b/src/libraries/Common/src/Interop/Windows/BCrypt/Interop.BCryptExportKey.cs index a9c3da451f636d..f691eba430dbb4 100644 --- a/src/libraries/Common/src/Interop/Windows/BCrypt/Interop.BCryptExportKey.cs +++ b/src/libraries/Common/src/Interop/Windows/BCrypt/Interop.BCryptExportKey.cs @@ -17,7 +17,7 @@ private static partial NTSTATUS BCryptExportKey( SafeBCryptKeyHandle hKey, IntPtr hExportKey, string pszBlobType, - byte[]? pbOutput, + [Out] byte[]? pbOutput, int cbOutput, out int pcbResult, int dwFlags); diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextProperty.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextProperty.cs index a05a4078778f91..32a9e5e326e018 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextProperty.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextProperty.cs @@ -14,7 +14,7 @@ internal static partial class Crypt32 internal static partial bool CertGetCertificateContextProperty( SafeCertContextHandle pCertContext, CertContextPropId dwPropId, - byte[]? pvData, + [Out] byte[]? pvData, ref int pcbData); [LibraryImport(Libraries.Crypt32, SetLastError = true, EntryPoint = "CertGetCertificateContextProperty")] diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextProperty_NO_NULLABLE.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextProperty_NO_NULLABLE.cs index 31c6aca580d2ef..db21c44960715d 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextProperty_NO_NULLABLE.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextProperty_NO_NULLABLE.cs @@ -13,7 +13,7 @@ internal static partial class Crypt32 internal static partial bool CertGetCertificateContextProperty( SafeCertContextHandle pCertContext, CertContextPropId dwPropId, - byte[]? pvData, + [Out] byte[]? pvData, ref int pcbData); } } diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertSerializeCertificateStoreElement.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertSerializeCertificateStoreElement.cs index d97573056ff6ff..629c1a5a2191c3 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertSerializeCertificateStoreElement.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertSerializeCertificateStoreElement.cs @@ -10,6 +10,6 @@ internal static partial class Crypt32 { [LibraryImport(Libraries.Crypt32, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - internal static partial bool CertSerializeCertificateStoreElement(SafeCertContextHandle pCertContext, int dwFlags, byte[]? pbElement, ref int pcbElement); + internal static partial bool CertSerializeCertificateStoreElement(SafeCertContextHandle pCertContext, int dwFlags, [Out] byte[]? pbElement, ref int pcbElement); } } diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertStrToName.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertStrToName.cs index 2d5d4fddde6ca7..988fc5f4fa4222 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertStrToName.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertStrToName.cs @@ -10,6 +10,6 @@ internal static partial class Crypt32 { [LibraryImport(Libraries.Crypt32, EntryPoint = "CertStrToNameW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)] [return: MarshalAs(UnmanagedType.Bool)] - internal static partial bool CertStrToName(CertEncodingType dwCertEncodingType, string pszX500, CertNameStrTypeAndFlags dwStrType, IntPtr pvReserved, byte[]? pbEncoded, ref int pcbEncoded, IntPtr ppszError); + internal static partial bool CertStrToName(CertEncodingType dwCertEncodingType, string pszX500, CertNameStrTypeAndFlags dwStrType, IntPtr pvReserved, [Out] byte[]? pbEncoded, ref int pcbEncoded, IntPtr ppszError); } } diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptDecodeObjectPointer_IntPtr.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptDecodeObjectPointer_IntPtr.cs index 41f8b128d61177..97248824cc5e3c 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptDecodeObjectPointer_IntPtr.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptDecodeObjectPointer_IntPtr.cs @@ -13,7 +13,7 @@ internal static partial class Crypt32 internal static unsafe partial bool CryptDecodeObjectPointer( CertEncodingType dwCertEncodingType, IntPtr lpszStructType, - byte[] pbEncoded, + [In] byte[] pbEncoded, int cbEncoded, CryptDecodeObjectFlags dwFlags, void* pvStructInfo, diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptDecodeObjectPointer_string.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptDecodeObjectPointer_string.cs index 1dce8c8e9e78bf..c947192f57fa4e 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptDecodeObjectPointer_string.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptDecodeObjectPointer_string.cs @@ -12,7 +12,7 @@ internal static partial class Crypt32 internal static unsafe partial bool CryptDecodeObjectPointer( CertEncodingType dwCertEncodingType, [MarshalAs(UnmanagedType.LPStr)] string lpszStructType, - byte[] pbEncoded, int cbEncoded, + [In] byte[] pbEncoded, int cbEncoded, CryptDecodeObjectFlags dwFlags, void* pvStructInfo, ref int pcbStructInfo); diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptDecodeObject_CertEncodingType.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptDecodeObject_CertEncodingType.cs index 7ac987f08d072f..776ab3340381a7 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptDecodeObject_CertEncodingType.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptDecodeObject_CertEncodingType.cs @@ -10,6 +10,6 @@ internal static partial class Crypt32 { [LibraryImport(Libraries.Crypt32, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - internal static partial bool CryptDecodeObject(CertEncodingType dwCertEncodingType, IntPtr lpszStructType, byte[] pbEncoded, int cbEncoded, CryptDecodeObjectFlags dwFlags, byte[]? pvStructInfo, ref int pcbStructInfo); + internal static partial bool CryptDecodeObject(CertEncodingType dwCertEncodingType, IntPtr lpszStructType, [In] byte[] pbEncoded, int cbEncoded, CryptDecodeObjectFlags dwFlags, [Out] byte[]? pvStructInfo, ref int pcbStructInfo); } } diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptEncodeObject.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptEncodeObject.cs index 9d346a3c8291ab..6b8a2d15fa0523 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptEncodeObject.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptEncodeObject.cs @@ -19,7 +19,7 @@ private static unsafe partial bool CryptEncodeObject( MsgEncodingType dwCertEncodingType, nint lpszStructType, void* pvStructInfo, - byte[]? pbEncoded, + [Out] byte[]? pbEncoded, ref int pcbEncoded); } } diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptEncodeObject_CertEncodingType.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptEncodeObject_CertEncodingType.cs index 2d0e9b1b1a3bab..6d66c8a3f1aa0c 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptEncodeObject_CertEncodingType.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptEncodeObject_CertEncodingType.cs @@ -10,10 +10,10 @@ internal static partial class Crypt32 { [LibraryImport(Libraries.Crypt32, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - internal static unsafe partial bool CryptEncodeObject(CertEncodingType dwCertEncodingType, IntPtr lpszStructType, void* pvStructInfo, byte[]? pbEncoded, ref int pcbEncoded); + internal static unsafe partial bool CryptEncodeObject(CertEncodingType dwCertEncodingType, IntPtr lpszStructType, void* pvStructInfo, [Out] byte[]? pbEncoded, ref int pcbEncoded); [LibraryImport(Libraries.Crypt32, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - internal static unsafe partial bool CryptEncodeObject(CertEncodingType dwCertEncodingType, [MarshalAs(UnmanagedType.LPStr)] string lpszStructType, void* pvStructInfo, byte[]? pbEncoded, ref int pcbEncoded); + internal static unsafe partial bool CryptEncodeObject(CertEncodingType dwCertEncodingType, [MarshalAs(UnmanagedType.LPStr)] string lpszStructType, void* pvStructInfo, [Out] byte[]? pbEncoded, ref int pcbEncoded); } } diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptFormatObject.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptFormatObject.cs index ae5f4e792fde69..93b352f9190526 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptFormatObject.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptFormatObject.cs @@ -20,7 +20,7 @@ internal static unsafe partial bool CryptFormatObject( int dwFormatStrType, // select multiline IntPtr pFormatStruct, // unused - pass IntPtr.Zero byte* lpszStructType, // OID value - byte[] pbEncoded, // Data to be formatted + [In] byte[] pbEncoded, // Data to be formatted int cbEncoded, // Length of data to be formatted void* pbFormat, // Receives formatted string. ref int pcbFormat); // Sends/receives length of formatted string in bytes diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptMsgUpdate.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptMsgUpdate.cs index 503789f12c6727..906ee587d76a69 100644 --- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptMsgUpdate.cs +++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CryptMsgUpdate.cs @@ -11,7 +11,7 @@ internal static partial class Crypt32 { [LibraryImport(Libraries.Crypt32, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - internal static partial bool CryptMsgUpdate(SafeCryptMsgHandle hCryptMsg, byte[] pbData, int cbData, [MarshalAs(UnmanagedType.Bool)] bool fFinal); + internal static partial bool CryptMsgUpdate(SafeCryptMsgHandle hCryptMsg, [In] byte[] pbData, int cbData, [MarshalAs(UnmanagedType.Bool)] bool fFinal); [LibraryImport(Libraries.Crypt32, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.EnumProcessModulesEx.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.EnumProcessModulesEx.cs index 9d795c6f45b2ce..e510c7d04b2d4c 100644 --- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.EnumProcessModulesEx.cs +++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.EnumProcessModulesEx.cs @@ -13,6 +13,6 @@ internal static partial class Kernel32 [LibraryImport(Libraries.Kernel32, EntryPoint = "K32EnumProcessModulesEx", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - internal static partial bool EnumProcessModulesEx(SafeProcessHandle handle, IntPtr[]? modules, int size, out int needed, int filterFlag); + internal static partial bool EnumProcessModulesEx(SafeProcessHandle handle, [Out] IntPtr[]? modules, int size, out int needed, int filterFlag); } } diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.EnumProcesses.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.EnumProcesses.cs index 96a3b5e5409019..57f8ba4ec286a9 100644 --- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.EnumProcesses.cs +++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.EnumProcesses.cs @@ -9,6 +9,6 @@ internal static partial class Kernel32 { [LibraryImport(Libraries.Kernel32, EntryPoint = "K32EnumProcesses", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)] [return: MarshalAs(UnmanagedType.Bool)] - internal static partial bool EnumProcesses(int[] processIds, int size, out int needed); + internal static partial bool EnumProcesses([Out] int[] processIds, int size, out int needed); } } diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.FormatMessage_SafeLibraryHandle.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.FormatMessage_SafeLibraryHandle.cs index cc01c8b461b957..7668595ee0b09d 100644 --- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.FormatMessage_SafeLibraryHandle.cs +++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.FormatMessage_SafeLibraryHandle.cs @@ -21,6 +21,6 @@ public static partial int FormatMessage( int dwLanguageId, [Out] char[] lpBuffer, int nSize, - IntPtr[] arguments); + [In] IntPtr[] arguments); } } diff --git a/src/libraries/Common/src/Interop/Windows/NCrypt/Interop.Keys.cs b/src/libraries/Common/src/Interop/Windows/NCrypt/Interop.Keys.cs index 1b24ea9b4e471c..f22c56f225aa4f 100644 --- a/src/libraries/Common/src/Interop/Windows/NCrypt/Interop.Keys.cs +++ b/src/libraries/Common/src/Interop/Windows/NCrypt/Interop.Keys.cs @@ -26,7 +26,7 @@ internal static partial class NCrypt internal static partial ErrorCode NCryptImportKey(SafeNCryptProviderHandle hProvider, IntPtr hImportKey, string pszBlobType, ref NCryptBufferDesc pParameterList, out SafeNCryptKeyHandle phKey, ref byte pbData, int cbData, int dwFlags); [LibraryImport(Interop.Libraries.NCrypt, StringMarshalling = StringMarshalling.Utf16)] - internal static partial ErrorCode NCryptExportKey(SafeNCryptKeyHandle hKey, IntPtr hExportKey, string pszBlobType, IntPtr pParameterList, byte[]? pbOutput, int cbOutput, out int pcbResult, int dwFlags); + internal static partial ErrorCode NCryptExportKey(SafeNCryptKeyHandle hKey, IntPtr hExportKey, string pszBlobType, IntPtr pParameterList, [Out] byte[]? pbOutput, int cbOutput, out int pcbResult, int dwFlags); [LibraryImport(Interop.Libraries.NCrypt, StringMarshalling = StringMarshalling.Utf16)] internal static partial ErrorCode NCryptExportKey(SafeNCryptKeyHandle hKey, IntPtr hExportKey, string pszBlobType, IntPtr pParameterList, ref byte pbOutput, int cbOutput, out int pcbResult, int dwFlags); diff --git a/src/libraries/Common/src/Interop/Windows/NCrypt/Interop.NCryptDeriveKeyMaterial.cs b/src/libraries/Common/src/Interop/Windows/NCrypt/Interop.NCryptDeriveKeyMaterial.cs index 61635c50767301..7235a815b85ee5 100644 --- a/src/libraries/Common/src/Interop/Windows/NCrypt/Interop.NCryptDeriveKeyMaterial.cs +++ b/src/libraries/Common/src/Interop/Windows/NCrypt/Interop.NCryptDeriveKeyMaterial.cs @@ -20,7 +20,7 @@ private static partial ErrorCode NCryptDeriveKey( SafeNCryptSecretHandle hSharedSecret, string pwszKDF, ref NCryptBufferDesc pParameterList, - [MarshalAs(UnmanagedType.LPArray)] byte[]? pbDerivedKey, + [MarshalAs(UnmanagedType.LPArray), Out] byte[]? pbDerivedKey, int cbDerivedKey, out int pcbResult, SecretAgreementFlags dwFlags); diff --git a/src/libraries/Common/src/Interop/Windows/OleAut32/Interop.SysAllocStringByteLen.cs b/src/libraries/Common/src/Interop/Windows/OleAut32/Interop.SysAllocStringByteLen.cs index 717fb1c3da32ec..76bfa616078ef8 100644 --- a/src/libraries/Common/src/Interop/Windows/OleAut32/Interop.SysAllocStringByteLen.cs +++ b/src/libraries/Common/src/Interop/Windows/OleAut32/Interop.SysAllocStringByteLen.cs @@ -9,6 +9,6 @@ internal static partial class Interop internal static partial class OleAut32 { [LibraryImport(Libraries.OleAut32)] - internal static partial IntPtr SysAllocStringByteLen(byte[]? str, uint len); + internal static partial IntPtr SysAllocStringByteLen([In] byte[]? str, uint len); } } diff --git a/src/libraries/Common/src/Interop/Windows/SspiCli/Interop.SSPI.cs b/src/libraries/Common/src/Interop/Windows/SspiCli/Interop.SSPI.cs index ffb51e5dd0d969..75926c10e5c0b0 100644 --- a/src/libraries/Common/src/Interop/Windows/SspiCli/Interop.SSPI.cs +++ b/src/libraries/Common/src/Interop/Windows/SspiCli/Interop.SSPI.cs @@ -415,7 +415,7 @@ internal static unsafe partial int QueryContextAttributesW( internal static partial int SetContextAttributesW( ref CredHandle contextHandle, ContextAttribute attribute, - byte[] buffer, + [In] byte[] buffer, int bufferSize); [LibraryImport(Interop.Libraries.SspiCli, SetLastError = true)] diff --git a/src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketBeginClientHandshake.cs b/src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketBeginClientHandshake.cs index f0d011185b15ab..96be0855488cd1 100644 --- a/src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketBeginClientHandshake.cs +++ b/src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketBeginClientHandshake.cs @@ -15,7 +15,7 @@ internal static unsafe partial int WebSocketBeginClientHandshake( uint subProtocolCount, IntPtr extensions, uint extensionCount, - HttpHeader[] initialHeaders, + [In] HttpHeader[] initialHeaders, uint initialHeaderCount, out WEB_SOCKET_HTTP_HEADER* additionalHeadersPtr, out uint additionalHeaderCount); diff --git a/src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketBeginServerHandshake.cs b/src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketBeginServerHandshake.cs index 20b0d9c782e1d9..46a614af23783a 100644 --- a/src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketBeginServerHandshake.cs +++ b/src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketBeginServerHandshake.cs @@ -14,7 +14,7 @@ internal static partial int WebSocketBeginServerHandshake( IntPtr subProtocol, IntPtr extensions, uint extensionCount, - HttpHeader[] requestHeaders, + [In] HttpHeader[] requestHeaders, uint requestHeaderCount, out IntPtr responseHeadersPtr, out uint responseHeaderCount); diff --git a/src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketCreateClientHandle.cs b/src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketCreateClientHandle.cs index 33c64a7e7e3852..fc81e5b21890d3 100644 --- a/src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketCreateClientHandle.cs +++ b/src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketCreateClientHandle.cs @@ -12,7 +12,7 @@ internal static partial class WebSocket { [LibraryImport(Libraries.WebSocket)] internal static partial int WebSocketCreateClientHandle( - Property[] properties, + [In] Property[] properties, uint propertyCount, out SafeWebSocketHandle webSocketHandle); } diff --git a/src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketCreateServerHandle.cs b/src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketCreateServerHandle.cs index e7f058468075ac..b4e904e3fbe456 100644 --- a/src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketCreateServerHandle.cs +++ b/src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketCreateServerHandle.cs @@ -11,7 +11,7 @@ internal static partial class WebSocket { [LibraryImport(Libraries.WebSocket)] internal static partial int WebSocketCreateServerHandle( - Property[] properties, + [In] Property[] properties, uint propertyCount, out SafeWebSocketHandle webSocketHandle); } diff --git a/src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketGetAction.cs b/src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketGetAction.cs index 9f4ac61846f994..58c191fbfb8d48 100644 --- a/src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketGetAction.cs +++ b/src/libraries/Common/src/Interop/Windows/WebSocket/Interop.WebSocketGetAction.cs @@ -14,7 +14,7 @@ internal static partial class WebSocket internal static partial int WebSocketGetAction( SafeHandle webSocketHandle, ActionQueue actionQueue, - Buffer[] dataBuffers, + [In, Out] Buffer[] dataBuffers, ref uint dataBufferCount, out System.Net.WebSockets.WebSocketProtocolComponent.Action action, out BufferType bufferType, diff --git a/src/libraries/Common/src/Interop/Windows/WinMm/Interop.PlaySound.cs b/src/libraries/Common/src/Interop/Windows/WinMm/Interop.PlaySound.cs index 55ca77837ab4aa..9676861fa84cb5 100644 --- a/src/libraries/Common/src/Interop/Windows/WinMm/Interop.PlaySound.cs +++ b/src/libraries/Common/src/Interop/Windows/WinMm/Interop.PlaySound.cs @@ -23,6 +23,6 @@ internal static partial class WinMM [LibraryImport(Libraries.WinMM, EntryPoint = "PlaySoundW")] [return: MarshalAs(UnmanagedType.Bool)] - internal static partial bool PlaySound(byte[]? soundName, IntPtr hmod, int soundFlags); + internal static partial bool PlaySound([In] byte[]? soundName, IntPtr hmod, int soundFlags); } } diff --git a/src/libraries/Common/src/Interop/Windows/WinMm/Interop.mmioRead.cs b/src/libraries/Common/src/Interop/Windows/WinMm/Interop.mmioRead.cs index ecf8a0e3ca046a..f43672d39073fd 100644 --- a/src/libraries/Common/src/Interop/Windows/WinMm/Interop.mmioRead.cs +++ b/src/libraries/Common/src/Interop/Windows/WinMm/Interop.mmioRead.cs @@ -25,6 +25,6 @@ internal sealed class WAVEFORMATEX internal const int WAVE_FORMAT_IEEE_FLOAT = 0x0003; [LibraryImport(Libraries.WinMM)] - internal static partial int mmioRead(IntPtr hMIO, [MarshalAs(UnmanagedType.LPArray)] byte[] wf, int cch); + internal static partial int mmioRead(IntPtr hMIO, [Out, MarshalAs(UnmanagedType.LPArray)] byte[] wf, int cch); } } diff --git a/src/libraries/Common/src/Interop/Windows/WinMm/Interop.waveOutOpen.cs b/src/libraries/Common/src/Interop/Windows/WinMm/Interop.waveOutOpen.cs index 41e46950029329..09f9c922d13074 100644 --- a/src/libraries/Common/src/Interop/Windows/WinMm/Interop.waveOutOpen.cs +++ b/src/libraries/Common/src/Interop/Windows/WinMm/Interop.waveOutOpen.cs @@ -46,6 +46,6 @@ internal enum MM_MSG /// Flags for opening the device. /// MMSYSERR [LibraryImport(Libraries.WinMM)] - internal static partial MMSYSERR waveOutOpen(ref IntPtr phwo, int uDeviceID, byte[] pwfx, WaveOutProc dwCallback, IntPtr dwInstance, uint fdwOpen); + internal static partial MMSYSERR waveOutOpen(ref IntPtr phwo, int uDeviceID, [In] byte[] pwfx, WaveOutProc dwCallback, IntPtr dwInstance, uint fdwOpen); } } diff --git a/src/libraries/Common/src/Interop/Windows/WinSock/Interop.WSAIoctl.cs b/src/libraries/Common/src/Interop/Windows/WinSock/Interop.WSAIoctl.cs index d7804bc7cbd364..4417297c533a88 100644 --- a/src/libraries/Common/src/Interop/Windows/WinSock/Interop.WSAIoctl.cs +++ b/src/libraries/Common/src/Interop/Windows/WinSock/Interop.WSAIoctl.cs @@ -26,9 +26,9 @@ internal static partial SocketError WSAIoctl( internal static partial SocketError WSAIoctl_Blocking( SafeSocketHandle socketHandle, int ioControlCode, - byte[]? inBuffer, + [In] byte[]? inBuffer, int inBufferSize, - byte[]? outBuffer, + [Out] byte[]? outBuffer, int outBufferSize, out int bytesTransferred, IntPtr overlapped, diff --git a/src/libraries/System.Data.OleDb/src/OleDbError.cs b/src/libraries/System.Data.OleDb/src/OleDbError.cs index 2e81f631773d41..dba355a7e485ca 100644 --- a/src/libraries/System.Data.OleDb/src/OleDbError.cs +++ b/src/libraries/System.Data.OleDb/src/OleDbError.cs @@ -17,7 +17,7 @@ internal OleDbError(UnsafeNativeMethods.IErrorRecords errorRecords, int index) { OleDbHResult hr; int lcid = System.Globalization.CultureInfo.CurrentCulture.LCID; - UnsafeNativeMethods.IErrorInfo errorInfo = errorRecords.GetErrorInfo(index, lcid); + errorRecords.GetErrorInfo(index, lcid, out UnsafeNativeMethods.IErrorInfo? errorInfo); if (null != errorInfo) { hr = errorInfo.GetDescription(out this.message); @@ -26,7 +26,7 @@ internal OleDbError(UnsafeNativeMethods.IErrorRecords errorRecords, int index) { UnsafeNativeMethods.ReleaseComWrappersObject(errorInfo); lcid = Interop.Kernel32.GetUserDefaultLCID(); - errorInfo = errorRecords.GetErrorInfo(index, lcid); + errorRecords.GetErrorInfo(index, lcid, out errorInfo); if (null != errorInfo) { @@ -45,7 +45,7 @@ internal OleDbError(UnsafeNativeMethods.IErrorRecords errorRecords, int index) { UnsafeNativeMethods.ReleaseComWrappersObject(errorInfo); lcid = Interop.Kernel32.GetUserDefaultLCID(); - errorInfo = errorRecords.GetErrorInfo(index, lcid); + errorRecords.GetErrorInfo(index, lcid, out errorInfo); if (null != errorInfo) { diff --git a/src/libraries/System.Data.OleDb/src/OleDbErrorCollection.cs b/src/libraries/System.Data.OleDb/src/OleDbErrorCollection.cs index d6a16448755966..163226650b7639 100644 --- a/src/libraries/System.Data.OleDb/src/OleDbErrorCollection.cs +++ b/src/libraries/System.Data.OleDb/src/OleDbErrorCollection.cs @@ -18,7 +18,7 @@ internal OleDbErrorCollection(UnsafeNativeMethods.IErrorInfo? errorInfo) UnsafeNativeMethods.IErrorRecords? errorRecords = (errorInfo as UnsafeNativeMethods.IErrorRecords); if (null != errorRecords) { - int recordCount = errorRecords.GetRecordCount(); + errorRecords.GetRecordCount(out int recordCount); for (int i = 0; i < recordCount; ++i) { diff --git a/src/libraries/System.Data.OleDb/src/UnsafeNativeMethods.cs b/src/libraries/System.Data.OleDb/src/UnsafeNativeMethods.cs index 683ea7d8be9f05..569d4153c67ae5 100644 --- a/src/libraries/System.Data.OleDb/src/UnsafeNativeMethods.cs +++ b/src/libraries/System.Data.OleDb/src/UnsafeNativeMethods.cs @@ -562,14 +562,17 @@ internal partial interface IErrorRecords [MarshalUsing(typeof(UniqueComInterfaceMarshaller))] out ISQLErrorInfo ppObject); - [return: MarshalUsing(typeof(UniqueComInterfaceMarshaller))] - IErrorInfo GetErrorInfo( + [PreserveSig] + System.Data.OleDb.OleDbHResult GetErrorInfo( int ulRecordNum, - int lcid); + int lcid, + [MarshalUsing(typeof(UniqueComInterfaceMarshaller))] + out IErrorInfo ppErrorInfo); [Obsolete("not used")] void GetErrorParameters(/*deleted parameter signature*/); - int GetRecordCount(); + [PreserveSig] + System.Data.OleDb.OleDbHResult GetRecordCount(out int pcRecords); } #if false MIDL_INTERFACE("0c733a67-2a1c-11ce-ade5-00aa0044773d") diff --git a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/UnsafeNativeMethods.cs b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/UnsafeNativeMethods.cs index 9f9e2862e0293d..60be9c10aab71e 100644 --- a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/UnsafeNativeMethods.cs +++ b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/UnsafeNativeMethods.cs @@ -473,7 +473,7 @@ internal static partial EventLogHandle EvtSubscribe( internal static partial bool EvtNext( EventLogHandle queryHandle, int eventSize, - [MarshalAs(UnmanagedType.LPArray)] IntPtr[] events, + [Out, MarshalAs(UnmanagedType.LPArray)] IntPtr[] events, int timeout, int flags, ref int returned); @@ -669,7 +669,7 @@ internal static partial bool EvtClearLog( [LibraryImport(Interop.Libraries.Wevtapi, SetLastError = true)] internal static partial EventLogHandle EvtCreateRenderContext( int valuePathsCount, - [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr)] + [In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr)] string[] valuePaths, EvtRenderContextFlags flags); @@ -759,7 +759,7 @@ internal static partial bool EvtFormatMessage( EventLogHandle eventHandle, uint messageId, int valueCount, - EvtStringVariant[] values, + [In] EvtStringVariant[] values, EvtFormatMessageFlags flags, int bufferSize, Span buffer, diff --git a/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/IPrepareInfo.cs b/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/IPrepareInfo.cs index 5df6a795b29c92..ed1da30f3e62a3 100644 --- a/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/IPrepareInfo.cs +++ b/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/IPrepareInfo.cs @@ -12,5 +12,5 @@ internal partial interface IPrepareInfo { void GetPrepareInfoSize(out uint pcbPrepInfo); - void GetPrepareInfo([MarshalAs(UnmanagedType.LPArray)] byte[] pPrepInfo); + void GetPrepareInfo([MarshalAs(UnmanagedType.LPArray), Out] byte[] pPrepInfo); } diff --git a/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/IResourceManager.cs b/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/IResourceManager.cs index f47e892dc2e57c..b0ae360e4a2d10 100644 --- a/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/IResourceManager.cs +++ b/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/IResourceManager.cs @@ -18,7 +18,7 @@ internal void Enlist( [MarshalAs(UnmanagedType.Interface)] out ITransactionEnlistmentAsync ppEnlist); internal void Reenlist( - [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] byte[] pPrepInfo, + [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1), In] byte[] pPrepInfo, uint cbPrepInfom, uint lTimeout, out OletxXactStat pXactStat); diff --git a/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionExport.cs b/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionExport.cs index 0b557693d3dab8..cfe0235202539f 100644 --- a/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionExport.cs +++ b/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionExport.cs @@ -15,6 +15,6 @@ internal partial interface ITransactionExport void GetTransactionCookie( [MarshalAs(UnmanagedType.Interface)] ITransaction pITransaction, uint cbTransactionCookie, - [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] byte[] rgbTransactionCookie, + [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1), Out] byte[] rgbTransactionCookie, out uint pcbUsed); } diff --git a/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionExportFactory.cs b/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionExportFactory.cs index 48ae5356b70bbe..79900ac720ee2b 100644 --- a/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionExportFactory.cs +++ b/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionExportFactory.cs @@ -14,6 +14,6 @@ internal partial interface ITransactionExportFactory void Create( uint cbWhereabouts, - [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] byte[] rgbWhereabouts, + [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0), In] byte[] rgbWhereabouts, [MarshalAs(UnmanagedType.Interface)] out ITransactionExport ppExport); } diff --git a/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionImport.cs b/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionImport.cs index 9246a6de83af62..2a45e266a6f4ff 100644 --- a/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionImport.cs +++ b/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionImport.cs @@ -12,7 +12,7 @@ internal partial interface ITransactionImport { void Import( uint cbTransactionCookie, - [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] byte[] rgbTransactionCookie, + [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0), In] byte[] rgbTransactionCookie, in Guid piid, [MarshalAs(UnmanagedType.Interface)] out object ppvTransaction); } diff --git a/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionImportWhereabouts.cs b/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionImportWhereabouts.cs index e88c4a381f1c39..fad4b8f320cf24 100644 --- a/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionImportWhereabouts.cs +++ b/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionImportWhereabouts.cs @@ -14,6 +14,6 @@ internal partial interface ITransactionImportWhereabouts internal void GetWhereabouts( uint cbWhereabouts, - [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] byte[] rgbWhereabouts, + [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0), Out] byte[] rgbWhereabouts, out uint pcbUsed); } diff --git a/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionReceiver.cs b/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionReceiver.cs index 600b4d86532309..3af1e69722edd2 100644 --- a/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionReceiver.cs +++ b/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionReceiver.cs @@ -12,7 +12,7 @@ internal partial interface ITransactionReceiver { void UnmarshalPropagationToken( uint cbToken, - [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] byte[] rgbToken, + [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0), In] byte[] rgbToken, [MarshalAs(UnmanagedType.Interface)] out ITransaction ppTransaction); void GetReturnTokenSize(out uint pcbReturnToken); diff --git a/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionTransmitter.cs b/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionTransmitter.cs index 32cce8ba70c567..a5ea7b496f4de6 100644 --- a/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionTransmitter.cs +++ b/src/libraries/System.Transactions.Local/src/System/Transactions/DtcProxyShim/DtcInterfaces/ITransactionTransmitter.cs @@ -16,12 +16,12 @@ internal partial interface ITransactionTransmitter void MarshalPropagationToken( uint cbToken, - [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] byte[] rgbToken, + [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0), Out] byte[] rgbToken, out uint pcbUsed); void UnmarshalReturnToken( uint cbReturnToken, - [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] byte[] rgbToken); + [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0), In] byte[] rgbToken); void Reset(); } diff --git a/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ISOSDacInterface.cs b/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ISOSDacInterface.cs index a43959d81f63dc..dfebf34f5c92ad 100644 --- a/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ISOSDacInterface.cs +++ b/src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ISOSDacInterface.cs @@ -823,6 +823,7 @@ public unsafe partial interface ISOSDacInterface8 [Guid("4eca42d8-7e7b-4c8a-a116-7bfbf6929267")] public partial interface ISOSDacInterface9 { + [PreserveSig] int GetBreakingChangeVersion(); }