//-------------------------------------------------------------------------------- bool CSecurityClient::MainLoop() { if(! IsConnectComplete()) return true; // we've lost the certificate and now we're waiting for a new one // but we're still using our old copy if(IsWaitingForObtained()) { if(IsObtained()) { // no more deadline CancelDeadlineTimer(); // no longer waiting m_evtWaitingForObtained.ResetEvent(); // certificate obtained so reinstate msg sending m_pConnection->SetTarget(this, MsgIdCertificate); CWriteLock lock(&m_container); // keep a copy of the new certificate m_pConnection->GetCertificateCopy(m_container.m_pCert); } else { // set the timer for obtaining a license // does nothing if the timer's already set SetDeadlineTimer(); // we have no certificate but maybe we have a dongle or a cert copy if(! IsLicensed()) { SetTerminate(); return false; } // we should have (re)connected by now so if not then we're done if(IsConnectDeadline()) { // we've timed out, there's no dongle, no note from mom, life sucks, app must bail SetTerminate(); return false; } return true; } } if(IsLicensed()) return true; SetTerminate(); return false; }
//-------------------------------------------------------------------------------- void CSecurityClient::OnMessage(UINT nMsg, WPARAM wparam, LPARAM lparam) { switch(nMsg) { case MsgIdCertificate: if(! DoSecurityMessage(lparam)) SetTerminate(); break; } }
void MyGameApp::QuitGame() { SetTerminate(); }