Reading IMSI, TMSI, ICCID, MNC, MCC and LAC using SimReadRecord API

by Krishnaraj Varma on July 12, 2009

in Windows Mobile

Download the source code

While searching I found this useful link explaining how to retrieve ICC-ID using Sim Manager APIs. I extended this sample to read IMSI, TMSI, MNC, MCC and LAC. The SimReadRecord API is used to read the records stored in the SIM. The second parameter specifies the address to read and the sixth parameter specifies the size of the data to read. To get more details of the SIM records refer to the GSM 11.11 specification. Below are some of the record address and its length:

ICCID address 0x2FE2, length 10 bytes
IMSI address 0x6F07, length 10 bytes
TMSI, MCC, MNC, LAC address 0x6F7E, length 11 bytes

{ 7 comments… read them below or add one }

liujianhaicx November 23, 2009 at 12:23 pm

hi
I used the SimReadRecord like this:
HSIM hSim=NULL;
HRESULT hResult=0;
hResult=SimInitialize(0,NULL,0,&hSim);
if (hResult!=S_OK)
{
MessageBox(m_hDlg,_T(“初始化失败!”),_T(“提示”),MB_OK);
}
else
{
DWORD EF_ICCID=0x2FE2;
BYTE* pbtDate=new BYTE[50];
DWORD dwSize=0;
hResult=SimReadRecord(hSim,EF_ICCID,SIM_RECORDTYPE_TRANSPARENT,0,pbtDate,50,&dwSize);
}

SimDeinitialize(hSim);
But the SimReadRecord is return SIM_E_MOBILEERROR, I can’t understand this. By the way, I test the code in Windows Mobile 6.1 and CDMA net.

Krishnaraj Varma November 27, 2009 at 11:47 pm

Liu, the address 0×2FE2 is for GSM, I don’t think this will work for CDMA.

liujianhaicx January 27, 2010 at 8:19 am

Thank you very much.
And do you have any idea for getting ICCID in the CDMA network?
Thank you angin.

Krishnaraj Varma January 30, 2010 at 12:50 pm

Liu, this document has the address of different records in CDMA. I think the address is 0x6F74 you are looking for. I will work on it and update you here, meanwhile if you get anything post it here.

liujianhaicx February 1, 2010 at 11:20 am

Hi.
I have tried the address0x6F74,but it was not working.And,I had searched in MSDN,just found someting like this “CDMA mobile devices do not support SIM Manager”.My god!

Krishnaraj Varma February 1, 2010 at 11:23 pm

How come I miss this point!

liujianhaicx February 2, 2010 at 6:27 am

God Save Me!
But,thank you very much.

Previous post:

Next post:

Disclaimer: This is a personal weblog. The information in this weblog is provided “AS IS” with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.