public int SimCard_readSimPhoneNoAndIMSI(string comstr, ref List <string> listPhoneNo, ref string imsi) { IntPtr handle = IntPtr.Zero; int result = -1; try { result = SIMCoreAPI.SimCard_Mount(ref handle, comstr, ReadProcessBack); if (0 != result) { return(result); } byte simType = 0; result = SIMCoreAPI.SimCard_readType(handle, ref simType); if (0 != result) { return(result); } result = SIMCoreAPI.SimCard_readIMSI(handle, ref imsi); if (0 != result) { return(result); } IntPtr pPhoneNo = IntPtr.Zero; int phoneNoCount = 0; result = SIMCoreAPI.SimCard_readSimPhoneNo(handle, ref pPhoneNo, ref phoneNoCount); if (0 == result) { } } catch { } finally { if (IntPtr.Zero != handle) { SIMCoreAPI.Simcard_unmount(ref handle); } } return(result); }
private IntPtr InitSIMCard(string comStr) { IntPtr handle = IntPtr.Zero; int i = SIMCoreAPI.SimCard_Mount(ref handle, comStr, ReadProcessBack); if (i != 0) { return(handle); } byte simType = 0; i = SIMCoreAPI.SimCard_readType(handle, ref simType); //读取卡类型 if (i != 0) { return(handle); } string imsi = ""; i = SIMCoreAPI.SimCard_readIMSI(handle, ref imsi); //需要先读取imsi号,才能读取到大于250条数据 if (i != 0) { return(handle); } IntPtr pPhoneNo = IntPtr.Zero; int phoneNoCount = 0; i = SIMCoreAPI.SimCard_readSimPhoneNo(handle, ref pPhoneNo, ref phoneNoCount); //读取本机号码 if (i != 0) { return(handle); } return(handle); }