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);
                        }
                    }
                }
            }
        }
Exemple #2
0
 private void escapeCharactersCheckBox_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         if (escapeCharactersCheckBox.Checked)
         {
             textBox.Text = NuGenHelperFunctions.ShowEscapeCharacters(textBox.Text, true);
         }
         else
         {
             textBox.Text = NuGenHelperFunctions.ConvertEscapedCharacters(textBox.Text, true);
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show("An exception occurred while trying to display the text:\n\n" + exception.ToString());
     }
 }
        public NuGenPermissionSet(uint token, uint securityFlag, IntPtr signatureBlob, uint signatureBlobLength)
        {
            Token        = Token;
            SecurityFlag = (CorDeclSecurity)securityFlag;

            byte[] description = new byte[signatureBlobLength];
            for (int offset = 0; offset < signatureBlobLength; offset++)
            {
                description[offset] = Marshal.ReadByte(signatureBlob, offset);
            }

            UnicodeEncoding encoding = new UnicodeEncoding();

            Name = string.Format(".permissionset {0} \"{1}\"", SecurityFlagAsString(), NuGenHelperFunctions.ShowEscapeCharacters(encoding.GetString(description, 0, description.Length)));
        }