private static UIntPtr For(RuntimeSystemType parent, MD5TypeEntry hash) { RuntimeSystemType rts = new RuntimeSystemType(parent, hash); // IMPORTANT we need to allocate these handles to the kernel, since // they are stored in shared heap object headers that move from process // to process. rts.handle = Process.kernelProcess.AllocateHandle(rts); // TODO: Figure out how to collect them // return(rts.handle); }
int IComparable.CompareTo(object o2) { MD5TypeEntry m2 = (MD5TypeEntry)o2; if (upperHash < m2.upperHash) { return(-1); } else if (upperHash > m2.upperHash) { return(1); } else if (lowerHash < m2.lowerHash) { return(-1); } else if (lowerHash > m2.lowerHash) { return(1); } return(this.name.CompareTo(m2.name)); #if false long d1 = unchecked (this.upperHash - m2.upperHash); if (d1 == 0) { long d2 = unchecked (this.lowerHash - m2.lowerHash); if (d2 == 0) { return(0); } if (d2 < 0) { return(-1); } return(+1); } if (d1 < 0) { return(-1); } return(+1); #endif }
internal UIntPtr LookupChildHandle(string name, long lowerHash, long upperHash) { MD5TypeEntry childhash = new MD5TypeEntry(name, lowerHash, upperHash); object childBox = this.ChildHandles[childhash]; if (childBox == null) { lock (this.ChildHandles) { childBox = this.ChildHandles[childhash]; if (childBox == null) { UIntPtr child = RuntimeSystemType.For(this, childhash); this.ChildHandles.Add(childhash, child); DebugLine("RST.LookupChild({0}.{1:x16}{2:x16}) => Create {3:x8}", __arglist(name, lowerHash, upperHash, child)); return(child); } } } DebugLine("RST.LookupChild({0}.{1:x16}{2:x16}) => Find {3:x8}", __arglist(name, lowerHash, upperHash, (UIntPtr)childBox)); return((UIntPtr)childBox); }
private RuntimeSystemType(RuntimeSystemType parent, MD5TypeEntry hash) { this.hash = hash; this.parent = parent; }