update sharp token

This commit is contained in:
beichen
2023-11-25 01:15:26 +08:00
parent 447d354248
commit 446d95579f
4 changed files with 35 additions and 10 deletions
+3 -1
View File
@@ -1,3 +1,5 @@
/.vs/
/bin/
/obj/
/obj/
GodPotato.csproj.user
app.config
+4 -1
View File
@@ -5,7 +5,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2AE886C3-3272-40BE-8D3C-EBAEDE9E61E1}</ProjectGuid>
<OutputType>Exe</OutputType>
<OutputType>Library</OutputType>
<RootNamespace>GodPotato</RootNamespace>
<AssemblyName>GodPotato</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
@@ -32,6 +32,9 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
+4
View File
@@ -158,6 +158,10 @@ namespace GodPotato.NativeAPI
public IntPtr /* PMIDL_SYNTAX_INFO */ pSyntaxInfo;
}
void aa() {
}
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool VirtualProtect([In] IntPtr pBlock,[In] uint size,[In] uint newProtect,[Out] out uint oldProtect);
+24 -8
View File
@@ -693,6 +693,8 @@ namespace SharpToken
public bool IsClose { get; private set; }
private static readonly List<string> blackGroupSid = new List<string>();
private ProcessToken()
{
@@ -813,15 +815,29 @@ namespace SharpToken
for (int i = 0; i < groupCount; i++)
{
try
lock (blackGroupSid)
{
securityIdentifier = new SecurityIdentifier(Marshal.ReadIntPtr(new IntPtr(tokenUserPtr.ToInt64() + offset)));
offset += Marshal.SizeOf(typeof(SID_AND_ATTRIBUTES));
goups.Add(securityIdentifier.Translate(typeof(NTAccount)).Value);
}
catch (Exception e)
{
continue;
try
{
securityIdentifier = new SecurityIdentifier(Marshal.ReadIntPtr(new IntPtr(tokenUserPtr.ToInt64() + offset)));
offset += Marshal.SizeOf(typeof(SID_AND_ATTRIBUTES));
if (blackGroupSid.Contains(securityIdentifier.Value))
{
continue;
}
goups.Add(securityIdentifier.Translate(typeof(NTAccount)).Value);
}
catch (Exception e)
{
if (securityIdentifier != null)
{
blackGroupSid.Add(securityIdentifier.Value);
}
continue;
}
}
}
Marshal.FreeHGlobal(tokenUserPtr);