1. Additional packages must be downloaded. Notice that you must downloaded the correct version which was originally used.
- MimePP
- OpenSSL headers and pre-compiled LIB files. The download links are from a third-party website as the OpenSSL source code from official website was not developed in VS and takes some efforts to make it compile under VS.
- Curl headers and pre-compiled libcurl_imp.lib. Although Curl has several LIB files, YPops source code only uses libcurl_imp.lib.
- Re-Lib: regular expression Library in C++ (included in source code package)
- Load the project under VS2005 and choose to upgrade from VS6 to VS2005 project
- Choose to build the project. There are initially some errors about missing include files and/or linker errors. Fixing these errors should be obvious; most of the time it's just about some hard-coded include paths which are no longer valid, or some .LIB files which are different between VS6 and VS2005.
- The not-so-obvious errors which must be fixed are listed below:
//Original: WORD wszWideString[MAX_PATH];
//Change to:
LPWSTR wszWideString = new wchar_t[MAX_PATH];
MultiByteToWideChar(CP_ACP, 0, lpszDestination, -1, wszWideString, MAX_PATH);
Error 2: MessageMap incompatibilities, see http://blog.voidnish.com/?p=91
BEGIN_MESSAGE_MAP(CHyperLink, CStatic)
//{{AFX_MSG_MAP(CHyperLink)
ON_WM_CTLCOLOR_REFLECT()
ON_WM_SETCURSOR()
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONUP()
ON_WM_SETFOCUS()
ON_WM_KILLFOCUS()
ON_WM_KEYDOWN()
//ON_WM_NCHITTEST() //commented out
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
Error 3: Constant char pointer and normal char pointer
//Original: char *ptr = strstr(str, startstr)
//Change to:
const char *ptr = strstr(str, startstr);
Error 4: VS6 function prototype doesn't require return type, but VS2005 does
//Original: Create(CWnd* pParent, LPCTSTR pszTitle, BOOL bSmooth = FALSE);
BOOL Create(CWnd* pParent, LPCTSTR pszTitle, BOOL bSmooth = FALSE);
- Tell the linker to link using correct library files (.lib) for OpenSSL, Curl and MimePP. For MimePP, download the makefile from its website and compile it using nmake:
- Copy extra DLL libraries for OpenSSL, curl, mimepp to the same directory as the executable output and choose to Start debugging.
- Upon startup, there will be runtime error.
Reasons: Attempt to modify an uninitialized array:
Luckily, this is easily to fix:
//Original: char wdir[_MAX_PATH];
//fixed:
char *wdir = new char[_MAX_PATH];
//code that follows (not modified)
if (getcwd(wdir, _MAX_PATH - 1) != NULL)
{
wdir[_MAX_PATH] = '\0';
logdir = CStringEx(wdir);
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.