Retrieving IMEI, IMSI and Operator Status using Extended TAPI functions

Download the source code

The Extended TAPI function lineGetGeneralInfo can be used to retrieve the IMEI and IMSI numbers of the phone and SIM card. The syntax is defined as:

LONG WINAPI lineGetGeneralInfo(HLINE hLine, LPLINEGENERALINFO lpLineGeneralInfo);

The hLine parameter is the handle to the line you are interested. The handle is returned by the API lineOpen. The LINEGENERALINFO pointer that is passed in will be filled with the general information. You have to set the dwTotalSize of the pointer to the size you have allocated. If this size is small, then the system will set the dwNeededSize with the size in bytes that is needed to hold all the information. After successful completion of the function the memory will be filled with the general information.

The Extended TAPI function lineGetOperatorStatus is used to retrieve the operator status of the given line. The syntax is defined as:

LONG WINAPI lineGetOperatorStatus(HLINE hLine, LPLINEOPERATORSTATUS pOperatorStatus);

A sample application is provided to demonstrate the use of these APIs. The application displays the IMEI, IMSI, Operator Names along with some other information in a list control.

Since this is sample uses Extended TAPI functions, to run this you have to sign this application with a valid certificate. For testing purpose you can use the Developer Certificate (SDKSamplePrivDeveloper.pfx) that is provided with the Windows Mobile SDK. You can find this in the folder drive:Program FilesWindows CE Toolswce500Windows Mobile 5.0 Pocket PC SDKTools.

Note that the lineGetOperatorStatus function may take some time to complete and return so it may take some time to load the application.

Leave a Reply

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