CSMTPConnection, ws2_32.dll, and GetAddrInfoW
I have compiled an ATL COM object in VS.net 2003, in which I use the ATL CSMTPConnection class to send emails, however when I try to register the COM object on a Windows 2000 machine the registration fails.
The DLL ws2_32.dll appears to be missing the function GetAddrInfoW, the unicode version of GetAddrInfo. The registration works fine on WindowsXP.
Can I get this to work on Windows 2000?
Re: CSMTPConnection, ws2_32.dll, and GetAddrInfoW
I think GetAddrInfoW requires Windows 2k "Pro". Is that what you have?
If not, then maybe this discussion thread might help: http://groups-beta.google.com/group/...4fa2051a673208
Or, it might relate to a known bug in atlsocket.inl. See this discussion thread: http://groups.google.com/group/micro...9ef573ae1d76e3
Incidentally, the exact opposite symptoms that you described (i.e., it doesn't work on XP) are described in this KB article, which also mentions your CSMTPConnection class: "BUG: Cannot Locate the Procedure Entry Point FreeAddrInfoW When You Run an Application on Windows XP" at http://support.microsoft.com/default...b;en-us;822334
Maybe it's related?
Mike
Re: CSMTPConnection, ws2_32.dll, and GetAddrInfoW
Thanks fo the links Mike. I think I've got it sorted now.
The CSMTPConnection class uses the CSocketAddr class which uses the function GetAddrInfo, which is not supported on Windows2000 (only XP/2003).
The version of platform SDK I was using incorrectly provides linkage to this function even when the target OS is 2000. When I installed the Platform SDK for 2003 the project fails to build for 2000.
I then had to include the following lines before the atl headers:
#include <winsock2.h>
#include <ws2tcpip.h>
#include <wspiapi.h>
#define GetAddrInfo WspiapiGetAddrInfo
#define FreeAddrInfo WspiapiFreeAddrInfo
This allows the use of getaddrinfo emulation function that apparently works on 2000, although I haven't tested this yet.