首发自http://jiangliwei.blogbus.com/logs/28509863.html
转载请注明来源,谢谢。
代码来源:
官方eMule-VeryCD源码包
http://download.VeryCD.com/eMule-VeryCD-src.rar
编译好的第三方库,来http://www.VeryCD.com/groups/eMuleDev/209863.topic
http://download.VeryCD.com/emule071112_libsForVS2005.rar
编译环境:
WindowsXPsp3CN
VC2008EN + SP1
ATL Server http://www.codeplex.com/AtlServer
修改过程:(只修改error的部分,警告看着不爽自己整)
1. 解压缩源码包,其中src目录下为emule源码。
2. vs2008打开emule.sln,首先是转换工程向导,转换之。
3. 首次build,会提示你如下错误。
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\..\src\mfc\afximpl.h(631) : error C2059: syntax error : '<L_TYPE_raw>'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\..\src\mfc\afximpl.h(631) : error C2238: unexpected token(s) preceding ';'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\..\src\mfc\afximpl.h(635) : error C2059: syntax error : '<L_TYPE_raw>'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\..\src\mfc\afximpl.h(635) : error C2238: unexpected token(s) preceding ';'
这个错误是由于WINVER定义不正确造成的,编辑stdafx.h,更改代码如下:
#ifndef WINVER
#define WINVER 0x0501
#endif
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
4. 重新build,又会有一大坨error,其中最多的是
error C2011: 'tagMENUINFO' : 'struct' type redefinition
结构重复定义,查看winuser.h就会发现如下定义
#if(WINVER >= 0x0500)
...
typedef struct tagMENUINFO
{
DWORD cbSize;
DWORD fMask;
DWORD dwStyle;
UINT cyMax;
HBRUSH hbrBack;
DWORD dwContextHelpID;
ULONG_PTR dwMenuData;
} MENUINFO, FAR *LPMENUINFO;
typedef MENUINFO CONST FAR *LPCMENUINFO;
还是WINVER的问题,编辑TitleMenu.h,更改代码如下:
#if (WINVER < 0x0500)
typedef struct tagMENUINFO
{
DWORD cbSize;
DWORD fMask;
DWORD dwStyle;
UINT cyMax;
HBRUSH hbrBack;
DWORD dwContextHelpID;
ULONG_PTR dwMenuData;
} MENUINFO, FAR *LPMENUINFO;
typedef MENUINFO CONST FAR *LPCMENUINFO;
#endif
或者直接注释掉也可以
5. 重新build(很可能你改完了上面的代码后,上一次build仍没有结束,要毫不犹豫地cancel),再次出现一大坨error,总共有两类()
1>.\UPnpNat.cpp(706) : error C2440: '=' : cannot convert from 'const char *' to 'char *'
1>.\SharedFilesCtrl.cpp(585) : error C2039: 'bWin95' : is not a member of 'AUX_DATA'
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\..\src\mfc\afximpl.h(54) : see declaration of 'AUX_DATA'
1>SearchListCtrl.cpp
1>.\SearchListCtrl.cpp(1729) : error C2039: 'bWin95' : is not a member of 'AUX_DATA'
1> C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\..\src\mfc\afximpl.h(54) : see declaration of 'AUX_DATA'
其中第一个很好改,强制转换类型即可。
至于第二种错误,AUX_DATA中已不再包含成员bWin95,如有需要参与运算的部分则bWin95=0,具体请自行google。
这个改起来也很容易,将所有bWin95的部分注释掉即可,其多半是参与if判断,需要的地方统统取FALSE即可。涉及到的文件共有14个
修改举例
lf.lfQuality = afxData.bWin95 ? NONANTIALIASED_QUALITY : ANTIALIASED_QUALITY;
改为
lf.lfQuality = ANTIALIASED_QUALITY;
if (!afxData.bWin95 && iItem >= 0)
改为
if (iItem >= 0)






























