//版本号(专业版) //public static string PFProductName = "Philisense_GMISINFO_Professional_3.5_2012-10-01"; public static bool JiaMiDog() { int iCount = 0; byte[] bDataBuf = new byte[128]; string sVendorID = "13920512"; //按VendorID查找Rockey3,VendorID为8个字节的字符串。 //找到该VendorID的Rockey3的个数返回到iCount中。 iRes = ProfessionalEncryptDog.RY3_Find(sVendorID, ref iCount); if (iRes == ProfessionalEncryptDog.RY_SUCCESS) { iRes = ProfessionalEncryptDog.RY3_Open(ref hHandle, 1); if (iRes == ProfessionalEncryptDog.RY_SUCCESS) { //uint model = ProfessionalEncryptDog.RY3_CloseNetMod(hHandle, 1); //iRes = ProfessionalEncryptDog.RY3_OpenNetMod(ref hHandle, 1); //Console.WriteLine("\nRY3_Find Success, iCount:" + iCount); //if (iRes == 0xF000001C) //if (iRes == ProfessionalEncryptDog.RY_SUCCESS) { iRes = ProfessionalEncryptDog.RY3_Read(hHandle, 0, bDataBuf, PFProductName.Length); if (iRes == ProfessionalEncryptDog.RY_SUCCESS) //if (iRes == 0xF0000025) { strtemp = System.Text.Encoding.Default.GetString(bDataBuf); strtemp = System.Text.Encoding.Default.GetString(bDataBuf).Substring(0, PFProductName.Length); if (strtemp == PFProductName) { strtemp = System.Text.Encoding.Default.GetString(bDataBuf).Substring(0, PFProductName.Length); //MessageBox.Show(this, "加密狗读取成功!", "提示"); return(true); } else { return(false); } } else { //Console.WriteLine("RY3_Read Error:" + iRes); //MessageBox.Show("加密狗读取失败!"); //Cursor = Cursors.Arrow; return(false); } } //else //{ // return false; //} } else { // Console.WriteLine("RY3_Open Error:" + iRes); //MessageBox.Show("加密狗打开失败!"); //this.Cursor = Cursors.Arrow; return(false); } } else { //Console.WriteLine("RY3_Find Error:" + iRes); ////Console.WriteLine(); ////GetHex(iRes); //MessageBox.Show("加密狗不存在!"); //this.Cursor = Cursors.Arrow; return(false); } }
/// <summary> /// 判断加密狗是否存在【登录时 私有】(王科技2012-10-30) /// </summary> /// <param name="JMG"></param> /// <returns></returns> public static bool JiaMiDogNow(out bool JMG) { int iCount = 0; byte[] bDataBuf = new byte[64]; string sVendorID = "13920512"; int iSize = 20; //string ProductName = "Philisense_GMISINFO_Professional_3.5_2012-10-010"; //按VendorID查找Rockey3,VendorID为8个字节的字符串。 //找到该VendorID的Rockey3的个数返回到iCount中。 iRes = ProfessionalEncryptDog.RY3_Find(sVendorID, ref iCount); if (iRes == ProfessionalEncryptDog.RY_SUCCESS) { iRes = ProfessionalEncryptDog.RY3_Open(ref hHandle, 1); if (iRes == ProfessionalEncryptDog.RY_SUCCESS) { iRes = ProfessionalEncryptDog.RY3_OpenNetMod(ref hHandle, 0); //Console.WriteLine("\nRY3_Find Success, iCount:" + iCount); if (iRes == RY3_NETLOCK_SUCCESS) { //Console.WriteLine("\nRY3_Find Success, iCount:" + iCount); //iRes = ProfessionalEncryptDog.RY3_GetFreeSize(hHandle, ref iSize); iRes = ProfessionalEncryptDog.RY3_Read(hHandle, 0, bDataBuf, PFProductName.Length); if (iRes == ProfessionalEncryptDog.RY_SUCCESS) { //strtemp = System.Text.Encoding.Default.GetString(bDataBuf); strtemp = System.Text.Encoding.Default.GetString(bDataBuf).Substring(0, PFProductName.Length); if (strtemp == PFProductName) { strtemp = System.Text.Encoding.Default.GetString(bDataBuf).Substring(0, PFProductName.Length); //MessageBox.Show(this, "加密狗读取成功!", "提示"); JMG = true; //return JMG; } else { JMG = false; //return JMG; } } else { //Console.WriteLine("RY3_Read Error:" + iRes); //MessageBox.Show("加密狗读取失败!"); //Cursor = Cursors.Arrow; JMG = false; //return JMG; } } else { JMG = false; } } else { // Console.WriteLine("RY3_Open Error:" + iRes); //MessageBox.Show("加密狗打开失败!"); //this.Cursor = Cursors.Arrow; JMG = false; //return JMG; } } else { //Console.WriteLine("RY3_Find Error:" + iRes); ////Console.WriteLine(); ////GetHex(iRes); //MessageBox.Show("加密狗不存在!"); //this.Cursor = Cursors.Arrow; JMG = false; //return JMG; } return(JMG); }