1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
4 using System.Runtime.InteropServices;
6 namespace System.Data.Common
8 internal static class NativeMethods
10 [Guid("0c733a1e-2a1c-11ce-ade5-00aa0044773d"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), ComImport]
11 internal interface ISourcesRowset
14 System.Data.OleDb.OleDbHResult GetSourcesRowset(
15 [In] IntPtr pUnkOuter,
16 [In, MarshalAs(UnmanagedType.LPStruct)] Guid riid,
17 [In] int cPropertySets,
18 [In] IntPtr rgProperties,
19 [Out, MarshalAs(UnmanagedType.Interface)] out object ppRowset);
22 [Guid("0C733A5E-2A1C-11CE-ADE5-00AA0044773D"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), ComImport]
23 internal interface ITransactionJoin
25 [Obsolete("not used", true)]
27 int GetOptionsObject(IntPtr ppOptions);
30 [In, MarshalAs(UnmanagedType.Interface)] object? punkTransactionCoord,
33 [In] IntPtr pOtherOptions);
36 [DllImport(Interop.Libraries.Kernel32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
37 internal static extern IntPtr MapViewOfFile(IntPtr hFileMappingObject, int dwDesiredAccess, int dwFileOffsetHigh, int dwFileOffsetLow, IntPtr dwNumberOfBytesToMap);
39 [DllImport(Interop.Libraries.Kernel32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
40 internal static extern bool UnmapViewOfFile(IntPtr lpBaseAddress);
42 [DllImport(Interop.Libraries.Kernel32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
43 internal static extern bool CloseHandle(IntPtr handle);
45 [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
46 internal static extern bool AllocateAndInitializeSid(
47 IntPtr pIdentifierAuthority, // authority
48 byte nSubAuthorityCount, // count of subauthorities
49 int dwSubAuthority0, // subauthority 0
50 int dwSubAuthority1, // subauthority 1
51 int dwSubAuthority2, // subauthority 2
52 int dwSubAuthority3, // subauthority 3
53 int dwSubAuthority4, // subauthority 4
54 int dwSubAuthority5, // subauthority 5
55 int dwSubAuthority6, // subauthority 6
56 int dwSubAuthority7, // subauthority 7
57 ref IntPtr pSid); // SID
59 [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
60 internal static extern int GetLengthSid(
61 IntPtr pSid); // SID to query
63 [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
64 internal static extern bool InitializeAcl(
66 int nAclLength, // size of ACL
67 int dwAclRevision); // revision level of ACL
69 [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
70 internal static extern bool AddAccessDeniedAce(
71 IntPtr pAcl, // access control list
72 int dwAceRevision, // ACL revision level
73 int AccessMask, // access mask
74 IntPtr pSid); // security identifier
76 [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
77 internal static extern bool AddAccessAllowedAce(
78 IntPtr pAcl, // access control list
79 int dwAceRevision, // ACL revision level
80 uint AccessMask, // access mask
81 IntPtr pSid); // security identifier
83 [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
84 internal static extern bool InitializeSecurityDescriptor(
85 IntPtr pSecurityDescriptor, // SD
86 int dwRevision); // revision level
87 [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
88 internal static extern bool SetSecurityDescriptorDacl(
89 IntPtr pSecurityDescriptor, // SD
90 bool bDaclPresent, // DACL presence
92 bool bDaclDefaulted); // default DACL
94 [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
95 internal static extern IntPtr FreeSid(
96 IntPtr pSid); // SID to free