-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge | NativeMethods/SafeNativeMethods (#2997)
* Moving SafeNativeMethods to Interop.Windows.Kernel32 namespace, migrating usages * Move Kernel32 calls from NativeMethods to Interop.Windows.Kernel32 * Moving AdvApi32 interop calls to Interop.Windows.AdvApi32, migrating usages * Remove redundant safe method in SNINativeMethodWrapper, migrate usages
- Loading branch information
Showing
11 changed files
with
168 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 0 additions & 106 deletions
106
src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Common/NativeMethods.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/Microsoft.Data.SqlClient/src/Interop/Windows/AdvApi32/AdvApi32.netfx.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
using System.Runtime.Versioning; | ||
|
||
namespace Interop.Windows.AdvApi32 | ||
{ | ||
internal class AdvApi32 | ||
{ | ||
private const string DllName = "advapi32.dll"; | ||
|
||
[DllImport(DllName, ExactSpelling = true, CharSet = CharSet.Auto, SetLastError = true)] | ||
[ResourceExposure(ResourceScope.None)] | ||
internal static extern bool AddAccessAllowedAce(IntPtr pAcl, int dwAceRevision, uint AccessMask, IntPtr pSid); | ||
|
||
[DllImport(DllName, ExactSpelling = true, CharSet = CharSet.Auto, SetLastError = true)] | ||
[ResourceExposure(ResourceScope.None)] | ||
internal static extern bool AddAccessDeniedAce(IntPtr pAcl, int dwAceRevision, int AccessMask, IntPtr pSid); | ||
|
||
[DllImport(DllName, ExactSpelling = true, CharSet = CharSet.Auto, SetLastError = true)] | ||
[ResourceExposure(ResourceScope.None)] | ||
internal static extern bool AllocateAndInitializeSid( | ||
IntPtr pIdentifierAuthority, | ||
byte nSubAuthorityCount, | ||
int dwSubAuthority0, | ||
int dwSubAuthority1, | ||
int dwSubAuthority2, | ||
int dwSubAuthority3, | ||
int dwSubAuthority4, | ||
int dwSubAuthority5, | ||
int dwSubAuthority6, | ||
int dwSubAuthority7, | ||
ref IntPtr pSid); | ||
|
||
|
||
[DllImport(DllName, ExactSpelling = true, CharSet = CharSet.Auto, SetLastError = true)] | ||
[ResourceExposure(ResourceScope.None)] | ||
internal static extern IntPtr FreeSid(IntPtr pSid); | ||
|
||
[DllImport(DllName, ExactSpelling = true, CharSet = CharSet.Auto, SetLastError = true)] | ||
[ResourceExposure(ResourceScope.None)] | ||
internal static extern int GetLengthSid(IntPtr pSid); | ||
|
||
[DllImport(DllName, ExactSpelling = true, CharSet = CharSet.Auto, SetLastError = true)] | ||
[ResourceExposure(ResourceScope.None)] | ||
internal static extern bool InitializeAcl(IntPtr pAcl, int nAclLength, int dwAclRevision); | ||
|
||
[DllImport(DllName, ExactSpelling = true, CharSet = CharSet.Auto, SetLastError = true)] | ||
[ResourceExposure(ResourceScope.None)] | ||
internal static extern bool InitializeSecurityDescriptor(IntPtr pSecurityDescriptor, int dwRevision); | ||
|
||
[DllImport(DllName, ExactSpelling = true, CharSet = CharSet.Auto, SetLastError = true)] | ||
[ResourceExposure(ResourceScope.None)] | ||
internal static extern bool SetSecurityDescriptorDacl( | ||
IntPtr pSecurityDescriptor, | ||
bool bDaclPresent, | ||
IntPtr pDacl, | ||
bool bDaclDefaulted); | ||
} | ||
} |
Oops, something went wrong.