Пример #1
0
        // Token: 0x06000528 RID: 1320 RVA: 0x00013480 File Offset: 0x00011680
        public bool SetValue(string propertyName, object propertyValue, RegistryValueKind valueKind, bool isBestEffort, ReadWriteConstraints constraints)
        {
            bool result = false;

            using (ClusdbMarshalledProperty clusdbMarshalledProperty = ClusdbMarshalledProperty.Create(propertyName, propertyValue, valueKind))
            {
                if (clusdbMarshalledProperty != null)
                {
                    int num = ClusapiMethods.ClusterRegSetValue(this.KeyHandle, clusdbMarshalledProperty.PropertyName, clusdbMarshalledProperty.ValueKind, clusdbMarshalledProperty.PropertyValueIntPtr, clusdbMarshalledProperty.PropertyValueSize);
                    if (num != 0)
                    {
                        if (!isBestEffort)
                        {
                            throw AmExceptionHelper.ConstructClusterApiException(num, "ClusterRegSetValue()", new object[0]);
                        }
                    }
                    else
                    {
                        result = true;
                    }
                }
                else if (!isBestEffort)
                {
                    string typeName = (propertyValue != null) ? propertyValue.GetType().Name : "<null>";
                    throw new ClusterApiException("ClusterRegSetValue(unsupported registry type)", new ClusterUnsupportedRegistryTypeException(typeName));
                }
            }
            return(result);
        }
        // Token: 0x060004FD RID: 1277 RVA: 0x00012FF8 File Offset: 0x000111F8
        public void Execute(ReadWriteConstraints constraints)
        {
            bool flag = this.totalCommands > 0;

            if (flag && this.batchHandle != null && !this.batchHandle.IsInvalid)
            {
                try
                {
                    int num = this.batchHandle.CommitAndClose();
                    if (num != 0)
                    {
                        throw AmExceptionHelper.ConstructClusterApiException(num, "CommitAndClose()", new object[0]);
                    }
                }
                finally
                {
                    try
                    {
                        this.batchHandle.Dispose();
                    }
                    finally
                    {
                        this.batchHandle = null;
                    }
                }
            }
        }
Пример #3
0
        // Token: 0x0600052C RID: 1324 RVA: 0x000135F4 File Offset: 0x000117F4
        public IEnumerable <string> GetSubkeyNames(ReadWriteConstraints constraints)
        {
            List <string> list = new List <string>();
            int           num  = 128;
            int           num2 = 0;
            int           num4;

            for (;;)
            {
                StringBuilder stringBuilder = new StringBuilder(num);
                int           num3          = num;
                num4 = ClusapiMethods.ClusterRegEnumKey(this.KeyHandle, num2, stringBuilder, ref num3, IntPtr.Zero);
                if (234 == num4)
                {
                    num           = num3 + 1;
                    stringBuilder = new StringBuilder(num);
                    num4          = ClusapiMethods.ClusterRegEnumKey(this.KeyHandle, num2, stringBuilder, ref num3, IntPtr.Zero);
                }
                if (num4 != 0)
                {
                    break;
                }
                list.Add(stringBuilder.ToString());
                num2++;
            }
            if (259 != num4)
            {
                throw AmExceptionHelper.ConstructClusterApiException(num4, "ClusterRegEnumKey()", new object[0]);
            }
            return(list.ToArray());
        }
        // Token: 0x060004FC RID: 1276 RVA: 0x00012FB4 File Offset: 0x000111B4
        public void DeleteValue(string propertyName)
        {
            int num = ClusapiMethods.ClusterRegBatchAddCommand(this.batchHandle, CLUSTER_REG_COMMAND.CLUSREG_DELETE_VALUE, propertyName, RegistryValueKind.Unknown, IntPtr.Zero, 0);

            if (num != 0)
            {
                throw AmExceptionHelper.ConstructClusterApiException(num, "ClusterRegBatchAddCommand(CLUSREG_DELETE_VALUE)", new object[0]);
            }
            Interlocked.Increment(ref this.totalCommands);
        }
        // Token: 0x060004F6 RID: 1270 RVA: 0x00012E40 File Offset: 0x00011040
        public ClusdbBatchRequest(ClusterDbKey containerKey)
        {
            AmClusterBatchHandle amClusterBatchHandle = null;
            int num = ClusapiMethods.ClusterRegCreateBatch(containerKey.KeyHandle, out amClusterBatchHandle);

            if (num != 0 || amClusterBatchHandle.IsInvalid)
            {
                throw AmExceptionHelper.ConstructClusterApiException(num, "ClusterRegCreateBatch()", new object[0]);
            }
            this.batchHandle  = amClusterBatchHandle;
            this.ContainerKey = containerKey;
        }
Пример #6
0
        // Token: 0x0600052B RID: 1323 RVA: 0x000135B4 File Offset: 0x000117B4
        public bool DeleteValue(string propertyName, bool isIgnoreIfNotExist, ReadWriteConstraints constraints)
        {
            if (isIgnoreIfNotExist && !this.IsPropertyExists(propertyName, constraints))
            {
                return(false);
            }
            int num = ClusapiMethods.ClusterRegDeleteValue(this.KeyHandle, propertyName);

            if (num != 0)
            {
                throw AmExceptionHelper.ConstructClusterApiException(num, "ClusterRegDeleteValue()", new object[0]);
            }
            return(true);
        }
        // Token: 0x060004FB RID: 1275 RVA: 0x00012F34 File Offset: 0x00011134
        public void SetValue(string propertyName, object propertyValue, RegistryValueKind valueKind)
        {
            ClusdbMarshalledProperty clusdbMarshalledProperty = ClusdbMarshalledProperty.Create(propertyName, propertyValue, valueKind);

            if (clusdbMarshalledProperty == null)
            {
                throw new ClusterApiException("WfcDataStoreBatch.SetValue - property value is null", new ClusterUnsupportedRegistryTypeException("null"));
            }
            this.properties.Add(clusdbMarshalledProperty);
            int num = ClusapiMethods.ClusterRegBatchAddCommand(this.batchHandle, CLUSTER_REG_COMMAND.CLUSREG_SET_VALUE, clusdbMarshalledProperty.PropertyName, clusdbMarshalledProperty.ValueKind, clusdbMarshalledProperty.PropertyValueIntPtr, clusdbMarshalledProperty.PropertyValueSize);

            if (num != 0)
            {
                throw AmExceptionHelper.ConstructClusterApiException(num, "ClusterRegBatchAddCommand(CLUSREG_SET_VALUE)", new object[0]);
            }
            Interlocked.Increment(ref this.totalCommands);
        }
Пример #8
0
		private void RegisterForChangeNotification(IDistributedStoreKey dsKey, AmClusterNotifyHandle hChange)
		{
			AmClusterRegkeyHandle clusdbKeyHandle = this.GetClusdbKeyHandle(dsKey);
			if (clusdbKeyHandle != null && !clusdbKeyHandle.IsInvalid)
			{
				ClusterNotifyFlags dwFilter = ClusterNotifyFlags.CLUSTER_CHANGE_REGISTRY_VALUE;
				IntPtr dwNotifyKey = (IntPtr)1;
				int num = ClusapiMethods.RegisterClusterNotify(hChange, dwFilter, clusdbKeyHandle, dwNotifyKey);
				if (num != 0)
				{
					NetworkManager.TraceError("RegisterClusterNotify for reg notification 0x{0:X8}", new object[]
					{
						num
					});
					throw AmExceptionHelper.ConstructClusterApiException(num, "RegisterClusterNotify(Network Registry)", new object[0]);
				}
			}
		}
Пример #9
0
        // Token: 0x0600052D RID: 1325 RVA: 0x00013694 File Offset: 0x00011894
        public IEnumerable <Tuple <string, RegistryValueKind> > GetValueInfos(ReadWriteConstraints constraints)
        {
            List <Tuple <string, RegistryValueKind> > list = new List <Tuple <string, RegistryValueKind> >();
            int num  = 128;
            int num2 = 0;
            int item = 0;
            int num5;

            for (;;)
            {
                StringBuilder stringBuilder = new StringBuilder(num);
                int           num3          = num;
                int           num4          = 0;
                num5 = ClusapiMethods.ClusterRegEnumValue(this.KeyHandle, num2, stringBuilder, ref num3, ref item, IntPtr.Zero, ref num4);
                if (259 == num5)
                {
                    return(list);
                }
                if (234 != num5 && num5 != 0)
                {
                    break;
                }
                if (num3 > num)
                {
                    num           = num3 + 1;
                    num4          = 0;
                    stringBuilder = new StringBuilder(num);
                    num5          = ClusapiMethods.ClusterRegEnumValue(this.KeyHandle, num2, stringBuilder, ref num3, ref item, IntPtr.Zero, ref num4);
                }
                if (234 != num5 && num5 != 0)
                {
                    goto Block_6;
                }
                list.Add(new Tuple <string, RegistryValueKind>(stringBuilder.ToString(), (RegistryValueKind)item));
                num2++;
            }
            throw AmExceptionHelper.ConstructClusterApiException(num5, "ClusterRegEnumValue(first)", new object[0]);
Block_6:
            throw AmExceptionHelper.ConstructClusterApiException(num5, "ClusterRegEnumValue(second)", new object[0]);
        }