int GetDialupSignalStrength(int &dwSignal)
{
HKEY hKEY;
LPCTSTR data_Set = _T("System//State//Phone//");
long ret = (::RegOpenKeyEx(HKEY_LOCAL_MACHINE, data_Set, 0, KEY_READ, &hKEY));
if(ret!=ERROR_SUCCESS)
{
return GetDialupErrorCode(ret);
}
BYTE dSignal =0;
DWORD type_1=REG_DWORD;
DWORD cbData_1=128;
ret = ::RegQueryValueEx(hKEY, _T("Signal Strength Raw"), NULL, &type_1, &dSignal, &cbData_1);
if(ret!=ERROR_SUCCESS)
{
::RegCloseKey(hKEY);
return GetDialupErrorCode(ret);
}
if(cbData_1<=0)
{
::RegCloseKey(hKEY);
return error;
}
::RegCloseKey(hKEY);
dwSignal = dSignal;
return GetDialupErrorCode(ret);
}
int GetDialupRoaming(bool& bRoamFlag)
{
HKEY hKEY;
LPCTSTR data_Set = _T("System//State//Phone//");
long ret = (::RegOpenKeyEx(HKEY_LOCAL_MACHINE, data_Set, 0, KEY_READ, &hKEY));
if(ret!=ERROR_SUCCESS)
{
return GetDialupErrorCode(ret);
}
BYTE dRoam =0;
DWORD type_1=REG_DWORD;
DWORD cbData_1=128;
BYTE gg[200] = {0};
LONG RegQueryValueEx(
HKEY hKey,
LPCWSTR lpValueName,
LPDWORD lpReserved,
LPDWORD lpType,
LPBYTE lpData,
LPDWORD lpcbData
);
int dwRoam;
ret = ::RegQueryValueEx(hKEY,_T("Status"), NULL, &type_1, gg, &cbData_1);
memcpy(&dwRoam, gg, sizeof(DWORD));
if(ret != ERROR_SUCCESS)
{
::RegCloseKey(hKEY);
return GetDialupErrorCode(ret);
}
::RegCloseKey(hKEY);
bRoamFlag = (0 != (dwRoam & SN_PHONEROAMING_BITMASK ));
return GetDialupErrorCode(ret);
}