private DONGLE_INFO WriteData(byte[] datas) { DONGLE_INFO pDongleInfo; ushort pCount = 0; IntPtr pt = RockeyArmHelper.EnumRockeyArm(out pCount); if (pCount > 1) { throw new Exception("加密锁不止一个!"); } else if (pCount == 0) { throw new Exception("没有找到加密锁!"); } else { pDongleInfo = (DONGLE_INFO)Marshal.PtrToStructure((IntPtr)(UInt32)pt, typeof(DONGLE_INFO)); if (pDongleInfo.m_PID != CodyMasterPid) { this.Init(); } } uint hDongle = 0; RockeyArmHelper.OpenRockey(ref hDongle, 0); RockeyArmHelper.VerifyPIN(hDongle, CodyMasterPin); RockeyArmHelper.WriteData(hDongle, datas); RockeyArmHelper.CloseRockey(hDongle); return(pDongleInfo); }