|
// <auto-generated/>
internal static unsafe partial class Interop
{
internal static unsafe partial class Kernel32
{
[global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "GetCurrentProcess", ExactSpelling = true)]
internal static extern partial nint GetCurrentProcess();
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Kernel32
{
[global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "GetCurrentThread", ExactSpelling = true)]
internal static extern partial nint GetCurrentThread();
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial bool OpenProcessToken(nint ProcessToken, global::System.Security.Principal.TokenAccessLevels DesiredAccess, out global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle TokenHandle)
{
int __lastError;
bool __invokeSucceeded = default;
TokenHandle = default;
nint __TokenHandle_native = default;
bool __retVal = default;
int __retVal_native = default;
// Setup - Perform required setup.
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle>.ManagedToUnmanagedOut __TokenHandle_native__marshaller = new();
try
{
{
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal_native = __PInvoke(ProcessToken, DesiredAccess, &__TokenHandle_native);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
__invokeSucceeded = true;
// UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
__TokenHandle_native__marshaller.FromUnmanaged(__TokenHandle_native);
// Unmarshal - Convert native data to managed data.
__retVal = __retVal_native != 0;
TokenHandle = __TokenHandle_native__marshaller.ToManaged();
}
finally
{
if (__invokeSucceeded)
{
// CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
__TokenHandle_native__marshaller.Free();
}
}
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "OpenProcessToken", ExactSpelling = true)]
static extern unsafe int __PInvoke(nint __ProcessToken_native, global::System.Security.Principal.TokenAccessLevels __DesiredAccess_native, nint* __TokenHandle_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial bool GetTokenInformation(nint TokenHandle, uint TokenInformationClass, nint TokenInformation, uint TokenInformationLength, out uint ReturnLength)
{
int __lastError;
ReturnLength = default;
bool __retVal;
int __retVal_native;
// Pin - Pin data in preparation for calling the P/Invoke.
fixed (uint* __ReturnLength_native = &ReturnLength)
{
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal_native = __PInvoke(TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength, __ReturnLength_native);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
// Unmarshal - Convert native data to managed data.
__retVal = __retVal_native != 0;
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "GetTokenInformation", ExactSpelling = true)]
static extern unsafe int __PInvoke(nint __TokenHandle_native, uint __TokenInformationClass_native, nint __TokenInformation_native, uint __TokenInformationLength_native, uint* __ReturnLength_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial bool GetTokenInformation(global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle TokenHandle, uint TokenInformationClass, global::Microsoft.Win32.SafeHandles.SafeLocalAllocHandle TokenInformation, uint TokenInformationLength, out uint ReturnLength)
{
int __lastError;
ReturnLength = default;
nint __TokenHandle_native = default;
nint __TokenInformation_native = default;
bool __retVal = default;
int __retVal_native = default;
// Setup - Perform required setup.
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLocalAllocHandle>.ManagedToUnmanagedIn __TokenInformation_native__marshaller = new();
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle>.ManagedToUnmanagedIn __TokenHandle_native__marshaller = new();
try
{
// Marshal - Convert managed data to native data.
__TokenInformation_native__marshaller.FromManaged(TokenInformation);
__TokenHandle_native__marshaller.FromManaged(TokenHandle);
// Pin - Pin data in preparation for calling the P/Invoke.
fixed (uint* __ReturnLength_native = &ReturnLength)
{
// PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
__TokenInformation_native = __TokenInformation_native__marshaller.ToUnmanaged();
__TokenHandle_native = __TokenHandle_native__marshaller.ToUnmanaged();
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal_native = __PInvoke(__TokenHandle_native, TokenInformationClass, __TokenInformation_native, TokenInformationLength, __ReturnLength_native);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
// Unmarshal - Convert native data to managed data.
__retVal = __retVal_native != 0;
}
finally
{
// CleanupCallerAllocated - Perform cleanup of caller allocated resources.
__TokenInformation_native__marshaller.Free();
__TokenHandle_native__marshaller.Free();
}
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "GetTokenInformation", ExactSpelling = true)]
static extern unsafe int __PInvoke(nint __TokenHandle_native, uint __TokenInformationClass_native, nint __TokenInformation_native, uint __TokenInformationLength_native, uint* __ReturnLength_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial bool GetTokenInformation(nint TokenHandle, uint TokenInformationClass, global::Microsoft.Win32.SafeHandles.SafeLocalAllocHandle TokenInformation, uint TokenInformationLength, out uint ReturnLength)
{
int __lastError;
ReturnLength = default;
nint __TokenInformation_native = default;
bool __retVal = default;
int __retVal_native = default;
// Setup - Perform required setup.
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLocalAllocHandle>.ManagedToUnmanagedIn __TokenInformation_native__marshaller = new();
try
{
// Marshal - Convert managed data to native data.
__TokenInformation_native__marshaller.FromManaged(TokenInformation);
// Pin - Pin data in preparation for calling the P/Invoke.
fixed (uint* __ReturnLength_native = &ReturnLength)
{
// PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
__TokenInformation_native = __TokenInformation_native__marshaller.ToUnmanaged();
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal_native = __PInvoke(TokenHandle, TokenInformationClass, __TokenInformation_native, TokenInformationLength, __ReturnLength_native);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
// Unmarshal - Convert native data to managed data.
__retVal = __retVal_native != 0;
}
finally
{
// CleanupCallerAllocated - Perform cleanup of caller allocated resources.
__TokenInformation_native__marshaller.Free();
}
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "GetTokenInformation", ExactSpelling = true)]
static extern unsafe int __PInvoke(nint __TokenHandle_native, uint __TokenInformationClass_native, nint __TokenInformation_native, uint __TokenInformationLength_native, uint* __ReturnLength_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial bool DuplicateTokenEx(global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle hExistingToken, uint dwDesiredAccess, nint lpTokenAttributes, uint ImpersonationLevel, uint TokenType, ref global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle phNewToken)
{
int __lastError;
bool __invokeSucceeded = default;
nint __hExistingToken_native = default;
nint __phNewToken_native = default;
bool __retVal = default;
int __retVal_native = default;
// Setup - Perform required setup.
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle>.ManagedToUnmanagedRef __phNewToken_native__marshaller = new();
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle>.ManagedToUnmanagedIn __hExistingToken_native__marshaller = new();
try
{
// Marshal - Convert managed data to native data.
__phNewToken_native__marshaller.FromManaged(phNewToken);
__hExistingToken_native__marshaller.FromManaged(hExistingToken);
{
// PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
__phNewToken_native = __phNewToken_native__marshaller.ToUnmanaged();
__hExistingToken_native = __hExistingToken_native__marshaller.ToUnmanaged();
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal_native = __PInvoke(__hExistingToken_native, dwDesiredAccess, lpTokenAttributes, ImpersonationLevel, TokenType, &__phNewToken_native);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
// NotifyForSuccessfulInvoke - Keep alive any managed objects that need to stay alive across the call.
__phNewToken_native__marshaller.OnInvoked();
__invokeSucceeded = true;
// UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
__phNewToken_native__marshaller.FromUnmanaged(__phNewToken_native);
// Unmarshal - Convert native data to managed data.
__retVal = __retVal_native != 0;
}
finally
{
if (__invokeSucceeded)
{
// GuaranteedUnmarshal - Convert native data to managed data even in the case of an exception during the non-cleanup phases.
phNewToken = __phNewToken_native__marshaller.ToManagedFinally();
}
// CleanupCallerAllocated - Perform cleanup of caller allocated resources.
__phNewToken_native__marshaller.Free();
__hExistingToken_native__marshaller.Free();
}
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "DuplicateTokenEx", ExactSpelling = true)]
static extern unsafe int __PInvoke(nint __hExistingToken_native, uint __dwDesiredAccess_native, nint __lpTokenAttributes_native, uint __ImpersonationLevel_native, uint __TokenType_native, nint* __phNewToken_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Kernel32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial bool DuplicateHandle(nint hSourceProcessHandle, nint hSourceHandle, nint hTargetProcessHandle, out global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle lpTargetHandle, uint dwDesiredAccess, bool bInheritHandle, uint dwOptions)
{
int __lastError;
bool __invokeSucceeded = default;
lpTargetHandle = default;
nint __lpTargetHandle_native = default;
int __bInheritHandle_native = default;
bool __retVal = default;
int __retVal_native = default;
// Setup - Perform required setup.
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle>.ManagedToUnmanagedOut __lpTargetHandle_native__marshaller = new();
try
{
// Marshal - Convert managed data to native data.
__bInheritHandle_native = (int)(bInheritHandle ? 1 : 0);
{
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal_native = __PInvoke(hSourceProcessHandle, hSourceHandle, hTargetProcessHandle, &__lpTargetHandle_native, dwDesiredAccess, __bInheritHandle_native, dwOptions);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
__invokeSucceeded = true;
// UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
__lpTargetHandle_native__marshaller.FromUnmanaged(__lpTargetHandle_native);
// Unmarshal - Convert native data to managed data.
__retVal = __retVal_native != 0;
lpTargetHandle = __lpTargetHandle_native__marshaller.ToManaged();
}
finally
{
if (__invokeSucceeded)
{
// CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
__lpTargetHandle_native__marshaller.Free();
}
}
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "DuplicateHandle", ExactSpelling = true)]
static extern unsafe int __PInvoke(nint __hSourceProcessHandle_native, nint __hSourceHandle_native, nint __hTargetProcessHandle_native, nint* __lpTargetHandle_native, uint __dwDesiredAccess_native, int __bInheritHandle_native, uint __dwOptions_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Kernel32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial bool CloseHandle(nint handle)
{
int __lastError;
bool __retVal;
int __retVal_native;
{
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal_native = __PInvoke(handle);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
// Unmarshal - Convert native data to managed data.
__retVal = __retVal_native != 0;
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "CloseHandle", ExactSpelling = true)]
static extern unsafe int __PInvoke(nint __handle_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class SspiCli
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial int LsaGetLogonSessionData(ref global::Interop.LUID LogonId, out global::Microsoft.Win32.SafeHandles.SafeLsaReturnBufferHandle ppLogonSessionData)
{
int __lastError;
bool __invokeSucceeded = default;
ppLogonSessionData = default;
nint __ppLogonSessionData_native = default;
int __retVal = default;
// Setup - Perform required setup.
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLsaReturnBufferHandle>.ManagedToUnmanagedOut __ppLogonSessionData_native__marshaller = new();
try
{
// Pin - Pin data in preparation for calling the P/Invoke.
fixed (global::Interop.LUID* __LogonId_native = &LogonId)
{
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal = __PInvoke(__LogonId_native, &__ppLogonSessionData_native);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
__invokeSucceeded = true;
// UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
__ppLogonSessionData_native__marshaller.FromUnmanaged(__ppLogonSessionData_native);
// Unmarshal - Convert native data to managed data.
ppLogonSessionData = __ppLogonSessionData_native__marshaller.ToManaged();
}
finally
{
if (__invokeSucceeded)
{
// CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
__ppLogonSessionData_native__marshaller.Free();
}
}
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("sspicli.dll", EntryPoint = "LsaGetLogonSessionData", ExactSpelling = true)]
static extern unsafe int __PInvoke(global::Interop.LUID* __LogonId_native, nint* __ppLogonSessionData_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class SspiCli
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial int LsaFreeReturnBuffer(nint handle)
{
int __lastError;
int __retVal;
{
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal = __PInvoke(handle);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("sspicli.dll", EntryPoint = "LsaFreeReturnBuffer", ExactSpelling = true)]
static extern unsafe int __PInvoke(nint __handle_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial uint LsaLookupNames2(global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle handle, int flags, int count, global::Interop.Advapi32.MARSHALLED_UNICODE_STRING[] names, out global::Microsoft.Win32.SafeHandles.SafeLsaMemoryHandle referencedDomains, out global::Microsoft.Win32.SafeHandles.SafeLsaMemoryHandle sids)
{
int __lastError;
bool __invokeSucceeded = default;
referencedDomains = default;
sids = default;
nint __handle_native = default;
global::Interop.Advapi32.MARSHALLED_UNICODE_STRING.Marshaller.Native* __names_native = default;
nint __referencedDomains_native = default;
nint __sids_native = default;
uint __retVal = default;
// Setup - Perform required setup.
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLsaMemoryHandle>.ManagedToUnmanagedOut __sids_native__marshaller = new();
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLsaMemoryHandle>.ManagedToUnmanagedOut __referencedDomains_native__marshaller = new();
scoped global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Interop.Advapi32.MARSHALLED_UNICODE_STRING, global::Interop.Advapi32.MARSHALLED_UNICODE_STRING.Marshaller.Native>.ManagedToUnmanagedIn __names_native__marshaller = new();
int __names_native__lastIndexMarshalled = 0;
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
try
{
// Marshal - Convert managed data to native data.
__names_native__marshaller.FromManaged(names, stackalloc global::Interop.Advapi32.MARSHALLED_UNICODE_STRING.Marshaller.Native[global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<global::Interop.Advapi32.MARSHALLED_UNICODE_STRING, global::Interop.Advapi32.MARSHALLED_UNICODE_STRING.Marshaller.Native>.ManagedToUnmanagedIn.BufferSize]);
{
global::System.ReadOnlySpan<global::Interop.Advapi32.MARSHALLED_UNICODE_STRING> __names_native__managedSpan = __names_native__marshaller.GetManagedValuesSource();
global::System.Span<global::Interop.Advapi32.MARSHALLED_UNICODE_STRING.Marshaller.Native> __names_native__nativeSpan = __names_native__marshaller.GetUnmanagedValuesDestination();
for (int __i0 = 0; __i0 < __names_native__managedSpan.Length; ++__i0, ++__names_native__lastIndexMarshalled)
{
__names_native__nativeSpan[__i0] = global::Interop.Advapi32.MARSHALLED_UNICODE_STRING.Marshaller.ConvertToUnmanaged(__names_native__managedSpan[__i0]);
}
}
__handle_native__marshaller.FromManaged(handle);
// Pin - Pin data in preparation for calling the P/Invoke.
fixed (void* __names_native__unused = __names_native__marshaller)
{
// PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
__names_native = __names_native__marshaller.ToUnmanaged();
__handle_native = __handle_native__marshaller.ToUnmanaged();
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal = __PInvoke(__handle_native, flags, count, __names_native, &__referencedDomains_native, &__sids_native);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
__invokeSucceeded = true;
// UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
__sids_native__marshaller.FromUnmanaged(__sids_native);
__referencedDomains_native__marshaller.FromUnmanaged(__referencedDomains_native);
// Unmarshal - Convert native data to managed data.
sids = __sids_native__marshaller.ToManaged();
referencedDomains = __referencedDomains_native__marshaller.ToManaged();
}
finally
{
if (__invokeSucceeded)
{
// CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
__sids_native__marshaller.Free();
__referencedDomains_native__marshaller.Free();
_ = __names_native__lastIndexMarshalled;
}
// CleanupCallerAllocated - Perform cleanup of caller allocated resources.
{
global::System.ReadOnlySpan<global::Interop.Advapi32.MARSHALLED_UNICODE_STRING.Marshaller.Native> __names_native__nativeSpan = __names_native__marshaller.GetUnmanagedValuesDestination();
for (int __i0 = 0; __i0 < __names_native__lastIndexMarshalled; ++__i0)
{
global::Interop.Advapi32.MARSHALLED_UNICODE_STRING.Marshaller.Free(__names_native__nativeSpan[__i0]);
}
}
__names_native__marshaller.Free();
__handle_native__marshaller.Free();
}
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "LsaLookupNames2", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
static extern unsafe uint __PInvoke(nint __handle_native, int __flags_native, int __count_native, global::Interop.Advapi32.MARSHALLED_UNICODE_STRING.Marshaller.Native* __names_native, nint* __referencedDomains_native, nint* __sids_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial uint LsaLookupSids(global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle handle, int count, nint[] sids, out global::Microsoft.Win32.SafeHandles.SafeLsaMemoryHandle referencedDomains, out global::Microsoft.Win32.SafeHandles.SafeLsaMemoryHandle names)
{
int __lastError;
bool __invokeSucceeded = default;
referencedDomains = default;
names = default;
nint __handle_native = default;
nint __referencedDomains_native = default;
nint __names_native = default;
uint __retVal = default;
// Setup - Perform required setup.
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLsaMemoryHandle>.ManagedToUnmanagedOut __names_native__marshaller = new();
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLsaMemoryHandle>.ManagedToUnmanagedOut __referencedDomains_native__marshaller = new();
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle>.ManagedToUnmanagedIn __handle_native__marshaller = new();
try
{
// Marshal - Convert managed data to native data.
__handle_native__marshaller.FromManaged(handle);
// Pin - Pin data in preparation for calling the P/Invoke.
fixed (void* __sids_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<nint, nint>.ManagedToUnmanagedIn.GetPinnableReference(sids))
{
// PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
__handle_native = __handle_native__marshaller.ToUnmanaged();
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal = __PInvoke(__handle_native, count, (nint*)__sids_native, &__referencedDomains_native, &__names_native);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
__invokeSucceeded = true;
// UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
__names_native__marshaller.FromUnmanaged(__names_native);
__referencedDomains_native__marshaller.FromUnmanaged(__referencedDomains_native);
// Unmarshal - Convert native data to managed data.
names = __names_native__marshaller.ToManaged();
referencedDomains = __referencedDomains_native__marshaller.ToManaged();
}
finally
{
if (__invokeSucceeded)
{
// CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
__names_native__marshaller.Free();
__referencedDomains_native__marshaller.Free();
}
// CleanupCallerAllocated - Perform cleanup of caller allocated resources.
__handle_native__marshaller.Free();
}
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "LsaLookupSids", ExactSpelling = true)]
static extern unsafe uint __PInvoke(nint __handle_native, int __count_native, nint* __sids_native, nint* __referencedDomains_native, nint* __names_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial int LsaClose(nint handle)
{
int __lastError;
int __retVal;
{
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal = __PInvoke(handle);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "LsaClose", ExactSpelling = true)]
static extern unsafe int __PInvoke(nint __handle_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial int LsaFreeMemory(nint handle)
{
int __lastError;
int __retVal;
{
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal = __PInvoke(handle);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "LsaFreeMemory", ExactSpelling = true)]
static extern unsafe int __PInvoke(nint __handle_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
private static partial uint LsaOpenPolicy(ref global::Interop.UNICODE_STRING SystemName, ref global::Interop.OBJECT_ATTRIBUTES ObjectAttributes, int AccessMask, out global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle PolicyHandle)
{
int __lastError;
bool __invokeSucceeded = default;
PolicyHandle = default;
nint __PolicyHandle_native = default;
uint __retVal = default;
// Setup - Perform required setup.
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle>.ManagedToUnmanagedOut __PolicyHandle_native__marshaller = new();
try
{
// Pin - Pin data in preparation for calling the P/Invoke.
fixed (global::Interop.OBJECT_ATTRIBUTES* __ObjectAttributes_native = &ObjectAttributes)
fixed (global::Interop.UNICODE_STRING* __SystemName_native = &SystemName)
{
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal = __PInvoke(__SystemName_native, __ObjectAttributes_native, AccessMask, &__PolicyHandle_native);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
__invokeSucceeded = true;
// UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
__PolicyHandle_native__marshaller.FromUnmanaged(__PolicyHandle_native);
// Unmarshal - Convert native data to managed data.
PolicyHandle = __PolicyHandle_native__marshaller.ToManaged();
}
finally
{
if (__invokeSucceeded)
{
// CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
__PolicyHandle_native__marshaller.Free();
}
}
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "LsaOpenPolicy", ExactSpelling = true)]
static extern unsafe uint __PInvoke(global::Interop.UNICODE_STRING* __SystemName_native, global::Interop.OBJECT_ATTRIBUTES* __ObjectAttributes_native, int __AccessMask_native, nint* __PolicyHandle_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static unsafe partial global::Interop.BOOL ConvertStringSidToSid(string StringSid, out void* Sid)
{
int __lastError;
Sid = default;
global::Interop.BOOL __retVal;
// Pin - Pin data in preparation for calling the P/Invoke.
fixed (void** __Sid_native = &Sid)
fixed (void* __StringSid_native = &global::System.Runtime.InteropServices.Marshalling.Utf16StringMarshaller.GetPinnableReference(StringSid))
{
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal = __PInvoke((ushort*)__StringSid_native, __Sid_native);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "ConvertStringSidToSidW", ExactSpelling = true, CharSet = global::System.Runtime.InteropServices.CharSet.Unicode)]
static extern unsafe global::Interop.BOOL __PInvoke(ushort* __StringSid_native, void** __Sid_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial int CreateWellKnownSid(int sidType, byte[] domainSid, byte[] resultSid, ref uint resultSidLength)
{
int __lastError;
int __retVal;
// Pin - Pin data in preparation for calling the P/Invoke.
fixed (uint* __resultSidLength_native = &resultSidLength)
fixed (void* __resultSid_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(resultSid))
fixed (void* __domainSid_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(domainSid))
{
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal = __PInvoke(sidType, (byte*)__domainSid_native, (byte*)__resultSid_native, __resultSidLength_native);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "CreateWellKnownSid", ExactSpelling = true)]
static extern unsafe int __PInvoke(int __sidType_native, byte* __domainSid_native, byte* __resultSid_native, uint* __resultSidLength_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial bool CreateWellKnownSid(int sidType, nint domainSid, nint resultSid, ref uint resultSidLength)
{
int __lastError;
bool __retVal;
int __retVal_native;
// Pin - Pin data in preparation for calling the P/Invoke.
fixed (uint* __resultSidLength_native = &resultSidLength)
{
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal_native = __PInvoke(sidType, domainSid, resultSid, __resultSidLength_native);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
// Unmarshal - Convert native data to managed data.
__retVal = __retVal_native != 0;
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "CreateWellKnownSid", ExactSpelling = true)]
static extern unsafe int __PInvoke(int __sidType_native, nint __domainSid_native, nint __resultSid_native, uint* __resultSidLength_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial int GetWindowsAccountDomainSid(byte[] sid, byte[] resultSid, ref uint resultSidLength)
{
int __lastError;
int __retVal;
// Pin - Pin data in preparation for calling the P/Invoke.
fixed (uint* __resultSidLength_native = &resultSidLength)
fixed (void* __resultSid_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(resultSid))
fixed (void* __sid_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(sid))
{
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal = __PInvoke((byte*)__sid_native, (byte*)__resultSid_native, __resultSidLength_native);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "GetWindowsAccountDomainSid", ExactSpelling = true)]
static extern unsafe int __PInvoke(byte* __sid_native, byte* __resultSid_native, uint* __resultSidLength_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial int IsWellKnownSid(byte[] sid, int type)
{
int __lastError;
int __retVal;
// Pin - Pin data in preparation for calling the P/Invoke.
fixed (void* __sid_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(sid))
{
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal = __PInvoke((byte*)__sid_native, type);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "IsWellKnownSid", ExactSpelling = true)]
static extern unsafe int __PInvoke(byte* __sid_native, int __type_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial int IsEqualDomainSid(byte[] sid1, byte[] sid2, out bool result)
{
int __lastError;
result = default;
int __result_native;
int __retVal;
// Pin - Pin data in preparation for calling the P/Invoke.
fixed (void* __sid2_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(sid2))
fixed (void* __sid1_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(sid1))
{
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal = __PInvoke((byte*)__sid1_native, (byte*)__sid2_native, &__result_native);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
// Unmarshal - Convert native data to managed data.
result = __result_native != 0;
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "EqualDomainSid", ExactSpelling = true)]
static extern unsafe int __PInvoke(byte* __sid1_native, byte* __sid2_native, int* __result_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
private static partial bool OpenThreadToken(nint ThreadHandle, global::System.Security.Principal.TokenAccessLevels dwDesiredAccess, bool bOpenAsSelf, out global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle phThreadToken)
{
int __lastError;
bool __invokeSucceeded = default;
phThreadToken = default;
int __bOpenAsSelf_native = default;
nint __phThreadToken_native = default;
bool __retVal = default;
int __retVal_native = default;
// Setup - Perform required setup.
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle>.ManagedToUnmanagedOut __phThreadToken_native__marshaller = new();
try
{
// Marshal - Convert managed data to native data.
__bOpenAsSelf_native = (int)(bOpenAsSelf ? 1 : 0);
{
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal_native = __PInvoke(ThreadHandle, dwDesiredAccess, __bOpenAsSelf_native, &__phThreadToken_native);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
__invokeSucceeded = true;
// UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
__phThreadToken_native__marshaller.FromUnmanaged(__phThreadToken_native);
// Unmarshal - Convert native data to managed data.
__retVal = __retVal_native != 0;
phThreadToken = __phThreadToken_native__marshaller.ToManaged();
}
finally
{
if (__invokeSucceeded)
{
// CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
__phThreadToken_native__marshaller.Free();
}
}
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "OpenThreadToken", ExactSpelling = true)]
static extern unsafe int __PInvoke(nint __ThreadHandle_native, global::System.Security.Principal.TokenAccessLevels __dwDesiredAccess_native, int __bOpenAsSelf_native, nint* __phThreadToken_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial bool RevertToSelf()
{
int __lastError;
bool __retVal;
int __retVal_native;
{
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal_native = __PInvoke();
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
// Unmarshal - Convert native data to managed data.
__retVal = __retVal_native != 0;
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "RevertToSelf", ExactSpelling = true)]
static extern unsafe int __PInvoke();
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial bool ImpersonateLoggedOnUser(global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle userToken)
{
int __lastError;
nint __userToken_native = default;
bool __retVal = default;
int __retVal_native = default;
// Setup - Perform required setup.
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle>.ManagedToUnmanagedIn __userToken_native__marshaller = new();
try
{
// Marshal - Convert managed data to native data.
__userToken_native__marshaller.FromManaged(userToken);
{
// PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
__userToken_native = __userToken_native__marshaller.ToUnmanaged();
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal_native = __PInvoke(__userToken_native);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
// Unmarshal - Convert native data to managed data.
__retVal = __retVal_native != 0;
}
finally
{
// CleanupCallerAllocated - Perform cleanup of caller allocated resources.
__userToken_native__marshaller.Free();
}
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "ImpersonateLoggedOnUser", ExactSpelling = true)]
static extern unsafe int __PInvoke(nint __userToken_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "LsaNtStatusToWinError", ExactSpelling = true, SetLastError = false)]
internal static extern partial uint LsaNtStatusToWinError(uint status);
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class SspiCli
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial int LsaConnectUntrusted(out global::Microsoft.Win32.SafeHandles.SafeLsaHandle LsaHandle)
{
bool __invokeSucceeded = default;
LsaHandle = default;
nint __LsaHandle_native = default;
int __retVal = default;
// Setup - Perform required setup.
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLsaHandle>.ManagedToUnmanagedOut __LsaHandle_native__marshaller = new();
try
{
{
__retVal = __PInvoke(&__LsaHandle_native);
}
__invokeSucceeded = true;
// UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
__LsaHandle_native__marshaller.FromUnmanaged(__LsaHandle_native);
// Unmarshal - Convert native data to managed data.
LsaHandle = __LsaHandle_native__marshaller.ToManaged();
}
finally
{
if (__invokeSucceeded)
{
// CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
__LsaHandle_native__marshaller.Free();
}
}
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("sspicli.dll", EntryPoint = "LsaConnectUntrusted", ExactSpelling = true)]
static extern unsafe int __PInvoke(nint* __LsaHandle_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class SspiCli
{
[global::System.Runtime.InteropServices.DllImportAttribute("sspicli.dll", EntryPoint = "LsaDeregisterLogonProcess", ExactSpelling = true)]
internal static extern partial int LsaDeregisterLogonProcess(nint LsaHandle);
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class SspiCli
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial int LsaLogonUser(global::Microsoft.Win32.SafeHandles.SafeLsaHandle LsaHandle, in global::Interop.Advapi32.LSA_STRING OriginName, global::Interop.SspiCli.SECURITY_LOGON_TYPE LogonType, int AuthenticationPackage, nint AuthenticationInformation, int AuthenticationInformationLength, nint LocalGroups, in global::Interop.SspiCli.TOKEN_SOURCE SourceContext, out global::Microsoft.Win32.SafeHandles.SafeLsaReturnBufferHandle ProfileBuffer, out int ProfileBufferLength, out global::Interop.LUID LogonId, out global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle Token, out global::Interop.SspiCli.QUOTA_LIMITS Quotas, out int SubStatus)
{
bool __invokeSucceeded = default;
ProfileBuffer = default;
ProfileBufferLength = default;
LogonId = default;
Token = default;
Quotas = default;
SubStatus = default;
nint __LsaHandle_native = default;
nint __ProfileBuffer_native = default;
nint __Token_native = default;
int __retVal = default;
// Setup - Perform required setup.
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle>.ManagedToUnmanagedOut __Token_native__marshaller = new();
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLsaReturnBufferHandle>.ManagedToUnmanagedOut __ProfileBuffer_native__marshaller = new();
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLsaHandle>.ManagedToUnmanagedIn __LsaHandle_native__marshaller = new();
try
{
// Marshal - Convert managed data to native data.
__LsaHandle_native__marshaller.FromManaged(LsaHandle);
// Pin - Pin data in preparation for calling the P/Invoke.
fixed (int* __SubStatus_native = &SubStatus)
fixed (global::Interop.SspiCli.QUOTA_LIMITS* __Quotas_native = &Quotas)
fixed (global::Interop.LUID* __LogonId_native = &LogonId)
fixed (int* __ProfileBufferLength_native = &ProfileBufferLength)
fixed (global::Interop.SspiCli.TOKEN_SOURCE* __SourceContext_native = &SourceContext)
fixed (global::Interop.Advapi32.LSA_STRING* __OriginName_native = &OriginName)
{
// PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
__LsaHandle_native = __LsaHandle_native__marshaller.ToUnmanaged();
__retVal = __PInvoke(__LsaHandle_native, __OriginName_native, LogonType, AuthenticationPackage, AuthenticationInformation, AuthenticationInformationLength, LocalGroups, __SourceContext_native, &__ProfileBuffer_native, __ProfileBufferLength_native, __LogonId_native, &__Token_native, __Quotas_native, __SubStatus_native);
}
__invokeSucceeded = true;
// UnmarshalCapture - Capture the native data into marshaller instances in case conversion to managed data throws an exception.
__Token_native__marshaller.FromUnmanaged(__Token_native);
__ProfileBuffer_native__marshaller.FromUnmanaged(__ProfileBuffer_native);
// Unmarshal - Convert native data to managed data.
Token = __Token_native__marshaller.ToManaged();
ProfileBuffer = __ProfileBuffer_native__marshaller.ToManaged();
}
finally
{
if (__invokeSucceeded)
{
// CleanupCalleeAllocated - Perform cleanup of callee allocated resources.
__Token_native__marshaller.Free();
__ProfileBuffer_native__marshaller.Free();
}
// CleanupCallerAllocated - Perform cleanup of caller allocated resources.
__LsaHandle_native__marshaller.Free();
}
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("sspicli.dll", EntryPoint = "LsaLogonUser", ExactSpelling = true)]
static extern unsafe int __PInvoke(nint __LsaHandle_native, global::Interop.Advapi32.LSA_STRING* __OriginName_native, global::Interop.SspiCli.SECURITY_LOGON_TYPE __LogonType_native, int __AuthenticationPackage_native, nint __AuthenticationInformation_native, int __AuthenticationInformationLength_native, nint __LocalGroups_native, global::Interop.SspiCli.TOKEN_SOURCE* __SourceContext_native, nint* __ProfileBuffer_native, int* __ProfileBufferLength_native, global::Interop.LUID* __LogonId_native, nint* __Token_native, global::Interop.SspiCli.QUOTA_LIMITS* __Quotas_native, int* __SubStatus_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class SspiCli
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial int LsaLookupAuthenticationPackage(global::Microsoft.Win32.SafeHandles.SafeLsaHandle LsaHandle, ref global::Interop.Advapi32.LSA_STRING PackageName, out int AuthenticationPackage)
{
AuthenticationPackage = default;
nint __LsaHandle_native = default;
int __retVal = default;
// Setup - Perform required setup.
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeLsaHandle>.ManagedToUnmanagedIn __LsaHandle_native__marshaller = new();
try
{
// Marshal - Convert managed data to native data.
__LsaHandle_native__marshaller.FromManaged(LsaHandle);
// Pin - Pin data in preparation for calling the P/Invoke.
fixed (int* __AuthenticationPackage_native = &AuthenticationPackage)
fixed (global::Interop.Advapi32.LSA_STRING* __PackageName_native = &PackageName)
{
// PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
__LsaHandle_native = __LsaHandle_native__marshaller.ToUnmanaged();
__retVal = __PInvoke(__LsaHandle_native, __PackageName_native, __AuthenticationPackage_native);
}
}
finally
{
// CleanupCallerAllocated - Perform cleanup of caller allocated resources.
__LsaHandle_native__marshaller.Free();
}
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("sspicli.dll", EntryPoint = "LsaLookupAuthenticationPackage", ExactSpelling = true)]
static extern unsafe int __PInvoke(nint __LsaHandle_native, global::Interop.Advapi32.LSA_STRING* __PackageName_native, int* __AuthenticationPackage_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static unsafe partial bool AllocateLocallyUniqueId(global::Interop.LUID* Luid)
{
bool __retVal;
int __retVal_native;
{
__retVal_native = __PInvoke(Luid);
}
// Unmarshal - Convert native data to managed data.
__retVal = __retVal_native != 0;
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "AllocateLocallyUniqueId", ExactSpelling = true)]
static extern unsafe int __PInvoke(global::Interop.LUID* __Luid_native);
}
}
}
internal static unsafe partial class Interop
{
internal static unsafe partial class Advapi32
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Interop.LibraryImportGenerator", "11.0.14.26904")]
internal static partial bool CheckTokenMembership(global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle TokenHandle, byte[] SidToCheck, ref bool IsMember)
{
int __lastError;
nint __TokenHandle_native = default;
int __IsMember_native = default;
bool __retVal = default;
int __retVal_native = default;
// Setup - Perform required setup.
global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Microsoft.Win32.SafeHandles.SafeAccessTokenHandle>.ManagedToUnmanagedIn __TokenHandle_native__marshaller = new();
try
{
// Marshal - Convert managed data to native data.
__IsMember_native = (int)(IsMember ? 1 : 0);
__TokenHandle_native__marshaller.FromManaged(TokenHandle);
// Pin - Pin data in preparation for calling the P/Invoke.
fixed (void* __SidToCheck_native = &global::System.Runtime.InteropServices.Marshalling.ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(SidToCheck))
{
// PinnedMarshal - Convert managed data to native data that requires the managed data to be pinned.
__TokenHandle_native = __TokenHandle_native__marshaller.ToUnmanaged();
global::System.Runtime.InteropServices.Marshal.SetLastSystemError(0);
__retVal_native = __PInvoke(__TokenHandle_native, (byte*)__SidToCheck_native, &__IsMember_native);
__lastError = global::System.Runtime.InteropServices.Marshal.GetLastSystemError();
}
// Unmarshal - Convert native data to managed data.
__retVal = __retVal_native != 0;
IsMember = __IsMember_native != 0;
}
finally
{
// CleanupCallerAllocated - Perform cleanup of caller allocated resources.
__TokenHandle_native__marshaller.Free();
}
global::System.Runtime.InteropServices.Marshal.SetLastPInvokeError(__lastError);
return __retVal;
// Local P/Invoke
[global::System.Runtime.InteropServices.DllImportAttribute("advapi32.dll", EntryPoint = "CheckTokenMembership", ExactSpelling = true)]
static extern unsafe int __PInvoke(nint __TokenHandle_native, byte* __SidToCheck_native, int* __IsMember_native);
}
}
}
|