首页 > 解决方案 > 在 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();
    }

标签: .netsim-card

解决方案


推荐阅读