// Phonenosim
// Gets a value indicating whether the subscriber identity module (SIM) is installed in the mobile device.
# Define sn_phonenosim_root HKEY_LOCAL_MACHINE
# Define sn_phonenosim_path text ("system // state // phone ")
# Define sn_phonenosim_value text ("status ")
# Define sn_phonenosim_bitmask 2
//////////////////////////////////////// ////////////////////////////////////////
// Phoneinvalidsim
// Gets a value indicating whether the subscriber identity module (SIM) is invalid.
# Define sn_phoneinvalidsim_root HKEY_LOCAL_MACHINE
# Define sn_phoneinvalidsim_path text ("system // state // phone ")
# Define sn_phoneinvalidsim_value text ("status ")
# Define sn_phoneinvalidsim_bitmask 4
//////////////////////////////////////// ////////////////////////////////////////
// Phoneblockedsim
// Gets a value indicating whether the subscriber identity module (SIM) is blocked.
# Define sn_phoneblockedsim_root HKEY_LOCAL_MACHINE
# Define sn_phoneblockedsim_path text ("system // state // phone ")
# Define sn_phoneblockedsim_value text ("status ")
# Define sn_phoneblockedsim_bitmask 8
When SIM is on the device, the status value in HKEY_LOCAL_MACHINE // system // state // phone is 0x188000a0,
Bool gchecksimcardexist ()
{
Hkey = NULL;
DWORD dwdisposition;
DWORD dwtype;
DWORD cbdata;
Bool fgresult = false;
If (regcreatekeyex (HKEY_LOCAL_MACHINE, text ("// system // state // phone "),
0, null, 0, 0, null,
& Hkey, & dwdisposition )! = Error_success)
{
Assert (0 );
}
Cbdata = sizeof (DWORD );
If (regqueryvalueex (hkey, _ T ("status"), 0, & dwtype,
(Lpbyte) & dwdisposition, & cbdata )! = Error_success)
{
Assert (0 );
}
Regclosekey (hkey );
// Return value is 0x002000a2 when not exist SIM.
Dwdisposition & = 0x2;
If (dwdisposition = 0)
{
Fgresult = true;
}
}
Http://hailang19821213.blog.163.com/blog/static/306794612010315111847763/