Esempio n. 1
0
        /// <summary>
        /// initialize the restriction of target info
        /// </summary>
        /// <param name="targetInfo">the target info collection</param>
        private void InitializeRestriction(
            ICollection <AV_PAIR> targetInfo
            )
        {
            // update the MsAvRestrictions of targetInfo
            // MachineID (32 bytes): A 256-bit random number created at computer
            // startup to identify the calling machine.
            Restriction_Encoding restriction = new Restriction_Encoding();

            // defines the length, in bytes, of AV_PAIR Value.
            restriction.Size      = 0x30;
            restriction.MachineID = new byte[NlmpUtility.MACHINE_ID_SIZE];
            byte[] restrictionBytes = NlmpUtility.StructGetBytes(restriction);

            if (NlmpUtility.AvPairContains(targetInfo, AV_PAIR_IDs.MsAvRestrictions))
            {
                NlmpUtility.UpdateAvPair(
                    targetInfo, AV_PAIR_IDs.MsAvRestrictions, (ushort)restrictionBytes.Length, restrictionBytes);
            }
            else
            {
                NlmpUtility.AddAVPair(
                    targetInfo, AV_PAIR_IDs.MsAvRestrictions, (ushort)restrictionBytes.Length, restrictionBytes);
            }
        }
        /// <summary>
        /// initialize the restriction of target info
        /// </summary>
        /// <param name="targetInfo">the target info collection</param>
        private void InitializeRestriction(
            ICollection<AV_PAIR> targetInfo
            )
        {
            // update the MsAvRestrictions of targetInfo
            // MachineID (32 bytes): A 256-bit random number created at computer
            // startup to identify the calling machine.
            Restriction_Encoding restriction = new Restriction_Encoding();
            // defines the length, in bytes, of AV_PAIR Value.
            restriction.Size = 0x30;
            restriction.MachineID = new byte[NlmpUtility.MACHINE_ID_SIZE];
            byte[] restrictionBytes = NlmpUtility.StructGetBytes(restriction);

            if (NlmpUtility.AvPairContains(targetInfo, AV_PAIR_IDs.MsAvRestrictions))
            {
                NlmpUtility.UpdateAvPair(
                    targetInfo, AV_PAIR_IDs.MsAvRestrictions, (ushort)restrictionBytes.Length, restrictionBytes);
            }
            else
            {
                NlmpUtility.AddAVPair(
                    targetInfo, AV_PAIR_IDs.MsAvRestrictions, (ushort)restrictionBytes.Length, restrictionBytes);
            }
        }