Esempio n. 1
0
        public Object GetValue()
        {
            Object value = null;

            m_target.GetValue(out value);
            return(value);
        }
Esempio n. 2
0
        public object GetValue()
        {
            object value;

            unmanagedConstant.GetValue(out value);
            return(value);
        }
        public static void ValidateConstant(ISymUnmanagedConstant constant, string name, object value, byte[] signature)
        {
            int length, length2;

            // name:
            Assert.Equal(HResult.S_OK, constant.GetName(0, out length, null));
            Assert.Equal(name.Length + 1, length);
            var actualName = new char[length];

            Assert.Equal(HResult.S_OK, constant.GetName(length, out length2, actualName));
            Assert.Equal(length, length2);
            Assert.Equal(name + "\0", new string(actualName));

            // value:
            object actualValue;

            Assert.Equal(HResult.S_OK, constant.GetValue(out actualValue));
            Assert.Equal(value, actualValue);

            // signature:
            Assert.Equal(HResult.S_OK, constant.GetSignature(0, out length, null));
            var actualSignature = new byte[length];

            Assert.Equal(HResult.S_OK, constant.GetSignature(length, out length2, actualSignature));
            Assert.Equal(length, length2);
            AssertEx.Equal(signature, actualSignature);
        }
Esempio n. 4
0
        public static object GetValue(this ISymUnmanagedConstant constant)
        {
            object value;
            int    hr = constant.GetValue(out value);

            ThrowExceptionForHR(hr);
            return(value);
        }
        public static object GetValue(this ISymUnmanagedConstant constant)
        {
            if (constant == null)
            {
                throw new ArgumentNullException(nameof(constant));
            }

            object value;

            ThrowExceptionForHR(constant.GetValue(out value));
            return(value);
        }
Esempio n. 6
0
 public int GetSignature(int cSig, out int pcSig, byte[] sig)
 {
     if (_signatureOpt == null)
     {
         pcSig = 1;
         if (sig != null)
         {
             object value;
             _constant.GetValue(out value);
             sig[0] = (byte)GetSignatureTypeCode(value);
         }
     }
     else
     {
         pcSig = _signatureOpt.Length;
         if (sig != null)
         {
             Array.Copy(_signatureOpt, sig, cSig);
         }
     }
     return(SymUnmanagedReaderExtensions.S_OK);
 }
        private static bool TryGetConstantValue(this ISymUnmanagedConstant constant, out NamedLocalConstant value)
        {
            value = default(NamedLocalConstant);

            int length;
            int hresult = constant.GetName(0, out length, null);

            SymUnmanagedReaderExtensions.ThrowExceptionForHR(hresult);
            Debug.Assert(length > 0);
            if (length == 0)
            {
                return(false);
            }

            var chars = new char[length];

            hresult = constant.GetName(length, out length, chars);
            SymUnmanagedReaderExtensions.ThrowExceptionForHR(hresult);
            Debug.Assert(chars[length - 1] == 0);
            var name = new string(chars, 0, length - 1);

            constant.GetSignature(0, out length, null);
            Debug.Assert(length > 0);
            if (length == 0)
            {
                return(false);
            }

            var signature = new byte[length];

            constant.GetSignature(length, out length, signature);

            object val;

            constant.GetValue(out val);

            var constantValue = GetConstantValue(signature, val);

            value = new NamedLocalConstant(name, signature, constantValue);
            return(true);
        }
Esempio n. 8
0
        public static void ValidateConstant(ISymUnmanagedConstant constant, string name, object value, byte[] signature)
        {
            int length, length2;

            // name:
            Assert.Equal(HResult.S_OK, constant.GetName(0, out length, null));
            Assert.Equal(name.Length + 1, length);
            var actualName = new char[length];
            Assert.Equal(HResult.S_OK, constant.GetName(length, out length2, actualName));
            Assert.Equal(length, length2);
            Assert.Equal(name + "\0", new string(actualName));

            // value:
            object actualValue;
            Assert.Equal(HResult.S_OK, constant.GetValue(out actualValue));
            Assert.Equal(value, actualValue);

            // signature:
            Assert.Equal(HResult.S_OK, constant.GetSignature(0, out length, null));
            var actualSignature = new byte[length];
            Assert.Equal(HResult.S_OK, constant.GetSignature(length, out length2, actualSignature));
            Assert.Equal(length, length2);
            AssertEx.Equal(signature, actualSignature);
        }