本文整理汇总了C#中ConcurrentDictionary.AsEnumerable方法的典型用法代码示例。如果您正苦于以下问题:C# ConcurrentDictionary.AsEnumerable方法的具体用法?C# ConcurrentDictionary.AsEnumerable怎么用?C# ConcurrentDictionary.AsEnumerable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConcurrentDictionary
的用法示例。
在下文中一共展示了ConcurrentDictionary.AsEnumerable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GroupAS
//.........这里部分代码省略.........
var totGrouped = (from g in ASGroups.Values
select g).Sum(x => x.Count());
WriteLine($"Finished Group {CurrASID} collected size {ASGroups[CurrASID].Count()}, continuing to group");
// if there is more work todo, setup an entry for testing
if (totGrouped < totUngrouped)
{
// if we wind up here
// there has been no forward progress in isolating further groups
if(LastGroupTotal == totGrouped)
{
ForegroundColor = ConsoleColor.Red;
WriteLine($"Terminating with non-grouped process candidates. GroupThreshold may be too high. {GroupThreshold}");
var pz = from px in Processes
where px.AddressSpaceID == 0
select px;
// just add the ungrouped processes as a single each bare metal
// unless it has an existing VMCS pointer
foreach (var px in pz)
{
WriteLine(px);
CurrASID++;
px.AddressSpaceID = CurrASID;
ASGroups[CurrASID] = new ConcurrentBag<DetectedProc>() { px };
var isCandidate = from pvmcs in scan.HVLayer
where pvmcs.gCR3 == px.CR3Value
select pvmcs;
if (isCandidate.Count() > 0)
{
px.CandidateList = new List<VMCS>(isCandidate);
px.vmcs = px.CandidateList.First();
WriteColor( ConsoleColor.White, $"Detected ungrouped {px.CR3Value} as a candidate under {px.CandidateList.Count()} values (first){px.vmcs.EPTP}");
}
}
ForegroundColor = ConsoleColor.Yellow;
break;
}
CurrASID++;
ASGroups[CurrASID] = new ConcurrentBag<DetectedProc>();
WriteLine($"grouped count ({totGrouped}) is less than total process count ({totUngrouped}, rescanning...)");
LastGroupTotal = totGrouped;
}
else
break; // we grouped them all!
/// Isolate next un-grouped PageTable
var UnGroupedProc = from nextProc in Processes
where !grouped.Contains(nextProc)
select nextProc;
AlikelyKernelSet = from ptes in UnGroupedProc.First().TopPageTablePage
where ptes.Key > 255 && MagicNumbers.Each.All(ppx => ppx != ptes.Key)
select ptes.Value;
}
Console.WriteLine($"Done All process groups.");
// after grouping link VMCS back to the group who 'discovered' the VMCS in the first place!
var eptpz = VMCSs.Values.GroupBy(eptz => eptz.EPTP).OrderBy(eptx => eptx.Key).Select(ept => ept.First()).ToArray();
// find groups dominated by each vmcs
var VMCSGroup = from aspace in ASGroups.AsEnumerable()
from ept in eptpz
where aspace.Value.Any(adpSpace => adpSpace == ept.dp)
select new { AS = aspace, EPTctx = ept };
// link the proc back into the eptp
foreach (var ctx in VMCSGroup)
foreach (var dp in ctx.AS.Value)
{
if(dp.CandidateList == null)
dp.CandidateList = new List<VMCS>();
dp.vmcs = ctx.EPTctx;
dp.CandidateList.Add(ctx.EPTctx);
}
// resort by CR3
foreach (var ctx in ASGroups.Values)
{
var dpz = from d in ctx
orderby d.CR3Value descending
select d;
if (dpz.Count() >= 1)
{
var aspace = dpz.First().AddressSpaceID;
ASGroups[aspace] = new ConcurrentBag<DetectedProc>(dpz);
}
}
Phase = 4;
// were good, all Processes should have a VMCS if applicable and be identifiable by AS ID
}