private void EnsureRecordBuffer(uint bytes)
 {
     if (bytes > this.currentBufferSize)
     {
         this.bufferHandle.Close();
         this.currentBufferSize  = bytes;
         this.bufferHandle       = SafeHGlobalHandleCritical.AllocHGlobal(this.currentBufferSize);
         this.record.pbMDData    = this.bufferHandle.DangerousGetHandle();
         this.record.dwMDDataLen = this.currentBufferSize;
     }
 }
        void EnsureRecordBuffer(uint bytes)
        {
            if (bytes <= currentBufferSize)
            {
                return;
            }

            bufferHandle.Close();
            currentBufferSize = bytes;
            bufferHandle      = SafeHGlobalHandleCritical.AllocHGlobal(currentBufferSize);

            record.pbMDData    = bufferHandle.DangerousGetHandle();
            record.dwMDDataLen = currentBufferSize;
        }
        public MetabaseReader()
        {
            uint num;

            this.currentBufferSize = 0x400;
            lock (syncRoot)
            {
                if (adminBase == null)
                {
                    adminBase = (IMSAdminBase) new MSAdminBase();
                }
            }
            uint num2 = adminBase.OpenKey(0, "/LM", 1, 0x7530, out num);

            this.mdHandle = (int)num;
            if (num2 != 0)
            {
                throw FxTrace.Exception.AsError(new COMException(System.ServiceModel.Activation.SR.Hosting_MetabaseAccessError, (int)num2));
            }
            this.bufferHandle = SafeHGlobalHandleCritical.AllocHGlobal(this.currentBufferSize);
        }
        public MetabaseReader()
        {
            lock (syncRoot)
            {
                if (adminBase == null)
                {
                    adminBase = (IMSAdminBase) new MSAdminBase();
                }
            }

            uint handle;
            uint hResult = adminBase.OpenKey(MSAdminBase.METADATA_MASTER_ROOT_HANDLE, LMPath,
                                             MSAdminBase.METADATA_PERMISSION_READ, MSAdminBase.DEFAULT_METABASE_TIMEOUT, out handle);

            mdHandle = (int)handle;

            if (hResult != 0)
            {
                throw FxTrace.Exception.AsError(new COMException(SR.Hosting_MetabaseAccessError, (int)hResult));
            }

            bufferHandle = SafeHGlobalHandleCritical.AllocHGlobal(currentBufferSize);
        }