Bug 42293 - Accessing Wincrypt API on older version of the Microsoft Platform SDK
Summary: Accessing Wincrypt API on older version of the Microsoft Platform SDK
Status: RESOLVED FIXED
Alias: None
Product: APR
Classification: Unclassified
Component: APR (show other bugs)
Version: HEAD
Hardware: Other other
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache Portable Runtime bugs mailinglist
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2007-04-29 11:58 UTC by Davi Arnaut
Modified: 2007-06-29 10:06 UTC (History)
0 users



Attachments
Older version of the Wincrypt.h header requires _WIN32_WINNT (575 bytes, patch)
2007-04-29 12:00 UTC, Davi Arnaut
Details | Diff
Places wincrypt immediately after apr.h (390 bytes, patch)
2007-05-02 00:24 UTC, Curt Arnold
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Davi Arnaut 2007-04-29 11:58:58 UTC
Older version (ie: one that comes with Visual Studio 6.0) of the Wincrypt.h header requires _WIN32_WINNT 
>= 0x0400, which is already defined by apr.h (apr.hw).
Comment 1 Davi Arnaut 2007-04-29 12:00:48 UTC
Created attachment 20069 [details]
Older version of the Wincrypt.h header requires _WIN32_WINNT 

Build tested on older and newer (2003) platform SDK
Comment 2 Curt Arnold 2007-05-01 23:39:40 UTC
Rev 421805 (2006/07/14) changed the sequence of imports in misc/win32/rand.c

http://svn.apache.org/viewvc/apr/apr/trunk/misc/win32/rand.c?r1=170461&r2=421805

The change was mentioned in http://marc.info/?l=apr-dev&m=115285245603323&w=2.  I'm guessing 
it is MinGW related since it mentioned librpcrt4.a.

Xi Wang reported a compile failure related to this change in 2006-09-18: http://marc.info/?l=apr-
dev&m=115856814824660&w=2.  But the connection to the recent change did not seem to be made 
and there did not seem to be any follow through.

I'm seeing the same compile failure on my pretty vanilla VC6 set up (no later platform SDK, etc) on 
Windows 2000.


p.s.  I have set up a MSYS+MinGW build environment and I can confirm the attached patch (which 
reverts rev 421805) does cause the MSYS+MinGW build to break, but fixing the VC6 build takes 
precedence.  I plan to research it tomorrow (2007-05-02, US Central DT) and can hopefully come up 
with a solution that allows both to build. 
Comment 3 Curt Arnold 2007-05-02 00:24:52 UTC
Created attachment 20084 [details]
Places wincrypt immediately after apr.h
Comment 4 Curt Arnold 2007-05-02 00:32:35 UTC
Something in apr_private.h when preprocessed with the MinGW Windows headers effectively redefines 
WINADVAPI from __stdcall to empty which results in a link failure when wincrypt.h is placed after an 
include to apr_private.h.  This patch has been tested both the VC6 (which failed with the current SVN 
HEAD) and MSYS+MinGW (which failed with the first patch).  Have also successfully compiled with VS 
2005.
Comment 5 Davi Arnaut 2007-05-02 09:47:25 UTC
Thanks for tracking this down. It seems related to this bug report:

https://sourceforge.net/tracker/?func=detail&atid=302435&aid=1397036&group_id=2435
Comment 6 Davi Arnaut 2007-06-29 10:00:37 UTC
Committed to trunk as r551958.

http://svn.apache.org/viewvc?view=rev&revision=551958
Comment 7 Davi Arnaut 2007-06-29 10:06:24 UTC
Backported as r551959.

http://svn.apache.org/viewvc?view=rev&revision=551959