Mobile get SIM Card ID

const int EF_ICCID = 0x2FE2;

const int SIM_RECORDTYPE_TRANSPARENT = 0x1;

[DllImport("cellcore.dll")]

static extern int SimInitialize(

uint dwFlags,

IntPtr lpfnCallback,

uint dwParam,

ref IntPtr lphSim);

[DllImport("cellcore.dll")]

static extern int SimDeinitialize(IntPtr hSim);

[DllImport("cellcore.dll")]

static extern int SimReadRecord(

IntPtr hSim,

uint dwAddress,

uint dwRecordType,

uint dwIndex,

byte[] lpData,

uint dwBufferSize,

ref int dwSize);

___________________________________________________
IntPtr hSim = IntPtr.Zero;

byte[] iccid = new byte[10];

int zero = 0;

SimInitialize(0, IntPtr.Zero, 0, ref hSim);

SimReadRecord(hSim,

EF_ICCID,

SIM_RECORDTYPE_TRANSPARENT,

0,

iccid,

(uint)iccid.Length,

ref zero);

SimDeinitialize(hSim);

留言

這個網誌中的熱門文章

使用VB讀取健保卡基本資料

使用VB讀取自然人評証卡號