tangxu
2024-12-29 72e75456f8b30ec5b6f355539d9c883b0f810d21
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// THIS FILE IS PART OF Vanara PROJECT
// THE Vanara PROJECT IS AN OPENSOURCE LIBRARY LICENSED UNDER THE MIT License.
// COPYRIGHT (C) dahall. ALL RIGHTS RESERVED.
// GITHUB: https://github.com/dahall/Vanara
 
using System;
 
namespace Vanara.PInvoke
{
    /// <summary>Flags that determine the minimum supported client(s) for a P/Invoke function.</summary>
    [Flags]
    public enum PInvokeClient
    {
        /// <summary>No minimum (default).</summary>
        None = 0,
 
        /// <summary>Windows 2000</summary>
        Windows2000 = 0x1,
 
        /// <summary>Windows XP</summary>
        WindowsXP = 0x3,
 
        /// <summary>Windows XP SP2</summary>
        WindowsXP_SP2 = 0x7,
 
        /// <summary>Windows Vista</summary>
        WindowsVista = 0xF,
 
        /// <summary>Windows Vista SP2</summary>
        WindowsVista_SP2 = 0x1F,
 
        /// <summary>Windows 7</summary>
        Windows7 = 0x3F,
 
        /// <summary>Windows 8</summary>
        Windows8 = 0x7F,
 
        /// <summary>Windows 8.1</summary>
        Windows81 = 0xFF,
 
        /// <summary>Windows 10</summary>
        Windows10 = 0x1FF,
 
        /// <summary>Windows 11</summary>
        Windows11 = 0x2FF
    }
 
    /// <summary>Captures information about P/Invoke calls.</summary>
    /// <seealso cref="Attribute"/>
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Delegate | AttributeTargets.Enum | AttributeTargets.Event |
                    AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Method |
                    AttributeTargets.Property | AttributeTargets.Struct, AllowMultiple = true, Inherited = false)]
    public class PInvokeDataAttribute : Attribute
    {
        /// <summary>Initializes a new instance of the <see cref="PInvokeDataAttribute"/> class.</summary>
        /// <param name="header">The header.</param>
        public PInvokeDataAttribute(string header) => Header = header;
 
        /// <summary>Gets or sets the DLL in which this element is defined.</summary>
        /// <value>The DLL file name without the path (e.g. "advapi32.dll").</value>
        public string Dll { get; set; }
 
        /// <summary>Gets or sets the header in which this element is defined.</summary>
        /// <value>The header file name without the path (e.g. "winuser.h").</value>
        public string Header { get; set; }
 
        /// <summary>Gets or sets the minimum supported client.</summary>
        /// <value>The minimum supported client.</value>
        public PInvokeClient MinClient { get; set; }
 
        /// <summary>Gets or sets the MSDN short identifier.</summary>
        /// <value>The MSDN short identifier. This is a unique 8-character alphanumeric string used for Microsoft documentation.</value>
        public string MSDNShortId { get; set; }
    }
}