ddk/ntddk.h (alternative 1)

Francois Gouget fgouget at free.fr
Tue Aug 31 10:55:15 CDT 2004


Alexandre didn't like the idea of an application using DDK headers. It's
true that it's not quite right as applications should not have to depend
on the *Device* Driver Kit.

Unfortunately MS misplaced various APIs and type declarations which gets
us to the current situation. So I explored alternatives with Alexandre
and promised I would send patches so he could pick the one he prefers.

This one still uses ddk/ntddk.h when compiling on Windows which allows
us to use Microsoft's declarations and know when stuff changes.
And in Wine it uses a pseudo ntddk.h header that just turns around and
references winternl.h. This solves the declarations duplication aspect
which was another issue with my previous patch.

Also note that this header can indifferently be placed in
include/ddk/ntddk.h or, if we don't want regular applications to use it,
in dlls/ntddl/tests/ddk/ntddk.h. The patch uses the latter approach.


Changelog:

 * dlls/ntdll/tests/rtlbitmap.c
   dlls/ntdll/tests/ddk/ntddk.h

   Use ntddk.h so rtlbitmap.c compiles with the Windows (SDK+DDK)
headers.
   On Wine add a private ntddk.h header that turns around and includes
winternl.h.

-- 
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
      Broadcast message : fin du monde dans cinq minutes, repentez vous !
-------------- next part --------------
Index: dlls/ntdll/tests/rtlbitmap.c
===================================================================
RCS file: /var/cvs/wine/dlls/ntdll/tests/rtlbitmap.c,v
retrieving revision 1.8
diff -u -r1.8 rtlbitmap.c
--- dlls/ntdll/tests/rtlbitmap.c	23 Aug 2004 18:52:54 -0000	1.8
+++ dlls/ntdll/tests/rtlbitmap.c	31 Aug 2004 12:28:34 -0000
@@ -21,7 +21,9 @@
  * in later versions of ntdll.
  */
 
-#include "ntdll_test.h"
+#include <ddk/ntddk.h>
+#include <windef.h>
+#include <wine/test.h>
 
 /* Function ptrs for ordinal calls */
 static HMODULE hntdll = 0;
@@ -46,6 +48,12 @@
 static BYTE buff[256];
 static RTL_BITMAP bm;
 
+/* On Windows ntddk.h is incompatible with winbase.h so we need to provide
+ * our own prototypes here.
+ */
+HMODULE WINAPI LoadLibraryA(LPCSTR);
+FARPROC WINAPI GetProcAddress(HMODULE,LPCSTR);
+
 static void InitFunctionPtrs()
 {
   hntdll = LoadLibraryA("ntdll.dll");
--- /dev/null	2004-08-10 11:44:31.000000000 +0200
+++ dlls/ntdll/tests/ddk/ntddk.h	2004-08-31 14:58:19.000000000 +0200
@@ -0,0 +1,21 @@
+/*
+ * 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>
+#include <windef.h>
+#include <winbase.h>
+#include <winreg.h>
+#include <winternl.h>


More information about the wine-patches mailing list