// Отправка файлов DWORD CMraProto::MraGame(const CMStringA &szEmail, DWORD dwGameSessionID, DWORD dwGameMsg, DWORD dwGameMsgID, const CMStringA &szData) { if (szEmail.GetLength() <= 4) return 0; OutBuffer buf; buf.SetLPSLowerCase(szEmail); buf.SetUL(dwGameSessionID); buf.SetUL(dwGameMsg); buf.SetUL(dwGameMsgID); buf.SetUL(_time32(NULL)); buf.SetLPS(szData); return MraSendCMD(MRIM_CS_GAME, buf.Data(), buf.Len()); }
int hang (int howlonghang) { int lol; int templocaltime; #ifndef LINUX templocaltime = _time32(NULL); #endif #ifdef LINUX templocaltime = time(&temploctim); #endif lol = templocaltime + howlonghang; for(;;) { #ifndef LINUX templocaltime = _time32(NULL); #endif #ifdef LINUX templocaltime = time(&temploctim); #endif if(lol == templocaltime) break; } return 0; };
static int GM_CDECL gmfTime(gmThread * a_thread) { #ifdef IS64BIT // Compatible with 64bit OS __time32_t t; _time32(&t); GM_ASSERT(sizeof(t) <= sizeof(gmint)); a_thread->PushInt(t); return GM_OK; #else time_t t; time(&t); GM_ASSERT(sizeof(time_t) <= sizeof(gmptr)); a_thread->PushInt(t); return GM_OK; #endif }
BOOL CSoftInfoQuery::InitCacheDB() { if(!_initHttp) return FALSE; BOOL ret = FALSE; do { HMODULE hMod = LoadLibraryW(L"ksafedb.dll"); if(hMod == NULL) break; PFN_BKDbCreateObject pBKDbCreateObject = (PFN_BKDbCreateObject)GetProcAddress(hMod, "BKDbCreateObject"); if(pBKDbCreateObject == NULL) break; HRESULT hr = pBKDbCreateObject(__uuidof(ISQLiteComDatabase3), (void**)&_pDB, BKENG_CURRENT_VERSION); if(!SUCCEEDED(hr)) break; hr = _pDB->Open((_ksafePath + SOFT_INFO_DB).c_str()); if(!SUCCEEDED(hr)) break; _pDB->SetBusyTimeout(3000); _pDB->ExecuteUpdate(L"pragma page_size=4096;"); _pDB->ExecuteUpdate(L"pragma encoding = \"UTF-16\";"); if(_pDB->TableExists(L"soft_info_list")) { wostringstream os; os<<"delete from soft_info_list where update_time < "<<_time32(NULL) - SOFT_INFO_INTERVAL<<L';'; _pDB->ExecuteUpdate(os.str().c_str()); ret = TRUE; } else { static const LPCWSTR pSql = L"create table soft_info_list(" L"soft_id int primary key," L"grade nvarchar(32)," L"update_time int);"; ret = SUCCEEDED(_pDB->ExecuteUpdate(pSql)); } } while(FALSE); return ret; }
CFileAccess::CFileAccess(const TCHAR* FileName) { m_FileName = new TCHAR[_tcslen(FileName) + 1]; m_Journal.FileName = new TCHAR[_tcslen(FileName) + 5]; _tcscpy_s(m_FileName, _tcslen(FileName) + 1, FileName); _tcscpy_s(m_Journal.FileName, _tcslen(FileName) + 5, FileName); _tcscat_s(m_Journal.FileName, _tcslen(FileName) + 5, _T(".jrn")); m_ReadOnly = false; m_LastSize = 0; m_Size = 0; m_Journal.Use = false; m_Journal.hFile = 0; m_Journal.BufUse = 0; m_LastAllocTime = _time32(NULL); }
CJsonCoinOption(const std::string& filepath) { try { Json::Value jsv = json_from_file(filepath); if (jsv.empty()) { m_is_error = true; return; } this->prev_name = jsv["Name"].asString(); Json::Value& dnslist = jsv["DnsList"]; for (auto it = dnslist.begin(); it != dnslist.end(); ++it) { Json::Value& v = *it; this->DNSSeed.push_back(v.asString()); } std::string szNetHead = jsv["NetHead"].asString(); binary bNetHead = from_hex(szNetHead.c_str()); if (bNetHead.size() == 4) { this->pchMessageStart[0] = bNetHead[0]; this->pchMessageStart[1] = bNetHead[1]; this->pchMessageStart[2] = bNetHead[2]; this->pchMessageStart[3] = bNetHead[3]; } this->port = jsv["NetPort"].asInt(); this->protocol_version = jsv["NetVersion"].asInt(); this->first_blockhash = rstr_to_uint256(jsv["first_block_hash"].asString()); this->first_blocktime = jsv["first_block_time"].asInt(); if ((int)this->first_blocktime < 0) { this->first_blocktime = _time32(0) + int(this->first_blocktime); } this->PubkeyStart = jsv["Pubkey_Start"].asInt(); m_is_error = false; } catch(std::exception& e) { printf("%s\n", e.what()); m_is_error = true; } }
bool getdate( machine&, FSP arg1 ) { #if defined( HAVE_GETTIMEOFDAY ) && defined( HAVE_CTIME ) struct timeval current_time; gettimeofday( ¤t_time, NULL ); string str( ctime( ¤t_time.tv_sec ) ); return arg1.Unify( str.substr( 0, str.size() - 1 ).c_str() ); #elif defined(HAVE_TIME_H) && defined(LILFES_WIN_) // LILFES_WIN_ __time32_t ltime; _time32( <ime ); string str(_ctime32( <ime )); return arg1.Unify( str.substr( 0, str.size() - 1 ).c_str() ); #else // HAVE_GETTIMEOFDAY && HAVE_CTIME RUNWARN( "getdata: gettimeofday is not implemented in this system" ); return arg1.Unify( "" ); #endif // HAVE_GETTIMEOFDAY && HAVE_CTIME }
ROCK3DGAME_API IWorld* CreateWorld(const IView::Desc& viewDesc, bool steamInit) { CoInitializeEx(NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE); srand(_time32(NULL)); // restrict this main game thread to the first processor, so query performance counter won't jump on crappy AMD cpus DWORD dwThreadAffinityMask = 0x01; ::SetThreadAffinityMask( ::GetCurrentThread(), dwThreadAffinityMask ); World* world = new game::World(); try { #ifdef STEAM_SERVICE if (steamInit) { switch (SteamService::Initialize()) { case SteamService::irFailed: LSL_LOG("steam initialize irFailed"); break; case SteamService::irRestart: LSL_LOG("steam initialize irRestart"); //_world->Terminate(EXIT_FAILURE); break; case SteamService::irSuccess: LSL_LOG("steam initialize irSuccess"); break; } } #endif world->Init(viewDesc); } catch(...) { ReleaseWorld(world); world = 0; throw; } return world; }
__time32_t NXdostimeto32(__time32_t dostime) { tm t; memset(&t, 0, sizeof(tm)); t.tm_sec = 2 * (dostime & 0x1f); t.tm_min = (dostime >> 5) & 0x3f; t.tm_hour = (dostime >> 11) & 0x1f; t.tm_mday = (dostime >> 16) & 0x1f; t.tm_mon = ((dostime >> 21) & 0x0f) - 1; t.tm_year = ((dostime >> 25) & 0x7f) + 1980 - 1900; __time32_t r = _mktime32(&t); if(r == -1) { R(-1, "mktime error"); return _time32(NULL); } return r; }
cNetAdapter *CNetWatcherTask::FindAdapterByNet(NETWATCH::Network *netw) { if(netw->m_nIfType==IF_TYPE_SOFTWARE_LOOPBACK) return 0; cNetAdapter *pAdapter; DWORD x; for(x=1;x<m_adapters.size();x++) { pAdapter=&m_adapters[x]; if(netw->m_nIfType==IF_TYPE_SOFTWARE_LOOPBACK && pAdapter->m_nIfType==netw->m_nIfType) break; if(netw->m_nIfType!=IF_TYPE_PPP && pAdapter->m_sAdapterWinName==netw->m_sAdapterWinName) break; if(netw->m_nIfType==IF_TYPE_PPP && pAdapter->m_nIfType==netw->m_nIfType && pAdapter->QState(fTouch)==FALSE && pAdapter->m_sRasDeviceType==netw->m_sRasDeviceType && pAdapter->m_sRasDeviceName==netw->m_sRasDeviceName) break; } if(x==m_adapters.size()) { //new adapter pAdapter=&m_adapters.push_back(); DWORD max_ID=m_settings.m_NextAdapterID; Lock_settings(); while(TRUE) { DWORD x=0; while(x<m_adapters.size() || x<m_zones.size()) { if(x<m_adapters.size() && m_adapters[x].m_nID>=max_ID) break; if(x<m_zones.size() && m_zones[x].m_nAdapterID>=max_ID) break; x++; } if(x>=m_adapters.size() && x>=m_zones.size()) break; max_ID++; } m_settings.m_NextAdapterID=max_ID+1; Unlock_settings(); pAdapter->m_nID=max_ID; pAdapter->m_nIfType=netw->m_nIfType; pAdapter->SetState(fVisible,TRUE); switch(pAdapter->m_nIfType) { case IF_TYPE_IEEE80211: query_adapter_description(netw); pAdapter->m_sAdapterFrendlyName=netw->AdapterDesc; pAdapter->m_nTypeOfInterface=If_WiFi; break; case IF_TYPE_PPP: { cStringObj RasDeviceType=netw->m_sRasDeviceType; cStringObj RasDeviceName=netw->m_sRasDeviceName; pAdapter->m_nTypeOfInterface=If_PPP; pAdapter->m_sAdapterFrendlyName=netw->AdapterDesc; if(RasDeviceType==RASDT_Modem) { pAdapter->m_nTypeOfInterface=If_Modem; if(RasDeviceName.size()>0) pAdapter->m_sAdapterFrendlyName=RasDeviceName; } if(RasDeviceType==RASDT_PPPoE) pAdapter->m_nTypeOfInterface=If_PPPoE; if(RasDeviceType==RASDT_Vpn) pAdapter->m_nTypeOfInterface=If_VPN; pAdapter->m_sRasDeviceType=netw->m_sRasDeviceType; pAdapter->m_sRasDeviceName=netw->m_sRasDeviceName; } break; case IF_TYPE_SOFTWARE_LOOPBACK: pAdapter->m_sAdapterFrendlyName="LOOPBACK Adapter"; pAdapter->m_nTypeOfInterface=If_LoopBack; pAdapter->SetConnected(TRUE); break; default: query_adapter_description(netw); pAdapter->m_sAdapterFrendlyName=netw->AdapterDesc; pAdapter->m_nTypeOfInterface=If_Ethernet; pAdapter->m_sAdapterFrendlyName=netw->AdapterDesc; } _time32((__time32_t*)&pAdapter->m_nTimeCreated); pAdapter->SetState(fChanged,TRUE); PR_TRACE((g_root, prtIMPORTANT, TR "CNetWatcherTask::FindAdapterByNet Add new adapter %S",pAdapter->m_sAdapterFrendlyName)); } netw->adapter_ID=pAdapter->m_nID; tDWORD time_now; _time32((__time32_t*)&time_now); pAdapter->m_nMac=netw->m_nMac; pAdapter->m_nMacLen=netw->m_nMacLen; pAdapter->m_nFlags=netw->m_nFlags; pAdapter->m_nIfIndex=netw->m_nIfIndex; pAdapter->m_sAdapterWinName=netw->m_sAdapterWinName; pAdapter->SetState(fTouch,TRUE); if(!pAdapter->Connected() && netw->OperStatus==IfOperStatusUp) pAdapter->m_nTimeConnected=time_now; pAdapter->SetConnected(netw->OperStatus==IfOperStatusUp); if(pAdapter->Connected() && time_now-pAdapter->m_nTimeConnected<3 && netw->inRouteTable<5 && netw->m_nFlags & IP_ADAPTER_DHCP_ENABLED) { m_NewList->Flags=1; netw->OperStatus=IfOperStatusDown; if(netw->inRouteTable>1) m_level=5; } if(netw->m_nIfIndex==m_NewList->IPv4gw.dwIndex && netw->OperStatus==IfOperStatusUp) { m_zones[0].SetConnected(TRUE); m_zones[0].SetState(fTouch,TRUE); m_adapters[0].SetConnected(TRUE); pAdapter->SetState(fGateway,TRUE); } else pAdapter->SetState(fGateway,FALSE); pAdapter->m_nZoneID=0; return pAdapter; }
void CCrashDumpWriter::DumpMiniDump ( _EXCEPTION_POINTERS* pException, CExceptionInformation* pExceptionInformation ) { WriteDebugEvent ( "CCrashDumpWriter::DumpMiniDump" ); // Try to load the DLL in our directory HMODULE hDll = NULL; char szDbgHelpPath [MAX_PATH]; if ( GetModuleFileNameA ( NULL, szDbgHelpPath, MAX_PATH ) ) { char* pSlash = _tcsrchr ( szDbgHelpPath, '\\' ); if ( pSlash ) { _tcscpy ( pSlash + 1, "DBGHELP.DLL" ); hDll = LoadLibrary ( szDbgHelpPath ); } } // If we couldn't load the one in our dir, load any version available if ( !hDll ) { hDll = LoadLibrary( "DBGHELP.DLL" ); } if ( !hDll ) AddReportLog( 9201, "CCrashDumpWriter::DumpMiniDump - Could not load DBGHELP.DLL" ); // We could load a dll? if ( hDll ) { // Grab the MiniDumpWriteDump proc address MINIDUMPWRITEDUMP pDump = reinterpret_cast < MINIDUMPWRITEDUMP > ( GetProcAddress( hDll, "MiniDumpWriteDump" ) ); if ( !pDump ) AddReportLog( 9202, "CCrashDumpWriter::DumpMiniDump - Could not find MiniDumpWriteDump" ); if ( pDump ) { // Create the file HANDLE hFile = CreateFile ( CalcMTASAPath ( "mta\\core.dmp" ), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); if ( hFile == INVALID_HANDLE_VALUE ) AddReportLog( 9203, SString( "CCrashDumpWriter::DumpMiniDump - Could not create '%s'", *CalcMTASAPath ( "mta\\core.dmp" ) ) ); if ( hFile != INVALID_HANDLE_VALUE ) { // Create an exception information struct _MINIDUMP_EXCEPTION_INFORMATION ExInfo; ExInfo.ThreadId = GetCurrentThreadId (); ExInfo.ExceptionPointers = pException; ExInfo.ClientPointers = FALSE; // Write the dump BOOL bResult = pDump ( GetCurrentProcess(), GetCurrentProcessId(), hFile, (MINIDUMP_TYPE)( MiniDumpNormal | MiniDumpWithIndirectlyReferencedMemory ), &ExInfo, NULL, NULL ); if ( !bResult ) AddReportLog( 9204, SString( "CCrashDumpWriter::DumpMiniDump - MiniDumpWriteDump failed (%08x)", GetLastError() ) ); else WriteDebugEvent ( "CCrashDumpWriter::DumpMiniDump - MiniDumpWriteDump succeeded" ); // Close the dumpfile CloseHandle ( hFile ); // Grab the current time // Ask windows for the system time. SYSTEMTIME SystemTime; GetLocalTime ( &SystemTime ); // Create the dump directory CreateDirectory ( CalcMTASAPath ( "mta\\dumps" ), 0 ); CreateDirectory ( CalcMTASAPath ( "mta\\dumps\\private" ), 0 ); SString strModuleName = pExceptionInformation->GetModuleBaseName (); strModuleName = strModuleName.ReplaceI ( ".dll", "" ).Replace ( ".exe", "" ).Replace ( "_", "" ).Replace ( ".", "" ).Replace ( "-", "" ); if ( strModuleName.length () == 0 ) strModuleName = "unknown"; SString strMTAVersionFull = SString ( "%s.%s", MTA_DM_BUILDTAG_LONG, *GetApplicationSetting ( "mta-version-ext" ).SplitRight ( ".", NULL, -2 ) ); SString strSerialPart = GetApplicationSetting ( "serial" ).substr ( 0, 5 ); uint uiServerIP = GetApplicationSettingInt ( "last-server-ip" ); uint uiServerPort = GetApplicationSettingInt ( "last-server-port" ); int uiServerTime = GetApplicationSettingInt ( "last-server-time" ); int uiServerDuration = _time32 ( NULL ) - uiServerTime; uiServerDuration = Clamp ( 0, uiServerDuration + 1, 0xfff ); // Get path to mta dir SString strPathCode; { std::vector < SString > parts; PathConform ( CalcMTASAPath ( "" ) ).Split ( PATH_SEPERATOR, parts ); for ( uint i = 0 ; i < parts.size () ; i++ ) { if ( parts[i].CompareI ( "Program Files" ) ) strPathCode += "Pr"; else if ( parts[i].CompareI ( "Program Files (x86)" ) ) strPathCode += "Px"; else if ( parts[i].CompareI ( "MTA San Andreas" ) ) strPathCode += "Mt"; else if ( parts[i].BeginsWithI ( "MTA San Andreas" ) ) strPathCode += "Mb"; else strPathCode += parts[i].Left ( 1 ).ToUpper (); } } // Ensure filename parts match up with EDumpFileNameParts SString strFilename ( "mta\\dumps\\private\\client_%s_%s_%08x_%x_%s_%08X_%04X_%03X_%s_%04d%02d%02d_%02d%02d.dmp", strMTAVersionFull.c_str (), strModuleName.c_str (), pExceptionInformation->GetAddressModuleOffset (), pExceptionInformation->GetCode () & 0xffff, strPathCode.c_str (), uiServerIP, uiServerPort, uiServerDuration, strSerialPart.c_str (), SystemTime.wYear, SystemTime.wMonth, SystemTime.wDay, SystemTime.wHour, SystemTime.wMinute ); SString strPathFilename = CalcMTASAPath ( strFilename ); // Copy the file CopyFile ( CalcMTASAPath ( "mta\\core.dmp" ), strPathFilename, false ); // For the dump uploader SetApplicationSetting ( "diagnostics", "last-dump-extra", "none" ); SetApplicationSetting ( "diagnostics", "last-dump-save", strPathFilename ); // Try to append pool sizes info to dump file SetApplicationSetting ( "diagnostics", "last-dump-extra", "try-pools" ); CBuffer poolInfo; GetPoolInfo ( poolInfo ); AppendToDumpFile ( strPathFilename, poolInfo, 'POLs', 'POLe' ); SetApplicationSetting ( "diagnostics", "last-dump-extra", "added-pools" ); // Try to append d3d state info to dump file SetApplicationSetting ( "diagnostics", "last-dump-extra", "try-d3d" ); CBuffer d3dInfo; GetD3DInfo ( d3dInfo ); AppendToDumpFile ( strPathFilename, d3dInfo, 'D3Ds', 'D3De' ); SetApplicationSetting ( "diagnostics", "last-dump-extra", "added-d3d" ); // Try to append crash averted stats to dump file SetApplicationSetting ( "diagnostics", "last-dump-extra", "try-crash-averted" ); CBuffer crashAvertedStats; GetCrashAvertedStats ( crashAvertedStats ); AppendToDumpFile ( strPathFilename, crashAvertedStats, 'CASs', 'CASe' ); SetApplicationSetting ( "diagnostics", "last-dump-extra", "added-crash-averted" ); // Try to append log info to dump file SetApplicationSetting ( "diagnostics", "last-dump-extra", "try-log" ); CBuffer logInfo; GetLogInfo ( logInfo ); AppendToDumpFile ( strPathFilename, logInfo, 'LOGs', 'LOGe' ); SetApplicationSetting ( "diagnostics", "last-dump-extra", "added-log" ); // Try to append dx info to dump file SetApplicationSetting ( "diagnostics", "last-dump-extra", "try-misc" ); CBuffer dxInfo; GetDxInfo ( dxInfo ); AppendToDumpFile ( strPathFilename, dxInfo, 'DXIs', 'DXIe' ); SetApplicationSetting ( "diagnostics", "last-dump-extra", "added-misc" ); // Try to append misc info to dump file SetApplicationSetting ( "diagnostics", "last-dump-extra", "try-misc" ); CBuffer miscInfo; GetMiscInfo ( miscInfo ); AppendToDumpFile ( strPathFilename, miscInfo, 'MSCs', 'MSCe' ); SetApplicationSetting ( "diagnostics", "last-dump-extra", "added-misc" ); // Try to append memory info to dump file SetApplicationSetting ( "diagnostics", "last-dump-extra", "try-mem" ); CBuffer memInfo; GetMemoryInfo ( memInfo ); AppendToDumpFile ( strPathFilename, memInfo, 'MEMs', 'MEMe' ); SetApplicationSetting ( "diagnostics", "last-dump-extra", "added-mem" ); // Try to logfile.txt to dump file SetApplicationSetting ( "diagnostics", "last-dump-extra", "try-logfile" ); CBuffer logfileContent; logfileContent.LoadFromFile( CalcMTASAPath( PathJoin( "mta", "logs", "logfile.txt" ) ) ); AppendToDumpFile ( strPathFilename, logfileContent, 'LOGs', 'LOGe' ); SetApplicationSetting ( "diagnostics", "last-dump-extra", "added-logfile" ); // Try to report.log to dump file SetApplicationSetting ( "diagnostics", "last-dump-extra", "try-report" ); CBuffer reportLogContent; reportLogContent.LoadFromFile( PathJoin( GetMTADataPath(), "report.log" ) ); AppendToDumpFile ( strPathFilename, reportLogContent, 'REPs', 'REPe' ); SetApplicationSetting ( "diagnostics", "last-dump-extra", "added-report" ); } } // Free the DLL again FreeLibrary ( hDll ); } // Auto-fixes // Check if crash was in volumetric shadow code if ( ms_uiInCrashZone == 1 || ms_uiInCrashZone == 2 ) { CVARS_SET( "volumetric_shadows", false ); CCore::GetSingleton().SaveConfig(); AddReportLog( 9205, "Disabled volumetric shadows" ); } CNet* pNet = CCore::GetSingleton().GetNetwork(); if ( pNet ) pNet->PostCrash(); }
BOOL CSoftInfoQueryTask::TaskProcess(CTaskMgr *pMgr) { do { ISQLiteComDatabase3 *pDB = _pSoftQuery->GetDBPtr(); if(pMgr->IsExited()) break; // 1.查询本地缓存 { SoftInfo2List resultList; CCacheSoftInfoOpr softInfoOpr(pDB); SoftQueryInfoIter endQuery = _softQueryInfoList.end(); for(SoftQueryInfoIter it = _softQueryInfoList.begin(); it != endQuery; ) { wstring grade; if(softInfoOpr.Query(it->_id, grade) && !grade.empty()) { resultList.push_back(SoftInfo2(it->_id, grade)); _softQueryInfoList.erase(it++); } else { ++it; } } // 3.通知用户 if(pMgr->IsExited()) break; if(!resultList.empty()) { CSoftInfoEnum softInfoEnum(resultList); _pSoftQuery->GetNotify()->SoftQueryNotify(&softInfoEnum, _pParams); } } // 2.查询网络 if(!_softQueryInfoList.empty()) { if(pMgr->IsExited()) break; SoftInfo2List resultList; try{ QueryByNetwork(_softQueryInfoList, resultList); } catch(...) {} // 处理返回结果 if(!resultList.empty()) { if(pMgr->IsExited()) break; { CSoftInfoEnum softInfoEnum(resultList); _pSoftQuery->GetNotify()->SoftQueryNotify(&softInfoEnum, _pParams); } if(pMgr->IsExited()) break; // 保存到本地缓存 pDB->BeginTransaction(); { __time32_t now = _time32(NULL); CCacheSoftInfoOpr softInfoOpr(pDB); SoftInfo2CIter end = resultList.end(); for(SoftInfo2CIter it = resultList.begin(); it != end; ++it) { softInfoOpr.Insert(it->_id, it->_grade, now); } } pDB->CommitTransaction(); } } } while(FALSE); return FALSE; }
int CMraProto::MraChatGcEventHook(WPARAM, LPARAM lParam) { if (lParam) if (bChatExists) { GCHOOK* gch = (GCHOOK*)lParam; if (!_stricmp(gch->pDest->pszModule, m_szModuleName)) { switch (gch->pDest->iType) { case GC_USER_MESSAGE: if (gch->ptszText && lstrlen(gch->ptszText)) { size_t dwMessageSize = lstrlenW(gch->ptszText); CMStringA szEmail = gch->pDest->ptszID; HANDLE hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, NULL); BOOL bSlowSend = getByte("SlowSend", MRA_DEFAULT_SLOW_SEND); DWORD dwFlags = 0; if (getByte("RTFSendEnable", MRA_DEFAULT_RTF_SEND_ENABLE) && (MraContactCapabilitiesGet(hContact)&FEATURE_FLAG_RTF_MESSAGE)) dwFlags |= MESSAGE_FLAG_RTF; INT_PTR iSendRet = MraMessage(bSlowSend, hContact, ACKTYPE_MESSAGE, dwFlags, szEmail, gch->ptszText, NULL, 0); if (bSlowSend == FALSE) ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)iSendRet, 0); MraChatSessionEventSendByHandle(hContact, GC_EVENT_MESSAGE, GCEF_ADDTOLOG, "", NULL, gch->ptszText, 0, (DWORD)_time32(NULL)); } break; case GC_USER_PRIVMESS: MraChatSendPrivateMessage(_T2A(gch->ptszUID)); break; case GC_USER_LOGMENU: //sttLogListHook( this, item, gch ); break; case GC_USER_NICKLISTMENU: //sttNickListHook( this, item, gch ); break; case GC_USER_CHANMGR: //int iqId = SerialNext(); //IqAdd( iqId, IQ_PROC_NONE, &CJabberProto::OnIqResultGetMuc ); //m_ThreadInfo->send( XmlNodeIq( _T("get"), iqId, item->jid ) << XQUERY( xmlnsOwner )); break; } } } return 0; }
void CDlgCapCam::UpdateImage(void) { int i; CPen cur_pen, *old_pen=NULL; CBrush cur_brush,*old_brush = NULL; CPoint point; CSize size; CRect rect_image; CImage * pimage; CString str_dis; CRect client_rect1; CSize paint_size1; __time32_t l_time; if (!m_img_show.IsNull()) { pimage = &m_img_show; _time32(&l_time); CWnd * pDis1 = GetDlgItem(IDC_STATIC_IMGSHOW); CDC* pDC1 = pDis1->GetDC(); CDC MemDC1; CBitmap MemBitmap1; CPen pen_target; rect_image = CRect(0,0,pimage->GetWidth()-1, pimage->GetHeight()-1); pDis1->GetClientRect(&client_rect1); MemDC1.CreateCompatibleDC(pDC1); MemBitmap1.CreateCompatibleBitmap(pDC1,rect_image.Width(),rect_image.Height()); MemDC1.SelectObject(&MemBitmap1); MemDC1.SetStretchBltMode(COLORONCOLOR); pDC1->SetStretchBltMode(COLORONCOLOR); pimage->BitBlt(MemDC1.GetSafeHdc(),rect_image, CPoint(0,0),SRCCOPY); //draw other osd targets pen_target.CreatePen(PS_SOLID, 2, RGB(255, 0, 0)); MemDC1.SelectStockObject(NULL_BRUSH); MemDC1.SelectObject(&pen_target); for (i=0; i<m_proc_result_buf.target_set.num; i++) { MemDC1.Rectangle(m_proc_result_buf.target_set.targets[i].rect.left, m_proc_result_buf.target_set.targets[i].rect.bottom, m_proc_result_buf.target_set.targets[i].rect.right, m_proc_result_buf.target_set.targets[i].rect.top); } //修改事件抓拍为每10秒钟1次 #define SNATCH_TIME_INTER 10 #define SNATCH_TIME_LATE 120 time_t cur_time; struct tm * now_time; time(&cur_time); now_time = localtime(&cur_time); if (m_proc_result_buf.target_set.num > 0) { if (cur_time - m_trigger_snatch_time >= SNATCH_TIME_INTER) { //超过10s间隔 ScreenShot(1, SNATCH_TIME_INTER); m_trigger_snatch_time = cur_time; } } //延续120秒 else if(m_trigger_snatch_time > 0 && cur_time - m_trigger_snatch_time <=SNATCH_TIME_LATE) { ScreenShot(SNATCH_TIME_LATE/SNATCH_TIME_INTER, SNATCH_TIME_INTER); m_trigger_snatch_time = 0; } if (!m_proc_result_buf.flg_used) { if (m_proc_result_buf.target_set.num) { ((CSTEvaluationDlg*)pWndParent)->AddTarget(&m_proc_result_buf.target_set); } //do event for (i=0; i<m_proc_result_buf.event_set.num; i++) { //摄像头采集的,帧数置零 ((CSTEvaluationDlg*)pWndParent)->AddEvent(0,l_time,m_proc_result_buf.event_set.events[i].type); //同时触发抓拍 //ScreenShot(12, 10); } //防止由于刷新,事件被触发两次 m_proc_result_buf.flg_used = TRUE; } //---------------------抓拍的操作------------------- //if (WaitForSingleObject(m_proc_flgscreenshot, 0) == WAIT_OBJECT_0) if (m_snatch_count>0 && l_time - m_snatch_pretime>=m_snatch_intertime) { CImage img; CString str_name; time_t cur_time; struct tm * now_time; str_name = ((CSTEvaluationDlg*)pWndParent)->file_path; str_name += +_T("\\screenshot\\"); time(&cur_time); now_time = localtime(&cur_time); str_name.AppendFormat(_T("_%012d_alarm.jpg"), cur_time); img.Attach(MemBitmap1); img.Save(str_name); img.Detach(); m_snatch_count--; m_snatch_pretime = l_time; } pDC1->StretchBlt(0,0,STE_IMAGE_WIDTH*2-1,STE_IMAGE_HEIGH*2-1,&MemDC1,0,0,rect_image.Width()-1, rect_image.Height()-1, SRCCOPY); pDis1->ReleaseDC(pDC1); } else { pimage = &m_img_def; CWnd * pDis1 = GetDlgItem(IDC_STATIC_IMGSHOW); CDC* pDC1 = pDis1->GetDC(); rect_image = CRect(0,0,pimage->GetWidth()-1, pimage->GetHeight()-1); pDis1->GetClientRect(&client_rect1); pimage->StretchBlt(pDC1->GetSafeHdc(),client_rect1, rect_image, SRCCOPY); pDis1->ReleaseDC(pDC1); } #ifdef _DEBUG if (!m_img1.IsNull()) { pimage = &m_img1; //CWnd * pDis1 = GetDlgItem(IDC_STATIC_IMGSHOW); CDC* pDC1 = GetDC(); rect_image = CRect(0,0,pimage->GetWidth()-1, pimage->GetHeight()-1); GetClientRect(&client_rect1); pimage->StretchBlt(pDC1->GetSafeHdc(),CRect(380,20, 380+175, 20+143), rect_image); //pimage->BitBlt(pDC1->GetSafeHdc(), 500,0,352,288, 0,0,SRCCOPY); ReleaseDC(pDC1); } if (!m_img2.IsNull()) { pimage = &m_img2; //CWnd * pDis1 = GetDlgItem(IDC_STATIC_IMGSHOW); CDC* pDC1 = GetDC(); rect_image = CRect(0,0,pimage->GetWidth()-1, pimage->GetHeight()-1); GetClientRect(&client_rect1); pimage->StretchBlt(pDC1->GetSafeHdc(),CRect(380,170, 380+175, 170+143), rect_image); //pimage->BitBlt(pDC1->GetSafeHdc(), 500,0,352,288, 0,0,SRCCOPY); ReleaseDC(pDC1); } if (!m_img3.IsNull()) { pimage = &m_img3; //CWnd * pDis1 = GetDlgItem(IDC_STATIC_IMGSHOW); CDC* pDC1 = GetDC(); rect_image = CRect(0,0,pimage->GetWidth()-1, pimage->GetHeight()-1); GetClientRect(&client_rect1); pimage->StretchBlt(pDC1->GetSafeHdc(),CRect(560,20, 560+175, 20+143), rect_image); //pimage->BitBlt(pDC1->GetSafeHdc(), 500,0,352,288, 0,0,SRCCOPY); ReleaseDC(pDC1); } if (!m_img4.IsNull()) { pimage = &m_img4; //CWnd * pDis1 = GetDlgItem(IDC_STATIC_IMGSHOW); CDC* pDC1 = GetDC(); rect_image = CRect(0,0,pimage->GetWidth()-1, pimage->GetHeight()-1); GetClientRect(&client_rect1); pimage->StretchBlt(pDC1->GetSafeHdc(),CRect(560,170, 560+175, 170+143), rect_image); //pimage->BitBlt(pDC1->GetSafeHdc(), 500,0,352,288, 0,0,SRCCOPY); ReleaseDC(pDC1); } #endif //因为帧数等信息和图像相关,所以也放在此处更新 __time32_t n_time = 0; if (m_flg_process) { _time32(&n_time); } //str_dis.Format(_T("Frame:%06d; Time(s):%06d"), m_proc_result_buf.frame_index, n_time-m_start_time); str_dis.Format(_T("Frame:%02d; Time: %02dm:%02ds"), m_proc_result_buf.frame_index, (n_time-m_start_time)/60, (n_time-m_start_time)%60); GetDlgItem(IDC_STATIC_STATUS)->SetWindowText(str_dis); }
void CDlgCapCam::Start(void) { int i; printf("capcam start\r\n"); UpdateData(); m_trigger_snatch_time = 0; m_trigger_index = 0; //抓拍参数 m_snatch_count =0 ; m_snatch_intertime = 0; m_snatch_pretime = 0; if (!m_flg_process) { //使用的设备序号 m_index_device = m_combo_list_device.GetCurSel(); //每次start,都生成一个新的事件记录文件 //设置相关的其他文件路径 __time32_t cur_time; struct tm * now_time; _time32(&cur_time); now_time = _localtime32(&cur_time); i=config_path.ReverseFind(_T('\\')); event_file_path = config_path.Left(i) + _T("\\event\\"); event_file_path.AppendFormat(_T("_CAM%04d%02d%02d-%02d%02d%02d.csv"), now_time->tm_year+1900, now_time->tm_mon+1, now_time->tm_mday, now_time->tm_hour, now_time->tm_min, now_time->tm_sec); ((CSTEvaluationDlg*)pWndParent)->event_file_path = event_file_path; //记录开始时间 m_start_time = cur_time; //抓拍参数 m_snatch_count =0 ; m_snatch_intertime = 0; m_snatch_pretime = 0; ResetEvent(m_proc_flgexit); m_proc_handle = CreateThread( NULL, // default security attributes 0, // use default stack size thread_proc, // thread function this, // argument to thread function 0, // use default creation flags NULL); // returns the thread identifier if (m_proc_handle) { m_flg_process = TRUE; } else { printf("create proc thread failed!\r\n"); } Invalidate(); } else { ; } }
DWORD CNetWatcherTask::FindZoneByNet(NETWATCH::Network *netw) { if(netw->OperStatus!=IfOperStatusUp || (netw->number_of_ipv4==0 && netw->number_of_ipv6==0)) return 0; cNetZone *pZona; DWORD index; int level=-1; for(DWORD x=1;x<m_zones.size();x++) { pZona =&m_zones[x]; if(netw->m_nIfType==IF_TYPE_SOFTWARE_LOOPBACK && netw->m_nIfType==pZona->m_nIfType) { level=10; index=x; break; } if(pZona->QState(fTouch) || netw->m_nIfType!=pZona->m_nIfType || (pZona->m_nFlags & IP_ADAPTER_DHCP_ENABLED)!=(netw->m_nFlags & IP_ADAPTER_DHCP_ENABLED)) continue; if(!pZona->Connected() && (pZona->QState(fTemporary) || pZona->QState(fDeleted))) continue; BOOL this_zone=FALSE; if(pZona->Connected() && pZona->m_sAdapterWinName==netw->m_sAdapterWinName) this_zone=TRUE; if(netw->m_nIfType==IF_TYPE_PPP && pZona->m_sConnectionName==netw->AdapterFrendlyName) { int new_level=5; if(pZona->m_sRASPeer==netw->m_sRASPeer) { index=x; level=10; break; } if(new_level>level) { index=x; level=new_level; } continue; } if(netw->m_nIfType==IF_TYPE_IEEE80211 && pZona->m_sConnectionName==netw->SSID && pZona->m_nWiFiType==netw->m_nWiFiType) { int new_level=1; if(pZona->m_nWiFiAuthMode==netw->m_nWiFiAuthMode && pZona->m_nWiFiSecurity==netw->m_nWiFiSecurity) new_level+=4; if(new_level>level) { index=x; level=new_level; if(level>4) break; } continue; } if(netw->m_nIfType!=IF_TYPE_PPP && netw->m_nIfType!=IF_TYPE_IEEE80211) { int new_level=0; cIpMask IP; if(netw->m_nIP4Net>0) { IP.SetV4(netw->m_nIP4Net); IP.SetV4MaskByIp(netw->m_nIP4NetMask); } if(!(pZona->m_nFlags & IP_ADAPTER_DHCP_ENABLED)) { if(pZona->m_sAdapterWinName==netw->m_sAdapterWinName && IP.CmpNet(&pZona->m_IP)) { level=10; index=x; break; } continue; } if(netw->m_nGwMacLen==0) { if(this_zone && pZona->m_nGwMacLen==0) new_level+=1; } else { if(pZona->m_nGwMacLen==netw->m_nGwMacLen && pZona->m_nGwMac==netw->m_nGwMac) new_level+=5; else { if(pZona->m_nGwMacLen!=0) new_level-=6; if(this_zone) new_level+=5; } } if(netw->m_nDhcpMacLen==0) { if(this_zone && pZona->m_nDhcpMacLen==0) new_level+=1; } else { if(pZona->m_nDhcpMacLen==netw->m_nDhcpMacLen && pZona->m_nDhcpMac==netw->m_nDhcpMac) new_level+=5; else { if(pZona->m_nDhcpMacLen!=0) new_level-=6; if(this_zone) new_level+=5; } } if(pZona->m_IP.IsV4() && IP.CmpNet(&pZona->m_IP)) new_level+=1; if(pZona->m_sDnsSuffix==netw->DnsSuffix && this_zone) new_level+=5; if(pZona->m_sDnsSuffix==netw->DnsSuffix) new_level+=10; else new_level-=10; if(new_level>level) { index=x; level=new_level; if(level>10) break; } continue; } } if(level>0) pZona =&m_zones[index]; if(netw->m_nIfType==IF_TYPE_IEEE80211 && level<5) { if(netw->m_nWiFiAuthMode==Ndis802_11AuthModeOpen && netw->m_nWiFiSecurity==Ndis802_11EncryptionDisabled) { PR_TRACE((g_root, prtIMPORTANT, TR "CNetWatcherTask:: Warning !!! Security mode changed. ")); } } if(level<5) { pZona=NewZoneByNet(netw); if(!pZona) return 0; } else { PR_TRACE((g_root, prtIMPORTANT, TR "CNetWatcherTask:: level %d %S.\n",level,pZona->m_sFrendlyName)); if(netw->HasIPv4) { if(netw->m_nIP4Net>0) { pZona->m_IP.SetV4(netw->m_nIP4Net); pZona->m_IP.SetV4MaskByIp(netw->m_nIP4NetMask); } if(pZona->m_nDhcpIPv4==0) pZona->m_nDhcpIPv4=netw->m_nDhcpIPv4; if(pZona->m_nDhcpMacLen==0) { pZona->m_nDhcpMac=netw->m_nDhcpMac; pZona->m_nDhcpMacLen=netw->m_nDhcpMacLen; } if(pZona->m_nGwIPv4==0) pZona->m_nGwIPv4=netw->m_nGwIPv4; if(pZona->m_nGwMacLen==0) { pZona->m_nGwMac=netw->m_nGwMac; pZona->m_nGwMacLen=netw->m_nGwMacLen; } } if(!pZona->Connected()) { pZona->SetConnected(TRUE); ConnectZone(pZona,netw); } } _time32((__time32_t*)&pZona->m_nTimeConnected); pZona->SetState(fTouch,TRUE); netw->zone_ID=pZona->m_nID; netw->ARPWatch=pZona->m_nSettings & cNetZone::fARPWatch; cNetAdapter * pAdapter=FindAdapterByID(netw->adapter_ID); if(netw->adapter_ID>0 && pAdapter) { pAdapter->m_nZoneID=pZona->m_nID; if(pAdapter->QState(fGateway)) { m_zones[0].m_sFrendlyName=m_zones[0].m_sConnectionName; m_zones[0].m_sFrendlyName+=" thru "; m_zones[0].m_sFrendlyName+=pZona->m_sFrendlyName; } } return 1; }
cNetZone * CNetWatcherTask::NewZoneByNet(NETWATCH::Network * netw) { //if (netw->m_nFlags & IP_ADAPTER_DHCP_ENABLED && netw->DnsSuffix[0]==0) // return 1; cNetAdapter *pAdapter=FindAdapterByID(netw->adapter_ID); if(!pAdapter) { PR_TRACE((g_root, prtERROR, TR "CNetWatcherTask::NewZoneByNet Error: cant find adapter with ID=%d",netw->adapter_ID)); return 0; } Lock_settings(); DWORD max_ID=m_settings.m_NextZoneID; while(TRUE) { DWORD x=0; while(x<m_adapters.size() || x<m_zones.size()) { if(x<m_adapters.size() && m_adapters[x].m_nZoneID>=max_ID) break; if(x<m_zones.size() && m_zones[x].m_nID>=max_ID) break; x++; } if(x>=m_adapters.size() && x>=m_zones.size()) break; max_ID++; } m_settings.m_NextZoneID=max_ID+1; Unlock_settings(); cNetZone zone; cNetZone *pZona=&zone; if(netw->m_nIfType!=IF_TYPE_SOFTWARE_LOOPBACK) { if(pAdapter->m_nSettings & cNetAdapter::fAskWhenNewZones) { pZona->m_nSettings|=cNetZone::fNeedToAsk; } else { if(FindZoneByID(pAdapter->m_nUndefZoneID)) { zone=*FindZoneByID(pAdapter->m_nUndefZoneID); pZona->SetState(fTemporary,TRUE); } else { PR_TRACE((g_root, prtIMPORTANT, TR "CNetWatcherTask:: Cant find default zone for adapter %S.",pAdapter->m_sAdapterFrendlyName.data())); pZona->m_nSettings|=cNetZone::fNeedToAsk; } } } pZona->m_nID=max_ID; pZona->SetState(fVisible,TRUE); pZona->SetConnected(TRUE); pZona->m_sAdapterWinName=netw->m_sAdapterWinName; pZona->m_nIfType=netw->m_nIfType; pZona->m_nAdapterID=netw->adapter_ID; _time32((__time32_t*)&pZona->m_nTimeCreated); pZona->m_sDnsSuffix=netw->DnsSuffix; pZona->m_nFlags=netw->m_nFlags; pZona->m_nTypeOfInterface=pAdapter->m_nTypeOfInterface; if(netw->HasIPv4) { if(netw->m_nIP4Net>0) { pZona->m_IP.SetV4(netw->m_nIP4Net); pZona->m_IP.SetV4MaskByIp(netw->m_nIP4NetMask); } pZona->m_nDhcpIPv4=netw->m_nDhcpIPv4; pZona->m_nDhcpMac=netw->m_nDhcpMac; pZona->m_nDhcpMacLen=netw->m_nDhcpMacLen; pZona->m_nGwIPv4=netw->m_nGwIPv4; pZona->m_nGwMac=netw->m_nGwMac; pZona->m_nGwMacLen=netw->m_nGwMacLen; } switch(netw->m_nIfType) { case MIB_IF_TYPE_PPP: pZona->m_sConnectionName=netw->AdapterFrendlyName; pZona->m_sFrendlyName=netw->AdapterFrendlyName; pZona->m_nSettings-=pZona->m_nSettings & cNetZone::fUptoGateway; pZona->m_nSeverity = cNetZone::znUntrusted; pZona->m_sRASPeer=netw->m_sRASPeer; break; case IF_TYPE_IEEE80211: pZona->m_sConnectionName=netw->SSID; pZona->m_sFrendlyName=netw->SSID; if(pZona->m_sDnsSuffix.size()>1) { if(pZona->m_sConnectionName.size()>0) pZona->m_sFrendlyName+="("; pZona->m_sFrendlyName+=pZona->m_sDnsSuffix; if(pZona->m_sConnectionName.size()>0) pZona->m_sFrendlyName+=")"; } pZona->m_nWiFiSecurity=netw->m_nWiFiSecurity; pZona->m_nWiFiAuthMode=netw->m_nWiFiAuthMode; pZona->m_nWiFiType=netw->m_nWiFiType; if(!IsLocalArea(&pZona->m_IP) || pZona->m_nWiFiAuthMode==Ndis802_11AuthModeOpen || ( pZona->m_nWiFiSecurity==Ndis802_11EncryptionNotSupported || pZona->m_nWiFiSecurity==Ndis802_11EncryptionDisabled || pZona->m_nWiFiSecurity==Ndis802_11Encryption1KeyAbsent )) pZona->m_nSeverity = cNetZone::znUntrusted; else pZona->m_nSeverity=cNetZone::znNetBIOS; break; case IF_TYPE_SOFTWARE_LOOPBACK: pZona->m_nTypeOfInterface=If_LoopBack; pZona->m_sFrendlyName="localhost"; //pZona->SetState(fVisible,FALSE); pZona->m_nSeverity=cNetZone::znTrusted; pZona->m_nSettings-=pZona->m_nSettings & cNetZone::fNeedToAsk; break; default: //ethernet if(IsLocalArea(&pZona->m_IP)) pZona->m_nSeverity=cNetZone::znNetBIOS; else pZona->m_nSeverity=cNetZone::znUntrusted; pZona->m_nMac=netw->m_nMac; pZona->m_nMacLen=netw->m_nMacLen; pZona->m_sConnectionName=netw->AdapterDesc; pZona->m_sFrendlyName=netw->AdapterFrendlyName; if(netw->m_nFlags & IP_ADAPTER_DHCP_ENABLED && pZona->m_sDnsSuffix.size()>0) { pZona->m_sFrendlyName=pZona->m_sDnsSuffix; pZona->m_sFrendlyName+="("; pZona->m_sFrendlyName+=netw->AdapterFrendlyName; pZona->m_sFrendlyName+=")"; } else { if(netw->m_nIP4Net>0) { cIpMask ip; ip.SetV4(netw->m_nIP4Net); ip.SetV4MaskByIp(netw->m_nIP4NetMask); char str1[100]; ip.ToStr(str1,100); pZona->m_sFrendlyName=str1; pZona->m_sFrendlyName+="("; pZona->m_sFrendlyName+=netw->AdapterFrendlyName; pZona->m_sFrendlyName+=")"; } } pZona->m_nSettings|=cNetZone::fARPWatch; } PR_TRACE((g_root, prtIMPORTANT, TR "CNetWatcherTask:: Add new zone %S\n",zone.m_sFrendlyName)); if(pZona->QState(fTemporary)) pZona->m_sFrendlyName+="(temporary)"; pZona=&m_zones.push_back(zone); return pZona; }
BOOL CNetWatcherTask::UpdateARPWatch(PMIB_IPNETTABLE ARPTable) { if(!ARPTable) return 0; DWORD ArpChanged=0; PMIB_IPNETROW table=ARPTable->table; DWORD dwNumEntries=ARPTable->dwNumEntries; DWORD ARPSize=m_ARPWatch.size(); DWORD last_index=0; DWORD zone_ID=0; for(DWORD x=0;x<dwNumEntries;x++) { PMIB_IPNETROW IpMac=&table[x]; if(IpMac->dwType<3) continue; if(IpMac->dwIndex!=last_index) { last_index=IpMac->dwIndex; zone_ID=m_ArpWatchZones[last_index]; } if(zone_ID==0) continue; DWORD ip=IpMac->dwAddr; DWORD y; cARPWatch *row=0; for(y=0;y<ARPSize;y++) { row=&m_ARPWatch[y]; if(row->m_nTimeDeleted==0 && zone_ID==row->m_nZoneID && ip==row->m_nIP4) { if(row->m_nMacLen!=min(IpMac->dwPhysAddrLen,sizeof(row->m_nMac)) || memcmp(&row->m_nMac,IpMac->bPhysAddr,row->m_nMacLen)!=0) { _time32((__time32_t*)&row->m_nTimeDeleted); } break; } } if(y==ARPSize || row==0 || row->m_nTimeDeleted) { ArpChanged=1; cARPWatch new_row; new_row.m_nIP4=ip; new_row.m_nZoneID=zone_ID; new_row.m_nMacLen=min(IpMac->dwPhysAddrLen,sizeof(new_row.m_nMac)); memcpy(&new_row.m_nMac,IpMac->bPhysAddr,new_row.m_nMacLen); _time32((__time32_t*)&new_row.m_nTimeCreated); if(y!=ARPSize) { //message to user. ARP changed! //old m_ARPWatch[y], new new_row m_ARPWatch.push_back(new_row); PR_TRACE((g_root, prtIMPORTANT, TR "CNetWatcherTask:: ARP changed")); } else { //New ARP! new_row m_ARPWatch.push_back(new_row); } //aSize=m_ARPWatch.size(); } } return ArpChanged; }