- Fix debug header nonsense
 - Fix some w32api definitions
 - MSVC/PSDK Compatibility fixes.
 - Clean up user32 headers for greater PCH usage.
Modified: trunk/reactos/apps/utils/ps/ps.c
Modified: trunk/reactos/drivers/dd/mpu401/settings.c
Modified: trunk/reactos/include/reactos/debug.h
Modified: trunk/reactos/include/wine/debug.h
Modified: trunk/reactos/lib/ntdll/inc/ntdll.h
Modified: trunk/reactos/lib/user32/controls/button.c
Modified: trunk/reactos/lib/user32/controls/combo.c
Deleted: trunk/reactos/lib/user32/controls/controls.h
Modified: trunk/reactos/lib/user32/controls/edit.c
Modified: trunk/reactos/lib/user32/controls/icontitle.c
Modified: trunk/reactos/lib/user32/controls/listbox.c
Modified: trunk/reactos/lib/user32/controls/scrollbar.c
Added: trunk/reactos/lib/user32/include/controls.h
Added: trunk/reactos/lib/user32/include/dde_private.h
Deleted: trunk/reactos/lib/user32/include/debug.h
Modified: trunk/reactos/lib/user32/include/user32.h
Modified: trunk/reactos/lib/user32/include/user32p.h
Modified: trunk/reactos/lib/user32/misc/dde.c
Deleted: trunk/reactos/lib/user32/misc/dde_private.h
Modified: trunk/reactos/lib/user32/misc/ddeclient.c
Modified: trunk/reactos/lib/user32/misc/ddeserver.c
Modified: trunk/reactos/lib/user32/misc/display.c
Modified: trunk/reactos/lib/user32/misc/dllmain.c
Modified: trunk/reactos/lib/user32/misc/exticon.c
Modified: trunk/reactos/lib/user32/misc/object.c
Modified: trunk/reactos/lib/user32/misc/stubs.c
Modified: trunk/reactos/lib/user32/windows/bitmap.c
Modified: trunk/reactos/lib/user32/windows/clipboard.c
Modified: trunk/reactos/lib/user32/windows/cursor.c
Modified: trunk/reactos/lib/user32/windows/defwnd.c
Modified: trunk/reactos/lib/user32/windows/dialog.c
Modified: trunk/reactos/lib/user32/windows/draw.c
Modified: trunk/reactos/lib/user32/windows/font.c
Modified: trunk/reactos/lib/user32/windows/hook.c
Modified: trunk/reactos/lib/user32/windows/icon.c
Modified: trunk/reactos/lib/user32/windows/input.c
Modified: trunk/reactos/lib/user32/windows/mdi.c
Modified: trunk/reactos/lib/user32/windows/menu.c
Modified: trunk/reactos/lib/user32/windows/message.c
Modified: trunk/reactos/lib/user32/windows/messagebox.c
Modified: trunk/reactos/lib/user32/windows/nonclient.c
Modified: trunk/reactos/lib/user32/windows/paint.c
Modified: trunk/reactos/lib/user32/windows/window.c
Added: trunk/reactos/w32api/include/winnls32.h
Modified: trunk/reactos/w32api/include/winuser.h

Modified: trunk/reactos/apps/utils/ps/ps.c
--- trunk/reactos/apps/utils/ps/ps.c	2005-07-27 19:10:57 UTC (rev 16810)
+++ trunk/reactos/apps/utils/ps/ps.c	2005-07-27 19:21:46 UTC (rev 16811)
@@ -268,7 +268,7 @@
         	WriteFile(stdout, buf1, lstrlen(buf1), &r, NULL);
 
 		EnumThreadWindows((DWORD)CurrentProcess->Threads[ti].ClientId.UniqueThread,
-		                  (ENUMWINDOWSPROC) EnumThreadProc,
+		                  (WNDENUMPROC) EnumThreadProc,
 		                  (LPARAM)(LPTSTR) szWindowName );
 	   }
 	   CurrentProcess = (PSYSTEM_PROCESSES)((ULONG_PTR)CurrentProcess +

Modified: trunk/reactos/drivers/dd/mpu401/settings.c
--- trunk/reactos/drivers/dd/mpu401/settings.c	2005-07-27 19:10:57 UTC (rev 16810)
+++ trunk/reactos/drivers/dd/mpu401/settings.c	2005-07-27 19:21:46 UTC (rev 16811)
@@ -13,7 +13,7 @@
 
 #include "mpu401.h"
 
-// #define NDEBUG
+#define NDEBUG
 #include <debug.h>
 #include "sbdebug.h"  // our own debug helper
 

Modified: trunk/reactos/include/reactos/debug.h
--- trunk/reactos/include/reactos/debug.h	2005-07-27 19:10:57 UTC (rev 16810)
+++ trunk/reactos/include/reactos/debug.h	2005-07-27 19:21:46 UTC (rev 16811)
@@ -63,7 +63,7 @@
 #endif
 
 #ifndef NDEBUG
-#define DPRINT(...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(__VA_ARGS__); } while(0);
+#define DPRINT(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
 #define CHECKPOINT do { DbgPrint("%s:%d\n",__FILE__,__LINE__); } while(0);
 #else
 #ifdef __GNUC__

Modified: trunk/reactos/include/wine/debug.h
--- trunk/reactos/include/wine/debug.h	2005-07-27 19:10:57 UTC (rev 16810)
+++ trunk/reactos/include/wine/debug.h	2005-07-27 19:21:46 UTC (rev 16811)
@@ -6,6 +6,11 @@
 #include <windows.h>
 #include <wchar.h>
 
+/* Add ROS Master debug functions if not added yet */
+#ifndef __INTERNAL_DEBUG
+#include <reactos/debug.h>
+#endif
+
 #ifndef __GNUC__
 #define	__FUNCTION__ ""
 #define	inline __inline
@@ -13,21 +18,6 @@
 
 unsigned long DbgPrint(char *Format,...);
 
-#ifdef DBG
-#define DPRINT1 DbgPrint("(%s:%d:%s) ",__FILE__,__LINE__,__FUNCTION__), DbgPrint
-#else
-#define DPRINT1(...)
-#endif
-
-#if !defined(DBG) || !defined(YDEBUG)
-#define DPRINT(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
-#else
-#define DPRINT DbgPrint("(%s:%d:%s) ",__FILE__,__LINE__,__FUNCTION__), DbgPrint
-#endif
-
-#define UNIMPLEMENTED   DbgPrint("WARNING:  %s at %s:%d is UNIMPLEMENTED!\n",__FUNCTION__,__FILE__,__LINE__);
-
-
 struct _GUID;
 
 /* Exported definitions and macros */

Modified: trunk/reactos/lib/ntdll/inc/ntdll.h
--- trunk/reactos/lib/ntdll/inc/ntdll.h	2005-07-27 19:10:57 UTC (rev 16810)
+++ trunk/reactos/lib/ntdll/inc/ntdll.h	2005-07-27 19:21:46 UTC (rev 16811)
@@ -20,6 +20,9 @@
 #define NTOS_MODE_USER
 #include <ndk/ntndk.h>
 
+/* ELF Support */
+#include <elf/elf.h>
+
 /* Internal NTDLL */
 #include "ntdllp.h"
 

Modified: trunk/reactos/lib/user32/controls/button.c
--- trunk/reactos/lib/user32/controls/button.c	2005-07-27 19:10:57 UTC (rev 16810)
+++ trunk/reactos/lib/user32/controls/button.c	2005-07-27 19:21:46 UTC (rev 16811)
@@ -19,20 +19,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define __WINE__
 #include <user32.h>
-#include <stdarg.h>
-#include <string.h>
-#include <stdlib.h>
 
-#include "controls.h"
-#include "wine/unicode.h"
-#include "wine/debug.h"
-
-#ifdef __REACTOS__
-HPEN STDCALL GetSysColorPen(int nIndex);
-#endif
-
 /* GetWindowLong offsets for window extra information */
 #define STATE_GWL_OFFSET  0
 #define HFONT_GWL_OFFSET  (sizeof(LONG))
@@ -126,33 +114,33 @@
 };
 
 
-inline static LONG get_button_state( HWND hwnd )
+__inline static LONG get_button_state( HWND hwnd )
 {
     return GetWindowLongA( hwnd, STATE_GWL_OFFSET );
 }
 
-inline static void set_button_state( HWND hwnd, LONG state )
+__inline static void set_button_state( HWND hwnd, LONG state )
 {
     SetWindowLongA( hwnd, STATE_GWL_OFFSET, state );
 }
 
-inline static HFONT get_button_font( HWND hwnd )
+__inline static HFONT get_button_font( HWND hwnd )
 {
     return (HFONT)GetWindowLongA( hwnd, HFONT_GWL_OFFSET );
 }
 
-inline static void set_button_font( HWND hwnd, HFONT font )
+__inline static void set_button_font( HWND hwnd, HFONT font )
 {
     SetWindowLongA( hwnd, HFONT_GWL_OFFSET, (LONG)font );
 }
 
-inline static UINT get_button_type( LONG window_style )
+__inline static UINT get_button_type( LONG window_style )
 {
     return (window_style & 0x0f);
 }
 
 /* paint a button of any type */
-inline static void paint_button( HWND hwnd, LONG style, UINT action )
+__inline static void paint_button( HWND hwnd, LONG style, UINT action )
 {
     if (btnPaintFunc[style] && IsWindowVisible(hwnd))
     {
@@ -163,7 +151,7 @@
 }
 
 /* retrieve the button text; returned buffer must be freed by caller */
-inline static WCHAR *get_button_text( HWND hwnd )
+__inline static WCHAR *get_button_text( HWND hwnd )
 {
     INT len = 512;
     WCHAR *buffer = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) );

Modified: trunk/reactos/lib/user32/controls/combo.c
--- trunk/reactos/lib/user32/controls/combo.c	2005-07-27 19:10:57 UTC (rev 16810)
+++ trunk/reactos/lib/user32/controls/combo.c	2005-07-27 19:21:46 UTC (rev 16811)
@@ -20,18 +20,9 @@
  * FIXME: roll up in Netscape 3.01.
  */
 
-#define __WINE__
 #include <user32.h>
-#include <stdarg.h>
-#include <string.h>
-
 #define NDEBUG
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include "controls.h"
-#include "wine/debug.h"
-#include "wine/unicode.h"
+#include <debug.h>
 
 WINE_DEFAULT_DEBUG_CHANNEL(combo);
 

Deleted: trunk/reactos/lib/user32/controls/controls.h
--- trunk/reactos/lib/user32/controls/controls.h	2005-07-27 19:10:57 UTC (rev 16810)
+++ trunk/reactos/lib/user32/controls/controls.h	2005-07-27 19:21:46 UTC (rev 16811)
@@ -1,113 +0,0 @@
-#ifndef _ROS_CONTROLS_H
-#define _ROS_CONTROLS_H
-
-/* Missing from Winuser.h */
-#define ES_COMBO        0x00000200   /* Undocumented. Parent is a combobox */
-#ifndef MAKEINTATOMA
-#define MAKEINTATOMA(atom)  ((LPCSTR)((ULONG_PTR)((WORD)(atom))))
-#endif
-#ifndef WM_ISACTIVEICON
-#define WM_ISACTIVEICON         0x0035
-#endif
-
-#ifndef __USE_W32API
-#if defined(STRICT)
-typedef INT     (CALLBACK *EDITWORDBREAKPROCA)(LPSTR,INT,INT,INT);
-typedef INT     (CALLBACK *EDITWORDBREAKPROCW)(LPWSTR,INT,INT,INT);
-#else
-typedef FARPROC EDITWORDBREAKPROCA;
-typedef FARPROC EDITWORDBREAKPROCW;
-#endif
-#endif
-
-#ifndef HBMMENU_CALLBACK
-#define HBMMENU_CALLBACK	((HBITMAP) -1)
-#endif
-#ifndef HBMMENU_SYSTEM
-#define HBMMENU_SYSTEM		((HBITMAP)  1)
-#endif
-#ifndef HBMMENU_MBAR_RESTORE
-#define HBMMENU_MBAR_RESTORE	((HBITMAP)  2)
-#endif
-#ifndef HBMMENU_MBAR_MINIMIZE
-#define HBMMENU_MBAR_MINIMIZE	((HBITMAP)  3)
-#endif
-#ifndef HBMMENU_MBAR_CLOSE
-#define HBMMENU_MBAR_CLOSE	((HBITMAP)  5)
-#endif
-#ifndef HBMMENU_MBAR_CLOSE_D
-#define HBMMENU_MBAR_CLOSE_D	((HBITMAP)  6)
-#endif
-#ifndef HBMMENU_MBAR_MINIMIZE_D
-#define HBMMENU_MBAR_MINIMIZE_D	((HBITMAP)  7)
-#endif
-#ifndef HBMMENU_POPUP_CLOSE
-#define HBMMENU_POPUP_CLOSE	((HBITMAP)  8)
-#endif
-#ifndef HBMMENU_POPUP_RESTORE
-#define HBMMENU_POPUP_RESTORE	((HBITMAP)  9)
-#endif
-#ifndef HBMMENU_POPUP_MAXIMIZE
-#define HBMMENU_POPUP_MAXIMIZE	((HBITMAP) 10)
-#endif
-#ifndef HBMMENU_POPUP_MINIMIZE
-#define HBMMENU_POPUP_MINIMIZE	((HBITMAP) 11)
-#endif
-
-/* winuser.h */
-
-
-// I dont know where this goes
-
-#define LB_CARETON             0x01a3
-#define LB_CARETOFF            0x01a4
-
-/* combo box */
-
-#define ID_CB_LISTBOX           1000
-#define ID_CB_EDIT              1001
-
-/* Combo box message return values */
-#define CB_OKAY             0
-
-/* internal flags */
-#define CBF_DROPPED             0x0001
-#define CBF_BUTTONDOWN          0x0002
-#define CBF_NOROLLUP            0x0004
-#define CBF_MEASUREITEM         0x0008
-#define CBF_FOCUSED             0x0010
-#define CBF_CAPTURE             0x0020
-#define CBF_EDIT                0x0040
-#define CBF_NORESIZE            0x0080
-#define CBF_NOTIFY              0x0100
-#define CBF_NOREDRAW            0x0200
-#define CBF_SELCHANGE           0x0400
-#define CBF_NOEDITNOTIFY        0x1000
-#define CBF_NOLBSELECT          0x2000  /* do not change current selection */
-#define CBF_EUI                 0x8000
-
-/* combo state struct */
-typedef struct
-{
-   HWND           self;
-   HWND           owner;
-   UINT           dwStyle;
-   HWND           hWndEdit;
-   HWND           hWndLBox;
-   UINT           wState;
-   HFONT          hFont;
-   RECT           textRect;
-   RECT           buttonRect;
-   RECT           droppedRect;
-   INT            droppedIndex;
-   INT            fixedOwnerDrawHeight;
-   INT            droppedWidth;   /* last two are not used unless set */
-   INT            editHeight;     /* explicitly */
-} HEADCOMBO,*LPHEADCOMBO;
-
-/* Note, that CBS_DROPDOWNLIST style is actually (CBS_SIMPLE | CBS_DROPDOWN) */
-#define CB_GETTYPE( lphc )    ((lphc)->dwStyle & (CBS_DROPDOWNLIST))
-
-extern BOOL COMBO_FlipListbox( LPHEADCOMBO, BOOL, BOOL );
-
-#endif /* _ROS_CONTROLS_H */

Modified: trunk/reactos/lib/user32/controls/edit.c
--- trunk/reactos/lib/user32/controls/edit.c	2005-07-27 19:10:57 UTC (rev 16810)
+++ trunk/reactos/lib/user32/controls/edit.c	2005-07-27 19:21:46 UTC (rev 16811)
@@ -36,14 +36,9 @@
  *
  */
 
-#define __WINE__
 #include <user32.h>
-#include <stdarg.h>
-#include <string.h>
-#include <stdlib.h>
-#include "controls.h"
-#include "wine/unicode.h"
-#include "wine/debug.h"
+#define NDEBUG
+#include <debug.h>
 
 WINE_DEFAULT_DEBUG_CHANNEL(edit);
 WINE_DECLARE_DEBUG_CHANNEL(combo);
@@ -167,10 +162,10 @@
  *	We still like to call them internally
  *	"static inline" makes them more like macro's
  */
-static inline BOOL	EDIT_EM_CanUndo(EDITSTATE *es);
-static inline void	EDIT_EM_EmptyUndoBuffer(EDITSTATE *es);
-static inline void	EDIT_WM_Clear(EDITSTATE *es);
-static inline void	EDIT_WM_Cut(EDITSTATE *es);
+static __inline BOOL	EDIT_EM_CanUndo(EDITSTATE *es);
+static __inline void	EDIT_EM_EmptyUndoBuffer(EDITSTATE *es);
+static __inline void	EDIT_WM_Clear(EDITSTATE *es);
+static __inline void	EDIT_WM_Cut(EDITSTATE *es);
 
 /*
  *	Helper functions only valid for one type of control
@@ -310,7 +305,7 @@
  *	EM_CANUNDO
  *
  */
-static inline BOOL EDIT_EM_CanUndo(EDITSTATE *es)
+static __inline BOOL EDIT_EM_CanUndo(EDITSTATE *es)
 {
 	return (es->undo_insert_count || strlenW(es->undo_text));
 }
@@ -321,7 +316,7 @@
  *	EM_EMPTYUNDOBUFFER
  *
  */
-static inline void EDIT_EM_EmptyUndoBuffer(EDITSTATE *es)
+static __inline void EDIT_EM_EmptyUndoBuffer(EDITSTATE *es)
 {
 	es->undo_insert_count = 0;
 	*es->undo_text = '\0';
@@ -333,7 +328,7 @@
  *	WM_CLEAR
  *
  */
-static inline void EDIT_WM_Clear(EDITSTATE *es)
+static __inline void EDIT_WM_Clear(EDITSTATE *es)
 {
 	static const WCHAR empty_stringW[] = {0};
 
@@ -350,7 +345,7 @@
  *	WM_CUT
  *
  */
-static inline void EDIT_WM_Cut(EDITSTATE *es)
+static __inline void EDIT_WM_Cut(EDITSTATE *es)
 {
 	EDIT_WM_Copy(es);
 	EDIT_WM_Clear(es);
@@ -406,7 +401,7 @@
 	return (HBRUSH)SendMessageW(GetParent(es->hwndSelf), msg, (WPARAM)hdc, (LPARAM)es->hwndSelf);
 }
 
-static inline LRESULT DefWindowProcT(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode)
+static __inline LRESULT DefWindowProcT(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode)
 {
 	if(unicode)
 		return DefWindowProcW(hwnd, msg, wParam, lParam);

Modified: trunk/reactos/lib/user32/controls/icontitle.c
--- trunk/reactos/lib/user32/controls/icontitle.c	2005-07-27 19:10:57 UTC (rev 16810)
+++ trunk/reactos/lib/user32/controls/icontitle.c	2005-07-27 19:21:46 UTC (rev 16811)
@@ -18,9 +18,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include "user32.h"
-#include "controls.h"
-#include "wine/unicode.h"
+#include <user32.h>
 
 #ifdef __REACTOS__
 #define MAKEINTATOMW(atom)  ((LPCWSTR)((ULONG_PTR)((WORD)(atom))))

Modified: trunk/reactos/lib/user32/controls/listbox.c
--- trunk/reactos/lib/user32/controls/listbox.c	2005-07-27 19:10:57 UTC (rev 16810)
+++ trunk/reactos/lib/user32/controls/listbox.c	2005-07-27 19:21:46 UTC (rev 16811)
@@ -18,15 +18,10 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define __WINE__
 #include <user32.h>
-#include <string.h>
-#include <stdlib.h>
-#include "controls.h"
-#include "wine/debug.h"
+#define NDEBUG
+#include <debug.h>
 
-#ifdef __REACTOS__
-#include "wine/unicode.h"
 /* Start of hack section -------------------------------- */
 
 typedef short *LPINT16;
@@ -42,10 +37,9 @@
 #define WM_SYSTIMER         280
 
 UINT STDCALL SetSystemTimer(HWND,UINT_PTR,UINT,TIMERPROC);
-WINBOOL STDCALL KillSystemTimer(HWND,UINT_PTR);
+BOOL STDCALL KillSystemTimer(HWND,UINT_PTR);
 
 /* End of hack section -------------------------------- */
-#endif
 
 /* Unimplemented yet:
  * - LBS_USETABSTOPS

Modified: trunk/reactos/lib/user32/controls/scrollbar.c
--- trunk/reactos/lib/user32/controls/scrollbar.c	2005-07-27 19:10:57 UTC (rev 16810)
+++ trunk/reactos/lib/user32/controls/scrollbar.c	2005-07-27 19:21:46 UTC (rev 16811)
@@ -31,8 +31,10 @@
 /* INCLUDES *******************************************************************/
 
 #include <user32.h>
-#include <oleacc.h>
+#define NDEBUG
+#include <debug.h>
 
+
 /* GLOBAL VARIABLES ***********************************************************/
 
 /* Definitions for scrollbar hit testing [See SCROLLBARINFO in MSDN] */
@@ -70,7 +72,7 @@
 static LRESULT WINAPI ScrollBarWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
 
 UINT STDCALL SetSystemTimer(HWND,UINT_PTR,UINT,TIMERPROC);
-WINBOOL STDCALL KillSystemTimer(HWND,UINT_PTR);
+BOOL STDCALL KillSystemTimer(HWND,UINT_PTR);
 
 /*********************************************************************
  * scrollbar class descriptor
@@ -1272,10 +1274,11 @@
 //              infoPtr->flags = wParam ? ESB_ENABLE_BOTH : ESB_DISABLE_BOTH;
 //              SCROLL_RefreshScrollBar(hwnd, SB_CTL, TRUE, TRUE);
 //            }
+          HDC hdc;
           DbgPrint("ScrollBarWndProc WM_ENABLE\n");
           NtUserEnableScrollBar(Wnd,SB_CTL,(wParam ? ESB_ENABLE_BOTH : ESB_DISABLE_BOTH));
           /* Refresh Scrollbars. */          
-          HDC hdc = GetDCEx( Wnd, 0, DCX_CACHE );
+          hdc = GetDCEx( Wnd, 0, DCX_CACHE );
           if (!hdc) return 1;
           IntDrawScrollBar( Wnd, hdc, SB_CTL);
           ReleaseDC( Wnd, hdc );

Copied: trunk/reactos/lib/user32/include/controls.h (from rev 16791, trunk/reactos/lib/user32/controls/controls.h)

Copied: trunk/reactos/lib/user32/include/dde_private.h (from rev 16791, trunk/reactos/lib/user32/misc/dde_private.h)
--- trunk/reactos/lib/user32/misc/dde_private.h	2005-07-27 05:42:33 UTC (rev 16791)
+++ trunk/reactos/lib/user32/include/dde_private.h	2005-07-27 19:21:46 UTC (rev 16811)
@@ -0,0 +1,268 @@
+/* -*- tab-width: 8; c-basic-offset: 4 -*- */
+
+/*
+ * DDEML library
+ *
+ * Copyright 1997 Alexandre Julliard
+ * Copyright 1997 Len White
+ * Copyright 1999 Keith Matthews
+ * Copyright 2000 Corel
+ * Copyright 2001 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
+ */
+
+#ifndef __WINE_DDEML_PRIVATE_H
+#define __WINE_DDEML_PRIVATE_H
+
+/* defined in atom.c file.
+ */
+#define MAX_ATOM_LEN              255
+
+/* Maximum buffer size ( including the '\0' ).
+ */
+#define MAX_BUFFER_LEN            (MAX_ATOM_LEN + 1)
+
+/* The internal structures (prefixed by WDML) are used as follows:
+ * + a WDML_INSTANCE is created for each instance creation (DdeInitialize)
+ *      - a popup window (InstanceClass) is created for each instance.
+ *      - this window is used to receive all the DDEML events (server registration,
+ *	  conversation confirmation...). See the WM_WDML_???? messages for details
+ * + when registring a server (DdeNameService) a WDML_SERVER is created
+ *	- a popup window (ServerNameClass) is created
+ * + a conversation is represented by two WDML_CONV structures:
+ *	- one on the client side, the other one on the server side
+ *	- this is needed because the address spaces may be different
+ *	- therefore, two lists of links are kept for each instance
+ *	- two windows are created for a conversation:
+ *		o a popup window on client side (ClientConvClass)
+ *		o a child window (of the ServerName) on the server side
+ *		  (ServerConvClass)
+ *	- all the exchanges then take place between those two windows
+ *	- windows for the conversation exist in two forms (Ansi & Unicode). This
+ *	  is only needed when a partner in a conv is not handled by DDEML. The
+ *	  type (A/W) of the window is used to handle the ansi <=> unicode
+ *        transformations
+ *	- two handles are created for a conversation (on each side). Each handle
+ *	  is linked to a structure. To help differentiate those handles, the
+ *	  local one has an even value, whereas the remote one has an odd value.
+ * + a (warm or link) is represented by two WDML_LINK structures:
+ *	- one on client side, the other one on server side
+ *	- therefore, two lists of links are kept for each instance
+ *
+ * To help getting back to data, WDML windows store information:
+ *	- offset 0: the DDE instance
+ *	- offset 4: the current conversation (for ClientConv and ServerConv only)
+ *
+ * All the implementation (client & server) makes the assumption that the other side
+ * is not always a DDEML partner. However, if it's the case, supplementary services
+ * are available (most notably the REGISTER/UNREGISTER and CONNECT_CONFIRM messages
+ * to the callback function). To be correct in every situation, all the basic
+ * exchanges are made using the 'pure' DDE protocol. A (future !) enhancement would
+ * be to provide a new protocol in the case were both partners are handled by DDEML.
+ *
+ * The StringHandles are in fact stored as local atoms. So an HSZ and a (local) atom
+ * can be used interchangably. However, in order to keep track of the allocated HSZ,
+ * and to free them upon instance termination, all HSZ are stored in a link list.
+ * When the HSZ need to be passed thru DDE messages, we need to convert them back and
+ * forth to global atoms.
+ */
+
+/* this struct has the same mapping as all the DDE??? structures */
+typedef struct {
+    unsigned short unused:12,
+		   fResponse:1,
+                   fRelease:1,
+		   fDeferUpd:1,
+                   fAckReq:1;
+    short    cfFormat;
+} WINE_DDEHEAD;
+
+typedef struct tagHSZNode
+{
+    struct tagHSZNode*		next;
+    HSZ 			hsz;
+    unsigned			refCount;
+} HSZNode;
+
+typedef struct tagWDML_SERVER
+{
+    struct tagWDML_SERVER*	next;
+    HSZ				hszService;
+    HSZ				hszServiceSpec;
+    ATOM			atomService;
+    ATOM			atomServiceSpec;
+    BOOL			filterOn;
+    HWND			hwndServer;
+} WDML_SERVER;
+
+typedef struct tagWDML_XACT {
+    struct tagWDML_XACT*	next;		/* list of transactions in conversation */
+    DWORD			xActID;
+    UINT			ddeMsg;
+    HDDEDATA			hDdeData;
+    DWORD			dwTimeout;
+    DWORD			hUser;
+    UINT			wType;
+    UINT			wFmt;
+    HSZ				hszItem;
+    ATOM			atom;		/* as converted from or to hszItem */
+    HGLOBAL			hMem;
+    LPARAM			lParam; 	/* useful for reusing */
+} WDML_XACT;
+
+typedef struct tagWDML_CONV
+{
+    struct tagWDML_CONV*	next;		/* to link all the conversations */
+    struct tagWDML_INSTANCE*	instance;
+    HSZ				hszService;	/* pmt used for connection */
+    HSZ				hszTopic;	/* pmt used for connection */
+    UINT			afCmd;		/* service name flag */
+    CONVCONTEXT			convContext;
+    HWND			hwndClient;	/* source of conversation (ClientConvClass) */
+    HWND			hwndServer;	/* destination of conversation (ServerConvClass) */
+    WDML_XACT*			transactions;	/* pending transactions */
+    DWORD			hUser;		/* user defined value */
+    DWORD			wStatus;	/* same bits as convinfo.wStatus */
+    DWORD			wConvst;	/* same values as convinfo.wConvst */
+} WDML_CONV;
+
+/* DDE_LINK struct defines hot, warm, and cold links */
+typedef struct tagWDML_LINK {
+    struct tagWDML_LINK*	next;		/* to link all the active links */
+    HCONV			hConv;		/* to get back to the converstaion */
+    UINT			transactionType;/* 0 for no link */
+    HSZ				hszItem;	/* item targetted for (hot/warm) link */
+    UINT			uFmt;		/* format for data */
+} WDML_LINK;
+
+typedef struct tagWDML_INSTANCE
+{
+    struct tagWDML_INSTANCE*	next;
+    DWORD           		instanceID;	/* needed to track monitor usage */
+    DWORD			threadID;	/* needed to keep instance linked to a unique thread */
+    BOOL			monitor;        /* have these two as full Booleans cos they'll be tested frequently */
+    BOOL			clientOnly;	/* bit wasteful of space but it will be faster */
+    BOOL			unicode;        /* Flag to indicate Win32 API used to initialise */
+    BOOL			win16;          /* flag to indicate Win16 API used to initialize */
+    HSZNode*			nodeList;	/* for cleaning upon exit */
+    PFNCALLBACK     		callback;
+    DWORD           		CBFflags;
+    DWORD           		monitorFlags;
+    DWORD			lastError;
+    HWND			hwndEvent;
+    WDML_SERVER*		servers;	/* list of registered servers */
+    WDML_CONV*			convs[2];	/* active conversations for this instance (client and server) */
+    WDML_LINK*			links[2];	/* active links for this instance (client and server) */
+} WDML_INSTANCE;
+
+extern CRITICAL_SECTION WDML_CritSect;		/* protection for instance list */
+
+/* header for the DDE Data objects */
+typedef struct tagDDE_DATAHANDLE_HEAD
+{
+    short	cfFormat;
+    WORD        bAppOwned;
+} DDE_DATAHANDLE_HEAD;
+
+typedef enum tagWDML_SIDE
+{
+    WDML_CLIENT_SIDE = 0, WDML_SERVER_SIDE = 1
+} WDML_SIDE;
+
+typedef enum {
+    WDML_QS_ERROR, WDML_QS_HANDLED, WDML_QS_PASS, WDML_QS_SWALLOWED, WDML_QS_BLOCK,
+} WDML_QUEUE_STATE;
+
+extern	HDDEDATA 	WDML_InvokeCallback(WDML_INSTANCE* pInst, UINT uType, UINT uFmt, HCONV hConv,
+					    HSZ hsz1, HSZ hsz2, HDDEDATA hdata,
+					    DWORD dwData1, DWORD dwData2);
+extern	HDDEDATA 	WDML_InvokeCallback16(PFNCALLBACK pfn, UINT uType, UINT uFmt, HCONV hConv,
+					      HSZ hsz1, HSZ hsz2, HDDEDATA hdata,
+					      DWORD dwData1, DWORD dwData2);
+extern	WDML_SERVER*	WDML_AddServer(WDML_INSTANCE* pInstance, HSZ hszService, HSZ hszTopic);
+extern	void		WDML_RemoveServer(WDML_INSTANCE* pInstance, HSZ hszService, HSZ hszTopic);
+extern	WDML_SERVER*	WDML_FindServer(WDML_INSTANCE* pInstance, HSZ hszService, HSZ hszTopic);
+/* transaction handler on the server side */
+extern WDML_QUEUE_STATE WDML_ServerHandle(WDML_CONV* pConv, WDML_XACT* pXAct);
+/* called both in DdeClientTransaction and server side. */
+extern	UINT		WDML_Initialize(LPDWORD pidInst, PFNCALLBACK pfnCallback,
+					DWORD afCmd, DWORD ulRes, BOOL bUnicode, BOOL b16);
+extern	WDML_CONV* 	WDML_AddConv(WDML_INSTANCE* pInstance, WDML_SIDE side,
+				     HSZ hszService, HSZ hszTopic, HWND hwndClient, HWND hwndServer);
+extern	void		WDML_RemoveConv(WDML_CONV* pConv, WDML_SIDE side);
+extern	WDML_CONV*	WDML_GetConv(HCONV hConv, BOOL checkConnected);
+extern	WDML_CONV*	WDML_GetConvFromWnd(HWND hWnd);
+extern	WDML_CONV*	WDML_FindConv(WDML_INSTANCE* pInstance, WDML_SIDE side,
+				      HSZ hszService, HSZ hszTopic);
+extern  BOOL		WDML_PostAck(WDML_CONV* pConv, WDML_SIDE side, WORD appRetCode,
+				     BOOL fBusy, BOOL fAck, UINT pmt, LPARAM lParam, UINT oldMsg);
+extern	void		WDML_AddLink(WDML_INSTANCE* pInstance, HCONV hConv, WDML_SIDE side,
+				     UINT wType, HSZ hszItem, UINT wFmt);
+extern	WDML_LINK*	WDML_FindLink(WDML_INSTANCE* pInstance, HCONV hConv, WDML_SIDE side,
+				      HSZ hszItem, BOOL use_fmt, UINT uFmt);
+extern	void 		WDML_RemoveLink(WDML_INSTANCE* pInstance, HCONV hConv, WDML_SIDE side,
+					HSZ hszItem, UINT wFmt);
+extern	void		WDML_RemoveAllLinks(WDML_INSTANCE* pInstance, WDML_CONV* pConv, WDML_SIDE side);
+/* string internals */
+extern	void 		WDML_FreeAllHSZ(WDML_INSTANCE* pInstance);
+extern	BOOL		WDML_DecHSZ(WDML_INSTANCE* pInstance, HSZ hsz);
+extern	BOOL		WDML_IncHSZ(WDML_INSTANCE* pInstance, HSZ hsz);
+extern	ATOM		WDML_MakeAtomFromHsz(HSZ hsz);
+extern	HSZ		WDML_MakeHszFromAtom(WDML_INSTANCE* pInstance, ATOM atom);
+/* client calls these */
+extern	WDML_XACT*	WDML_AllocTransaction(WDML_INSTANCE* pInstance, UINT ddeMsg, UINT wFmt, HSZ hszItem);
+extern	void		WDML_QueueTransaction(WDML_CONV* pConv, WDML_XACT* pXAct);
+extern	BOOL		WDML_UnQueueTransaction(WDML_CONV* pConv, WDML_XACT*  pXAct);
+extern	void		WDML_FreeTransaction(WDML_INSTANCE* pInstance, WDML_XACT* pXAct, BOOL doFreePmt);
+extern	WDML_XACT*	WDML_FindTransaction(WDML_CONV* pConv, DWORD tid);
+extern	HGLOBAL		WDML_DataHandle2Global(HDDEDATA hDdeData, BOOL fResponse, BOOL fRelease,
+					       BOOL fDeferUpd, BOOL dAckReq);
+extern	HDDEDATA	WDML_Global2DataHandle(HGLOBAL hMem, WINE_DDEHEAD* da);
+extern  BOOL            WDML_IsAppOwned(HDDEDATA hDdeData);
+extern	WDML_INSTANCE*	WDML_GetInstance(DWORD InstId);
+extern	WDML_INSTANCE*	WDML_GetInstanceFromWnd(HWND hWnd);
+/* broadcasting to DDE windows */
+extern	void		WDML_BroadcastDDEWindows(const char* clsName, UINT uMsg,
+						 WPARAM wParam, LPARAM lParam);
+extern	void		WDML_NotifyThreadExit(DWORD tid);
+
+static __inline void WDML_ExtractAck(WORD status, DDEACK* da)
+{
+    *da = *((DDEACK*)&status);
+}
+
+extern const char 	WDML_szEventClass[]; 	   /* class of window for events (aka instance) */
+extern const char  	WDML_szServerConvClassA[]; /* class of window for server side conv (ansi) */
+extern const WCHAR 	WDML_szServerConvClassW[]; /* class of window for server side conv (unicode) */
+extern const char  	WDML_szClientConvClassA[]; /* class of window for client side conv (ansi) */
+extern const WCHAR 	WDML_szClientConvClassW[]; /* class of window for client side conv (unicode) */
+
+#define WM_WDML_REGISTER	(WM_USER + 0x200)
+#define WM_WDML_UNREGISTER	(WM_USER + 0x201)
+#define WM_WDML_CONNECT_CONFIRM	(WM_USER + 0x202)
+
+/* parameters for messages:
+ *			wParam				lParam
+ * Register		atom for service name		atom for service spec
+ * Unregister		atom for service name		atom for service spec
+ * ConnectConfirm	client window handle		server window handle
+ */
+
+#define	GWL_WDML_INSTANCE	(0)
+#define	GWL_WDML_CONVERSATION	(4)
+#define	GWL_WDML_SERVER		(4)
+
+#endif  /* __WINE_DDEML_PRIVATE_H */

Deleted: trunk/reactos/lib/user32/include/debug.h
--- trunk/reactos/lib/user32/include/debug.h	2005-07-27 19:10:57 UTC (rev 16810)
+++ trunk/reactos/lib/user32/include/debug.h	2005-07-27 19:21:46 UTC (rev 16811)
@@ -1,74 +0,0 @@
-/*
- * COPYRIGHT:   See COPYING in the top level directory
- * PROJECT:     ReactOS user32.dll
- * FILE:        include/debug.h
- * PURPOSE:     Debugging support macros
- * DEFINES:     DBG     - Enable debug output
- *              NASSERT - Disable assertions
- */
-#ifndef __DEBUG_H
-#define __DEBUG_H
-
-#define NORMAL_MASK    0x000000FF
-#define SPECIAL_MASK   0xFFFFFF00
-#define MIN_TRACE      0x00000001
-#define MID_TRACE      0x00000002
-#define MAX_TRACE      0x00000003
-
-#define DEBUG_CHECK    0x00000100
-#define DEBUG_OBJECT   0x00000200
-#define DEBUG_WINDOW   0x00000400
-#define DEBUG_ULTRA    0xFFFFFFFF
-
-#ifdef ASSERT
-#undef ASSERT
-#endif
-
-#ifdef DBG
-
-extern DWORD DebugTraceLevel;
-
-#define D(_t_, _x_) \
-    if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
-        ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
-        DbgPrint("(%hS:%d)(%hS) ", __FILE__, __LINE__, __FUNCTION__); \
-		    DbgPrint _x_; \
-    }
-
-#ifdef NASSERT
-#define ASSERT(x)
-#else /* NASSERT */
-#define ASSERT(x) if (!(x)) { D(MIN_TRACE, ("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__)); }
-#endif /* NASSERT */
-
-#define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x))
-
-#else /* DBG */
-
-#define D(_t_, _x_)
-
-#define ASSERT_IRQL(x)
-#define ASSERT(x)
-
-#endif /* DBG */
-
-#ifdef assert
-#undef assert
-#endif
-#define assert(x) ASSERT(x)
-#define assert_irql(x) ASSERT_IRQL(x)
-
-
-#define UNIMPLEMENTED \
-    D(MIN_TRACE, ("is unimplemented, please try again later.\n"));
-
-#define CHECKPOINT \
-    D(DEBUG_CHECK, ("\n"));
-
-#define DPRINT(X...) D(DEBUG_CHECK, (X))
-
-#define CP CHECKPOINT
-
-#endif /* __DEBUG_H */
-
-/* EOF */

Modified: trunk/reactos/lib/user32/include/user32.h
--- trunk/reactos/lib/user32/include/user32.h	2005-07-27 19:10:57 UTC (rev 16810)
+++ trunk/reactos/lib/user32/include/user32.h	2005-07-27 19:21:46 UTC (rev 16811)
@@ -8,17 +8,17 @@
 
 /* INCLUDES ******************************************************************/
 
-#ifndef USER32_H
-#define USER32_H
-
 /* C Headers */
 #include <stdio.h>
-#include <ctype.h>
+#include <math.h>
 
 /* SDK/NDK Headers */
+#define _USER32_
+#define OEMRESOURCE
+#define NTOS_MODE_USER
 #include <windows.h>
 #include <windowsx.h>
-#define NTOS_MODE_USER
+#include <winnls32.h>
 #include <ndk/ntndk.h>
 
 /* CSRSS Headers */
@@ -32,11 +32,13 @@
 #include <win32k/menu.h>
 #include <win32k/paint.h>
 
+/* WINE Headers */
+#include <wine/debug.h>
+#include <wine/unicode.h>
+
 /* Internal User32 Headers */
 #include "user32p.h"
 
 /* FIXME: FILIP */
 HGDIOBJ STDCALL  NtGdiSelectObject(HDC  hDC, HGDIOBJ  hGDIObj);
 DWORD STDCALL GdiGetCharDimensions(HDC, LPTEXTMETRICW, DWORD *);
-
-#endif /* USER32_H */

Modified: trunk/reactos/lib/user32/include/user32p.h
--- trunk/reactos/lib/user32/include/user32p.h	2005-07-27 19:10:57 UTC (rev 16810)
+++ trunk/reactos/lib/user32/include/user32p.h	2005-07-27 19:21:46 UTC (rev 16811)
@@ -14,10 +14,9 @@
 /* Private User32 Headers */
 #include "accel.h"
 #include "cursor.h"
-#ifndef __WINE__
-#include "debug.h"
-#endif
+#include "controls.h"
 #include "draw.h"
+#include "dde_private.h"
 #include "menu.h"
 #include "message.h"
 #include "regcontrol.h"

Modified: trunk/reactos/lib/user32/misc/dde.c
--- trunk/reactos/lib/user32/misc/dde.c	2005-07-27 19:10:57 UTC (rev 16810)
+++ trunk/reactos/lib/user32/misc/dde.c	2005-07-27 19:21:46 UTC (rev 16811)
@@ -22,22 +22,10 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include "wine/config.h"
-#include "wine/port.h"
+#include <user32.h>
+#define NDEBUG
+#include <debug.h>
 
-#include <string.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-#include "winerror.h"
-#include "dde.h"
-#include "ddeml.h"
-#include "wine/debug.h"
-#include "dde_private.h"
-
 WINE_DEFAULT_DEBUG_CHANNEL(ddeml);
 
 /* convert between ATOM and HSZ avoiding compiler warnings */

Deleted: trunk/reactos/lib/user32/misc/dde_private.h
--- trunk/reactos/lib/user32/misc/dde_private.h	2005-07-27 19:10:57 UTC (rev 16810)
+++ trunk/reactos/lib/user32/misc/dde_private.h	2005-07-27 19:21:46 UTC (rev 16811)
@@ -1,268 +0,0 @@
-/* -*- tab-width: 8; c-basic-offset: 4 -*- */
-
-/*
- * DDEML library
- *
- * Copyright 1997 Alexandre Julliard
- * Copyright 1997 Len White
- * Copyright 1999 Keith Matthews
- * Copyright 2000 Corel
- * Copyright 2001 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
- */
-
-#ifndef __WINE_DDEML_PRIVATE_H
-#define __WINE_DDEML_PRIVATE_H
-
-/* defined in atom.c file.
- */
-#define MAX_ATOM_LEN              255
-
-/* Maximum buffer size ( including the '\0' ).
- */
-#define MAX_BUFFER_LEN            (MAX_ATOM_LEN + 1)
-
-/* The internal structures (prefixed by WDML) are used as follows:
- * + a WDML_INSTANCE is created for each instance creation (DdeInitialize)
- *      - a popup window (InstanceClass) is created for each instance.
- *      - this window is used to receive all the DDEML events (server registration,
- *	  conversation confirmation...). See the WM_WDML_???? messages for details
- * + when registring a server (DdeNameService) a WDML_SERVER is created
- *	- a popup window (ServerNameClass) is created
- * + a conversation is represented by two WDML_CONV structures:
- *	- one on the client side, the other one on the server side
- *	- this is needed because the address spaces may be different
- *	- therefore, two lists of links are kept for each instance
- *	- two windows are created for a conversation:
- *		o a popup window on client side (ClientConvClass)
- *		o a child window (of the ServerName) on the server side
- *		  (ServerConvClass)
- *	- all the exchanges then take place between those two windows
- *	- windows for the conversation exist in two forms (Ansi & Unicode). This
- *	  is only needed when a partner in a conv is not handled by DDEML. The
- *	  type (A/W) of the window is used to handle the ansi <=> unicode
- *        transformations
- *	- two handles are created for a conversation (on each side). Each handle
- *	  is linked to a structure. To help differentiate those handles, the
- *	  local one has an even value, whereas the remote one has an odd value.
- * + a (warm or link) is represented by two WDML_LINK structures:
- *	- one on client side, the other one on server side
- *	- therefore, two lists of links are kept for each instance
- *
- * To help getting back to data, WDML windows store information:
- *	- offset 0: the DDE instance
- *	- offset 4: the current conversation (for ClientConv and ServerConv only)
- *
- * All the implementation (client & server) makes the assumption that the other side
- * is not always a DDEML partner. However, if it's the case, supplementary services
- * are available (most notably the REGISTER/UNREGISTER and CONNECT_CONFIRM messages
- * to the callback function). To be correct in every situation, all the basic
- * exchanges are made using the 'pure' DDE protocol. A (future !) enhancement would
- * be to provide a new protocol in the case were both partners are handled by DDEML.
- *
- * The StringHandles are in fact stored as local atoms. So an HSZ and a (local) atom
- * can be used interchangably. However, in order to keep track of the allocated HSZ,
[truncated at 1000 lines; 798 more skipped]