编译环境:Microsoft Visual C++ .NET 2005 英文版(VSTS) [1]下载源代码和支持库 (源文件需从CVS中下载最新的版本,否则不能通过编译) 6 DirectX9 SDK 注意DirectX9.0c中不包含directshow部分需另外下载 [2]编译eMule所需要的库。 Release时Run-Time Libaray都统一用用Multi-threaded (/MT) Debug时 Run-Time Libaray 都统一用用 (/MTD) 其中:zlib,libpng和crypto库 编译后的*.lib文件应分别放入./Debug 和./Release文件夹中 ResizableLib后产生的lib文件放入./DebugUnicode ,./ReleaseUnicode文件夹中 [3]编译emule 解压emule源文件后产生如下目录: eMule0.47a-Sources …….. id3lib 库文件,需先编译,方法同上 …….. srchybrid //emule源文件,最后编译 将libpng等库目录拷入eMule0.47a-Sources目录 最后目录结构如下: eMule0.47a-Sources …….. id3lib 库文件,需先编译,方法同上 …….. srchybrid //emule源文件,最后编译 ……………CxImage //需先编译 ……...png ….Debug/png.lib … Release/png.lib ………Zlib …………….Debug/zlib.lib …………….Release/zlib.lib 等 在工程设置中的Additional include directories ,把directXsdk的include目录添加进去 以上都作好了以后就可以编译emule了,编译时可以先把 warning level 设成 OFF 编译时大概有40多个错误。 修改如下:1.把如i为定义之类的简单错误改正 2.对GetLocalTm函数的处理 time_t tLast=safe_mktime(last.GetLocalTm());//错误处 struct tm tmp;//新加 time_t tLast=safe_mktime(last.GetLocalTm(&tmp));//修改 3. 修改AfxBeginMsgMapTemplate.h文件 在#else #error "MFC version not supported" 前添加如下内容 #elif _MFC_VER == 0x0800 #define BEGIN_MESSAGE_MAP_TEMPLATE(templateList, templateClass, theClass, baseClass) \\ PTM_WARNING_DISABLE \\ templateList const AFX_MSGMAP* templateClass::GetMessageMap() const \\ { return theClass::GetThisMessageMap(); } \\ templateList const AFX_MSGMAP* PASCAL templateClass::GetThisMessageMa() \\ { \\ typedef theClass ThisClass; \\ typedef baseClass TheBaseClass; \\ static const AFX_MSGMAP_ENTRY _messageEntries[] = \\ { 4.修改DialogMinTrayBtn.h文件 afx_msg UNIT OnNcHitTest(CPoint point);改成 afx_msg LRESULT OnNcHitTest(CPoint point); 5. 修改DialogMinTrayBtn.cpp文件 TEMPLATE UNIT CDialogMinTrayBtn<BASE>::OnNcHitTest(CPoint point)改成 TEMPLATE LRESULT CDialogMinTrayBtn<BASE>::OnNcHitTest(CPoint point) 6. emule.cpp 修改(不太确定,这样会不会出问题): #if _MFC_VER==0x0700 || _MFC_VER==0x0710 || _MFC_VER==0x0800 //此处新添 void __cdecl __AfxSocketTerm() { #if defined(_AFXDLL) && (_MFC_VER==0x0700 || _MFC_VER==0x0710) VERIFY( WSACleanup() == 0 ); #else _AFX_SOCK_STATE* pState = _afxSockState.GetData(); if (pState->m_pfnSockTerm != NULL){ VERIFY( WSACleanup() == 0 ); pState->m_pfnSockTerm = NULL; } #endif } #else #error "You are using an MFC version which may require a special version of the above function!" #endif 7. SearchManager.cpp 这里好像是个bug,该动如下 void CSearchManager::JumpStart() { // Find any searches that has stalled and jumpstart them. // This will also prune all searches. int flag=0; time_t tNow = time(NULL); for (SearchMap::iterator itSearchMap = m_mapSearches.begin(); itSearchMap =m_mapSearches.end(); ) { flag=0; // Each type has it's own criteria for being deleted or jumpstarted. switch(itSearchMap->second->GetSearchTypes()) { case CSearch::FILE: { if (itSearchMap->second->m_tCreated + SEARCHFILE_LIFETIME < tNow) { delete itSearchMap->second; itSearchMap = m_mapSearches.erase(itSearchMap); flag=1; } else if (itSearchMap->second->GetAnswers() >= SEARCHFILE_TOTAL || itSearchMap->second->m_tCreated + SEARCHFILE_LIFETIME - SEC(20) < tNow) itSearchMap->second->PrepareToStop(); else itSearchMap->second->JumpStart(); break; } case CSearch::KEYWORD: { if (itSearchMap->second->m_tCreated + SEARCHKEYWORD_LIFETIME < tNow) { // Tell GUI that search ended if (theApp.emuledlg && theApp.emuledlg->searchwnd) theApp.emuledlg->searchwnd->CancelKadSearch(itSearchMap->second->GetSearchID()); delete itSearchMap->second; itSearchMap = m_mapSearches.erase(itSearchMap); flag=1; } else if (itSearchMap->second->GetAnswers() >= SEARCHKEYWORD_TOTAL || itSearchMap->second->m_tCreated + SEARCHKEYWORD_LIFETIME - SEC(20) < tNow) itSearchMap->second->PrepareToStop(); else itSearchMap->second->JumpStart(); break; } case CSearch::NOTES: { if (itSearchMap->second->m_tCreated + SEARCHNOTES_LIFETIME < tNow) { delete itSearchMap->second; itSearchMap = m_mapSearches.erase(itSearchMap); flag=1; } else if (itSearchMap->second->GetAnswers() >= SEARCHNOTES_TOTAL || itSearchMap->second->m_tCreated + SEARCHNOTES_LIFETIME - SEC(20) < tNow) itSearchMap->second->PrepareToStop(); else itSearchMap->second->JumpStart(); break; } case CSearch::FINDBUDDY: { if (itSearchMap->second->m_tCreated + SEARCHFINDBUDDY_LIFETIME < tNow) { delete itSearchMap->second; itSearchMap = m_mapSearches.erase(itSearchMap); flag=1; } else if (itSearchMap->second->GetAnswers() >= SEARCHFINDBUDDY_TOTAL || itSearchMap->second->m_tCreated + SEARCHFINDBUDDY_LIFETIME - SEC(20) < tNow) itSearchMap->second->PrepareToStop(); else itSearchMap->second->JumpStart(); break; } case CSearch::FINDSOURCE: { if (itSearchMap->second->m_tCreated + SEARCHFINDSOURCE_LIFETIME < tNow) { delete itSearchMap->second; itSearchMap = m_mapSearches.erase(itSearchMap); flag=1; } else if (itSearchMap->second->GetAnswers() >= SEARCHFINDSOURCE_TOTAL || itSearchMap->second->m_tCreated + SEARCHFINDSOURCE_LIFETIME - SEC(20) < tNow) itSearchMap->second-&g[FS:PAGE]t;PrepareToStop(); else itSearchMap->second->JumpStart(); break; } case CSearch::NODE: { if (itSearchMap->second->m_tCreated + SEARCHNODE_LIFETIME < tNow) { delete itSearchMap->second; itSearchMap = m_mapSearches.erase(itSearchMap); flag=1; } else itSearchMap->second->JumpStart(); break; } case CSearch::NODECOMPLETE: { if (itSearchMap->second->m_tCreated + SEARCHNODE_LIFETIME < tNow) { // Tell Kad that it can start publishing. CKademlia::GetPrefs()->SetPublish(true); delete itSearchMap->second; itSearchMap = m_mapSearches.erase(itSearchMap); flag=1; } else if ((itSearchMap->second->m_tCreated + SEARCHNODECOMP_LIFETIME < tNow) && (itSearchMap->second->GetAnswers() >= SEARCHNODECOMP_TOTAL)) { // Tell Kad that it can start publishing. CKademlia::GetPrefs()->SetPublish(true); delete itSearchMap->second; itSearchMap = m_mapSearches.erase(itSearchMap); flag=1; } else itSearchMap->second->JumpStart(); break; } case CSearch::STOREFILE: { if (itSearchMap->second->m_tCreated + SEARCHSTOREFILE_LIFETIME < tNow) { delete itSearchMap->second; itSearchMap = m_mapSearches.erase(itSearchMap); flag=1; } else if (itSearchMap->second->GetAnswers() >= SEARCHSTOREFILE_TOTAL || itSearchMap->second->m_tCreated + SEARCHSTOREFILE_LIFETIME - SEC(20) < tNow) itSearchMap->second->PrepareToStop(); else itSearchMap->second->JumpStart(); break; } case CSearch::STOREKEYWORD: { if (itSearchMap->second->m_tCreated + SEARCHSTOREKEYWORD_LIFETIME < tNow) { delete itSearchMap->second; itSearchMap = m_mapSearches.erase(itSearchMap); flag=1; } else if (itSearchMap->second->GetAnswers() >= SEARCHSTOREKEYWORD_TOTAL || itSearchMap->second->m_tCreated + SEARCHSTOREKEYWORD_LIFETIME - SEC(20)< tNow) itSearchMap->second->PrepareToStop(); else itSearchMap->second->JumpStart(); break; } case CSearch::STORENOTES: { if (itSearchMap->second->m_tCreated + SEARCHSTORENOTES_LIFETIME < tNow) { delete itSearchMap->second; itSearchMap = m_mapSearches.erase(itSearchMap); flag=1; } else if (itSearchMap->second->GetAnswers() >= SEARCHSTORENOTES_TOTAL || itSearchMap->second->m_tCreated + SEARCHSTORENOTES_LIFETIME - SEC(20)< tNow) itSearchMap->second->PrepareToStop(); else itSearchMap->second->JumpStart(); break; } default: { if (itSearchMap->second->m_tCreated + SEARCH_LIFETIME < tNow) { delete itSearchMap->second; itSearchMap = m_mapSearches.erase(itSearchMap); flag=1; } else itSearchMap->second->JumpStart(); break; } } if (flag==0) ++itSearchMap; } } (iwgh) |