1 // Copyright (c) Microsoft Corp., 2004. All rights reserved. 2 #region Using directives 3 4 using System; 5 using System.Runtime.InteropServices; 6 using System.Workflow.ComponentModel; 7 using System.Workflow.ComponentModel.Design; 8 9 #endregion 10 11 namespace System.Workflow.Runtime.DebugEngine 12 { 13 internal static class NativeMethods 14 { 15 public const int STANDARD_RIGHTS_REQUIRED = (0x000F0000); 16 public const int TOKEN_ASSIGN_PRIMARY = (0x0001); 17 public const int TOKEN_DUPLICATE = (0x0002); 18 public const int TOKEN_IMPERSONATE = (0x0004); 19 public const int TOKEN_QUERY = (0x0008); 20 public const int TOKEN_QUERY_SOURCE = (0x0010); 21 public const int TOKEN_ADJUST_PRIVILEGES = (0x0020); 22 public const int TOKEN_ADJUST_GROUPS = (0x0040); 23 public const int TOKEN_ADJUST_DEFAULT = (0x0080); 24 public const int TOKEN_ADJUST_SESSIONID = (0x0100); 25 26 public const int TOKEN_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED | 27 TOKEN_ASSIGN_PRIMARY | 28 TOKEN_DUPLICATE | 29 TOKEN_IMPERSONATE | 30 TOKEN_QUERY | 31 TOKEN_QUERY_SOURCE | 32 TOKEN_ADJUST_PRIVILEGES | 33 TOKEN_ADJUST_GROUPS | 34 TOKEN_ADJUST_DEFAULT); 35 36 [Flags] 37 public enum SECURITY_INFORMATION : uint 38 { 39 OWNER_SECURITY_INFORMATION = 0x00000001, 40 GROUP_SECURITY_INFORMATION = 0x00000002, 41 DACL_SECURITY_INFORMATION = 0x00000004, 42 SACL_SECURITY_INFORMATION = 0x00000008, 43 UNPROTECTED_SACL_SECURITY_INFORMATION = 0x10000000, 44 UNPROTECTED_DACL_SECURITY_INFORMATION = 0x20000000, 45 PROTECTED_SACL_SECURITY_INFORMATION = 0x40000000, 46 PROTECTED_DACL_SECURITY_INFORMATION = 0x80000000 47 } 48 49 [Flags] 50 public enum RpcAuthnLevel 51 { 52 Default = 0, 53 None = 1, 54 Connect = 2, 55 Call = 3, 56 Pkt = 4, 57 PktIntegrity = 5, 58 PktPrivacy = 6 59 } 60 61 public enum EoAuthnCap 62 { 63 None = 0x00, 64 MutualAuth = 0x01, 65 StaticCloaking = 0x20, 66 DynamicCloaking = 0x40, 67 AnyAuthority = 0x80, 68 MakeFullSIC = 0x100, 69 Default = 0x800, 70 SecureRefs = 0x02, 71 AccessControl = 0x04, 72 AppID = 0x08, 73 Dynamic = 0x10, 74 RequireFullSIC = 0x200, 75 AutoImpersonate = 0x400, 76 NoCustomMarshal = 0x2000, 77 DisableAAA = 0x1000 78 } 79 80 public enum RpcImpLevel 81 { 82 Default = 0, 83 Anonymous = 1, 84 Identify = 2, 85 Impersonate = 3, 86 Delegate = 4 87 } 88 89 [DllImport("kernel32.dll", SetLastError = false)] GetCurrentThreadId()90 public static extern int GetCurrentThreadId(); 91 92 [DllImport("kernel32.dll", SetLastError = false)] GetCurrentProcess()93 public static extern IntPtr GetCurrentProcess(); 94 95 [DllImport("advapi32.dll", SetLastError = true)] RevertToSelf()96 public static extern bool RevertToSelf(); 97 98 [DllImport("advapi32.dll", SetLastError = true)] OpenProcessToken(IntPtr ProcessHandle, UInt32 DesiredAccess, out IntPtr TokenHandle)99 public static extern bool OpenProcessToken(IntPtr ProcessHandle, UInt32 DesiredAccess, out IntPtr TokenHandle); 100 101 [DllImport("advapi32.dll", SetLastError = true)] GetKernelObjectSecurity(IntPtr Handle, SECURITY_INFORMATION RequestedInformation, IntPtr pSecurityDescriptor, UInt32 nLength, out UInt32 lpnLengthNeeded)102 public static extern bool GetKernelObjectSecurity(IntPtr Handle, SECURITY_INFORMATION RequestedInformation, IntPtr pSecurityDescriptor, UInt32 nLength, out UInt32 lpnLengthNeeded); 103 104 [DllImport("advapi32.dll", SetLastError = true)] SetKernelObjectSecurity(IntPtr Handle, SECURITY_INFORMATION SecurityInformation, IntPtr SecurityDescriptor)105 public static extern bool SetKernelObjectSecurity(IntPtr Handle, SECURITY_INFORMATION SecurityInformation, IntPtr SecurityDescriptor); 106 107 [DllImport("kernel32.dll", SetLastError = true)] 108 [return: MarshalAs(UnmanagedType.Bool)] CloseHandle(IntPtr hObject)109 public static extern bool CloseHandle(IntPtr hObject); 110 111 } 112 113 internal static class Guids 114 { 115 internal const string CLSID_WDEProgramPublisher = "B6C0E598-314D-4b63-8C5C-4014F2A1B737"; 116 public const string IID_IWDEProgramNode = "e5e93adb-a6fe-435e-8640-31ae310d812f"; 117 public const string IID_IWDEProgramPublisher = "2BE74789-F70B-42a3-80CA-E91743385844"; 118 } 119 } 120