Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Please, help with COM obj. calling web service.

39 views
Skip to first unread message

Val Melamed

unread,
May 21, 2003, 2:39:07 PM5/21/03
to
The environment is VS 2003. Created a simple C++/ATL COM object and from
one of the methods I'm trying to call a web service. Generated all the ref.
files, etc. All compiles but does not register. Regsvr32 displays:

LoadLibrary("C:\...\MyComp.dll") failed - The specified procedure could not
be found.

Even DllMain does not get called. It is almost as if some dll is missing -
if I comment out all refrences and calls to the web service proxy object it
registers with no problems. But nothing is missing because if I include the
same web proxy generated files in a plain Win32 test app - it all loads and
works.

What am I doing wrong here?... What is missing? Any idea?

Val


Brian Muth

unread,
May 21, 2003, 2:43:44 PM5/21/03
to
Run depends.exe on your DLL, and see what DLL's it requires.

"Val Melamed" <vmel...@etrade.com> wrote in message
news:ObW2Dh8H...@tk2msftngp13.phx.gbl...

Igor Tandetnik

unread,
May 21, 2003, 2:45:29 PM5/21/03
to
Use Depends.exe to find out which other DLLs your DLL depends on. Some
of them appear to be missing on the target machine.
--
With best wishes,
Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken

"Val Melamed" <vmel...@etrade.com> wrote in message
news:ObW2Dh8H...@tk2msftngp13.phx.gbl...

Val Melamed

unread,
May 21, 2003, 3:43:15 PM5/21/03
to
This was the first thing I did - nothing special, nothing seems to be
missing... but I didn't notice that the icon of ws2_32.dll is in pink and
also the exports GetAddrInfoW and FreeAddrInfoW are in pink, i.e. missing.

The version of ws2_32.dll is 5.0.2195.4874 created on Oct 8, 2002. What do
you think is going on? Bad dll or?...

Val

"Igor Tandetnik" <itand...@mvps.org> wrote in message
news:eTCMok8H...@TK2MSFTNGP10.phx.gbl...

Val Melamed

unread,
May 21, 2003, 4:11:15 PM5/21/03
to
GetAddrInfoW and FreeAddrInfoW are actually imports(?) in ws2_32.dll.

"Val Melamed" <vmel...@etrade.com> wrote in message

news:OKHCAF9H...@tk2msftngp13.phx.gbl...

Igor Tandetnik

unread,
May 21, 2003, 4:17:17 PM5/21/03
to
"Val Melamed" <vmel...@etrade.com> wrote in message
news:OKHCAF9H...@tk2msftngp13.phx.gbl...

> This was the first thing I did - nothing special, nothing seems to be
> missing... but I didn't notice that the icon of ws2_32.dll is in pink
and
> also the exports GetAddrInfoW and FreeAddrInfoW are in pink, i.e.
missing.
>
> The version of ws2_32.dll is 5.0.2195.4874 created on Oct 8, 2002.
What do
> you think is going on? Bad dll or?...

In my Platform SDK headers, GetAddrInfoW is defined under

#if (_WIN32_WINNT >= 0x0502)

which means Win 2003 Server only. What is your target OS? How did you
get to build with this symbol in the first place? GetAddrInfo is not
even documented in April 2003 MSDN

Val Melamed

unread,
May 21, 2003, 4:39:44 PM5/21/03
to
GetAddrInfo is called in atlsocket.inl CSocketAddr::FindAddr and
FreeAddrInfo is called in the destructor CSocketAddr::~CSocketAddr().
GetAddrInfo(A/W) are defined in ws2tcpip.h:

C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\include\ws2tcpip.h

And I do not see this #if. I have

#define _WIN32_WINNT 0x0500

I'm on Windows 2000 professional.

CSocketAddr::FindAddr should not be calling GetAddrInfo, right?

"Igor Tandetnik" <itand...@mvps.org> wrote in message

news:%23A1b7X9...@tk2msftngp13.phx.gbl...

Igor Tandetnik

unread,
May 21, 2003, 5:15:04 PM5/21/03
to
I see the problem. <ws2tcpip.h> header shipped with VC7 is less
restrictive than the one shipped with February 2003 Platform SDK. Some
stuff that should have been restricted to Win2003 Server only is not.
And ATL socket classes use it.

This is a serious problem. With the latest Platform SDK, you get
compiler errors as soon as you #include <atlsocket.h>, unless you define
_WIN32_WINNT to 0x0502. I'm not sure what would be the best way to deal
with it. I guess for now, you can stay with SDK headers as shipped with
VC and avoid using CSocketAddr::FindAddr.


--
With best wishes,
Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken

"Val Melamed" <vmel...@etrade.com> wrote in message
news:eNS6hk9H...@TK2MSFTNGP11.phx.gbl...

Val Melamed

unread,
May 21, 2003, 6:16:16 PM5/21/03
to
Yep, it's a bug!

I'll think of something like renaming and rewriting the .inl... The problem
is that it is called by the generated web service client, not by me.

Igor, thank you very much for your help and also for all the other articles
in this group! Very helpful!!!

Val Melamed


"Igor Tandetnik" <itand...@mvps.org> wrote in message

news:umE3N49H...@TK2MSFTNGP10.phx.gbl...

Val Melamed

unread,
May 21, 2003, 7:11:44 PM5/21/03
to
Here are my solutions to the problem:

I. Do it all in MBCS

or

II. Try the following:

1. Back-up (!) all *.h and *.inl files that refer to the structure
ADDRINFOT.
2. Replace in all files ADDRINFOT with addrinfo
3. In the file atlsocket.inl replace all FreeAddrInfo with freeaddrinfo
4. In the file atlsocket.inl replace all GetAddrInfo with getaddrinfo
5. In the file atlsocket.inl(52) change the last line of the method
CSocketAddr::FindAddr from

return ::GetAddrInfo(szHost, szPortOrServiceName, &hints, &m_pAddrs);

to

USES_CONVERSION;
return ::getaddrinfo(T2CA(szHost), T2CA(szPortOrServiceName), &hints,
&m_pAddrs);

Got all to compile, link and load. :) All disclaimers about the above
you can think of do apply!

It is possible that some libraries wouldn't work (but they would't work
with the original code either).

or

III. (My favorite!) Take a vacation until MS releases patch(es).

Val

"Igor Tandetnik" <itand...@mvps.org> wrote in message

news:umE3N49H...@TK2MSFTNGP10.phx.gbl...

Igor Tandetnik

unread,
May 22, 2003, 9:21:11 AM5/22/03
to
"Val Melamed" <vmel...@etrade.com> wrote in message
news:u7XZZ5%23HDH...@tk2msftngp13.phx.gbl...

> II. Try the following:
>
> 1. Back-up (!) all *.h and *.inl files that refer to the structure
> ADDRINFOT.
> 2. Replace in all files ADDRINFOT with addrinfo
> 3. In the file atlsocket.inl replace all FreeAddrInfo with
freeaddrinfo
> 4. In the file atlsocket.inl replace all GetAddrInfo with
getaddrinfo
> 5. In the file atlsocket.inl(52) change the last line of the
method
> CSocketAddr::FindAddr from
>
> return ::GetAddrInfo(szHost, szPortOrServiceName, &hints,
&m_pAddrs);
>
> to
>
> USES_CONVERSION;
> return ::getaddrinfo(T2CA(szHost), T2CA(szPortOrServiceName),
&hints,
> &m_pAddrs);
>
> Got all to compile, link and load. :) All disclaimers about the
above
> you can think of do apply!

It's only going to work on XP and Win2003 Server. getaddrinfo and
freeaddrinfo are not available on earlier systems. Confirmed with
Depends.exe on Win2K Pro.

Val Melamed

unread,
May 23, 2003, 8:48:19 PM5/23/03
to
Just a clarification: Actually, I got it to run on Win2K Pro with installed
the lates public PSDK and the hack in the atl source libraries. In the
documentation you can find getaddrinfo and freeadrinfo but no
GetAddrInfo(A/W) and FreeAddrInfo(A/W). This was working in my client
initially because GetAddrInfo is #def-ed to getaddrinfo for MBCS and #def-ed
to GetAddrInfoW for _UNICODE. So, I guess the temporary workaround would be
to install the latest PSDK and pray that the MS fix will be out before your
release date.

Val

P.S. How do I report a bug to MS?

"Igor Tandetnik" <itand...@mvps.org> wrote in message

news:eR9EFUGI...@TK2MSFTNGP10.phx.gbl...

Sam

unread,
May 28, 2003, 11:00:12 AM5/28/03
to
If it helps, we were able to work around a similar problem by deriving a
class from ZEvtSyncSocket and overriding the functions that use GetAddrInfo
and FreeAddrInfo. This may work for you.

Sam


0 new messages