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

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

29 Responses

  1. liujianhaicx November 23, 2009 / 6:53 am

    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 / 6:17 pm

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

  2. liujianhaicx November 23, 2009 / 6:53 am

    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 / 6:17 pm

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

  3. liujianhaicx November 23, 2009 / 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 / 11:47 pm

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

  4. liujianhaicx November 23, 2009 / 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 / 11:47 pm

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

  5. liujianhaicx January 27, 2010 / 2:49 am

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

  6. liujianhaicx January 27, 2010 / 2:49 am

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

  7. liujianhaicx January 27, 2010 / 8:19 am

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

  8. liujianhaicx January 27, 2010 / 8:19 am

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

  9. Krishnaraj Varma January 30, 2010 / 7:20 am

    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.

  10. Krishnaraj Varma January 30, 2010 / 7:20 am

    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.

  11. Krishnaraj Varma January 30, 2010 / 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.

  12. Krishnaraj Varma January 30, 2010 / 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.

  13. liujianhaicx February 1, 2010 / 5:50 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!

  14. liujianhaicx February 1, 2010 / 5:50 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!

  15. liujianhaicx February 1, 2010 / 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!

  16. liujianhaicx February 1, 2010 / 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!

  17. liujianhaicx February 2, 2010 / 12:57 am

    God Save Me!
    But,thank you very much.

  18. liujianhaicx February 2, 2010 / 12:57 am

    God Save Me!
    But,thank you very much.

  19. liujianhaicx February 2, 2010 / 6:27 am

    God Save Me!
    But,thank you very much.

  20. liujianhaicx February 2, 2010 / 6:27 am

    God Save Me!
    But,thank you very much.

  21. mahmoud January 19, 2016 / 2:46 pm

    Sorry sir , i downloaded Sim read put how can i use it ?

Leave a Reply

Your email address will not be published. Required fields are marked *