Cleanup header usage in USER32.
Modified: trunk/reactos/lib/user32/controls/button.c
Modified: trunk/reactos/lib/user32/controls/combo.c
Modified: trunk/reactos/lib/user32/controls/edit.c
Modified: trunk/reactos/lib/user32/controls/listbox.c
Modified: trunk/reactos/lib/user32/controls/regcontrol.c
Modified: trunk/reactos/lib/user32/controls/scrollbar.c
Modified: trunk/reactos/lib/user32/controls/static.c
Modified: trunk/reactos/lib/user32/include/user32.h
Modified: trunk/reactos/lib/user32/misc/dde.c
Modified: trunk/reactos/lib/user32/misc/desktop.c
Modified: trunk/reactos/lib/user32/misc/display.c
Modified: trunk/reactos/lib/user32/misc/dllmain.c
Modified: trunk/reactos/lib/user32/misc/exit.c
Modified: trunk/reactos/lib/user32/misc/exticon.c
Modified: trunk/reactos/lib/user32/misc/misc.c
Modified: trunk/reactos/lib/user32/misc/object.c
Modified: trunk/reactos/lib/user32/misc/resources.c
Modified: trunk/reactos/lib/user32/misc/strpool.c
Modified: trunk/reactos/lib/user32/misc/stubs.c
Modified: trunk/reactos/lib/user32/misc/timer.c
Modified: trunk/reactos/lib/user32/misc/winhelp.c
Modified: trunk/reactos/lib/user32/misc/winsta.c
Modified: trunk/reactos/lib/user32/misc/wsprintf.c
Modified: trunk/reactos/lib/user32/windows/accel.c
Modified: trunk/reactos/lib/user32/windows/bitmap.c
Modified: trunk/reactos/lib/user32/windows/caret.c
Modified: trunk/reactos/lib/user32/windows/class.c
Modified: trunk/reactos/lib/user32/windows/clipboard.c
Modified: trunk/reactos/lib/user32/windows/cursor.c
Modified: trunk/reactos/lib/user32/windows/dc.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/prop.c
Modified: trunk/reactos/lib/user32/windows/rect.c
Modified: trunk/reactos/lib/user32/windows/text.c
Modified: trunk/reactos/lib/user32/windows/window.c
Modified: trunk/reactos/lib/user32/windows/winpos.c

Modified: trunk/reactos/lib/user32/controls/button.c
--- trunk/reactos/lib/user32/controls/button.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/controls/button.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -19,11 +19,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifndef __USE_W32API
-#define __USE_W32API
-#endif
-
-#include "user32.h"
+#define __WINE__
+#include <user32.h>
 #include <stdarg.h>
 #include <string.h>
 #include <stdlib.h>

Modified: trunk/reactos/lib/user32/controls/combo.c
--- trunk/reactos/lib/user32/controls/combo.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/controls/combo.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -20,7 +20,8 @@
  * FIXME: roll up in Netscape 3.01.
  */
 
-#include "user32.h"
+#define __WINE__
+#include <user32.h>
 #include <stdarg.h>
 #include <string.h>
 

Modified: trunk/reactos/lib/user32/controls/edit.c
--- trunk/reactos/lib/user32/controls/edit.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/controls/edit.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -36,11 +36,8 @@
  *
  */
 
-#ifndef __USE_W32API
-#define __USE_W32API
-#endif
-
-#include "user32.h"
+#define __WINE__
+#include <user32.h>
 #include <stdarg.h>
 #include <string.h>
 #include <stdlib.h>

Modified: trunk/reactos/lib/user32/controls/listbox.c
--- trunk/reactos/lib/user32/controls/listbox.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/controls/listbox.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -17,8 +17,9 @@
  * 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 "user32.h"
-#define NDEBUG
+
+#define __WINE__
+#include <user32.h>
 #include <string.h>
 #include <stdlib.h>
 #include "controls.h"

Modified: trunk/reactos/lib/user32/controls/regcontrol.c
--- trunk/reactos/lib/user32/controls/regcontrol.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/controls/regcontrol.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -9,9 +9,7 @@
  * NOTES:            Adapted from Wine
  */
 
-#include "user32.h"
-#include <wchar.h>
-#include "win32k/ntuser.h"
+#include <user32.h>
 
 static void RegisterBuiltinClass(const struct builtin_class_descr *Descr)
 {

Modified: trunk/reactos/lib/user32/controls/scrollbar.c
--- trunk/reactos/lib/user32/controls/scrollbar.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/controls/scrollbar.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -30,13 +30,8 @@
 
 /* INCLUDES *******************************************************************/
 
-#include "user32.h"
-#include <debug.h>
-#include <draw.h>
-#include <stdlib.h>
-#include <string.h>
+#include <user32.h>
 #include <oleacc.h>
-#include <rosrtl/minmax.h>
 
 /* GLOBAL VARIABLES ***********************************************************/
 
@@ -655,7 +650,11 @@
       return si.nMin;
     }
 
-  Pos = RtlRosMax(0, Pos - ScrollBarInfo->dxyLineButton);
+  Pos = Pos - ScrollBarInfo->dxyLineButton;
+  if (Pos < 0)
+    {
+      Pos = 0;
+    }
   if (Pixels < Pos)
     {
       Pos = Pixels;

Modified: trunk/reactos/lib/user32/controls/static.c
--- trunk/reactos/lib/user32/controls/static.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/controls/static.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -18,7 +18,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include "user32.h"
+#include <user32.h>
 
 #ifndef __REACTOS__
 WINE_DEFAULT_DEBUG_CHANNEL(static);

Modified: trunk/reactos/lib/user32/include/user32.h
--- trunk/reactos/lib/user32/include/user32.h	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/include/user32.h	2005-06-19 18:06:53 UTC (rev 16099)
@@ -4,12 +4,34 @@
  * FILE:        include/user32.h
  * PURPOSE:     Global user32 definitions
  */
+
+#ifndef USER32_H
+#define USER32_H
+
+#include <ctype.h>
+#include <stdio.h>
+#include <limits.h>
 #include <windows.h>
+#include <windowsx.h>
 #define NTOS_MODE_USER
 #include <ntos.h>
 #include <win32k/win32k.h>
-
+#include <win32k/callback.h>
+#include "accel.h"
+#include "cursor.h"
+#ifndef __WINE__
+#include "debug.h"
+#endif
+#include "draw.h"
+#include "menu.h"
+#include "message.h"
 #include "regcontrol.h"
+#include "resource.h"
+#include "scroll.h"
+#include "strpool.h"
+#include "window.h"
+#include "winpos.h"
+#include "winsta.h"
 
 extern HINSTANCE User32Instance;
 
@@ -131,3 +153,4 @@
 #define NtUserEnableProcessWindowGhosting(bEnable) \
   NtUserCallOneParam((DWORD)bEnable, ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING)
 
+#endif /* USER32_H */

Modified: trunk/reactos/lib/user32/misc/dde.c
--- trunk/reactos/lib/user32/misc/dde.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/misc/dde.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -22,10 +22,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifndef __USE_W32API
-#define __USE_W32API
-#endif
-
 #include "wine/config.h"
 #include "wine/port.h"
 

Modified: trunk/reactos/lib/user32/misc/desktop.c
--- trunk/reactos/lib/user32/misc/desktop.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/misc/desktop.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -9,14 +9,9 @@
  *      06-06-2001  CSH  Created
  */
 
-#include "user32.h"
-#include "winsta.h"
-#include <string.h>
-#include <debug.h>
+#include <user32.h>
 #include <rosrtl/devmode.h>
 #include <rosrtl/logfont.h>
-#include <malloc.h>
-#include <math.h>
 
 /*
  * @implemented

Modified: trunk/reactos/lib/user32/misc/display.c
--- trunk/reactos/lib/user32/misc/display.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/misc/display.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -28,11 +28,8 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
+#include <user32.h>
 #include <rosrtl/devmode.h>
-#include <win32k/ntuser.h>
-#define NDEBUG
-#include <debug.h>
 
 /* FUNCTIONS *****************************************************************/
 

Modified: trunk/reactos/lib/user32/misc/dllmain.c
--- trunk/reactos/lib/user32/misc/dllmain.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/misc/dllmain.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -1,12 +1,5 @@
-#include "user32.h"
-#include "menu.h"
-#include "message.h"
-#include "accel.h"
-#include "strpool.h"
-#include <win32k/callback.h>
+#include <user32.h>
 
-#include <debug.h>
-
 /* FIXME: Belongs to some header. */
 WINBOOL STDCALL GdiDllInitialize(HANDLE, DWORD, LPVOID);
 

Modified: trunk/reactos/lib/user32/misc/exit.c
--- trunk/reactos/lib/user32/misc/exit.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/misc/exit.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -7,7 +7,7 @@
  * PROGRAMMER:      Eric Kohl (ekohl@rz-online.de)
  */
 
-#include "user32.h"
+#include <user32.h>
 #include <ntdll/csr.h>
 
 /*

Modified: trunk/reactos/lib/user32/misc/exticon.c
--- trunk/reactos/lib/user32/misc/exticon.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/misc/exticon.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -22,15 +22,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-/* Remove this once w32api conversion is done */
-#ifndef __USE_W32API
-#define __USE_W32API
-#define _WIN32_IE 0x600
-#define	_WIN32_WINNT 0x501
-#define	WINVER 0x501
-#define __need_offsetof
-#endif /* __USE_W32API */
-
 #include <stdarg.h>
 #include <string.h>
 #include <stdlib.h>	/* abs() */

Modified: trunk/reactos/lib/user32/misc/misc.c
--- trunk/reactos/lib/user32/misc/misc.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/misc/misc.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -28,8 +28,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <debug.h>
+#include <user32.h>
 #include <ntdll/csr.h>
 
 /* FUNCTIONS *****************************************************************/

Modified: trunk/reactos/lib/user32/misc/object.c
--- trunk/reactos/lib/user32/misc/object.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/misc/object.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -28,8 +28,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <debug.h>
+#include <user32.h>
 
 /* FUNCTIONS *****************************************************************/
 

Modified: trunk/reactos/lib/user32/misc/resources.c
--- trunk/reactos/lib/user32/misc/resources.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/misc/resources.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -1,5 +1,4 @@
-#include "user32.h"
-#include <string.h>
+#include <user32.h>
 
 /* FIXME: Currently IsBadWritePtr is implemented using VirtualQuery which
           does not seem to work properly for stack address space. */

Modified: trunk/reactos/lib/user32/misc/strpool.c
--- trunk/reactos/lib/user32/misc/strpool.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/misc/strpool.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -1,8 +1,6 @@
 // strpool.c
 
-#include "user32.h"
-#include <strpool.h>
-#include <string.h>
+#include <user32.h>
 
 typedef struct tagHEAP_STRING_POOLA
 {

Modified: trunk/reactos/lib/user32/misc/stubs.c
--- trunk/reactos/lib/user32/misc/stubs.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/misc/stubs.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -10,10 +10,7 @@
  *      08-F05-2001  CSH  Created
  */
 
-#include "user32.h"
-#include <debug.h>
-#include <string.h>
-#include <mmsystem.h>
+#include <user32.h>
 #ifdef __USE_W32API
 typedef PVOID LPIMEPROW, LPIMEPROA;
 #endif

Modified: trunk/reactos/lib/user32/misc/timer.c
--- trunk/reactos/lib/user32/misc/timer.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/misc/timer.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -28,8 +28,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <debug.h>
+#include <user32.h>
 
 /* FUNCTIONS *****************************************************************/
 

Modified: trunk/reactos/lib/user32/misc/winhelp.c
--- trunk/reactos/lib/user32/misc/winhelp.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/misc/winhelp.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -28,9 +28,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <string.h>
-#include <debug.h>
+#include <user32.h>
 
 /* WinHelp internal structure */
 typedef struct

Modified: trunk/reactos/lib/user32/misc/winsta.c
--- trunk/reactos/lib/user32/misc/winsta.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/misc/winsta.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -9,10 +9,8 @@
  *      04-06-2001  CSH  Created
  */
 
-#include "user32.h"
-#include <debug.h>
+#include <user32.h>
 
-
 /*
  * @implemented
  */

Modified: trunk/reactos/lib/user32/misc/wsprintf.c
--- trunk/reactos/lib/user32/misc/wsprintf.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/misc/wsprintf.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -31,11 +31,7 @@
  * NOTES:            Adapted from Wine
  */
 
-#include "user32.h"
-#include <stdarg.h>
-#include <string.h>
-#include <stdio.h>
-#include "strpool.h"
+#include <user32.h>
 
 #define WPRINTF_LEFTALIGN   0x0001  /* Align output on the left ('-' prefix) */
 #define WPRINTF_PREFIX_HEX  0x0002  /* Prefix hex with 0x ('#' prefix) */

Modified: trunk/reactos/lib/user32/windows/accel.c
--- trunk/reactos/lib/user32/windows/accel.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/accel.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -29,9 +29,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include "accel.h"
-#include <win32k/ntuser.h>
+#include <user32.h>
 
 /* this is the 8 byte accel struct used in Win32 resources (internal only) */
 typedef struct

Modified: trunk/reactos/lib/user32/windows/bitmap.c
--- trunk/reactos/lib/user32/windows/bitmap.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/bitmap.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -28,10 +28,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <string.h>
-#include <debug.h>
-#include <stdlib.h>
+#include <user32.h>
 
 /*forward declerations... actualy in user32\windows\icon.c but usful here****/
 HICON ICON_CreateCursorFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cxDesired, int cyDesired, int xHotspot, int yHotspot);

Modified: trunk/reactos/lib/user32/windows/caret.c
--- trunk/reactos/lib/user32/windows/caret.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/caret.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -28,8 +28,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <debug.h>
+#include <user32.h>
 
 /* FUNCTIONS *****************************************************************/
 

Modified: trunk/reactos/lib/user32/windows/class.c
--- trunk/reactos/lib/user32/windows/class.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/class.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -9,14 +9,8 @@
  *      09-05-2001  CSH  Created
  */
 
-#include "user32.h"
-#include <string.h>
-#include <stdlib.h>
-#include <debug.h>
-#include <window.h>
-#include <strpool.h>
+#include <user32.h>
 
-
 static BOOL GetClassInfoExCommon(
     HINSTANCE hInst,
     LPCWSTR lpszClass,

Modified: trunk/reactos/lib/user32/windows/clipboard.c
--- trunk/reactos/lib/user32/windows/clipboard.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/clipboard.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -28,10 +28,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <strpool.h>
-#define NDEBUG
-#include <debug.h>
+#include <user32.h>
 
 /* FUNCTIONS *****************************************************************/
 

Modified: trunk/reactos/lib/user32/windows/cursor.c
--- trunk/reactos/lib/user32/windows/cursor.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/cursor.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -28,9 +28,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <string.h>
-#include <debug.h>
+#include <user32.h>
 #undef CopyCursor
 
 HBITMAP

Modified: trunk/reactos/lib/user32/windows/dc.c
--- trunk/reactos/lib/user32/windows/dc.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/dc.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -28,8 +28,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <debug.h>
+#include <user32.h>
 
 /* FUNCTIONS *****************************************************************/
 

Modified: trunk/reactos/lib/user32/windows/defwnd.c
--- trunk/reactos/lib/user32/windows/defwnd.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/defwnd.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -11,18 +11,8 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <windowsx.h>
-#include <window.h>
-#include <string.h>
-#include <cursor.h>
-#include <menu.h>
-#include <scroll.h>
-#include <winpos.h>
+#include <user32.h>
 
-#define NDEBUG
-#include <debug.h>
-
 #ifndef WM_SETVISIBLE
 #define WM_SETVISIBLE 9
 #endif

Modified: trunk/reactos/lib/user32/windows/dialog.c
--- trunk/reactos/lib/user32/windows/dialog.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/dialog.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -31,13 +31,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <limits.h>
-#include <debug.h>
+#include <user32.h>
 
 /* MACROS/DEFINITIONS ********************************************************/
 
@@ -1235,24 +1229,6 @@
 #undef SENDMSG
 }
 
-/* Hack - We dont define this anywhere and we shouldn't
- * Its only used to port buggy WINE code in to our buggy code.
- * Make it go away - sedwards
- */
-/* strdup macros */
-/* DO NOT USE IT!!  it will go away soon */
-inline static LPSTR HEAP_strdupWtoA( HANDLE heap, DWORD flags, LPCWSTR str )
-{
-    LPSTR ret;
-    INT len;
-
-    if (!str) return NULL;
-    len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
-    ret = RtlAllocateHeap(GetProcessHeap(), flags, len );
-    if(ret) WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
-    return ret;
-}
-
 /**********************************************************************
  *	    DIALOG_DlgDirListW
  *
@@ -1263,11 +1239,14 @@
 {
     if (spec)
     {
-        LPSTR specA = HEAP_strdupWtoA( GetProcessHeap(), 0, spec );
-        INT ret = DIALOG_DlgDirList( hDlg, specA, idLBox, idStatic,
-                                       attrib, combo );
+        LPSTR specA;
+        INT ret;
+
+        HEAP_strdupWtoA ( &specA, spec, lstrlenW(spec) );
+        ret = DIALOG_DlgDirList( hDlg, specA, idLBox, idStatic,
+                                 attrib, combo );
         MultiByteToWideChar( CP_ACP, 0, specA, -1, spec, 0x7fffffff );
-        HeapFree( GetProcessHeap(), 0, specA );
+        HEAP_free( specA );
         return ret;
     }
     return DIALOG_DlgDirList( hDlg, NULL, idLBox, idStatic, attrib, combo );

Modified: trunk/reactos/lib/user32/windows/draw.c
--- trunk/reactos/lib/user32/windows/draw.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/draw.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -28,17 +28,7 @@
 
 /* INCLUDES *******************************************************************/
 
-#ifndef __USE_W32API
-#define __USE_W32API
-#define _WIN32_WINNT 0x0500
-#define WINVER 0x0500
-#endif
-
-#include <windows.h>
-#include <string.h>
-#include <wine/unicode.h>
 #include <user32.h>
-#include <debug.h>
 
 /* GLOBALS *******************************************************************/
 
@@ -1388,7 +1378,7 @@
         if (unicode)
             nCount = lstrlenW((WCHAR*)lpData);
         else
-            nCount = strlen((CHAR*)lpData);
+            nCount = lstrlenA((CHAR*)lpData);
     }
 
     if (! nWidth || ! nHeight)
@@ -1545,9 +1535,9 @@
     if((opcode == DST_TEXT || opcode == DST_PREFIXTEXT) && !len)    /* The string is '\0' terminated */
     {
         if(unicode)
-            len = strlenW((LPWSTR)lp);
+            len = lstrlenW((LPWSTR)lp);
         else
-            len = strlen((LPSTR)lp);
+            len = lstrlenA((LPSTR)lp);
     }
 
     /* Find out what size the image has if not given by caller */

Modified: trunk/reactos/lib/user32/windows/font.c
--- trunk/reactos/lib/user32/windows/font.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/font.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -28,9 +28,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <string.h>
-#include <debug.h>
+#include <user32.h>
 
 /* FUNCTIONS *****************************************************************/
 

Modified: trunk/reactos/lib/user32/windows/hook.c
--- trunk/reactos/lib/user32/windows/hook.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/hook.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -28,10 +28,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <win32k/callback.h>
-#define NDEBUG
-#include <debug.h>
+#include <user32.h>
 
 /* FUNCTIONS *****************************************************************/
 

Modified: trunk/reactos/lib/user32/windows/icon.c
--- trunk/reactos/lib/user32/windows/icon.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/icon.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -28,10 +28,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <string.h>
-#include <stdlib.h>
-#include <debug.h>
+#include <user32.h>
 
 /* FUNCTIONS *****************************************************************/
 

Modified: trunk/reactos/lib/user32/windows/input.c
--- trunk/reactos/lib/user32/windows/input.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/input.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -28,9 +28,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <debug.h>
-#include <wchar.h>
+#include <user32.h>
 
 /* FUNCTIONS *****************************************************************/
 

Modified: trunk/reactos/lib/user32/windows/mdi.c
--- trunk/reactos/lib/user32/windows/mdi.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/mdi.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -80,6 +80,8 @@
  *
  */
 
+#define __WINE__
+
 #include <stdlib.h>
 #include <stdarg.h>
 #include <stdio.h>

Modified: trunk/reactos/lib/user32/windows/menu.c
--- trunk/reactos/lib/user32/windows/menu.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/menu.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -33,18 +33,9 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <ctype.h>
-#include <string.h>
-#include <draw.h>
-#include <window.h>
-#include <strpool.h>
-#include <win32k/callback.h>
+#include <user32.h>
 #include "../controls/controls.h"
 
-#define NDEBUG
-#include <debug.h>
-
 /* internal popup menu window messages */
 #define MM_SETMENUHANDLE (WM_USER + 0)
 #define MM_GETMENUHANDLE (WM_USER + 1)

Modified: trunk/reactos/lib/user32/windows/message.c
--- trunk/reactos/lib/user32/windows/message.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/message.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -8,11 +8,7 @@
  *      06-06-2001  CSH  Created
  */
 
-#include "user32.h"
-#include <string.h>
-#include <debug.h>
-#include <win32k/callback.h>
-#include <message.h>
+#include <user32.h>
 
 /* DDE message exchange
  *

Modified: trunk/reactos/lib/user32/windows/messagebox.c
--- trunk/reactos/lib/user32/windows/messagebox.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/messagebox.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -31,15 +31,8 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <debug.h>
-#include "resource.h"
+#include <user32.h>
 
-#include <mmsystem.h>
-
 /* DEFINES *******************************************************************/
 
 #define MSGBOX_IDICON   (1088)

Modified: trunk/reactos/lib/user32/windows/nonclient.c
--- trunk/reactos/lib/user32/windows/nonclient.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/nonclient.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -30,25 +30,8 @@
 #define __REACTOS__
 */
 
-/*
- * Use w32api headers
- */
-/*
-#define __USE_W32API
-#define _WIN32_WINNT 0x0501
-*/
-
-#include <windows.h>
-#include <windowsx.h>
-#include <string.h>
-#include <menu.h>
-#include <winpos.h>
 #include <user32.h>
-#include "window.h"
 
-#define NDEBUG
-#include <debug.h>
-
 #define HAS_DLGFRAME(Style, ExStyle) \
             (((ExStyle) & WS_EX_DLGMODALFRAME) || \
             (((Style) & WS_DLGFRAME) && (!((Style) & (WS_THICKFRAME | WS_MINIMIZE)))))

Modified: trunk/reactos/lib/user32/windows/paint.c
--- trunk/reactos/lib/user32/windows/paint.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/paint.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -28,10 +28,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <resource.h>
-#define NDEBUG
-#include <debug.h>
+#include <user32.h>
 
 static HBRUSH FrameBrushes[13];
 static HBITMAP hHatch;

Modified: trunk/reactos/lib/user32/windows/prop.c
--- trunk/reactos/lib/user32/windows/prop.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/prop.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -28,9 +28,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <strpool.h>
-#include <debug.h>
+#include <user32.h>
 
 typedef struct _PROPLISTITEM
 {

Modified: trunk/reactos/lib/user32/windows/rect.c
--- trunk/reactos/lib/user32/windows/rect.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/rect.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -28,8 +28,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <debug.h>
+#include <user32.h>
 
 /* FUNCTIONS *****************************************************************/
 

Modified: trunk/reactos/lib/user32/windows/text.c
--- trunk/reactos/lib/user32/windows/text.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/text.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -28,11 +28,8 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <ctype.h>
-#include <debug.h>
+#include <user32.h>
 
-
 /* FUNCTIONS *****************************************************************/
 
 static WORD

Modified: trunk/reactos/lib/user32/windows/window.c
--- trunk/reactos/lib/user32/windows/window.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/window.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -11,13 +11,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <window.h>
-#include <string.h>
-#include <strpool.h>
-#include <win32k/callback.h>
-#define NDEBUG
-#include <debug.h>
+#include <user32.h>
 
 BOOL ControlsInitialized = FALSE;
 

Modified: trunk/reactos/lib/user32/windows/winpos.c
--- trunk/reactos/lib/user32/windows/winpos.c	2005-06-19 17:34:05 UTC (rev 16098)
+++ trunk/reactos/lib/user32/windows/winpos.c	2005-06-19 18:06:53 UTC (rev 16099)
@@ -11,12 +11,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#include "user32.h"
-#include <window.h>
-#include <win32k/callback.h>
-#include <window.h>
-#define NDEBUG
-#include <debug.h>
+#include <user32.h>
 
 /* FUNCTIONS *****************************************************************/