Closed Bug 83976 Opened 23 years ago Closed 23 years ago

Compilation problems in activex control with Microsoft Platform SDK.

Categories

(Core Graveyard :: Embedding: ActiveX Wrapper, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED
mozilla0.9.2

People

(Reporter: wtc, Assigned: adamlock)

References

Details

Attachments

(1 file)

I have the February 2001 Edition of Microsoft Platform SDK
installed on my Windows 2000 PC.  The Platform SDK has some
system headers that are supposed to be newer than the system
headers included with Visual C++ 6.0.  With the Platform SDK
headers, I have two compilation problems in
mozilla/embedding/browser/activex/src/control/.

The first problem is a known problem with InlineIsEqualGUID()
and Microsoft has a recommended workaround.  It is described
in Microsoft Knowledge Base Article ID Q243298
(http://support.microsoft.com/support/kb/articles/Q243/2/98.ASP).

The second problem is caused by the inclusion of winsock.h by
windows.h, which prevents StdAfx.h from including winsock2.h.
In the version windows.h in Visual C++ 6.0, it includes either
winsock2.h or winsock.h depending on the value of the _WIN32_WINNT
macro:

#if(_WIN32_WINNT >= 0x0400)
#include <winsock2.h>
#include <mswsock.h>
#else
#include <winsock.h>
#endif /* _WIN32_WINNT >=  0x0400 */

I believe this is why StdAfx.h defines _WIN32_WINNT to
be 0x0400.

In the version of windows.h in the Platform SDK, the
above code has become simply the following:

#include <winsock.h>

I don't know why.  I didn't find any articles about this
in the Microsoft Knowledge Base.  There are three possible
workarounds.

1. In StdAfx.h, make sure that we include winsock2.h
   before we include windows.h.  Note that we include
   windows.h indirectly via the inclusion of atlbase.h.
   This solution requires that the headers be included
   in a specific order.
2. In StdAfx.h, define the macro _WINSOCKAPI_ to prevent
   the inclusion of winsock.h in windows.h.  This is
   what winsock2.h does.  I don't like this solution
   because _WINSOCKAPI_ is an undocumented macro
   (the include-once macro in winsock.h).
3. In StdAfx.h, define WIN32_LEAN_AND_MEAN.  This prevents
   windows.h from including a bunch of headers, including
   winsock2.h and winsock.h.  We will need to include the
   headers that we need explicitly though.

I like solution #1 the best.

I will attach a patch containing Microsoft's recommended
workaround for the first problem and solution #1 for
the second problem..
Attached patch Proposed patch.Splinter Review
Keywords: mozilla0.9.2, review
Hi Wan-Teh,

You patch builds cleanly on my non-SDK enhanced VC6++ as well. I'm happy to give
you r=adamlock and a= for check in or would you rather I did the checkin?
Hi Adam,

Thank you for your review.  Could you check in the patch please?
My mozilla tree is on my PC at home. :-)
Reassign
Assignee: locka → adamlock
Keywords: patch
Target Milestone: --- → mozilla0.9.2
sr=blizzard
a=blizzard for drivers for the trunk
Blocks: 83989
Fix is checked in.

I actually ran into compile problems with moving winsock2.h but I didn't see 
them yesterday because I made the change to the wrong StdAfx.h. Therefore 
instead of moving the #include I have just deleted it. This appears to have no 
affect on my machines or tinderbox. Can you verify that your machine with the 
Platform SDK builds without winsock2.h?
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You are right.  I just put the winsock2.h inclusion back,
rebuilt *without* the Platform SDK headers, and could not
compile StdAfx.cpp.  I have had a lot of problem with
winsock2.h before and resorted to just including windows.h,
which includes winsock2.h if _WIN32_WINNT is 0x0400 or higher.

If you don't need winsock2.h, it is a good idea to just
delete it.  In fact, that was one of the solutions I tried.

I verified that I could build just fine with Platform SDK
headers.  Thank you for your help.
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: