Exemple #1
0
BOOL
CRegisterDeviceDialog::IsValidDeviceStringIdKey()
{
	// Transfer data from the controls to member variables
	DoDataExchange(TRUE);

	if (!(m_strDeviceIDs[0].GetLength() == 5 &&
		m_strDeviceIDs[1].GetLength() == 5 &&
		m_strDeviceIDs[2].GetLength() == 5 &&
		m_strDeviceIDs[3].GetLength() == 5 &&
		(m_strDeviceKey.GetLength() == 0 || m_strDeviceKey.GetLength() == 5)))
	{
		return FALSE;
	}

	WTL::CString strDeviceID;
	strDeviceID.Format(TEXT("%s%s%s%s"), 
		m_strDeviceIDs[0], m_strDeviceIDs[1], 
		m_strDeviceIDs[2], m_strDeviceIDs[3]);

	strDeviceID.MakeUpper();

	if (m_strDeviceKey.GetLength() > 0) {
		m_strDeviceKey.MakeUpper();
		return ::NdasValidateStringIdKeyW(strDeviceID, m_strDeviceKey);
	} else {
		return ::NdasValidateStringIdKeyW(strDeviceID, NULL);
	}
}