⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sim.cs

📁 读取Windows Mobile 6中的SIM卡存储信息
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace Sim_CS
{
    static class SimWrap
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        /// 

        public const int SIM_CAPSTYPE_ALL = 0x3F;       // All device cabability types
        public const int SIM_PBSTORAGE_SIM = 0x10;      // General SIM Storage
        public const int SIM_SMSSTORAGE_SIM = 0x2;      // SIM storage location
        //public const int SIM_NUMLOCKFACILITIES = 10;   // Number of locking facilities

        [StructLayout(LayoutKind.Sequential)]
        public struct SimLockingPwdLength
        {
          public uint dwFacility;           // The locking facility
          public uint dwPasswordLength;     // The minimum password length
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct SimCaps 
        {
          public uint cbSize;
          public uint dwParams;
          public uint dwPBStorages;
          public uint dwMinPBIndex;
          public uint dwMaxPBIndex;
          public uint dwMaxPBEAddressLength;
          public uint dwMaxPBETextLength;
          public uint dwLockFacilities;
          public uint dwReadMsgStorages;
          public uint dwWriteMsgStorages;
          public uint dwNumLockingPwdLengths;
          //[MarshalAs(UnmanagedType.ByValArray, SizeConst=10)] 
          //public SimLockingPwdLength[] rgLockingPwdLengths;
          public SimLockingPwdLength rgLockingPwdLengths0;
          public SimLockingPwdLength rgLockingPwdLengths1;
          public SimLockingPwdLength rgLockingPwdLengths2;
          public SimLockingPwdLength rgLockingPwdLengths3;
          public SimLockingPwdLength rgLockingPwdLengths4;
          public SimLockingPwdLength rgLockingPwdLengths5;
          public SimLockingPwdLength rgLockingPwdLengths6;
          public SimLockingPwdLength rgLockingPwdLengths7;
          public SimLockingPwdLength rgLockingPwdLengths8;
          public SimLockingPwdLength rgLockingPwdLengths9;
        }

        [DllImport("cellcore.dll")]
        public static extern int SimInitialize(uint dwFlags, int lpfnCallBack, uint dwParam, ref int lphSim);

        [DllImport("cellcore.dll")]
        public static extern int SimDeinitialize(int hSim);

        [DllImport("cellcore.dll")]
        public static extern int SimGetPhonebookStatus(int hSim, uint dwLocation, ref uint lpdwUsed, ref uint lpdwTotal);

        [DllImport("cellcore.dll")]
        public static extern int SimGetDevCaps(int hSim, uint dwCapsType, ref SimCaps lpSimCaps);

        [DllImport("cellcore.dll")]
        public static extern int SimGetSmsStorageStatus(int hSim, uint dwStorage, ref uint lpdwUsed, ref uint lpdwTotal );
  
        [MTAThread]
        static void Main()
        {
            Application.Run(new Form1());
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -