Kill large parts of rosrtl. devmode conversion implented in gdi32 because it's actually an exported api, 2nd converstion used only once so inlined. logfont conversion implented as functions directly in the ddl. rtlrosmin/max replaced by actual macros, and resource rtlros function in aclui replace by actual win32 call. other rosrtl code was already deprecated.
Deleted: trunk/reactos/include/rosrtl/devmode.h
Deleted: trunk/reactos/include/rosrtl/gdimacro.h
Deleted: trunk/reactos/include/rosrtl/logfont.h
Deleted: trunk/reactos/include/rosrtl/minmax.h
Deleted: trunk/reactos/include/rosrtl/path.h
Deleted: trunk/reactos/include/rosrtl/priv.h
Deleted: trunk/reactos/include/rosrtl/resstr.h
Deleted: trunk/reactos/include/rosrtl/sparse.h
Modified: trunk/reactos/lib/aclui/aclui.c
Modified: trunk/reactos/lib/gdi32/include/precomp.h
Modified: trunk/reactos/lib/gdi32/misc/stubs.c
Modified: trunk/reactos/lib/gdi32/objects/dc.c
Modified: trunk/reactos/lib/gdi32/objects/font.c
Modified: trunk/reactos/lib/gdi32/objects/utils.c
Modified: trunk/reactos/lib/rosrtl/file/sparse.c
Modified: trunk/reactos/lib/rosrtl/misc/devmode.c
Modified: trunk/reactos/lib/rosrtl/misc/logfont.c
Modified: trunk/reactos/lib/rosrtl/thread/priv.c
Modified: trunk/reactos/lib/user32/include/user32p.h
Modified: trunk/reactos/lib/user32/misc/desktop.c
Modified: trunk/reactos/lib/user32/misc/display.c
Modified: trunk/reactos/subsys/csrss/win32csr/conio.c

Deleted: trunk/reactos/include/rosrtl/devmode.h
--- trunk/reactos/include/rosrtl/devmode.h	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/include/rosrtl/devmode.h	2005-07-01 01:54:55 UTC (rev 16359)
@@ -1,18 +0,0 @@
-/* devmode.h
- */
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-void
-RosRtlDevModeA2W ( LPDEVMODEW pW, const LPDEVMODEA pA );
-void
-RosRtlDevModeW2A( LPDEVMODEA pA, const LPDEVMODEW pW );
-
-#ifdef __cplusplus
-}
-#endif
-
-/* EOF */

Deleted: trunk/reactos/include/rosrtl/gdimacro.h
--- trunk/reactos/include/rosrtl/gdimacro.h	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/include/rosrtl/gdimacro.h	2005-07-01 01:54:55 UTC (rev 16359)
@@ -1,24 +0,0 @@
-/*
- * gdimacro.h
- */
-
-#ifndef ROSRTL_GDIMACRO_H
-#define ROSRTL_GDIMACRO_H
-
-#define IN_RECT(r,x,y) \
-( \
- (x) >= (r).left && \
- (y) >= (r).top && \
- (x) < (r).right && \
- (y) < (r).bottom \
-)
-
-#define RECT_OVERLAP(a,b) \
-( \
-  (a).left < (b).right && \
-  (b).left < (a).right && \
-  (a).top < (b).bottom && \
-  (b).top < (a).bottom \
-)
-
-#endif /* ROSRTL_GDIMACRO_H */

Deleted: trunk/reactos/include/rosrtl/logfont.h
--- trunk/reactos/include/rosrtl/logfont.h	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/include/rosrtl/logfont.h	2005-07-01 01:54:55 UTC (rev 16359)
@@ -1,19 +0,0 @@
-/* logfont.h
- */
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-void
-RosRtlLogFontA2W ( LPLOGFONTW pW, const LOGFONTA *pA );
-
-void
-RosRtlLogFontW2A ( LPLOGFONTA pA, const LOGFONTW *pW );
-
-#ifdef __cplusplus
-}
-#endif
-
-/* EOF */

Deleted: trunk/reactos/include/rosrtl/minmax.h
--- trunk/reactos/include/rosrtl/minmax.h	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/include/rosrtl/minmax.h	2005-07-01 01:54:55 UTC (rev 16359)
@@ -1,23 +0,0 @@
-/* $Id$
- */
-
-#ifndef ROSRTL_MINMAX_H__
-#define ROSRTL_MINMAX_H__
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#define RtlRosMin(X,Y) (((X) < (Y))? (X) : (Y))
-#define RtlRosMax(X,Y) (((X) > (Y))? (X) : (Y))
-#define RtlRosMin3(X,Y,Z) (((X) < (Y)) ? RtlRosMin(X,Z) : RtlRosMin(Y,Z))
-#define RtlRosMax3(X,Y,Z) (((X) > (Y)) ? RtlRosMax(X,Z) : RtlRosMax(Y,Z))
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/* EOF */

Deleted: trunk/reactos/include/rosrtl/path.h
--- trunk/reactos/include/rosrtl/path.h	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/include/rosrtl/path.h	2005-07-01 01:54:55 UTC (rev 16359)
@@ -1,21 +0,0 @@
-/*
- */
-
-#ifndef ROSRTL_PATH_H__
-#define ROSRTL_PATH_H__
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-BOOL STDCALL MakeSureDirectoryPathExistsExA(LPCSTR DirPath, BOOL FileAtEnd);
-BOOL STDCALL MakeSureDirectoryPathExistsExW(LPCWSTR DirPath, BOOL FileAtEnd);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/* EOF */

Deleted: trunk/reactos/include/rosrtl/priv.h
--- trunk/reactos/include/rosrtl/priv.h	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/include/rosrtl/priv.h	2005-07-01 01:54:55 UTC (rev 16359)
@@ -1,23 +0,0 @@
-/* $Id$
- */
-
-#ifndef ROSRTL_SEC_H__
-#define ROSRTL_SEC_H__
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-BOOL
-RosEnableThreadPrivileges(HANDLE *hToken, LUID *Privileges, DWORD PrivilegeCount);
-BOOL
-RosResetThreadPrivileges(HANDLE hToken);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/* EOF */

Deleted: trunk/reactos/include/rosrtl/resstr.h
--- trunk/reactos/include/rosrtl/resstr.h	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/include/rosrtl/resstr.h	2005-07-01 01:54:55 UTC (rev 16359)
@@ -1,43 +0,0 @@
-/* $Id$
- */
-
-#ifndef ROSRTL_RESSTR_H__
-#define ROSRTL_RESSTR_H__
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-int
-RosLenOfStrResource(HINSTANCE hInst, UINT uID);
-int
-RosAllocAndLoadStringA(LPSTR *lpTarget, HINSTANCE hInst, UINT uID);
-int
-RosAllocAndLoadStringW(LPWSTR *lpTarget, HINSTANCE hInst, UINT uID);
-DWORD
-RosFormatStrA(LPSTR *lpTarget, LPSTR lpFormat, ...);
-DWORD
-RosFormatStrW(LPWSTR *lpTarget, LPWSTR lpFormat, ...);
-DWORD
-RosLoadAndFormatStrA(HINSTANCE hInst, UINT uID, LPSTR *lpTarget, ...);
-DWORD
-RosLoadAndFormatStrW(HINSTANCE hInst, UINT uID, LPWSTR *lpTarget, ...);
-
-#ifdef UNICODE
-# define RosFmtString RosFmtStringW
-# define RosAllocAndLoadString RosAllocAndLoadStringW
-# define RosLoadAndFormatStr RosLoadAndFormatStrW
-#else
-# define RosFmtString RosFmtStringA
-# define RosAllocAndLoadString RosAllocAndLoadStringA
-# define RosLoadAndFormatStr RosLoadAndFormatStrA
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/* EOF */

Deleted: trunk/reactos/include/rosrtl/sparse.h
--- trunk/reactos/include/rosrtl/sparse.h	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/include/rosrtl/sparse.h	2005-07-01 01:54:55 UTC (rev 16359)
@@ -1,36 +0,0 @@
-/* $Id$
- */
-
-#ifndef ROSRTL_SPARSE_H__
-#define ROSRTL_SPARSE_H__
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-BOOL
-STDCALL
-SetFileSparse(HANDLE hFile);
-
-BOOL
-STDCALL
-ZeroFileData(HANDLE hFile,
-             PLARGE_INTEGER pliFileOffset,
-             PLARGE_INTEGER pliBeyondFinalZero);
-
-DWORD
-STDCALL
-QueryAllocatedFileRanges(HANDLE hFile,
-                         PLARGE_INTEGER pliFileOffset,
-                         PLARGE_INTEGER pliLength,
-                         PFILE_ALLOCATED_RANGE_BUFFER lpAllocatedRanges,
-                         DWORD dwBufferSize);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/* EOF */

Modified: trunk/reactos/lib/aclui/aclui.c
--- trunk/reactos/lib/aclui/aclui.c	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/lib/aclui/aclui.c	2005-07-01 01:54:55 UTC (rev 16359)
@@ -31,7 +31,6 @@
 #include <commctrl.h>
 #include <prsht.h>
 #include <aclui.h>
-#include <rosrtl/resstr.h>
 #include "internal.h"
 #include "resource.h"
 
@@ -184,7 +183,7 @@
   SI_OBJECT_INFO ObjectInfo;
   PROPSHEETHEADER psh;
   HPROPSHEETPAGE hPages[1];
-  LPWSTR lpCaption;
+  LPVOID lpCaption;
   BOOL Ret;
   
   if(psi == NULL)
@@ -229,8 +228,15 @@
   {
     /* Set the page title to the object name, make sure the format string
        has "%1" NOT "%s" because it uses FormatMessage() to automatically
-       allocate the right amount of memory. */
-    RosLoadAndFormatStr(hDllInstance, IDS_PSP_TITLE, &lpCaption, ObjectInfo.pszObjectName);
+       allocate the right amount of memory. */       
+    FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | 
+                   FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_ARGUMENT_ARRAY,
+                   hDllInstance, 
+                   IDS_PSP_TITLE, 
+                   0,
+                   (LPSTR)lpCaption,
+                   0,
+                   (va_list*)&ObjectInfo.pszObjectName); /* Acc. to MSDN, should work */
     psh.pszCaption = lpCaption;
   }
   psh.nPages = sizeof(hPages) / sizeof(HPROPSHEETPAGE);

Modified: trunk/reactos/lib/gdi32/include/precomp.h
--- trunk/reactos/lib/gdi32/include/precomp.h	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/lib/gdi32/include/precomp.h	2005-07-01 01:54:55 UTC (rev 16359)
@@ -20,10 +20,6 @@
 /* Win32K External Headers */
 #include <win32k/kapi.h>
 
-/* FIXME: ROSRTL */
-#include <rosrtl/logfont.h>
-#include <rosrtl/devmode.h>
-
 #define NtUserGetDCBrushColor(hbr) \
   (COLORREF)NtUserCallTwoParam((DWORD)(hbr), OBJ_BRUSH, TWOPARAM_ROUTINE_GETDCCOLOR)
 
@@ -73,4 +69,16 @@
 BOOL STDCALL CalculateColorTableSize(CONST BITMAPINFOHEADER *BitmapInfoHeader, UINT *ColorSpec, UINT *ColorTableSize);
 LPBITMAPINFO STDCALL ConvertBitmapInfo(CONST BITMAPINFO *BitmapInfo, UINT ColorSpec, UINT *BitmapInfoSize, BOOL FollowedByData);
 
+/* == CONVERSION FUNCTIONS ================================================== */
+DEVMODEW *
+STDCALL
+GdiConvertToDevmodeW(DEVMODEA *dm);
+
+VOID
+STDCALL
+LogFontA2W(LPLOGFONTW pW, CONST LOGFONTA *pA);
+
+VOID
+STDCALL
+LogFontW2A(LPLOGFONTA pA, CONST LOGFONTW *pW);
 /* EOF */

Modified: trunk/reactos/lib/gdi32/misc/stubs.c
--- trunk/reactos/lib/gdi32/misc/stubs.c	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/lib/gdi32/misc/stubs.c	2005-07-01 01:54:55 UTC (rev 16359)
@@ -11,12 +11,15 @@
 
 #include "precomp.h"
 
+#define SIZEOF_DEVMODEA_300 124
+#define SIZEOF_DEVMODEA_400 148
+#define SIZEOF_DEVMODEA_500 156
+#define SIZEOF_DEVMODEW_300 188
+#define SIZEOF_DEVMODEW_400 212
+#define SIZEOF_DEVMODEW_500 220
+
 #define UNIMPLEMENTED DbgPrint("GDI32: %s is unimplemented, please try again later.\n", __FUNCTION__);
 
-
-
-
-
 /*
  * @unimplemented
  */
@@ -2676,15 +2679,74 @@
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
 DEVMODEW *
 STDCALL
 GdiConvertToDevmodeW(DEVMODEA *dm)
 {
-	UNIMPLEMENTED;
-	SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-	return 0;
+  LPDEVMODEW dmw;
+  
+  dmw = HEAP_alloc(sizeof(DEVMODEW));
+#define COPYS(f,len) MultiByteToWideChar ( CP_THREAD_ACP, 0, (LPSTR)dm->f, len, dmw->f, len )
+#define COPYN(f) dmw->f = dm->f
+  COPYS(dmDeviceName, CCHDEVICENAME );
+  COPYN(dmSpecVersion);
+  COPYN(dmDriverVersion);
+  switch ( dm->dmSize )
+    {
+    case SIZEOF_DEVMODEA_300:
+      dmw->dmSize = SIZEOF_DEVMODEW_300;
+      break;
+    case SIZEOF_DEVMODEA_400:
+      dmw->dmSize = SIZEOF_DEVMODEW_400;
+      break;
+    case SIZEOF_DEVMODEA_500:
+    default: /* FIXME what to do??? */
+      dmw->dmSize = SIZEOF_DEVMODEW_500;
+      break;
+    }
+  COPYN(dmDriverExtra);
+  COPYN(dmFields);
+  COPYN(dmPosition.x);
+  COPYN(dmPosition.y);
+  COPYN(dmScale);
+  COPYN(dmCopies);
+  COPYN(dmDefaultSource);
+  COPYN(dmPrintQuality);
+  COPYN(dmColor);
+  COPYN(dmDuplex);
+  COPYN(dmYResolution);
+  COPYN(dmTTOption);
+  COPYN(dmCollate);
+  COPYS(dmFormName,CCHFORMNAME);
+  COPYN(dmLogPixels);
+  COPYN(dmBitsPerPel);
+  COPYN(dmPelsWidth);
+  COPYN(dmPelsHeight);
+  COPYN(dmDisplayFlags); // aka dmNup
+  COPYN(dmDisplayFrequency);
+
+  if ( dm->dmSize <= SIZEOF_DEVMODEA_300 )
+    return dmw; // we're done with 0x300 fields
+
+  COPYN(dmICMMethod);
+  COPYN(dmICMIntent);
+  COPYN(dmMediaType);
+  COPYN(dmDitherType);
+  COPYN(dmReserved1);
+  COPYN(dmReserved2);
+
+  if ( dm->dmSize <= SIZEOF_DEVMODEA_400 )
+    return dmw; // we're done with 0x400 fields
+
+  COPYN(dmPanningWidth);
+  COPYN(dmPanningHeight);
+
+  return dmw;
+
+#undef COPYN
+#undef COPYS
 }
 
 /*

Modified: trunk/reactos/lib/gdi32/objects/dc.c
--- trunk/reactos/lib/gdi32/objects/dc.c	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/lib/gdi32/objects/dc.c	2005-07-01 01:54:55 UTC (rev 16359)
@@ -147,7 +147,7 @@
   NTSTATUS Status;
   LPWSTR lpszDriverW, lpszDeviceW, lpszOutputW;
   UNICODE_STRING Driver, Device, Output;
-  DEVMODEW dvmInitW;
+  LPDEVMODEW dvmInitW;
   HDC rc = 0;
 
   Status = HEAP_strdupA2W ( &lpszDriverW, lpszDriver );
@@ -166,7 +166,7 @@
 	else
 	  {
 	    if ( lpdvmInit )
-	      RosRtlDevModeA2W ( &dvmInitW, (const LPDEVMODEA)lpdvmInit );
+          dvmInitW = GdiConvertToDevmodeW((LPDEVMODEA)lpdvmInit);
         
         RtlInitUnicodeString(&Driver, lpszDriverW);
         RtlInitUnicodeString(&Device, lpszDeviceW);
@@ -174,8 +174,8 @@
 	    rc = NtGdiCreateIC ( &Driver,
 				&Device,
 				&Output,
-				lpdvmInit ? &dvmInitW : NULL );
-
+				lpdvmInit ? dvmInitW : NULL );
+        HEAP_free (dvmInitW);
 	    HEAP_free ( lpszOutputW );
 	  }
 	HEAP_free ( lpszDeviceW );
@@ -264,7 +264,7 @@
         {
           return 0;
         }
-      RosRtlLogFontW2A((LPLOGFONTA) Buffer, &LogFontW);
+      LogFontW2A((LPLOGFONTA) Buffer, &LogFontW);
       Result = sizeof(LOGFONTA);
     }
   else
@@ -362,11 +362,14 @@
 	CONST DEVMODEA	*lpInitData
 	)
 {
-  DEVMODEW InitDataW;
+  LPDEVMODEW InitDataW;
+  HDC hDc;
 
-  RosRtlDevModeA2W ( &InitDataW, (CONST LPDEVMODEA)lpInitData );
+  InitDataW = GdiConvertToDevmodeW((LPDEVMODEA)lpInitData);
 
-  return NtGdiResetDC ( hdc, &InitDataW );
+  hDc = NtGdiResetDC ( hdc, InitDataW );
+  HEAP_free(InitDataW);
+  return hDc;
 }
 
 

Modified: trunk/reactos/lib/gdi32/objects/font.c
--- trunk/reactos/lib/gdi32/objects/font.c	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/lib/gdi32/objects/font.c	2005-07-01 01:54:55 UTC (rev 16359)
@@ -231,7 +231,7 @@
         }
       else
         {
-          RosRtlLogFontW2A(&EnumLogFontExA.elfLogFont, &Info[i].EnumLogFontEx.elfLogFont);
+          LogFontW2A(&EnumLogFontExA.elfLogFont, &Info[i].EnumLogFontEx.elfLogFont);
           WideCharToMultiByte(CP_THREAD_ACP, 0, Info[i].EnumLogFontEx.elfFullName, -1,
                               (LPSTR)EnumLogFontExA.elfFullName, LF_FULLFACESIZE, NULL, NULL);
           WideCharToMultiByte(CP_THREAD_ACP, 0, Info[i].EnumLogFontEx.elfStyle, -1,
@@ -292,7 +292,7 @@
 {
   LOGFONTW LogFontW;
 
-  RosRtlLogFontA2W(&LogFontW, lpLogfont);
+  LogFontA2W(&LogFontW, lpLogfont);
 
   /* no need to convert LogFontW back to lpLogFont b/c it's an [in] parameter only */
   return IntEnumFontFamilies(hdc, &LogFontW, lpEnumFontFamExProc, lParam, FALSE);
@@ -532,7 +532,7 @@
 {
   LOGFONTW tlf;
 
-  RosRtlLogFontA2W(&tlf, lplf);
+  LogFontA2W(&tlf, lplf);
 
   return NtGdiCreateFontIndirect(&tlf);
 }

Modified: trunk/reactos/lib/gdi32/objects/utils.c
--- trunk/reactos/lib/gdi32/objects/utils.c	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/lib/gdi32/objects/utils.c	2005-07-01 01:54:55 UTC (rev 16359)
@@ -331,3 +331,55 @@
 
    return NewBitmapInfo;
 }
+
+VOID
+STDCALL
+LogFontA2W(LPLOGFONTW pW, CONST LOGFONTA *pA)
+{
+#define COPYS(f,len) MultiByteToWideChar ( CP_THREAD_ACP, 0, pA->f, len, pW->f, len )
+#define COPYN(f) pW->f = pA->f
+
+  COPYN(lfHeight);
+  COPYN(lfWidth);
+  COPYN(lfEscapement);
+  COPYN(lfOrientation);
+  COPYN(lfWeight);
+  COPYN(lfItalic);
+  COPYN(lfUnderline);
+  COPYN(lfStrikeOut);
+  COPYN(lfCharSet);
+  COPYN(lfOutPrecision);
+  COPYN(lfClipPrecision);
+  COPYN(lfQuality);
+  COPYN(lfPitchAndFamily);
+  COPYS(lfFaceName,LF_FACESIZE);
+
+#undef COPYN
+#undef COPYS
+}
+
+VOID
+STDCALL
+LogFontW2A(LPLOGFONTA pA, CONST LOGFONTW *pW)
+{
+#define COPYS(f,len) WideCharToMultiByte ( CP_THREAD_ACP, 0, pW->f, len, pA->f, len, NULL, NULL )
+#define COPYN(f) pA->f = pW->f
+
+  COPYN(lfHeight);
+  COPYN(lfWidth);
+  COPYN(lfEscapement);
+  COPYN(lfOrientation);
+  COPYN(lfWeight);
+  COPYN(lfItalic);
+  COPYN(lfUnderline);
+  COPYN(lfStrikeOut);
+  COPYN(lfCharSet);
+  COPYN(lfOutPrecision);
+  COPYN(lfClipPrecision);
+  COPYN(lfQuality);
+  COPYN(lfPitchAndFamily);
+  COPYS(lfFaceName,LF_FACESIZE);
+
+#undef COPYN
+#undef COPYS
+}

Modified: trunk/reactos/lib/rosrtl/file/sparse.c
--- trunk/reactos/lib/rosrtl/file/sparse.c	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/lib/rosrtl/file/sparse.c	2005-07-01 01:54:55 UTC (rev 16359)
@@ -1,3 +1,4 @@
+#if 0
 #include <windows.h>
 #include <ddk/ntifs.h>
 #include <string.h>
@@ -113,3 +114,4 @@
   return 0;
 }
 
+#endif

Modified: trunk/reactos/lib/rosrtl/misc/devmode.c
--- trunk/reactos/lib/rosrtl/misc/devmode.c	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/lib/rosrtl/misc/devmode.c	2005-07-01 01:54:55 UTC (rev 16359)
@@ -1,3 +1,4 @@
+#if 0
 #include <windows.h>
 #include <string.h>
 #include <rosrtl/devmode.h>
@@ -144,3 +145,4 @@
 #undef SIZEOF_DEVMODEW_300
 #undef SIZEOF_DEVMODEW_400
 #undef SIZEOF_DEVMODEW_500
+#endif

Modified: trunk/reactos/lib/rosrtl/misc/logfont.c
--- trunk/reactos/lib/rosrtl/misc/logfont.c	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/lib/rosrtl/misc/logfont.c	2005-07-01 01:54:55 UTC (rev 16359)
@@ -1,3 +1,4 @@
+#if 0
 #include <windows.h>
 #include <string.h>
 #include <rosrtl/logfont.h>
@@ -51,3 +52,4 @@
 #undef COPYN
 #undef COPYS
 }
+#endif

Modified: trunk/reactos/lib/rosrtl/thread/priv.c
--- trunk/reactos/lib/rosrtl/thread/priv.c	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/lib/rosrtl/thread/priv.c	2005-07-01 01:54:55 UTC (rev 16359)
@@ -1,3 +1,4 @@
+#if 0
 #include <windows.h>
 #include <rosrtl/priv.h>
 
@@ -117,4 +118,5 @@
   }
   return FALSE;
 }
+#endif
 

Modified: trunk/reactos/lib/user32/include/user32p.h
--- trunk/reactos/lib/user32/include/user32p.h	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/lib/user32/include/user32p.h	2005-07-01 01:54:55 UTC (rev 16359)
@@ -124,5 +124,9 @@
 
 PUSER32_THREAD_DATA User32GetThreadData();
   
+DEVMODEW *
+STDCALL
+GdiConvertToDevmodeW(DEVMODEA *dm);
+
 #endif
 /* EOF */

Modified: trunk/reactos/lib/user32/misc/desktop.c
--- trunk/reactos/lib/user32/misc/desktop.c	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/lib/user32/misc/desktop.c	2005-07-01 01:54:55 UTC (rev 16359)
@@ -10,9 +10,33 @@
  */
 
 #include <user32.h>
-#include <rosrtl/devmode.h>
-#include <rosrtl/logfont.h>
 
+VOID
+STDCALL
+LogFontW2A(LPLOGFONTA pA, CONST LOGFONTW *pW)
+{
+#define COPYS(f,len) WideCharToMultiByte ( CP_THREAD_ACP, 0, pW->f, len, pA->f, len, NULL, NULL )
+#define COPYN(f) pA->f = pW->f
+
+  COPYN(lfHeight);
+  COPYN(lfWidth);
+  COPYN(lfEscapement);
+  COPYN(lfOrientation);
+  COPYN(lfWeight);
+  COPYN(lfItalic);
+  COPYN(lfUnderline);
+  COPYN(lfStrikeOut);
+  COPYN(lfCharSet);
+  COPYN(lfOutPrecision);
+  COPYN(lfClipPrecision);
+  COPYN(lfQuality);
+  COPYN(lfPitchAndFamily);
+  COPYS(lfFaceName,LF_FACESIZE);
+
+#undef COPYN
+#undef COPYS
+}
+
 /*
  * @implemented
  */
@@ -76,11 +100,11 @@
            nclma->iSmCaptionHeight = nclmw.iSmCaptionHeight;
            nclma->iMenuWidth = nclmw.iMenuWidth;
            nclma->iMenuHeight = nclmw.iMenuHeight;
-           RosRtlLogFontW2A(&(nclma->lfCaptionFont), &(nclmw.lfCaptionFont));
-           RosRtlLogFontW2A(&(nclma->lfSmCaptionFont), &(nclmw.lfSmCaptionFont));
-           RosRtlLogFontW2A(&(nclma->lfMenuFont), &(nclmw.lfMenuFont));
-           RosRtlLogFontW2A(&(nclma->lfStatusFont), &(nclmw.lfStatusFont));
-           RosRtlLogFontW2A(&(nclma->lfMessageFont), &(nclmw.lfMessageFont));
+           LogFontW2A(&(nclma->lfCaptionFont), &(nclmw.lfCaptionFont));
+           LogFontW2A(&(nclma->lfSmCaptionFont), &(nclmw.lfSmCaptionFont));
+           LogFontW2A(&(nclma->lfMenuFont), &(nclmw.lfMenuFont));
+           LogFontW2A(&(nclma->lfStatusFont), &(nclmw.lfStatusFont));
+           LogFontW2A(&(nclma->lfMessageFont), &(nclmw.lfMessageFont));
            return TRUE;
         }
       case SPI_GETICONTITLELOGFONT:
@@ -88,7 +112,7 @@
            LOGFONTW lfw;
            if (!SystemParametersInfoW(uiAction, 0, &lfw, fWinIni))
              return FALSE;
-           RosRtlLogFontW2A(pvParam, &lfw);
+           LogFontW2A(pvParam, &lfw);
            return TRUE;
         }
       case SPI_GETDESKWALLPAPER:
@@ -310,7 +334,7 @@
   ANSI_STRING DesktopNameA;
   UNICODE_STRING DesktopNameU;
   HDESK hDesktop;
-  DEVMODEW DevmodeW;
+  LPDEVMODEW DevmodeW;
 
   if (lpszDesktop != NULL)
     {
@@ -322,11 +346,11 @@
       RtlInitUnicodeString(&DesktopNameU, NULL);
     }
 
-  RosRtlDevModeA2W ( &DevmodeW, pDevmode );
+  DevmodeW = GdiConvertToDevmodeW(pDevmode);
 
   hDesktop = CreateDesktopW(DesktopNameU.Buffer,
 			    NULL,
-			    &DevmodeW,
+			    DevmodeW,
 			    dwFlags,
 			    dwDesiredAccess,
 			    lpsa);

Modified: trunk/reactos/lib/user32/misc/display.c
--- trunk/reactos/lib/user32/misc/display.c	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/lib/user32/misc/display.c	2005-07-01 01:54:55 UTC (rev 16359)
@@ -29,8 +29,14 @@
 /* INCLUDES ******************************************************************/
 
 #include <user32.h>
-#include <rosrtl/devmode.h>
 
+#define SIZEOF_DEVMODEA_300 124
+#define SIZEOF_DEVMODEA_400 148
+#define SIZEOF_DEVMODEA_500 156
+#define SIZEOF_DEVMODEW_300 188
+#define SIZEOF_DEVMODEW_400 212
+#define SIZEOF_DEVMODEW_500 220
+
 /* FUNCTIONS *****************************************************************/
 
 /*
@@ -211,8 +217,62 @@
   rc = NtUserEnumDisplaySettings ( &DeviceName, iModeNum, &lpDevModeW,
                                    dwFlags );
 
-  RosRtlDevModeW2A ( lpDevMode, &lpDevModeW );
+#define COPYS(f,len) WideCharToMultiByte( CP_THREAD_ACP, 0, lpDevModeW.f, len, (LPSTR)lpDevMode->f, len, NULL, NULL )
+#define COPYN(f) lpDevMode->f = lpDevModeW.f
+  COPYS(dmDeviceName, CCHDEVICENAME );
+  COPYN(dmSpecVersion);
+  COPYN(dmDriverVersion);
+  switch ( lpDevModeW.dmSize )
+    {
+    case SIZEOF_DEVMODEW_300:
+      lpDevMode->dmSize = SIZEOF_DEVMODEA_300;
+      break;
+    case SIZEOF_DEVMODEW_400:
+      lpDevMode->dmSize = SIZEOF_DEVMODEA_400;
+      break;
+    case SIZEOF_DEVMODEW_500:
+    default: /* FIXME what to do??? */
+      lpDevMode->dmSize = SIZEOF_DEVMODEA_500;
+      break;
+    }
+  COPYN(dmDriverExtra);
+  COPYN(dmFields);
+  COPYN(dmPosition.x);
+  COPYN(dmPosition.y);
+  COPYN(dmScale);
+  COPYN(dmCopies);
+  COPYN(dmDefaultSource);
+  COPYN(dmPrintQuality);
+  COPYN(dmColor);
+  COPYN(dmDuplex);
+  COPYN(dmYResolution);
+  COPYN(dmTTOption);
+  COPYN(dmCollate);
+  COPYS(dmFormName,CCHFORMNAME);
+  COPYN(dmLogPixels);
+  COPYN(dmBitsPerPel);
+  COPYN(dmPelsWidth);
+  COPYN(dmPelsHeight);
+  COPYN(dmDisplayFlags); // aka dmNup
+  COPYN(dmDisplayFrequency);
 
+  if ( lpDevModeW.dmSize <= SIZEOF_DEVMODEW_300 )
+    goto done; // we're done with 0x300 fields
+
+  COPYN(dmICMMethod);
+  COPYN(dmICMIntent);
+  COPYN(dmMediaType);
+  COPYN(dmDitherType);
+  COPYN(dmReserved1);
+  COPYN(dmReserved2);
+
+  if ( lpDevModeW.dmSize <= SIZEOF_DEVMODEW_400 )
+    goto done; // we're done with 0x400 fields
+
+  COPYN(dmPanningWidth);
+  COPYN(dmPanningHeight);
+
+done:
   RtlFreeUnicodeString ( &DeviceName );
 
 
@@ -380,8 +440,7 @@
   LONG rc;
   UNICODE_STRING DeviceName;
   PUNICODE_STRING pDeviceName = &DeviceName;
-  DEVMODEW DevModeW;
-  LPDEVMODEW pDevModeW = &DevModeW;
+  LPDEVMODEW pDevModeW;
 
   if (lpszDeviceName != NULL)
     {
@@ -395,7 +454,7 @@
     pDeviceName = NULL;
 
   if (lpDevMode != NULL)
-    RosRtlDevModeA2W ( pDevModeW, lpDevMode );
+    pDevModeW = GdiConvertToDevmodeW(lpDevMode);
   else
     pDevModeW = NULL;
 

Modified: trunk/reactos/subsys/csrss/win32csr/conio.c
--- trunk/reactos/subsys/csrss/win32csr/conio.c	2005-06-30 22:40:36 UTC (rev 16358)
+++ trunk/reactos/subsys/csrss/win32csr/conio.c	2005-07-01 01:54:55 UTC (rev 16359)
@@ -13,7 +13,6 @@
 #include <ndk/ntndk.h>
 #include <ddk/ntddblue.h>
 #include <rosrtl/string.h>
-#include <rosrtl/minmax.h>
 
 #include <string.h>
 
@@ -420,8 +419,8 @@
                     }
                   Offset = 2 * ((Buff->CurrentY * Buff->MaxX) + Buff->CurrentX);
                   SET_CELL_BUFFER(Buff, Offset, ' ', Buff->DefaultAttrib);
-                  UpdateRect.left = RtlRosMin(UpdateRect.left, Buff->CurrentX);
-                  UpdateRect.right = RtlRosMax(UpdateRect.right, (LONG) Buff->CurrentX);
+                  UpdateRect.left = min(UpdateRect.left, Buff->CurrentX);
+                  UpdateRect.right = max(UpdateRect.right, (LONG) Buff->CurrentX);
                 }
                 continue;
             }
@@ -429,8 +428,8 @@
           else if (Buffer[i] == '\r')
             {
               Buff->CurrentX = 0;
-              UpdateRect.left = RtlRosMin(UpdateRect.left, Buff->CurrentX);
-              UpdateRect.right = RtlRosMax(UpdateRect.right, (LONG) Buff->CurrentX);
+              UpdateRect.left = min(UpdateRect.left, Buff->CurrentX);
+              UpdateRect.right = max(UpdateRect.right, (LONG) Buff->CurrentX);
               continue;
             }
           /* --- TAB --- */
@@ -438,7 +437,7 @@
             {
               UINT EndX;
 
-              UpdateRect.left = RtlRosMin(UpdateRect.left, Buff->CurrentX);
+              UpdateRect.left = min(UpdateRect.left, Buff->CurrentX);
               EndX = (Buff->CurrentX + 8) & ~7;
               if (EndX > Buff->MaxX)
                 {
@@ -451,7 +450,7 @@
                   Offset += 2;
                   Buff->CurrentX++;
                 }
-              UpdateRect.right = RtlRosMax(UpdateRect.right, (LONG) Buff->CurrentX - 1);
+              UpdateRect.right = max(UpdateRect.right, (LONG) Buff->CurrentX - 1);
               if (Buff->CurrentX == Buff->MaxX)
                 {
                   if (Buff->Mode & ENABLE_WRAP_AT_EOL_OUTPUT)
@@ -467,8 +466,8 @@
               continue;
             }
         }
-      UpdateRect.left = RtlRosMin(UpdateRect.left, Buff->CurrentX);
-      UpdateRect.right = RtlRosMax(UpdateRect.right, (LONG) Buff->CurrentX);
+      UpdateRect.left = min(UpdateRect.left, Buff->CurrentX);
+      UpdateRect.right = max(UpdateRect.right, (LONG) Buff->CurrentX);
       Offset = 2 * (((Buff->CurrentY * Buff->MaxX)) + Buff->CurrentX);
       Buff->Buffer[Offset++] = Buffer[i];
       if (Attrib)
@@ -679,10 +678,10 @@
   }
 
   ConioInitRect(Intersection,
-               RtlRosMax(Rect1->top, Rect2->top),
-               RtlRosMax(Rect1->left, Rect2->left),
-               RtlRosMin(Rect1->bottom, Rect2->bottom),
-               RtlRosMin(Rect1->right, Rect2->right));
+               max(Rect1->top, Rect2->top),
+               max(Rect1->left, Rect2->left),
+               min(Rect1->bottom, Rect2->bottom),
+               min(Rect1->right, Rect2->right));
 
   return TRUE;
 }
@@ -711,10 +710,10 @@
   else
     {
       ConioInitRect(Union,
-                   RtlRosMin(Rect1->top, Rect2->top),
-                   RtlRosMin(Rect1->left, Rect2->left),
-                   RtlRosMax(Rect1->bottom, Rect2->bottom),
-                   RtlRosMax(Rect1->right, Rect2->right));
+                   min(Rect1->top, Rect2->top),
+                   min(Rect1->left, Rect2->left),
+                   max(Rect1->bottom, Rect2->bottom),
+                   max(Rect1->right, Rect2->right));
     }
 
   return TRUE;
@@ -2299,8 +2298,8 @@
   WriteRegion.right = Request->Data.WriteConsoleOutputRequest.WriteRegion.Right;
   WriteRegion.bottom = Request->Data.WriteConsoleOutputRequest.WriteRegion.Bottom;
 
-  SizeY = RtlRosMin(BufferSize.Y - BufferCoord.Y, ConioRectHeight(&WriteRegion));
-  SizeX = RtlRosMin(BufferSize.X - BufferCoord.X, ConioRectWidth(&WriteRegion));
+  SizeY = min(BufferSize.Y - BufferCoord.Y, ConioRectHeight(&WriteRegion));
+  SizeX = min(BufferSize.X - BufferCoord.X, ConioRectWidth(&WriteRegion));
   WriteRegion.bottom = WriteRegion.top + SizeY - 1;
   WriteRegion.right = WriteRegion.left + SizeX - 1;
 
@@ -2797,8 +2796,8 @@
       return Request->Status ;
     }
 
-  SizeY = RtlRosMin(BufferSize.Y - BufferCoord.Y, ConioRectHeight(&ReadRegion));
-  SizeX = RtlRosMin(BufferSize.X - BufferCoord.X, ConioRectWidth(&ReadRegion));
+  SizeY = min(BufferSize.Y - BufferCoord.Y, ConioRectHeight(&ReadRegion));
+  SizeX = min(BufferSize.X - BufferCoord.X, ConioRectWidth(&ReadRegion));
   ReadRegion.bottom = ReadRegion.top + SizeY;
   ReadRegion.right = ReadRegion.left + SizeX;