diff --git a/src/Microsoft.Windows.CsWin32/Generator.cs b/src/Microsoft.Windows.CsWin32/Generator.cs index 3a2b773d..c2580184 100644 --- a/src/Microsoft.Windows.CsWin32/Generator.cs +++ b/src/Microsoft.Windows.CsWin32/Generator.cs @@ -145,6 +145,7 @@ public class Generator : IDisposable private static readonly AttributeSyntax PreserveSigAttribute = Attribute(IdentifierName("PreserveSig")); private static readonly AttributeSyntax ObsoleteAttribute = Attribute(IdentifierName("Obsolete")).WithArgumentList(null); private static readonly AttributeSyntax SupportedOSPlatformAttribute = Attribute(IdentifierName("SupportedOSPlatform")); + private static readonly AttributeSyntax UnscopedRefAttribute = Attribute(ParseName("UnscopedRef")).WithArgumentList(null); private static readonly AttributeListSyntax DefaultDllImportSearchPathsAttributeList = AttributeList() .WithCloseBracketToken(TokenWithLineFeed(SyntaxKind.CloseBracketToken)) .AddAttributes(Attribute(IdentifierName("DefaultDllImportSearchPaths")).AddArgumentListArguments(AttributeArgument(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, IdentifierName(nameof(DllImportSearchPath)), IdentifierName(nameof(DllImportSearchPath.System32)))))); @@ -337,6 +338,7 @@ public class Generator : IDisposable private readonly bool canCallCreateSpan; private readonly bool canUseUnsafeAsRef; private readonly bool canUseUnsafeNullRef; + private readonly bool unscopedRefAttributePredefined; private readonly bool getDelegateForFunctionPointerGenericExists; private readonly bool generateSupportedOSPlatformAttributes; private readonly bool generateSupportedOSPlatformAttributesOnInterfaces; // only supported on net6.0 (https://github.com/dotnet/runtime/pull/48838) @@ -384,6 +386,7 @@ public Generator(string metadataLibraryPath, Docs? docs, GeneratorOptions option this.canCallCreateSpan = this.compilation?.GetTypeByMetadataName(typeof(MemoryMarshal).FullName)?.GetMembers("CreateSpan").Any() is true; this.canUseUnsafeAsRef = this.compilation?.GetTypeByMetadataName(typeof(Unsafe).FullName)?.GetMembers("AsRef").Any() is true; this.canUseUnsafeNullRef = this.compilation?.GetTypeByMetadataName(typeof(Unsafe).FullName)?.GetMembers("NullRef").Any() is true; + this.unscopedRefAttributePredefined = this.compilation?.GetTypeByMetadataName("System.Diagnostics.CodeAnalysis.UnscopedRefAttribute") is not null; this.getDelegateForFunctionPointerGenericExists = this.compilation?.GetTypeByMetadataName(typeof(Marshal).FullName)?.GetMembers(nameof(Marshal.GetDelegateForFunctionPointer)).Any(m => m is IMethodSymbol { IsGenericMethod: true }) is true; this.generateDefaultDllImportSearchPathsAttribute = this.compilation?.GetTypeByMetadataName(typeof(DefaultDllImportSearchPathsAttribute).FullName) is object; if (this.compilation?.GetTypeByMetadataName("System.Runtime.Versioning.SupportedOSPlatformAttribute") is { } attribute @@ -1086,7 +1089,7 @@ public IReadOnlyDictionary GetCompilationUnits(Ca // .g.cs because the resulting files are not user-created. const string FilenamePattern = "{0}.g.cs"; - var results = new Dictionary(StringComparer.OrdinalIgnoreCase); + Dictionary results = new(StringComparer.OrdinalIgnoreCase); IEnumerable GroupMembersByNamespace(IEnumerable members) { @@ -1100,12 +1103,23 @@ nsContents.Key is object if (this.options.EmitSingleFile) { + CompilationUnitSyntax file = CompilationUnit() + .AddMembers(starterNamespace.AddMembers(GroupMembersByNamespace(this.NamespaceMembers).ToArray())) + .AddMembers(this.committedCode.GeneratedTopLevelTypes.ToArray()); results.Add( string.Format(CultureInfo.InvariantCulture, FilenamePattern, "NativeMethods"), - starterNamespace.AddMembers(GroupMembersByNamespace(this.NamespaceMembers).ToArray())); + file); } else { + foreach (MemberDeclarationSyntax topLevelType in this.committedCode.GeneratedTopLevelTypes) + { + string typeName = topLevelType.DescendantNodesAndSelf().OfType().First().Identifier.ValueText; + results.Add( + string.Format(CultureInfo.InvariantCulture, FilenamePattern, typeName), + CompilationUnit().AddMembers(topLevelType)); + } + IEnumerable>? membersByFile = this.NamespaceMembers.GroupBy( member => member.HasAnnotations(SimpleFileNameAnnotation) ? member.GetAnnotations(SimpleFileNameAnnotation).Single().Data @@ -1124,9 +1138,11 @@ nsContents.Key is object { try { + CompilationUnitSyntax file = CompilationUnit() + .AddMembers(starterNamespace.AddMembers(GroupMembersByNamespace(fileSimpleName).ToArray())); results.Add( string.Format(CultureInfo.InvariantCulture, FilenamePattern, fileSimpleName.Key), - starterNamespace.AddMembers(GroupMembersByNamespace(fileSimpleName).ToArray())); + file); } catch (ArgumentException ex) { @@ -1139,6 +1155,7 @@ nsContents.Key is object { UsingDirective(AliasQualifiedName(IdentifierName(Token(SyntaxKind.GlobalKeyword)), IdentifierName(nameof(System)))), UsingDirective(AliasQualifiedName(IdentifierName(Token(SyntaxKind.GlobalKeyword)), IdentifierName(nameof(System) + "." + nameof(System.Diagnostics)))), + UsingDirective(AliasQualifiedName(IdentifierName(Token(SyntaxKind.GlobalKeyword)), IdentifierName(nameof(System) + "." + nameof(System.Diagnostics) + "." + nameof(System.Diagnostics.CodeAnalysis)))), UsingDirective(ParseName(GlobalNamespacePrefix + SystemRuntimeCompilerServices)), UsingDirective(ParseName(GlobalNamespacePrefix + SystemRuntimeInteropServices)), }; @@ -1153,9 +1170,8 @@ nsContents.Key is object var normalizedResults = new Dictionary(StringComparer.OrdinalIgnoreCase); results.AsParallel().WithCancellation(cancellationToken).ForAll(kv => { - CompilationUnitSyntax? compilationUnit = ((CompilationUnitSyntax)CompilationUnit() - .AddMembers( - kv.Value.AddUsings(usingDirectives.ToArray())) + CompilationUnitSyntax? compilationUnit = ((CompilationUnitSyntax)kv.Value + .AddUsings(usingDirectives.ToArray()) .Accept(new WhitespaceRewriter())!) .WithLeadingTrivia(FileHeader); @@ -4997,6 +5013,7 @@ private ParameterSyntax CreateParameter(TypeHandleInfo parameterInfo, Parameter return (ranklessArray, default(SyntaxList), marshalAs); } + SyntaxList additionalMembers = default; int length = int.Parse(((LiteralExpressionSyntax)arrayType.RankSpecifiers[0].Sizes[0]).Token.ValueText, CultureInfo.InvariantCulture); TypeSyntax elementType = arrayType.ElementType; @@ -5046,8 +5063,8 @@ private ParameterSyntax CreateParameter(TypeHandleInfo parameterInfo, Parameter if (this.canCallCreateSpan) { // ... - // internal ref TheStruct this[int index] => ref AsSpan()[index]; - // internal Span AsSpan() => MemoryMarshal.CreateSpan(ref _0, 4); + // [UnscopedRef] internal ref TheStruct this[int index] => ref AsSpan()[index]; + // [UnscopedRef] internal Span AsSpan() => MemoryMarshal.CreateSpan(ref _0, 4); fixedLengthStruct = fixedLengthStruct .AddMembers( IndexerDeclaration(RefType(elementType).WithTrailingTrivia(TriviaList(Space))) @@ -5057,6 +5074,7 @@ private ParameterSyntax CreateParameter(TypeHandleInfo parameterInfo, Parameter ElementAccessExpression(InvocationExpression(IdentifierName("AsSpan"))) .AddArgumentListArguments(Argument(IdentifierName("index")))))) .WithSemicolonToken(SemicolonWithLineFeed) + .AddAttributeLists(AttributeList().AddAttributes(UnscopedRefAttribute)) .WithLeadingTrivia(InlineArrayUnsafeIndexerComment), MethodDeclaration(MakeSpanOfT(elementType).WithTrailingTrivia(TriviaList(Space)), Identifier("AsSpan")) .AddModifiers(TokenWithSpace(this.Visibility)) @@ -5066,7 +5084,9 @@ private ParameterSyntax CreateParameter(TypeHandleInfo parameterInfo, Parameter Argument(nameColon: null, TokenWithSpace(SyntaxKind.RefKeyword), firstElementFieldName), Argument(lengthLiteralSyntax)))))) .WithSemicolonToken(SemicolonWithLineFeed) + .AddAttributeLists(AttributeList().AddAttributes(UnscopedRefAttribute)) .WithLeadingTrivia(InlineArrayUnsafeAsSpanComment)); + this.DeclareUnscopedRefAttributeIfNecessary(); } #pragma warning disable SA1515 // Single-line comment should be preceded by blank line @@ -5486,7 +5506,41 @@ private ParameterSyntax CreateParameter(TypeHandleInfo parameterInfo, Parameter .WithBody(body); this.volatileCode.AddInlineArrayIndexerExtension(getOrSetAtMethod); - return (fixedLengthStructName, List().Add(fixedLengthStruct), null); + additionalMembers = additionalMembers.Add(fixedLengthStruct); + return (fixedLengthStructName, additionalMembers, null); + } + + private void DeclareUnscopedRefAttributeIfNecessary() + { + if (this.unscopedRefAttributePredefined) + { + return; + } + + const string name = "UnscopedRefAttribute"; + this.volatileCode.GenerateSpecialType(name, delegate + { + ExpressionSyntax[] uses = new[] + { + MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, IdentifierName(nameof(AttributeTargets)), IdentifierName(nameof(AttributeTargets.Method))), + MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, IdentifierName(nameof(AttributeTargets)), IdentifierName(nameof(AttributeTargets.Property))), + MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, IdentifierName(nameof(AttributeTargets)), IdentifierName(nameof(AttributeTargets.Parameter))), + }; + AttributeListSyntax usageAttr = AttributeList().AddAttributes( + Attribute(IdentifierName(nameof(AttributeUsageAttribute))).AddArgumentListArguments( + AttributeArgument( + uses.Aggregate((left, right) => BinaryExpression(SyntaxKind.BitwiseOrExpression, left, right))), + AttributeArgument(LiteralExpression(SyntaxKind.FalseLiteralExpression)).WithNameEquals(NameEquals(IdentifierName("AllowMultiple"))), + AttributeArgument(LiteralExpression(SyntaxKind.FalseLiteralExpression)).WithNameEquals(NameEquals(IdentifierName("Inherited"))))); + ClassDeclarationSyntax attrDecl = ClassDeclaration(Identifier("UnscopedRefAttribute")) + .WithBaseList(BaseList(SingletonSeparatedList(SimpleBaseType(IdentifierName("Attribute"))))) + .AddModifiers(Token(SyntaxKind.InternalKeyword), TokenWithSpace(SyntaxKind.SealedKeyword)) + .AddAttributeLists(usageAttr); + NamespaceDeclarationSyntax nsDeclaration = NamespaceDeclaration(ParseName("System.Diagnostics.CodeAnalysis")) + .AddMembers(attrDecl); + + this.volatileCode.AddSpecialType(name, nsDeclaration, topLevel: true); + }); } private bool IsTypeDefStruct(TypeHandleInfo? typeHandleInfo) @@ -5844,7 +5898,7 @@ private class GeneratedCode private readonly List safeHandleTypes = new(); - private readonly Dictionary specialTypes = new(StringComparer.Ordinal); + private readonly Dictionary specialTypes = new(StringComparer.Ordinal); /// /// The set of types that are or have been generated so we don't stack overflow for self-referencing types. @@ -5881,7 +5935,11 @@ internal GeneratedCode(GeneratedCode parent) internal bool IsEmpty => this.modulesAndMembers.Count == 0 && this.types.Count == 0 && this.fieldsToSyntax.Count == 0 && this.safeHandleTypes.Count == 0 && this.specialTypes.Count == 0 && this.inlineArrayIndexerExtensionsMembers.Count == 0 && this.comInterfaceFriendlyExtensionsMembers.Count == 0; - internal IEnumerable GeneratedTypes => this.GetTypesWithInjectedFields().Concat(this.specialTypes.Values).Concat(this.safeHandleTypes); + internal IEnumerable GeneratedTypes => this.GetTypesWithInjectedFields() + .Concat(this.specialTypes.Values.Where(st => !st.TopLevel).Select(st => st.Type)) + .Concat(this.safeHandleTypes); + + internal IEnumerable GeneratedTopLevelTypes => this.specialTypes.Values.Where(st => st.TopLevel).Select(st => st.Type); internal IEnumerable ComInterfaceExtensions => this.comInterfaceFriendlyExtensionsMembers; @@ -5962,10 +6020,16 @@ internal void AddComInterfaceExtension(IEnumerable exte this.comInterfaceFriendlyExtensionsMembers.AddRange(extension); } - internal void AddSpecialType(string specialName, MemberDeclarationSyntax specialDeclaration) + /// + /// Adds a declaration to the generated code. + /// + /// The same constant provided to . This serves to avoid repeat declarations. + /// The declaration. + /// if this declaration should not be nested within the top-level namespace for generated code. + internal void AddSpecialType(string specialName, MemberDeclarationSyntax specialDeclaration, bool topLevel = false) { this.ThrowIfNotGenerating(); - this.specialTypes.Add(specialName, specialDeclaration); + this.specialTypes.Add(specialName, (specialDeclaration, topLevel)); } internal void AddInteropType(TypeDefinitionHandle typeDefinitionHandle, bool hasUnmanagedName, MemberDeclarationSyntax typeDeclaration) diff --git a/test/.editorconfig b/test/.editorconfig index 7e808a06..df7a82de 100644 --- a/test/.editorconfig +++ b/test/.editorconfig @@ -59,3 +59,6 @@ dotnet_diagnostic.SA1401.severity = silent # SA1133: Do not combine attributes dotnet_diagnostic.SA1133.severity = silent + +# SA1611: Element parameters should be documented +dotnet_diagnostic.SA1611.severity = suggestion diff --git a/test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs b/test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs index 507e86ea..8bde5c7a 100644 --- a/test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs +++ b/test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs @@ -1404,6 +1404,7 @@ internal partial struct __uint_4 /// Gets a ref to an individual element of the inline array. /// ⚠ Important ⚠: When this struct is on the stack, do not let the returned reference outlive the stack frame that defines it. /// + [UnscopedRef] internal ref uint this[int index] => ref AsSpan()[index]; /// @@ -1412,6 +1413,7 @@ internal partial struct __uint_4 /// /// ⚠ Important ⚠: When this struct is on the stack, do not let the returned span outlive the stack frame that defines it. /// + [UnscopedRef] internal Span AsSpan() => MemoryMarshal.CreateSpan(ref _0, 4); internal unsafe readonly void CopyTo(Span target, int length = 4) @@ -1696,14 +1698,14 @@ public async Task TestSimpleStructure() // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 +using global::System; +using global::System.Diagnostics; +using global::System.Diagnostics.CodeAnalysis; +using global::System.Runtime.CompilerServices; +using global::System.Runtime.InteropServices; +using winmdroot = global::Windows.Win32; namespace Windows.Win32 {{ - using global::System; - using global::System.Diagnostics; - using global::System.Runtime.CompilerServices; - using global::System.Runtime.InteropServices; - using winmdroot = global::Windows.Win32; - namespace Foundation {{ [DebuggerDisplay(""{{Value}}"")] @@ -1765,14 +1767,14 @@ public async Task TestSimpleEnum() // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 +using global::System; +using global::System.Diagnostics; +using global::System.Diagnostics.CodeAnalysis; +using global::System.Runtime.CompilerServices; +using global::System.Runtime.InteropServices; +using winmdroot = global::Windows.Win32; namespace Windows.Win32 {{ - using global::System; - using global::System.Diagnostics; - using global::System.Runtime.CompilerServices; - using global::System.Runtime.InteropServices; - using winmdroot = global::Windows.Win32; - namespace Devices.Display {{ /// The DISPLAYCONFIG_SCANLINE_ORDERING enumeration specifies the method that the display uses to create an image on a screen. @@ -1832,14 +1834,14 @@ public async Task TestSimpleEnumWithoutDocs() // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 +using global::System; +using global::System.Diagnostics; +using global::System.Diagnostics.CodeAnalysis; +using global::System.Runtime.CompilerServices; +using global::System.Runtime.InteropServices; +using winmdroot = global::Windows.Win32; namespace Windows.Win32 {{ - using global::System; - using global::System.Diagnostics; - using global::System.Runtime.CompilerServices; - using global::System.Runtime.InteropServices; - using winmdroot = global::Windows.Win32; - namespace Devices.Display {{ [global::System.CodeDom.Compiler.GeneratedCode(""Microsoft.Windows.CsWin32"", ""{ThisAssembly.AssemblyInformationalVersion}"")] @@ -1889,14 +1891,14 @@ public async Task TestFlagsEnum() // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 +using global::System; +using global::System.Diagnostics; +using global::System.Diagnostics.CodeAnalysis; +using global::System.Runtime.CompilerServices; +using global::System.Runtime.InteropServices; +using winmdroot = global::Windows.Win32; namespace Windows.Win32 {{ - using global::System; - using global::System.Diagnostics; - using global::System.Runtime.CompilerServices; - using global::System.Runtime.InteropServices; - using winmdroot = global::Windows.Win32; - namespace Storage.FileSystem {{ [Flags] @@ -1969,14 +1971,14 @@ public async Task TestSimpleDelegate() // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 +using global::System; +using global::System.Diagnostics; +using global::System.Diagnostics.CodeAnalysis; +using global::System.Runtime.CompilerServices; +using global::System.Runtime.InteropServices; +using winmdroot = global::Windows.Win32; namespace Windows.Win32 {{ - using global::System; - using global::System.Diagnostics; - using global::System.Runtime.CompilerServices; - using global::System.Runtime.InteropServices; - using winmdroot = global::Windows.Win32; - namespace Foundation {{ [DebuggerDisplay(""{{Value}}"")] @@ -2014,14 +2016,14 @@ internal readonly partial struct BOOL // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 +using global::System; +using global::System.Diagnostics; +using global::System.Diagnostics.CodeAnalysis; +using global::System.Runtime.CompilerServices; +using global::System.Runtime.InteropServices; +using winmdroot = global::Windows.Win32; namespace Windows.Win32 {{ - using global::System; - using global::System.Diagnostics; - using global::System.Runtime.CompilerServices; - using global::System.Runtime.InteropServices; - using winmdroot = global::Windows.Win32; - namespace UI.WindowsAndMessaging {{ [UnmanagedFunctionPointerAttribute(CallingConvention.Winapi)] @@ -2040,14 +2042,14 @@ namespace UI.WindowsAndMessaging // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 +using global::System; +using global::System.Diagnostics; +using global::System.Diagnostics.CodeAnalysis; +using global::System.Runtime.CompilerServices; +using global::System.Runtime.InteropServices; +using winmdroot = global::Windows.Win32; namespace Windows.Win32 {{ - using global::System; - using global::System.Diagnostics; - using global::System.Runtime.CompilerServices; - using global::System.Runtime.InteropServices; - using winmdroot = global::Windows.Win32; - namespace Foundation {{ [DebuggerDisplay(""{{Value}}"")] @@ -2085,14 +2087,14 @@ internal readonly partial struct HWND // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 +using global::System; +using global::System.Diagnostics; +using global::System.Diagnostics.CodeAnalysis; +using global::System.Runtime.CompilerServices; +using global::System.Runtime.InteropServices; +using winmdroot = global::Windows.Win32; namespace Windows.Win32 {{ - using global::System; - using global::System.Diagnostics; - using global::System.Runtime.CompilerServices; - using global::System.Runtime.InteropServices; - using winmdroot = global::Windows.Win32; - namespace Foundation {{ [DebuggerDisplay(""{{Value}}"")] @@ -2150,14 +2152,14 @@ public async Task TestSimpleMethod() // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 +using global::System; +using global::System.Diagnostics; +using global::System.Diagnostics.CodeAnalysis; +using global::System.Runtime.CompilerServices; +using global::System.Runtime.InteropServices; +using winmdroot = global::Windows.Win32; namespace Windows.Win32 {{ - using global::System; - using global::System.Diagnostics; - using global::System.Runtime.CompilerServices; - using global::System.Runtime.InteropServices; - using winmdroot = global::Windows.Win32; - namespace Graphics.Gdi {{ [DebuggerDisplay(""{{Value}}"")] @@ -2195,14 +2197,14 @@ internal readonly partial struct HDC // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 +using global::System; +using global::System.Diagnostics; +using global::System.Diagnostics.CodeAnalysis; +using global::System.Runtime.CompilerServices; +using global::System.Runtime.InteropServices; +using winmdroot = global::Windows.Win32; namespace Windows.Win32 {{ - using global::System; - using global::System.Diagnostics; - using global::System.Runtime.CompilerServices; - using global::System.Runtime.InteropServices; - using winmdroot = global::Windows.Win32; - namespace Foundation {{ [DebuggerDisplay(""{{Value}}"")] @@ -2240,14 +2242,14 @@ internal readonly partial struct HWND // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 +using global::System; +using global::System.Diagnostics; +using global::System.Diagnostics.CodeAnalysis; +using global::System.Runtime.CompilerServices; +using global::System.Runtime.InteropServices; +using winmdroot = global::Windows.Win32; namespace Windows.Win32 {{ - using global::System; - using global::System.Diagnostics; - using global::System.Runtime.CompilerServices; - using global::System.Runtime.InteropServices; - using winmdroot = global::Windows.Win32; - /// /// Contains extern methods from ""USER32.dll"". @@ -2303,14 +2305,14 @@ public async Task TestMethodWithOverloads() // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 +using global::System; +using global::System.Diagnostics; +using global::System.Diagnostics.CodeAnalysis; +using global::System.Runtime.CompilerServices; +using global::System.Runtime.InteropServices; +using winmdroot = global::Windows.Win32; namespace Windows.Win32 {{ - using global::System; - using global::System.Diagnostics; - using global::System.Runtime.CompilerServices; - using global::System.Runtime.InteropServices; - using winmdroot = global::Windows.Win32; - namespace Foundation {{ [DebuggerDisplay(""{{Value}}"")] @@ -2348,14 +2350,14 @@ internal readonly partial struct BOOL // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 +using global::System; +using global::System.Diagnostics; +using global::System.Diagnostics.CodeAnalysis; +using global::System.Runtime.CompilerServices; +using global::System.Runtime.InteropServices; +using winmdroot = global::Windows.Win32; namespace Windows.Win32 {{ - using global::System; - using global::System.Diagnostics; - using global::System.Runtime.CompilerServices; - using global::System.Runtime.InteropServices; - using winmdroot = global::Windows.Win32; - namespace Storage.FileSystem {{ [Flags] @@ -2405,14 +2407,14 @@ internal enum FILE_ACCESS_FLAGS : uint // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 +using global::System; +using global::System.Diagnostics; +using global::System.Diagnostics.CodeAnalysis; +using global::System.Runtime.CompilerServices; +using global::System.Runtime.InteropServices; +using winmdroot = global::Windows.Win32; namespace Windows.Win32 {{ - using global::System; - using global::System.Diagnostics; - using global::System.Runtime.CompilerServices; - using global::System.Runtime.InteropServices; - using winmdroot = global::Windows.Win32; - namespace Storage.FileSystem {{ [global::System.CodeDom.Compiler.GeneratedCode(""Microsoft.Windows.CsWin32"", ""{ThisAssembly.AssemblyInformationalVersion}"")] @@ -2437,14 +2439,14 @@ internal enum FILE_CREATION_DISPOSITION : uint // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 +using global::System; +using global::System.Diagnostics; +using global::System.Diagnostics.CodeAnalysis; +using global::System.Runtime.CompilerServices; +using global::System.Runtime.InteropServices; +using winmdroot = global::Windows.Win32; namespace Windows.Win32 {{ - using global::System; - using global::System.Diagnostics; - using global::System.Runtime.CompilerServices; - using global::System.Runtime.InteropServices; - using winmdroot = global::Windows.Win32; - namespace Storage.FileSystem {{ [Flags] @@ -2510,14 +2512,14 @@ internal enum FILE_FLAGS_AND_ATTRIBUTES : uint // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 +using global::System; +using global::System.Diagnostics; +using global::System.Diagnostics.CodeAnalysis; +using global::System.Runtime.CompilerServices; +using global::System.Runtime.InteropServices; +using winmdroot = global::Windows.Win32; namespace Windows.Win32 {{ - using global::System; - using global::System.Diagnostics; - using global::System.Runtime.CompilerServices; - using global::System.Runtime.InteropServices; - using winmdroot = global::Windows.Win32; - namespace Storage.FileSystem {{ [Flags] @@ -2542,14 +2544,14 @@ internal enum FILE_SHARE_MODE : uint // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 +using global::System; +using global::System.Diagnostics; +using global::System.Diagnostics.CodeAnalysis; +using global::System.Runtime.CompilerServices; +using global::System.Runtime.InteropServices; +using winmdroot = global::Windows.Win32; namespace Windows.Win32 {{ - using global::System; - using global::System.Diagnostics; - using global::System.Runtime.CompilerServices; - using global::System.Runtime.InteropServices; - using winmdroot = global::Windows.Win32; - namespace Foundation {{ [DebuggerDisplay(""{{Value}}"")] @@ -2587,14 +2589,14 @@ internal readonly partial struct HANDLE // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 +using global::System; +using global::System.Diagnostics; +using global::System.Diagnostics.CodeAnalysis; +using global::System.Runtime.CompilerServices; +using global::System.Runtime.InteropServices; +using winmdroot = global::Windows.Win32; namespace Windows.Win32 {{ - using global::System; - using global::System.Diagnostics; - using global::System.Runtime.CompilerServices; - using global::System.Runtime.InteropServices; - using winmdroot = global::Windows.Win32; - namespace Foundation {{ /// @@ -2664,14 +2666,14 @@ internal int Length // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 +using global::System; +using global::System.Diagnostics; +using global::System.Diagnostics.CodeAnalysis; +using global::System.Runtime.CompilerServices; +using global::System.Runtime.InteropServices; +using winmdroot = global::Windows.Win32; namespace Windows.Win32 {{ - using global::System; - using global::System.Diagnostics; - using global::System.Runtime.CompilerServices; - using global::System.Runtime.InteropServices; - using winmdroot = global::Windows.Win32; - /// /// Contains extern methods from ""KERNEL32.dll"". @@ -2771,14 +2773,14 @@ internal static unsafe Microsoft.Win32.SafeHandles.SafeFileHandle CreateFile(str // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 +using global::System; +using global::System.Diagnostics; +using global::System.Diagnostics.CodeAnalysis; +using global::System.Runtime.CompilerServices; +using global::System.Runtime.InteropServices; +using winmdroot = global::Windows.Win32; namespace Windows.Win32 {{ - using global::System; - using global::System.Diagnostics; - using global::System.Runtime.CompilerServices; - using global::System.Runtime.InteropServices; - using winmdroot = global::Windows.Win32; - namespace Foundation {{ [DebuggerDisplay(""{{Value}}"")] @@ -2832,14 +2834,14 @@ internal int Length // ------------------------------------------------------------------------------ #pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981 +using global::System; +using global::System.Diagnostics; +using global::System.Diagnostics.CodeAnalysis; +using global::System.Runtime.CompilerServices; +using global::System.Runtime.InteropServices; +using winmdroot = global::Windows.Win32; namespace Windows.Win32 {{ - using global::System; - using global::System.Diagnostics; - using global::System.Runtime.CompilerServices; - using global::System.Runtime.InteropServices; - using winmdroot = global::Windows.Win32; - namespace Security {{ /// The SECURITY_ATTRIBUTES structure contains the security descriptor for an object and specifies whether the handle retrieved by specifying this structure is inheritable.