Author: sginsberg
Date: Mon Sep 28 19:45:23 2009
New Revision: 43205

URL: http://svn.reactos.org/svn/reactos?rev=43205&view=rev
Log:
Hey Arch, how do you expect kernel32 to build with Microsoft's headers if you 
define a NTDDI_VERSION that conflicts with _WIN32_WINNT and makes sdkddkver.h 
cry? Remove the conflicting define from the .rbuild and redefine it in the 
header before including the NDK (this is needed because we need Vista types 
from the PSDK but require 2003 types from the NDK -- glorious, eh?).

Prepare sddkver.h for mingw-w64 import:
- Point out the fact that the header is in the public domain.
- Add some missing stuff, including a NTDDI_VERSION sanity check.
- Format fixes, add some comments

Modified:
    trunk/reactos/dll/win32/kernel32/k32.h
    trunk/reactos/dll/win32/kernel32/kernel32.rbuild
    trunk/reactos/include/psdk/sdkddkver.h

Modified: trunk/reactos/dll/win32/kernel32/k32.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/k32.h?rev=43205&r1=43204&r2=43205&view=diff
==============================================================================
--- trunk/reactos/dll/win32/kernel32/k32.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/k32.h [iso-8859-1] Mon Sep 28 19:45:23 2009
@@ -16,11 +16,15 @@
 #include <windows.h>
 #include <tlhelp32.h>
 
-#ifdef __GNUC__
-#include "intrin.h"
-#endif
+/* Redefine NTDDI_VERSION to 2K3 SP1 to get correct NDK definitions */
+#undef NTDDI_VERSION
+#define NTDDI_VERSION NTDDI_WS03SP1
 
 #include <ndk/ntndk.h>
+
+
+#undef NTDDI_WS03SP1
+
 
 /* CSRSS Header */
 #include <csrss/csrss.h>

Modified: trunk/reactos/dll/win32/kernel32/kernel32.rbuild
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/kernel32.rbuild?rev=43205&r1=43204&r2=43205&view=diff
==============================================================================
--- trunk/reactos/dll/win32/kernel32/kernel32.rbuild [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/kernel32.rbuild [iso-8859-1] Mon Sep 28 
19:45:23 2009
@@ -13,7 +13,6 @@
        <define name="_KERNEL32_" />
        <redefine name="_WIN32_WINNT">0x0600</redefine>
        <define name="__NO_CTYPE_INLINES" />
-       <define name="NTDDI_VERSION">0x05020100</define>
        <dependency>errcodes</dependency>
        <!-- See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38269
        <pch>k32.h</pch>

Modified: trunk/reactos/include/psdk/sdkddkver.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/sdkddkver.h?rev=43205&r1=43204&r2=43205&view=diff
==============================================================================
--- trunk/reactos/include/psdk/sdkddkver.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/sdkddkver.h [iso-8859-1] Mon Sep 28 19:45:23 2009
@@ -1,12 +1,31 @@
+/* ReactOS DDK
+
+This file is in the public domain.
+
+Header Name:
+
+    sdkddkver.h
+
+Abstract:
+
+    Version definitions for SDK and DDK.
+
+--*/
+
 #ifndef _INC_SDKDDKVER
 #define _INC_SDKDDKVER
 
-/* Version constants */
+/* _WIN32_WINNT */
 #define _WIN32_WINNT_NT4                    0x0400
 #define _WIN32_WINNT_WIN2K                  0x0500
 #define _WIN32_WINNT_WINXP                  0x0501
 #define _WIN32_WINNT_WS03                   0x0502
+#define _WIN32_WINNT_WIN6                   0x0600
+#define _WIN32_WINNT_VISTA                  0x0600
+#define _WIN32_WINNT_WS08                   0x0600
 #define _WIN32_WINNT_LONGHORN               0x0600
+
+/* _WIN32_IE */
 #define _WIN32_IE_IE20                      0x0200
 #define _WIN32_IE_IE30                      0x0300
 #define _WIN32_IE_IE302                     0x0302
@@ -19,6 +38,8 @@
 #define _WIN32_IE_IE60SP1                   0x0601
 #define _WIN32_IE_IE60SP2                   0x0603
 #define _WIN32_IE_IE70                      0x0700
+
+/* Mappings Between IE Version  and Windows Version */
 #define _WIN32_IE_NT4                       _WIN32_IE_IE20
 #define _WIN32_IE_NT4SP1                    _WIN32_IE_IE20
 #define _WIN32_IE_NT4SP2                    _WIN32_IE_IE20
@@ -39,7 +60,10 @@
 #define _WIN32_IE_XPSP2                     _WIN32_IE_IE60SP2
 #define _WIN32_IE_WS03                      0x0602
 #define _WIN32_IE_WS03SP1                   _WIN32_IE_IE60SP2
+#define _WIN32_IE_WIN6                      _WIN32_IE_IE70
 #define _WIN32_IE_LONGHORN                  _WIN32_IE_IE70
+
+/* NTDDI_VERSION */
 #define NTDDI_WIN2K                         0x05000000
 #define NTDDI_WIN2KSP1                      0x05000100
 #define NTDDI_WIN2KSP2                      0x05000200
@@ -71,13 +95,23 @@
 #define NTDDI_WS08SP3                       NTDDI_WIN6SP3
 #define NTDDI_WS08SP4                       NTDDI_WIN6SP4
 
+/* Version Fields in NTDDI_VERSION */
+#define OSVERSION_MASK                      0xFFFF0000
+#define SPVERSION_MASK                      0x0000FF00
+#define SUBVERSION_MASK                     0x000000FF
+
+/* Macros to Extract Version Fields From NTDDI_VERSION */
+#define OSVER(Version)                      ((Version) & OSVERSION_MASK)
+#define SPVER(Version)                      (((Version) & SPVERSION_MASK) >> 8)
+#define SUBVER(Version)                     (((Version) & SUBVERSION_MASK))
+
 /* Macros to get the NTDDI for a given WIN32 */
-#define NTDDI_VERSION_FROM_WIN32_WINNT2(ver)    ver##0000
-#define NTDDI_VERSION_FROM_WIN32_WINNT(ver)     
NTDDI_VERSION_FROM_WIN32_WINNT2(ver)
+#define NTDDI_VERSION_FROM_WIN32_WINNT2(Version) Version##0000
+#define NTDDI_VERSION_FROM_WIN32_WINNT(Version)  
NTDDI_VERSION_FROM_WIN32_WINNT2(Version)
 
 /* Select Default WIN32_WINNT Value */
 #if !defined(_WIN32_WINNT) && !defined(_CHICAGO_)
-#define  _WIN32_WINNT   0x0600
+#define _WIN32_WINNT    0x0600
 #endif
 
 /* Choose NTDDI Version */
@@ -117,4 +151,12 @@
 #endif
 #endif
 
+/* Make Sure NTDDI_VERSION and _WIN32_WINNT Match */
+#if ((OSVER(NTDDI_VERSION) == NTDDI_WIN2K) && (_WIN32_WINNT != 
_WIN32_WINNT_WIN2K)) || \
+    ((OSVER(NTDDI_VERSION) == NTDDI_WINXP) && (_WIN32_WINNT != 
_WIN32_WINNT_WINXP)) || \
+    ((OSVER(NTDDI_VERSION) == NTDDI_WS03) && (_WIN32_WINNT != 
_WIN32_WINNT_WS03))   || \
+    ((OSVER(NTDDI_VERSION) == NTDDI_WINXP) && (_WIN32_WINNT != 
_WIN32_WINNT_WINXP))
+#error NTDDI_VERSION and _WIN32_WINNT mismatch!
 #endif
+
+#endif


Reply via email to