STATUS_* redefinitions

Francois Gouget fgouget at free.fr
Fri Aug 13 06:01:55 CDT 2004


Including both ntstatus.h and winnt.h causes a lot of annoying macro
redefinitions which results in a lot of warnings with Visual C++. But
winnt.h does not define all the STATUS_* macros we need so we cannot
remove the #include "ntstatus.h".

So I have modified the tests to do:

#include "ntstatus.h"
#define WIN32_NO_STATUS
...
#include "winnt.h"

Which gets rid of the macro redefinitions. I also added a #define
_WIN32_WINNT 0x500 so the Windows headers give us the NTSTATUS
definition and put this all in the ntdll_test.h header so it's
consistent for all the ntdll test files, and so I can get the right
thing in generated.c.

Hmmm, maybe keeping the macro redefinition warnings as a way to detect
bad copy/paste would be better. In that case it would probably be enough
to define _WIN32_WINNT so things compile with the Windows headers. Let
me know if you prefer this solution.

This almost gets all the ntdll tests to compile. The next obstacle is
RTL_BITMAP which, according to the Windows ddk, should be defined in
ddk/ntddk.h along with a bunch of other functions and types. So moving
these definitions will be the next step.


Changelog:

 * dlls/ntdll/tests/ntdll_test.h   (new file)
   dlls/ntdll/tests/env.c
   dlls/ntdll/tests/generated.c
   dlls/ntdll/tests/large_int.c
   dlls/ntdll/tests/path.c
   dlls/ntdll/tests/rtl.c
   dlls/ntdll/tests/rtlbitmap.c
   dlls/ntdll/tests/rtlstr.c
   dlls/ntdll/tests/string.c
   tools/winapi/tests.dat

   Avoid annoying 'macro redefinition' warnings by defining
WIN32_NO_STATUS at the right time.
   Define _WIN32_WINNT otherwise we are missing some symbols with the
Windows headers.



--- /dev/null	2004-08-10 11:44:31.000000000 +0200
+++ dlls/ntdll/tests/ntdll_test.h	2004-08-11 16:00:52.000000000 +0200
@@ -0,0 +1,35 @@
+/*
+ * Unit test suite for ntdll path functions
+ *
+ * Copyright 2003 Eric Pouech
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdarg.h>
+
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x500 /* For NTSTATUS */
+#endif
+
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
+#include "windef.h"
+#include "winbase.h"
+#include "winnt.h"
+#include "winreg.h"
+#include "winternl.h"
+
+#include "wine/test.h"
Index: dlls/ntdll/tests/env.c
===================================================================
RCS file: /var/cvs/wine/dlls/ntdll/tests/env.c,v
retrieving revision 1.7
diff -u -r1.7 env.c
--- dlls/ntdll/tests/env.c	7 Feb 2004 01:03:17 -0000	1.7
+++ dlls/ntdll/tests/env.c	11 Aug 2004 14:00:21 -0000
@@ -18,15 +18,9 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */

-#include <stdarg.h>
 #include <stdio.h>
-#include "wine/test.h"
-#include "ntstatus.h"
-#include "windef.h"
-#include "winbase.h"
-#include "winnt.h"
-#include "winreg.h"
-#include "winternl.h"
+
+#include "ntdll_test.h"
 #include "wine/unicode.h"

 static NTSTATUS (WINAPI *pRtlMultiByteToUnicodeN)( LPWSTR dst, DWORD dstlen, LPDWORD reslen,
Index: dlls/ntdll/tests/generated.c
===================================================================
RCS file: /var/cvs/wine/dlls/ntdll/tests/generated.c,v
retrieving revision 1.9
diff -u -r1.9 generated.c
--- dlls/ntdll/tests/generated.c	4 May 2004 00:41:11 -0000	1.9
+++ dlls/ntdll/tests/generated.c	11 Aug 2004 14:43:39 -0000
@@ -11,8 +11,7 @@

 #define WINE_NOWINSOCK

-#include "ntstatus.h"
-#include "windows.h"
+#include "ntdll_test.h"

 #include "wine/test.h"

Index: dlls/ntdll/tests/large_int.c
===================================================================
RCS file: /var/cvs/wine/dlls/ntdll/tests/large_int.c,v
retrieving revision 1.6
diff -u -r1.6 large_int.c
--- dlls/ntdll/tests/large_int.c	7 Feb 2004 01:03:17 -0000	1.6
+++ dlls/ntdll/tests/large_int.c	11 Aug 2004 14:01:08 -0000
@@ -21,17 +21,11 @@
  * windows.
  */

-#include <stdarg.h>
 #include <stdlib.h>

-#include "ntstatus.h"
-#include "windef.h"
-#include "winbase.h"
-#include "wine/test.h"
-#include "winnt.h"
+#include "ntdll_test.h"
+
 #include "winnls.h"
-#include "winreg.h"
-#include "winternl.h"

 /* Function ptrs for ntdll calls */
 static HMODULE hntdll = 0;
Index: dlls/ntdll/tests/path.c
===================================================================
RCS file: /var/cvs/wine/dlls/ntdll/tests/path.c,v
retrieving revision 1.10
diff -u -r1.10 path.c
--- dlls/ntdll/tests/path.c	11 Aug 2004 18:51:25 -0000	1.10
+++ dlls/ntdll/tests/path.c	11 Aug 2004 19:40:35 -0000
@@ -18,15 +18,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */

-#include <stdarg.h>
-
-#include "wine/test.h"
-#include "ntstatus.h"
-#include "windef.h"
-#include "winbase.h"
-#include "winnt.h"
-#include "winreg.h"
-#include "winternl.h"
+#include "ntdll_test.h"

 static NTSTATUS (WINAPI *pRtlMultiByteToUnicodeN)( LPWSTR dst, DWORD dstlen, LPDWORD reslen,
                                                    LPCSTR src, DWORD srclen );
Index: dlls/ntdll/tests/rtl.c
===================================================================
RCS file: /var/cvs/wine/dlls/ntdll/tests/rtl.c,v
retrieving revision 1.9
diff -u -r1.9 rtl.c
--- dlls/ntdll/tests/rtl.c	23 Jul 2004 23:02:10 -0000	1.9
+++ dlls/ntdll/tests/rtl.c	12 Aug 2004 15:14:52 -0000
@@ -21,17 +21,10 @@
  * windows.
  */

-#include <stdarg.h>
 #include <stdlib.h>

-#include "ntstatus.h"
-#include "windef.h"
-#include "winbase.h"
-#include "wine/test.h"
-#include "winnt.h"
+#include "ntdll_test.h"
 #include "winnls.h"
-#include "winreg.h"
-#include "winternl.h"

 /* Function ptrs for ntdll calls */
 static HMODULE hntdll = 0;
Index: dlls/ntdll/tests/rtlbitmap.c
===================================================================
RCS file: /var/cvs/wine/dlls/ntdll/tests/rtlbitmap.c,v
retrieving revision 1.6
diff -u -r1.6 rtlbitmap.c
--- dlls/ntdll/tests/rtlbitmap.c	7 Feb 2004 01:02:48 -0000	1.6
+++ dlls/ntdll/tests/rtlbitmap.c	11 Aug 2004 14:08:55 -0000
@@ -20,15 +20,8 @@
  * We use function pointers here as some of the bitmap functions exist only
  * in later versions of ntdll.
  */
-#include <stdarg.h>

-#include "wine/test.h"
-#include "ntstatus.h"
-#include "windef.h"
-#include "winbase.h"
-#include "winnt.h"
-#include "winreg.h"
-#include "winternl.h"
+#include "ntdll_test.h"

 /* Function ptrs for ordinal calls */
 static HMODULE hntdll = 0;
Index: dlls/ntdll/tests/rtlstr.c
===================================================================
RCS file: /var/cvs/wine/dlls/ntdll/tests/rtlstr.c,v
retrieving revision 1.17
diff -u -r1.17 rtlstr.c
--- dlls/ntdll/tests/rtlstr.c	5 May 2004 01:38:24 -0000	1.17
+++ dlls/ntdll/tests/rtlstr.c	11 Aug 2004 14:00:35 -0000
@@ -22,18 +22,12 @@
  * windows.
  */

-#include <stdarg.h>
 #include <stdlib.h>

 #define INITGUID
-#include "ntstatus.h"
-#include "windef.h"
-#include "winbase.h"
-#include "wine/test.h"
-#include "winnt.h"
+
+#include "ntdll_test.h"
 #include "winnls.h"
-#include "winreg.h"
-#include "winternl.h"
 #include "guiddef.h"

 /* Function ptrs for ntdll calls */
Index: dlls/ntdll/tests/string.c
===================================================================
RCS file: /var/cvs/wine/dlls/ntdll/tests/string.c,v
retrieving revision 1.6
diff -u -r1.6 string.c
--- dlls/ntdll/tests/string.c	7 Feb 2004 01:03:17 -0000	1.6
+++ dlls/ntdll/tests/string.c	11 Aug 2004 14:00:43 -0000
@@ -21,17 +21,11 @@
  * windows.
  */

-#include <stdarg.h>
 #include <stdlib.h>

-#include "ntstatus.h"
-#include "windef.h"
-#include "winbase.h"
-#include "wine/test.h"
-#include "winnt.h"
+#include "ntdll_test.h"
+
 #include "winnls.h"
-#include "winreg.h"
-#include "winternl.h"

 /* Function ptrs for ntdll calls */
 static HMODULE hntdll = 0;
Index: tools/winapi/tests.dat
===================================================================
RCS file: /var/cvs/wine/tools/winapi/tests.dat,v
retrieving revision 1.13
diff -u -r1.13 tests.dat
--- tools/winapi/tests.dat	11 Aug 2004 20:52:37 -0000	1.13
+++ tools/winapi/tests.dat	11 Aug 2004 22:58:27 -0000
@@ -628,8 +625,7 @@

 %include

-"ntstatus.h"
-"windows.h"
+"ntdll_test.h"

 %type


-- 
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
                  A black hole is just God dividing by zero.



More information about the wine-patches mailing list