.net - 在 dotnet 中通过 MbnApi 禁用 SIM PIN
问题描述
我尝试在我的企业中禁用某些 SIM 卡的 PIN,并且需要远程操作。因为卡片太多,我想自动化它。长话短说:
我想通过 dotnet 禁用 SIM-Pins。我已经使用 MbnApi 读取 SIM-ICC 等,但我无法获得 PIN 码。我知道有关 SIM-ICC 的任何 PIN,但我不知道如何获取 IMbnPin 的实例。
如何实例化 IMbnPin?
提前致谢,
亚历山大——编辑:
以下是我迄今为止对 API 的了解。我的问题仍然存在,我找不到提供 IMbnPin 实例的方法。我查看了 API 参考:https ://docs.microsoft.com/de-de/windows/desktop/api/mbnapi/nn-mbnapi-imbnpinmanager (这是针对非托管 c++ 的)并扩展了良好的搜索引擎。
IMbnInterface::QueryInterface 方法在托管代码/C# 中不存在。
public static SimCard[] ReadDevices() {
List<SimCard> sc = new List<SimCard>();
SimCard temp = new SimCard();
MbnInterfaceManager mbnInfMgr = new MbnInterfaceManager();
IMbnInterfaceManager infMgr = (IMbnInterfaceManager)mbnInfMgr;
IMbnInterface[] interfaces = (IMbnInterface[])infMgr.GetInterfaces();
foreach (IMbnInterface mobileInterface in interfaces)
{
temp = new SimCard();
try {
MBN_INTERFACE_CAPS caps = mobileInterface.GetInterfaceCapability();
temp.Imei = caps.deviceID;
IMbnSubscriberInformation iSubInf = mobileInterface.GetSubscriberInformation();
temp.Icc = iSubInf.SimIccID;
temp.Imsi = iSubInf.SubscriberID;
MBN_PROVIDER provider = mobileInterface.GetHomeProvider();
temp.Carrier = provider.providerName;
MBN_READY_STATE readyState = mobileInterface.GetReadyState();
IMbnRadio radio = (IMbnRadio)mobileInterface;
}
catch(Exception ex) { //Ignore Errors
StreamWriter wr = new StreamWriter(Path.GetTempPath() + "\\regat.txt");
wr.Write(ex.ToString());
wr.Flush();
wr.Close();
}
finally { // Get minimal Information out of PIN-Locked SIM-Card
if (temp != null &&
!string.IsNullOrEmpty(temp.Imei) &&
!string.IsNullOrEmpty(temp.Icc)) {
sc.Add(temp);
}
}
}
return sc.ToArray();
}
解决方案
推荐阅读
- json - SwiftyJson 无循环遍历几个数组
- javascript - 如何获取要单击的图像并将该数据通过表单发送到 JSON 和 mysql?
- c++ - 训练 SVM 时出现内存异常
- playframework - 如何使用 sbt/eclipse 调试播放框架
- android - PagerAdapter 实现 View.OnClickListener 的重构建议
- javascript - 使用 CodeMirror。“无法设置未定义的属性‘modeOption’”
- c++ - 如何将 -fix 选项添加到 .clang-tidy 文件?
- c# - 当玩家进入敌人射程时,试图让敌人向玩家发射弹丸
- javascript - 我在 ejs 模板中的“错误”变量导致页面加载时出现“未定义”错误
- java - Hibernate:设置固定参数是一种好习惯吗?