예제 #1
0
        private void GetThreadName(ThreadWrapper threadWrapper, ValueWrapper threadObject, NuGenFrameRefresher threadActiveFrameRefresher)
        {
            List <ModuleWrapper> modules = threadWrapper.FindModulesByName(GetThreadNameMethod.BaseTypeDefinition.ModuleScope.Assembly.FileName);

            if (modules.Count == 1)
            {
                ModuleWrapper       module = modules[0];
                FunctionWrapper     getThreadNameFunction = module.GetFunction(GetThreadNameMethod.Token);
                List <ValueWrapper> arguments             = new List <ValueWrapper>(1);
                arguments.Add(threadObject);

                NuGenEvaluationHandler    methodCaller     = new NuGenEvaluationHandler(threadActiveFrameRefresher);
                NuGenBaseEvaluationResult evaluationResult = methodCaller.CallFunction(getThreadNameFunction, arguments);

                if (evaluationResult.IsSuccessful)
                {
                    if (evaluationResult.Result != null && (CorElementType)evaluationResult.Result.ElementType == CorElementType.ELEMENT_TYPE_STRING)
                    {
                        ValueWrapper dereferencedResult = evaluationResult.Result.DereferenceValue();

                        if (dereferencedResult != null)
                        {
                            EvaluatedThreadName = NuGenHelperFunctions.ShowEscapeCharacters(dereferencedResult.GetStringValue(), true);
                        }
                    }
                }
            }
        }