コード例 #1
0
ファイル: StackWalker.cs プロジェクト: goldshtn/msos
        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;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        internal bool GetThreadSleepBlockingObject(UnifiedStackFrame frame, out UnifiedBlockingObject blockingObject)
        {
            blockingObject = null;

            if (IsMatchingMethod(frame, NTDELAY_EXECUTION_FUNCTION_NAME))
            {
                blockingObject = GetNtDelayExecutionBlockingObject(frame);
            }

            return(blockingObject != null);
        }
コード例 #4
0
ファイル: StackWalker.cs プロジェクト: goldshtn/msos
        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;
        }