コード例 #1
0
        public void SamrValidatePassword_Reset_Success()
        {
            HRESULT  hResult;
            IChecker PtfAssert = TestClassBase.BaseTestSite.Assert;

            ConnectAndOpenDomain(
                GetPdcDnsName(),
                _samrProtocolAdapter.PrimaryDomainDnsName,
                out _serverHandle,
                out _domainHandle);

            _SAM_VALIDATE_INPUT_ARG inputArg = new _SAM_VALIDATE_INPUT_ARG();

            inputArg.ValidatePasswordResetInput = new _SAM_VALIDATE_PASSWORD_RESET_INPUT_ARG();

            DateTime  lockOutTime = DateTime.Now - TimeSpan.FromDays(5);
            DateTime  lastSetTime = DateTime.Now - TimeSpan.FromDays(6);
            _FILETIME lockout     = DtypUtility.ToFileTime(lockOutTime);
            _FILETIME lastset     = DtypUtility.ToFileTime(lastSetTime);

            BaseTestSite.Log.Add(LogEntryKind.TestStep,
                                 string.Format("Create InputArg for SamValidatePasswordReset, LockoutTime:{0}, PasswordLastSet:{1}, PasswordMustChangeAtNextLogon: {2}, PasswordHistoryLength: {3}.",
                                               lockOutTime.ToString(),
                                               lastSetTime.ToString(),
                                               1,
                                               0));
            inputArg.ValidatePasswordResetInput.InputPersistedFields.LockoutTime.QuadPart     = (((long)lockout.dwHighDateTime) << 32) | lockout.dwLowDateTime;
            inputArg.ValidatePasswordResetInput.InputPersistedFields.PasswordLastSet.QuadPart = (((long)lastset.dwHighDateTime) << 32) | lastset.dwLowDateTime;
            inputArg.ValidatePasswordResetInput.ClearPassword = DtypUtility.ToRpcUnicodeString("drowssaP02!");
            inputArg.ValidatePasswordResetInput.InputPersistedFields.BadPasswordCount      = 1;
            inputArg.ValidatePasswordResetInput.PasswordMustChangeAtNextLogon              = 1;
            inputArg.ValidatePasswordResetInput.InputPersistedFields.PasswordHistoryLength = 0;
            inputArg.ValidatePasswordResetInput.ClearLockout = 1;
            inputArg.ValidatePasswordResetInput.InputPersistedFields.PasswordHistory = new _SAM_VALIDATE_PASSWORD_HASH[] { };
            inputArg.ValidatePasswordResetInput.HashedPassword = new _SAM_VALIDATE_PASSWORD_HASH()
            {
                Hash   = new byte[] { 0xDE, 0xAD, 0xBE, 0xEF },
                Length = 4
            };

            BaseTestSite.Log.Add(LogEntryKind.TestStep, string.Format("Invoke SamrValidatePassword."));

            _SAM_VALIDATE_OUTPUT_ARG?outputArg;

            hResult = (HRESULT)SAMRProtocolAdapter.RpcAdapter.SamrValidatePassword(
                _domainHandle,
                _PASSWORD_POLICY_VALIDATION_TYPE.SamValidatePasswordReset,
                inputArg,
                out outputArg
                );
            PtfAssert.AreEqual(HRESULT.STATUS_SUCCESS, hResult, "SamrValidatePassword returns success.");
            PtfAssert.AreEqual(_SAM_VALIDATE_VALIDATION_STATUS.SamValidateSuccess, outputArg.Value.ValidatePasswordResetOutput.ValidationStatus,
                               "[MS-SAMR]3.1.5.13.7.3 ValidationStatus MUST be set to SamValidateSuccess.");
            PtfAssert.AreEqual(0, outputArg.Value.ValidatePasswordResetOutput.ChangedPersistedFields.PasswordLastSet.QuadPart,
                               "[MS-SAMR]3.1.5.13.7.3 If PasswordMustChangeAtNextLogon is nonzero, PasswordLastSet MUST be set to 0.");
            PtfAssert.AreEqual(0, outputArg.Value.ValidatePasswordResetOutput.ChangedPersistedFields.LockoutTime.QuadPart,
                               "[MS-SAMR]3.1.5.13.7.3 LockoutTime MUST be set to 0.");
            PtfAssert.AreEqual(0u, outputArg.Value.ValidatePasswordResetOutput.ChangedPersistedFields.BadPasswordCount,
                               "[MS-SAMR]3.1.5.13.7.3 If ValidatePasswordResetInput.InputPersistedFields.BadPasswordCount is nonzero, BadPasswordCount MUST be set to 0.");
        }
コード例 #2
0
        /// <summary>
        /// Creates an PacClientInfo instance using the specified clientId and name.
        /// </summary>
        /// <param name="clientId">A FileTime that contains the Kerberos initial
        /// ticket-granting ticket TGT authentication time, as specified in [RFC4120]
        /// section 5.3.</param>
        /// <param name="name">The client's account name</param>
        /// <returns>The created PacClientInfo instance.</returns>
        public static PacClientInfo CreateClientInfoBuffer(_FILETIME clientId, string name)
        {
            PacClientInfo clientInfo = new PacClientInfo();

            clientInfo.NativePacClientInfo.ClientId   = clientId;
            clientInfo.NativePacClientInfo.Name       = name.ToCharArray();
            clientInfo.NativePacClientInfo.NameLength = (ushort)(name.Length * 2);

            return(clientInfo);
        }
コード例 #3
0
        public void SamrValidatePassword_Auth_Success()
        {
            HRESULT  hResult;
            IChecker PtfAssert = TestClassBase.BaseTestSite.Assert;

            ConnectAndOpenDomain(
                GetPdcDnsName(),
                _samrProtocolAdapter.PrimaryDomainDnsName,
                out _serverHandle,
                out _domainHandle);

            _SAM_VALIDATE_INPUT_ARG inputArg = new _SAM_VALIDATE_INPUT_ARG();

            inputArg.ValidateAuthenticationInput = new _SAM_VALIDATE_AUTHENTICATION_INPUT_ARG();

            DateTime  lockOutTime = DateTime.Now - TimeSpan.FromDays(5);
            DateTime  lastSetTime = DateTime.Now - TimeSpan.FromDays(6);
            _FILETIME lockout     = DtypUtility.ToFileTime(lockOutTime);
            _FILETIME lastset     = DtypUtility.ToFileTime(lastSetTime);

            BaseTestSite.Log.Add(LogEntryKind.TestStep,
                                 string.Format("Create InputArg for SamrValidatePassword, LockoutTime:{0}, PasswordLastSet:{1}, PasswordMatched:{2}, BadPasswordCount: {3}, PasswordHistoryLength: {4}.",
                                               lockOutTime.ToString(),
                                               lastSetTime.ToString(),
                                               1,
                                               1,
                                               0));
            inputArg.ValidateAuthenticationInput.InputPersistedFields.LockoutTime.QuadPart     = (((long)lockout.dwHighDateTime) << 32) | lockout.dwLowDateTime;
            inputArg.ValidateAuthenticationInput.InputPersistedFields.PasswordLastSet.QuadPart = (((long)lastset.dwHighDateTime) << 32) | lastset.dwLowDateTime;
            inputArg.ValidateAuthenticationInput.PasswordMatched = 1;
            inputArg.ValidateAuthenticationInput.InputPersistedFields.BadPasswordCount      = 1;
            inputArg.ValidateAuthenticationInput.InputPersistedFields.PasswordHistoryLength = 0;
            inputArg.ValidateAuthenticationInput.InputPersistedFields.PasswordHistory       = new _SAM_VALIDATE_PASSWORD_HASH[] { };

            BaseTestSite.Log.Add(LogEntryKind.TestStep, string.Format("Invoke SamrValidatePassword."));

            _SAM_VALIDATE_OUTPUT_ARG?outputArg;

            hResult = (HRESULT)SAMRProtocolAdapter.RpcAdapter.SamrValidatePassword(
                _domainHandle,
                _PASSWORD_POLICY_VALIDATION_TYPE.SamValidateAuthentication,
                inputArg,
                out outputArg
                );
            PtfAssert.AreEqual(HRESULT.STATUS_SUCCESS, hResult, "SamrGetUserDomainPasswordInformation returns success.");
            PtfAssert.AreEqual(0, outputArg.Value.ValidateAuthenticationOutput.ChangedPersistedFields.LockoutTime.QuadPart,
                               "[MS-SAMR] 3.1.5.13.7.1 LockoutTime MUST be set to 0 (and continue processing).");
            PtfAssert.AreEqual(_SAM_VALIDATE_VALIDATION_STATUS.SamValidateSuccess, outputArg.Value.ValidateAuthenticationOutput.ValidationStatus,
                               "[MS-SAMR] 3.1.5.13.7.1 ValidationStatus MUST be set to SamValidateSuccess.");
            PtfAssert.AreEqual(0u, outputArg.Value.ValidateAuthenticationOutput.ChangedPersistedFields.BadPasswordCount,
                               "[MS-SAMR] 3.1.5.13.7.1 If BadPasswordCount is nonzero, BadPasswordCount MUST be set to 0.");
        }
コード例 #4
0
 void ITTSCentral.ToFileTime(ref ulong pqTimeStamp, out _FILETIME pFT)
 {
     try
     {
         miniLog("ToFileTime");
         pFT.dwHighDateTime = pFT.dwLowDateTime = 0;
     }
     catch (Exception e)
     {
         pFT = new _FILETIME();
         Sapi4Engine.miniLog(e + ": " + e.Message);
     }
 }
コード例 #5
0
        public static string GetFTSting(_FILETIME ft)
        {
            long lFT = (((long)ft.dwHighDateTime) << 32) + ft.dwLowDateTime;

            try
            {
                DateTime dt = System.DateTime.FromFileTime(lFT);
                return(dt.ToString());
            }
            catch (ApplicationException ex)
            {
                return(ex.Message);
            }
        }
コード例 #6
0
ファイル: OpcDaTagValue.cs プロジェクト: xbadcode/Rubezh
		public OpcDaTagValue(string tagId, ushort valueType, 
			object value, _FILETIME timeStamp, ushort signalQuality)
		{
			TagId = tagId;
			ValueType = ConvertToValueType(valueType);
			Value = value;
			TimeStamp = ConvertToDateTime(timeStamp);
			if (Enum.IsDefined(typeof(Quality), signalQuality))
			{
				SignalQuality = (Quality)signalQuality;
			}
			else
			{
				throw new InvalidCastException(String.Format(
					"Невозможно конвертировать значение {0} в тип Quality", 
					signalQuality));
			}
		}
コード例 #7
0
 internal extern static void GetSystemTimeAsFileTime(out _FILETIME lpSystemTimeAsFileTime);
コード例 #8
0
ファイル: WinAPI.cs プロジェクト: AndrewEastwood/desktop
 public static extern bool SetFileTime(IntPtr hFile, ref _FILETIME lpCreationTime, ref _FILETIME lpLastAccessTime, ref _FILETIME lpLastWriteTime);
コード例 #9
0
ファイル: WinAPI.cs プロジェクト: AndrewEastwood/desktop
 public static extern bool FileTimeToSystemTime(ref _FILETIME lpFileTime, out _SYSTEMTIME lpSystemTime);
コード例 #10
0
ファイル: WinAPI.cs プロジェクト: AndrewEastwood/desktop
 public static extern bool FileTimeToLocalFileTime(ref _FILETIME lpFileTime, out _FILETIME lpLocalFileTime);
コード例 #11
0
ファイル: WinAPI.cs プロジェクト: AndrewEastwood/desktop
 public static extern long CompareFileTime(ref _FILETIME lpFileTime1, ref _FILETIME lpFileTime2);
コード例 #12
0
ファイル: DataCallback.cs プロジェクト: DerWikinger/OPCClient
        public void OnReadComplete(uint dwTransid, uint hGroup, int hrMasterquality, int hrMastererror, uint dwCount,
                                   ref uint phClientItems, ref object pvValues, ref ushort pwQualities, ref _FILETIME pftTimeStamps, ref int pErrors)
        {
            int count = (int)dwCount;

            tagOPCITEMVQT[] tags = new tagOPCITEMVQT[count];

            IntPtr iptrValues = Marshal.AllocCoTaskMem(count * sizeof(int));

            Marshal.GetNativeVariantForObject(pvValues, iptrValues);
            byte[] vt = new byte[count * 4];
            Marshal.Copy(iptrValues, vt, 0, count * 4);
            Marshal.FreeCoTaskMem(iptrValues);

            IntPtr iptrClientItems = Marshal.AllocCoTaskMem(count * sizeof(uint));

            Marshal.GetNativeVariantForObject(phClientItems, iptrClientItems);
            byte[] ct = new byte[count * sizeof(uint)];
            //Marshal.Copy(phClientItems, ct, 0, count * sizeof(uint));
            Marshal.Copy(iptrClientItems, ct, 0, count * sizeof(uint));
            Marshal.FreeCoTaskMem(iptrClientItems);

/*            IntPtr iptrFiletimes = Marshal.AllocCoTaskMem(count * sizeof(uint) * 2);
 *          Marshal.GetNativeVariantForObject(pftTimeStamps, iptrFiletimes);
 *          byte[] ft = new byte[count * sizeof(uint) * 2];
 *          Marshal.Copy(iptrFiletimes, ft, 0, count * sizeof(uint) * 2);
 *          Marshal.FreeCoTaskMem(iptrFiletimes);*/

            IntPtr iptrQualities = Marshal.AllocCoTaskMem(count * sizeof(ushort));

            Marshal.GetNativeVariantForObject(pwQualities, iptrQualities);
            byte[] qt = new byte[count * sizeof(ushort)];
            Marshal.Copy(iptrQualities, qt, 0, count * sizeof(ushort));
            Marshal.FreeCoTaskMem(iptrQualities);

            IntPtr iptrErrors = Marshal.AllocCoTaskMem(count * sizeof(int));

            Marshal.GetNativeVariantForObject(pErrors, iptrErrors);
            byte[] et = new byte[count * sizeof(int)];
            Marshal.Copy(iptrErrors, et, 0, count * sizeof(int));
            Marshal.FreeCoTaskMem(iptrErrors);

            ushort[] usVt = new ushort[count];

/*            for (int i = 0; i < count; i++)
 *          {
 *              usVt[i] = (ushort)(vt[i * 2] + vt[i * 2 + 1] * 255);
 *          }*/

            m_item.DataCallback.Invoke(usVt);
        }
コード例 #13
0
ファイル: OPCServer.cs プロジェクト: DerWikinger/OPCClient
        public List <PropertyData> GetItemProperties(string szItemID)
        {
            IOPCItemProperties properties = (IOPCItemProperties)m_pOPCServer;
            uint   pdwCount       = 0;
            IntPtr ppvData        = IntPtr.Zero;
            IntPtr ppPropertyIDs  = IntPtr.Zero;
            IntPtr ppDescriptions = IntPtr.Zero;
            IntPtr ppvtDataTypes  = IntPtr.Zero;
            IntPtr ppErrors       = IntPtr.Zero;

            properties.QueryAvailableProperties(szItemID, out pdwCount, out ppPropertyIDs, out ppDescriptions, out ppvtDataTypes);

            int[] propertiesIDs = new int[pdwCount];
            Marshal.Copy(ppPropertyIDs, propertiesIDs, 0, (int)pdwCount);
            IntPtr pdwPropertyIDs = Marshal.AllocCoTaskMem((int)pdwCount * sizeof(int));

            Marshal.Copy(propertiesIDs, 0, pdwPropertyIDs, (int)pdwCount);

            IntPtr[] pDescriptions = new IntPtr[pdwCount];
            Marshal.Copy(ppDescriptions, pDescriptions, 0, (int)pdwCount);
            string[] descriptions = new string[pdwCount];
            for (int i = 0; i < pdwCount; i++)
            {
                string description;
                int    length = 0;
                description     = Marshal.PtrToStringAuto(pDescriptions[i]);
                length         += description.Length;
                descriptions[i] = description;
                Marshal.FreeCoTaskMem(pDescriptions[i]);
            }

            short[] propertyTypes = new short[pdwCount];
            Marshal.Copy(ppvtDataTypes, propertyTypes, 0, (int)pdwCount);

            var strPropertyTypes = from type in propertyTypes
                                   let sType = Converter.GetVTString((ushort)type)
                                               let typeSize = Converter.GetVTSize((ushort)type)
                                                              select sType + " : " + typeSize;

            string[] list = strPropertyTypes.ToArray();

            properties.GetItemProperties(szItemID, pdwCount, pdwPropertyIDs, out ppvData, out ppErrors);

            List <PropertyData> pValues = new List <PropertyData>();
            int   start = 0;
            short vt;

            for (int i = 0; i < pdwCount; i++)
            {
                int   propertyID = propertiesIDs[i];
                ulong value      = (ulong)Marshal.ReadInt64(ppvData + start * sizeof(ulong));
                int   sz         = Converter.GetVTSize((ushort)value);
                vt = propertyTypes[i];
                if (vt == 8)
                {
                    start++;
                    IntPtr[] strPtr = new IntPtr[1];
                    Marshal.Copy(ppvData + start * sizeof(long), strPtr, 0, 1);
                    string val = Marshal.PtrToStringUni(strPtr[0]);
                    pValues.Add(new PropertyData()
                    {
                        ID = propertyID, Name = descriptions[i], Value = val
                    });
                    start++;
                }
                else if (vt == 8197)
                {
                    start++;
                    IntPtr[] strPtr = new IntPtr[1];
                    Marshal.Copy(ppvData + start * sizeof(long), strPtr, 0, 1);
                    string val = Marshal.PtrToStringUni(strPtr[0]);
                    pValues.Add(new PropertyData()
                    {
                        ID = propertyID, Name = descriptions[i], Value = val
                    });
                    start++;
                }
                else if (vt == 4)
                {
                    start++;
                    value = (ulong)Marshal.ReadInt64(ppvData + start * sizeof(ulong));
                    object obj = Converter.GetPropertyValue(vt, value);
                    pValues.Add(new PropertyData()
                    {
                        ID = propertyID, Name = descriptions[i], Value = obj
                    });
                    start++;
                }
                else if (vt == 7)
                {
                    // Пока не разобрался с конвертированием данных в формат даты
                    // поэтому присваивается текущее значение даты и времени
                    start++;
                    IntPtr pDate = ppvData + start * sizeof(ulong);
                    //IntPtr pp = Marshal.AllocCoTaskMem(8);
                    //byte[] bb = new byte[8];
                    //Marshal.GetNativeVariantForObject(pDate, pp);
                    //Marshal.Copy(pp, bb, 0, 8);

                    Type type = typeof(DateTime);

                    long lValue = Marshal.ReadInt64(pDate);

                    uint lt = (uint)Marshal.ReadInt32(pDate, 4);
                    uint ht = (uint)Marshal.ReadInt32(pDate, 0);

                    lValue = ((long)ht << 32) + lt;
                    //DateTime ft = (DateTime)Marshal.PtrToStructure(pDate, type);

                    _FILETIME ft = new _FILETIME()
                    {
                        dwHighDateTime = ht, dwLowDateTime = lt
                    };
                    //DateTime dt = DateTime.FromBinary(lValue);
                    //string s = Converter.GetFTSting(ft);
                    //DateTime dt = new DateTime(lValue);
                    string strDate = DateTime.Now.ToString();
                    pValues.Add(new PropertyData()
                    {
                        ID = propertyID, Name = descriptions[i], Value = strDate
                    });
                    //Marshal.FreeCoTaskMem(pDate);
                    start++;
                }
                else
                {
                    start++;
                    value = (ulong)Marshal.ReadInt64(ppvData + start * sizeof(ulong));
                    pValues.Add(new PropertyData()
                    {
                        ID = propertyID, Name = descriptions[i], Value = value
                    });
                    start++;
                }
            }

            Marshal.FreeCoTaskMem(ppDescriptions);
            Marshal.FreeCoTaskMem(ppPropertyIDs);
            Marshal.FreeCoTaskMem(ppvtDataTypes);
            Marshal.FreeCoTaskMem(ppvData);
            Marshal.FreeCoTaskMem(ppErrors);

            return(pValues);
        }
コード例 #14
0
ファイル: OpcDaTagValue.cs プロジェクト: xbadcode/Rubezh
		public static DateTime ConvertToDateTime(_FILETIME dateTime)
		{
			long lFT = (((long)dateTime.dwHighDateTime) << 32) + dateTime.dwLowDateTime;
			DateTime dt = System.DateTime.FromFileTime(lFT);
			return dt;
		}
コード例 #15
0
        public void TestConverter()
        {
            Assert.AreEqual("Bad", OPCLibrary.Converter.GetQualityString(0x00));
            Assert.AreEqual("Config Error", OPCLibrary.Converter.GetQualityString(0x04));
            Assert.AreEqual("Not Connected", OPCLibrary.Converter.GetQualityString(0x08));
            Assert.AreEqual("Device Failure", OPCLibrary.Converter.GetQualityString(0x0C));
            Assert.AreEqual("Sensor Failure", OPCLibrary.Converter.GetQualityString(0x10));
            Assert.AreEqual("Last Known", OPCLibrary.Converter.GetQualityString(0x14));
            Assert.AreEqual("Comm Failure", OPCLibrary.Converter.GetQualityString(0x18));
            Assert.AreEqual("Out of Service", OPCLibrary.Converter.GetQualityString(0x1C));
            Assert.AreEqual("Initializing", OPCLibrary.Converter.GetQualityString(0x20));
            Assert.AreEqual("Uncertain", OPCLibrary.Converter.GetQualityString(0x40));
            Assert.AreEqual("Last Usable", OPCLibrary.Converter.GetQualityString(0x44));
            Assert.AreEqual("Sensor Calibration", OPCLibrary.Converter.GetQualityString(0x50));
            Assert.AreEqual("EGU Exceeded", OPCLibrary.Converter.GetQualityString(0x54));
            Assert.AreEqual("Sub Normal", OPCLibrary.Converter.GetQualityString(0x58));
            Assert.AreEqual("Good", OPCLibrary.Converter.GetQualityString(0xC0));
            Assert.AreEqual("Local Override", OPCLibrary.Converter.GetQualityString(0xD8));
            Assert.AreEqual("Unknown", OPCLibrary.Converter.GetQualityString(0xFF));

            Assert.AreEqual("VT_EMPTY", OPCLibrary.Converter.GetVTString(0));

            float  f  = 1;
            IntPtr pF = Marshal.AllocCoTaskMem(4);

            Marshal.Copy(new float[1] {
                f
            }, 0, pF, 1);
            int iValue = Marshal.ReadInt32(pF);

            Marshal.FreeCoTaskMem(pF);

            Assert.AreEqual(char.Parse("1"), Converter.GetPropertyValue(16, 1));
            Assert.AreEqual(short.Parse("1"), Converter.GetPropertyValue(2, 1));
            Assert.AreEqual(float.Parse("1"), Converter.GetPropertyValue(4, iValue));
            Assert.AreEqual(1, Converter.GetPropertyValue(3, 1));
            Assert.AreEqual(long.Parse("1"), Converter.GetPropertyValue(20, 1));
            Assert.AreEqual(0, Converter.GetPropertyValue(999, 1));

            DateTime  dt = DateTime.Now;
            long      vt = dt.ToFileTime();
            uint      ht = (uint)(vt >> 32);
            uint      lt = (uint)(vt - ((long)ht << 32));
            _FILETIME ft = new _FILETIME()
            {
                dwHighDateTime = ht, dwLowDateTime = lt
            };

            Assert.AreEqual(dt.ToString(), Converter.GetFTSting(ft));

            Assert.AreEqual(typeof(char), Converter.GetVTType(16));
            Assert.AreEqual(typeof(string), Converter.GetVTType(8));
            Assert.AreEqual(typeof(short), Converter.GetVTType(2));
            Assert.AreEqual(typeof(float), Converter.GetVTType(4));
            Assert.AreEqual(typeof(int), Converter.GetVTType(3));
            Assert.AreEqual(typeof(long), Converter.GetVTType(20));

            Assert.AreEqual(sizeof(char), Converter.GetVTSize(16));
            Assert.AreEqual(sizeof(short), Converter.GetVTSize(2));
            Assert.AreEqual(sizeof(float), Converter.GetVTSize(4));
            Assert.AreEqual(sizeof(int), Converter.GetVTSize(3));
            Assert.AreEqual(sizeof(long), Converter.GetVTSize(20));
        }
コード例 #16
0
ファイル: Interop.manual.cs プロジェクト: jango2015/corert
 internal extern static void GetSystemTimeAsFileTime(out _FILETIME lpSystemTimeAsFileTime);
コード例 #17
0
ファイル: DataCallback.cs プロジェクト: DerWikinger/OPCClient
        public void OnDataChange(uint dwTransid, uint hGroup, int hrMasterquality, int hrMastererror, uint dwCount,
                                 ref uint phClientItems, ref object pvValues, ref ushort pwQualities, ref _FILETIME pftTimeStamps, ref int pErrors)
        {
            if (dwTransid == 0)
            {
                return;
            }
            int    count      = (int)dwCount;
            IntPtr iptrValues = Marshal.AllocCoTaskMem(count * 2);

            Marshal.GetNativeVariantForObject(pvValues, iptrValues);
            byte[] vt = new byte[count * 2];
            Marshal.Copy(iptrValues, vt, 0, count * 2);
            Marshal.FreeCoTaskMem(iptrValues);
            ushort[] usVt = new ushort[count];
            for (int i = 0; i < count; i++)
            {
                usVt[i] = (ushort)(vt[i * 2] + vt[i * 2 + 1] * 255);
            }

            m_item.DataCallback.Invoke(usVt);
        }