Author: cfinck
Date: Sun May 17 17:19:37 2015
New Revision: 67816

URL: http://svn.reactos.org/svn/reactos?rev=67816&view=rev
Log:
[WINSPOOL]
- Use GdiConvertToDevmodeW instead of duplicating code.
- Fix the spec2def call here as well.

Modified:
    
branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/CMakeLists.txt
    
branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/main.c

Modified: 
branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/CMakeLists.txt?rev=67816&r1=67815&r2=67816&view=diff
==============================================================================
--- 
branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/CMakeLists.txt
  [iso-8859-1] (original)
+++ 
branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/CMakeLists.txt
  [iso-8859-1] Sun May 17 17:19:37 2015
@@ -1,7 +1,7 @@
 
 include_directories(${REACTOS_SOURCE_DIR}/include/reactos/idl)
 add_rpc_files(client ${REACTOS_SOURCE_DIR}/include/reactos/idl/winspool.idl)
-spec2def(winspool winspool.spec ADD_IMPORTLIB)
+spec2def(winspool.drv winspool.spec ADD_IMPORTLIB)
 
 list(APPEND SOURCE
     main.c
@@ -17,6 +17,6 @@
 set_target_properties(winspool PROPERTIES SUFFIX ".drv")
 set_module_type(winspool win32dll UNICODE)
 target_link_libraries(winspool wine ${PSEH_LIB})
-add_importlibs(winspool rpcrt4 msvcrt kernel32 ntdll)
+add_importlibs(winspool gdi32 rpcrt4 msvcrt kernel32 ntdll)
 add_pch(winspool precomp.h SOURCE)
 add_cd_file(TARGET winspool DESTINATION reactos/system32 FOR all)

Modified: 
branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/main.c
URL: 
http://svn.reactos.org/svn/reactos/branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/main.c?rev=67816&r1=67815&r2=67816&view=diff
==============================================================================
--- 
branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/main.c
  [iso-8859-1] (original)
+++ 
branches/colins-printing-for-freedom/reactos/win32ss/printing/base/winspool/main.c
  [iso-8859-1] Sun May 17 17:19:37 2015
@@ -165,7 +165,6 @@
 OpenPrinterA(LPSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSA 
pDefault)
 {
     BOOL ReturnValue = FALSE;
-    DEVMODEW wDevMode;
     PWSTR pwszPrinterName = NULL;
     PWSTR pwszDatatype = NULL;
     PRINTER_DEFAULTSW wDefault = { 0 };
@@ -207,22 +206,15 @@
         }
 
         if (pDefault->pDevMode)
-        {
-            // Fixed size strings, so no additional memory needs to be 
allocated
-            MultiByteToWideChar(CP_ACP, 0, 
(LPCSTR)pDefault->pDevMode->dmDeviceName, -1, wDevMode.dmDeviceName, 
sizeof(wDevMode.dmDeviceName) / sizeof(WCHAR));
-            MultiByteToWideChar(CP_ACP, 0, 
(LPCSTR)pDefault->pDevMode->dmFormName, -1, wDevMode.dmFormName, 
sizeof(wDevMode.dmFormName) / sizeof(WCHAR));
-
-            // Use CopyMemory to copy over several structure values in one step
-            CopyMemory(&wDevMode.dmSpecVersion, 
&pDefault->pDevMode->dmSpecVersion, (ULONG_PTR)&wDevMode.dmCollate - 
(ULONG_PTR)&wDevMode.dmSpecVersion + sizeof(wDevMode.dmCollate));
-            CopyMemory(&wDevMode.dmLogPixels, 
&pDefault->pDevMode->dmLogPixels, (ULONG_PTR)&wDevMode.dmPanningHeight - 
(ULONG_PTR)&wDevMode.dmLogPixels + sizeof(wDevMode.dmPanningHeight));
-
-            wDefault.pDevMode = &wDevMode;
-        }
+            wDefault.pDevMode = GdiConvertToDevmodeW(pDefault->pDevMode);
     }
 
     ReturnValue = OpenPrinterW(pwszPrinterName, phPrinter, &wDefault);
 
 Cleanup:
+    if (wDefault.pDevMode)
+        HeapFree(GetProcessHeap(), 0, wDefault.pDevMode);
+
     if (pwszPrinterName)
         HeapFree(GetProcessHeap(), 0, pwszPrinterName);
 


Reply via email to