protected override UnifiedBlockingObject GetCriticalSectionBlockingObject(UnifiedStackFrame frame) { UnifiedBlockingObject result = null; var parameters = GetParameters(frame, ENTER_CRITICAL_SECTION_FUNCTION_PARAM_COUNT); var criticalSectionAddress = ConvertToAddress(parameters[0]); byte[] buffer = new byte[Marshal.SizeOf(typeof(CRITICAL_SECTION))]; int read; if (!_runtime.ReadMemory(criticalSectionAddress, buffer, buffer.Length, out read) || read != buffer.Length) throw new Exception($"Error reading critical section data from address: {criticalSectionAddress}"); var gch = GCHandle.Alloc(buffer, GCHandleType.Pinned); try { CRITICAL_SECTION section = (CRITICAL_SECTION)Marshal.PtrToStructure( gch.AddrOfPinnedObject(), typeof(CRITICAL_SECTION)); result = new UnifiedBlockingObject(section, criticalSectionAddress); } finally { gch.Free(); } return result; }
public bool GetCriticalSectionBlockingObject(UnifiedStackFrame frame, out UnifiedBlockingObject blockingObject) { blockingObject = null; if (frame.Handles != null && IsMatchingMethod(frame, ENTER_CRITICAL_SECTION_FUNCTION_NAME)) { blockingObject = GetCriticalSectionBlockingObject(frame); } return(blockingObject != null); }
internal bool GetThreadSleepBlockingObject(UnifiedStackFrame frame, out UnifiedBlockingObject blockingObject) { blockingObject = null; if (IsMatchingMethod(frame, NTDELAY_EXECUTION_FUNCTION_NAME)) { blockingObject = GetNtDelayExecutionBlockingObject(frame); } return(blockingObject != null); }
public bool GetCriticalSectionBlockingObject(UnifiedStackFrame frame, out UnifiedBlockingObject blockingObject) { bool result = false; if (frame.Handles != null && IsMatchingMethod(frame, ENTER_CRITICAL_SECTION_FUNCTION_NAME)) { blockingObject = GetCriticalSectionBlockingObject(frame); result = blockingObject != null; } else { blockingObject = null; } return result; }