From 48db9468eb665bbdb08a67a3990d9506b3878def Mon Sep 17 00:00:00 2001 From: Jason Filby Date: Sun, 27 Feb 2000 11:04:36 +0000 Subject: [PATCH] Minor fixes svn path=/trunk/; revision=1016 --- reactos/apps/tests/gditest/gditest.c | 4 +- reactos/lib/gdi32/makefile | 4 +- reactos/lib/gdi32/misc/stubsa.c | 106 ++++++--------------------- 3 files changed, 29 insertions(+), 85 deletions(-) diff --git a/reactos/apps/tests/gditest/gditest.c b/reactos/apps/tests/gditest/gditest.c index d080881cffe..32edd9b5fa7 100644 --- a/reactos/apps/tests/gditest/gditest.c +++ b/reactos/apps/tests/gditest/gditest.c @@ -7,8 +7,10 @@ int main (void) { - GdiDllInitialize (NULL, DLL_PROCESS_ATTACH, NULL); + HDC Desktop; + GdiDllInitialize (NULL, DLL_PROCESS_ATTACH, NULL); + Desktop = CreateDCA("DISPLAY", NULL, NULL, NULL); return 0; } diff --git a/reactos/lib/gdi32/makefile b/reactos/lib/gdi32/makefile index ea08cc8b615..f9828634198 100644 --- a/reactos/lib/gdi32/makefile +++ b/reactos/lib/gdi32/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.9 2000/02/20 22:52:48 ea Exp $ +# $Id: makefile,v 1.10 2000/02/27 11:04:36 jfilby Exp $ # # Makefile for ReactOS gdi32.dll # @@ -40,6 +40,7 @@ $(TARGET).dll: $(DLLMAIN) $(OBJECTS) $(TARGET).def --output-lib $(TARGET).a $(CC) $(TARGET).o \ ../kernel32/kernel32.a \ + ../ntdll/ntdll.a \ -specs=$(TARGET)_specs \ -mdll \ -o junk.tmp \ @@ -54,6 +55,7 @@ $(TARGET).dll: $(DLLMAIN) $(OBJECTS) $(TARGET).def - $(RM) base.tmp $(CC) $(TARGET).o \ ../kernel32/kernel32.a \ + ../ntdll/ntdll.a \ -specs=$(TARGET)_specs \ -mdll \ -o $(TARGET).dll \ diff --git a/reactos/lib/gdi32/misc/stubsa.c b/reactos/lib/gdi32/misc/stubsa.c index acae9a342ac..da93a1ed2e6 100644 --- a/reactos/lib/gdi32/misc/stubsa.c +++ b/reactos/lib/gdi32/misc/stubsa.c @@ -1,4 +1,4 @@ -/* $Id: stubsa.c,v 1.2 2000/02/20 22:52:48 ea Exp $ +/* $Id: stubsa.c,v 1.3 2000/02/27 11:04:36 jfilby Exp $ * * reactos/lib/gdi32/misc/stubs.c * @@ -11,54 +11,11 @@ #ifdef UNICODE #undef UNICODE #endif + +#undef WIN32_LEAN_AND_MEAN #include +#include -static -LPWSTR -STDCALL -AnsiStringToUnicodeString ( - LPCSTR AnsiString, - LPWSTR UnicodeString, - BOOLEAN AllocateBuffer - ) -{ - int Length; - LPWSTR _UnicodeString = UnicodeString; - - if ( (NULL == UnicodeString) - && (FALSE == AllocateBuffer) - ) - { - return NULL; - } - Length = (lstrlenA (AnsiString) + 1); - if (TRUE == AllocateBuffer) - { - _UnicodeString = LocalAlloc ( - LMEM_ZEROINIT, - Length - ); - if (NULL == _UnicodeString) - { - return NULL; - } - } - Length = MultiByteToWideChar ( - CP_ACP, - 0, - AnsiString, - -1, - _UnicodeString, - Length - ); - if (0 == Length) - { - return NULL; - } - return _UnicodeString; -} - - int STDCALL AddFontResourceA( @@ -91,70 +48,53 @@ CreateDCA ( CONST DEVMODE * lpInitData ) { - LPCWSTR lpwszDriver = NULL; - LPCWSTR lpwszDevice = NULL; - LPCWSTR lpwszOutput = NULL; + ANSI_STRING DriverA, DeviceA, OutputA; + UNICODE_STRING DriverU, DeviceU, OutputU; HDC hDC; /* * If needed, convert to Unicode * any string parameter. */ + if (NULL != lpszDriver) { - lpwszDriver = AnsiStringToUnicodeString ( - lpszDriver, - NULL, - TRUE - ); - if (NULL == lpwszDriver) - { - return 0; - } + RtlInitAnsiString(&DriverA, (LPSTR)lpszDriver); + RtlAnsiStringToUnicodeString(&DriverU, &DriverA, TRUE); } if (NULL != lpszDevice) { - lpwszDevice = AnsiStringToUnicodeString ( - lpszDevice, - NULL, - TRUE - ); - if (NULL == lpwszDevice) - { - return 0; - } + RtlInitAnsiString(&DeviceA, (LPSTR)lpszDevice); + RtlAnsiStringToUnicodeString(&DeviceU, &DeviceA, TRUE); } if (NULL != lpszOutput) { - lpwszOutput = AnsiStringToUnicodeString ( - lpszOutput, - NULL, - TRUE - ); - if (NULL == lpwszOutput) - { - return 0; - } + RtlInitAnsiString(&OutputA, (LPSTR)lpszOutput); + RtlAnsiStringToUnicodeString(&OutputU, &OutputA, TRUE); } + /* * Call the Unicode version * of CreateDC. */ + hDC = CreateDCW ( - lpwszDriver, - lpwszDevice, - lpwszOutput, + DriverU.Buffer, + DeviceU.Buffer, + OutputU.Buffer, lpInitData ); /* * Free Unicode parameters. */ - if (NULL != lpszDriver) LocalFree (lpwszDriver); - if (NULL != lpszDevice) LocalFree (lpwszDevice); - if (NULL != lpszOutput) LocalFree (lpwszOutput); + RtlFreeUnicodeString(&DriverU); + RtlFreeUnicodeString(&DeviceU); + RtlFreeUnicodeString(&OutputU); + /* * Return the possible DC handle. */ + return hDC; }