Ejemplo n.º 1
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        public void SetAt(int index, char c)
        {
            lock (_methodLock)
            {
                if (index < 0 || index >= _decryptedLength)
                {
                    throw new ArgumentOutOfRangeException("index", SR.ArgumentOutOfRange_IndexString);
                }
                Debug.Assert(index <= Int32.MaxValue / sizeof(char));

                EnsureNotDisposed();
                EnsureNotReadOnly();

                SafeBSTRHandle decryptedBuffer = null;
                try
                {
                    decryptedBuffer = UnProtectMemory();
                    decryptedBuffer.Write <char>((uint)index * sizeof(char), c);
                }
                finally
                {
                    ProtectMemory(decryptedBuffer);
                }
            }
        }
Ejemplo n.º 2
0
        [HandleProcessCorruptedStateExceptions] // 
#endif // FEATURE_CORRUPTING_EXCEPTIONS
        public void AppendChar(char c) {
            EnsureNotDisposed();
            EnsureNotReadOnly();

            EnsureCapacity(m_length + 1);

            RuntimeHelpers.PrepareConstrainedRegions();
            try {
                UnProtectMemory();            
                m_buffer.Write<char>((uint)m_length * sizeof(char), c);
                m_length++;
            }
            catch (Exception) {
                ProtectMemory();
                throw;
            }
            finally {
                ProtectMemory();            
            }
        }
Ejemplo n.º 3
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        private void SetAtCore(int index, char c)
        {
            SafeBSTRHandle decryptedBuffer = null;

            try
            {
                decryptedBuffer = UnProtectMemory();
                decryptedBuffer.Write <char>((uint)index * sizeof(char), c);
            }
            finally
            {
                ProtectMemory(decryptedBuffer);
            }
        }
Ejemplo n.º 4
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        private void AppendCharCore(char c)
        {
            SafeBSTRHandle decryptedBuffer = null;

            try
            {
                decryptedBuffer = UnProtectMemory();
                EnsureCapacity(ref decryptedBuffer, _decryptedLength + 1);
                decryptedBuffer.Write <char>((uint)_decryptedLength * sizeof(char), c);
                _decryptedLength++;
            }
            finally
            {
                ProtectMemory(decryptedBuffer);
            }
        }
Ejemplo n.º 5
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        public void AppendChar(char c)
        {
            lock (_methodLock)
            {
                EnsureNotDisposed();
                EnsureNotReadOnly();

                SafeBSTRHandle decryptedBuffer = null;
                try
                {
                    decryptedBuffer = UnProtectMemory();
                    EnsureCapacity(ref decryptedBuffer, _decryptedLength + 1);
                    decryptedBuffer.Write <char>((uint)_decryptedLength * sizeof(char), c);
                    _decryptedLength++;
                }
                finally
                {
                    ProtectMemory(decryptedBuffer);
                }
            }
        }