You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There appear to be a mismatches in the DllImport signatures for DuplicateTokenEx in this project. The 4th ImpersonationLevel argument is supposed to be of type SECURITY_IMPERSONATION_LEVEL, but is mapped to the .Net TokenImpersonationLevel counterpart. This .Net enumeration does on the surface appear identical, but the underlying values are shifted by one.
Change TokenImpersonationLevel ImpersonationLevel argument to uint ImpersonationLevel or define a matching .Net SECURITY_IMPERSONATION_LEVEL enumeration. Both strategies are already applied in the dotnet/runtime repo.
// Impersonation Level
//
// Impersonation level is represented by a pair of bits in Windows.
// If a new impersonation level is added or lowest value is changed from
// 0 to something else, fix the Windows CreateFile call.
//
typedef enum _SECURITY_IMPERSONATION_LEVEL {
SecurityAnonymous,
SecurityIdentification,
SecurityImpersonation,
SecurityDelegation
} SECURITY_IMPERSONATION_LEVEL, * PSECURITY_IMPERSONATION_LEVEL;
namespace System.Security.Principal
{
//
// Summary:
// Defines security impersonation levels. Security impersonation levels govern the
// degree to which a server process can act on behalf of a client process.
public enum TokenImpersonationLevel
{
None = 0,
Anonymous = 1,
Identification = 2,
Impersonation = 3,
Delegation = 4
}
}
The text was updated successfully, but these errors were encountered:
There appear to be a mismatches in the DllImport signatures for
DuplicateTokenEx
in this project. The 4thImpersonationLevel
argument is supposed to be of typeSECURITY_IMPERSONATION_LEVEL
, but is mapped to the .Net TokenImpersonationLevel counterpart. This .Net enumeration does on the surface appear identical, but the underlying values are shifted by one.Affected files:
Suggested fix
TokenImpersonationLevel ImpersonationLevel
argument touint ImpersonationLevel
or define a matching .NetSECURITY_IMPERSONATION_LEVEL
enumeration. Both strategies are already applied in the dotnet/runtime repo.Background material
From
winnt.h
SECURITY_IMPERSONATION_LEVEL:From .NET TokenImpersonationLevel:
The text was updated successfully, but these errors were encountered: