Author: jimtabor
Date: Tue May 26 09:50:15 2009
New Revision: 41122
URL:
http://svn.reactos.org/svn/reactos?rev=41122&view=rev
Log:
- Implementation of gdi printing support. Work in progress. Losts of updates, including
missing functions in the winspool spec file.
Added:
trunk/reactos/include/reactos/wine/winspool.h (with props)
Modified:
trunk/reactos/dll/win32/gdi32/include/gdi32p.h
trunk/reactos/dll/win32/gdi32/include/precomp.h
trunk/reactos/dll/win32/gdi32/main/dllmain.c
trunk/reactos/dll/win32/gdi32/objects/dc.c
trunk/reactos/dll/win32/gdi32/objects/printdrv.c
trunk/reactos/dll/win32/winspool/winspool.spec
trunk/reactos/include/ddk/winddiui.h
trunk/reactos/include/psdk/winspool.h
trunk/reactos/include/reactos/win32k/ntgdihdl.h
Modified: trunk/reactos/dll/win32/gdi32/include/gdi32p.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/include/gd…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/include/gdi32p.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/include/gdi32p.h [iso-8859-1] Tue May 26 09:50:15 2009
@@ -16,6 +16,8 @@
extern DWORD GDI_BatchLimit;
extern PDEVCAPS GdiDevCaps;
extern BOOL gbLpk; // Global bool LanguagePack
+extern HANDLE ghSpooler;
+extern RTL_CRITICAL_SECTION semLocal;
typedef INT
(CALLBACK* EMFPLAYPROC)(
@@ -111,6 +113,38 @@
FONT_ATTR lfa[LOCALFONT_COUNT];
} LOCALFONT, *PLOCALFONT;
+// sdk/winspool.h
+typedef BOOL WINAPI (*ABORTPRINTER) (HANDLE);
+typedef BOOL WINAPI (*CLOSEPRINTER) (HANDLE);
+typedef BOOL WINAPI (*CLOSESPOOLFILEHANDLE) (HANDLE, HANDLE); // W2k8
+typedef HANDLE WINAPI (*COMMITSPOOLDATA) (HANDLE,HANDLE,DWORD); // W2k8
+typedef LONG WINAPI (*DOCUMENTPROPERTIESW)
(HWND,HANDLE,LPWSTR,PDEVMODEW,PDEVMODEW,DWORD);
+typedef BOOL WINAPI (*ENDDOCPRINTER) (HANDLE);
+typedef BOOL WINAPI (*ENDPAGEPRINTER) (HANDLE);
+typedef BOOL WINAPI (*GETPRINTERW) (HANDLE,DWORD,LPBYTE,DWORD,LPDWORD);
+typedef BOOL WINAPI (*GETPRINTERDRIVERW) (HANDLE,LPWSTR,DWORD,LPBYTE,DWORD,LPDWORD);
+typedef HANDLE WINAPI (*GETSPOOLFILEHANDLE) (HANDLE); // W2k8
+typedef BOOL WINAPI (*ISVALIDDEVMODEW) (PDEVMODEW,size_t);
+typedef BOOL WINAPI (*OPENPRINTERW) (LPWSTR,PHANDLE,LPPRINTER_DEFAULTSW);
+typedef BOOL WINAPI (*READPRINTER) (HANDLE,PVOID,DWORD,PDWORD);
+typedef BOOL WINAPI (*RESETPRINTERW) (HANDLE,LPPRINTER_DEFAULTSW);
+typedef BOOL WINAPI (*STARTDOCDLGW) (HANDLE,DOCINFOW *);
+typedef DWORD WINAPI (*STARTDOCPRINTERW) (HANDLE,DWORD,PBYTE);
+typedef BOOL WINAPI (*STARTPAGEPRINTER) (HANDLE);
+// ddk/winsplp.h
+typedef BOOL WINAPI (*SEEKPRINTER) (HANDLE,LARGE_INTEGER,PLARGE_INTEGER,DWORD,BOOL);
+typedef BOOL WINAPI (*SPLREADPRINTER) (HANDLE,LPBYTE *,DWORD);
+// Same as ddk/winsplp.h DriverUnloadComplete?
+typedef BOOL WINAPI (*SPLDRIVERUNLOADCOMPLETE) (LPWSTR);
+// Driver support:
+// DrvDocumentEvent api/winddiui.h not W2k8 DocumentEventAW
+typedef INT WINAPI (*DOCUMENTEVENT) (HANDLE,HDC,INT,ULONG,PVOID,ULONG,PVOID);
+// DrvQueryColorProfile
+typedef BOOL WINAPI (*QUERYCOLORPROFILE) (HANDLE,PDEVMODEW,ULONG,VOID*,ULONG,FLONG);
+// Unknown:
+typedef DWORD WINAPI (*QUERYSPOOLMODE) (HANDLE,DWORD,DWORD);
+typedef DWORD WINAPI (*QUERYREMOTEFONTS) (DWORD,DWORD,DWORD);
+
/* FUNCTIONS *****************************************************************/
PVOID
@@ -242,4 +276,7 @@
VOID GdiSAPCallback(PLDC pldc);
+int FASTCALL DocumentEventEx(PVOID,HANDLE,HDC,int,ULONG,PVOID,ULONG,PVOID);
+BOOL FASTCALL LoadTheSpoolerDrv(VOID);
+
/* EOF */
Modified: trunk/reactos/dll/win32/gdi32/include/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/include/pr…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/include/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/include/precomp.h [iso-8859-1] Tue May 26 09:50:15 2009
@@ -19,6 +19,8 @@
#include <winddi.h>
#include <d3dnthal.h>
#include <prntfont.h>
+#include <winddiui.h>
+#include <winspool.h>
#include <pseh/pseh2.h>
Modified: trunk/reactos/dll/win32/gdi32/main/dllmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/main/dllma…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/main/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/main/dllmain.c [iso-8859-1] Tue May 26 09:50:15 2009
@@ -14,6 +14,7 @@
PDEVCAPS GdiDevCaps = NULL;
PGDIHANDLECACHE GdiHandleCache = NULL;
BOOL gbLpk = FALSE;
+RTL_CRITICAL_SECTION semLocal;
/*
* GDI32.DLL does have an entry point for disable threadlibrarycall,. The initialization
is done by a call
@@ -52,6 +53,7 @@
CurrentProcessId = NtCurrentTeb()->ClientId.UniqueProcess;
GDI_BatchLimit = (DWORD)
NtCurrentTeb()->ProcessEnvironmentBlock->GdiDCAttributeList;
GdiHandleCache =
(PGDIHANDLECACHE)NtCurrentTeb()->ProcessEnvironmentBlock->GdiHandleBuffer;
+ RtlInitializeCriticalSection(&semLocal);
}
Modified: trunk/reactos/dll/win32/gdi32/objects/dc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/dc…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/dc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/objects/dc.c [iso-8859-1] Tue May 26 09:50:15 2009
@@ -19,6 +19,15 @@
ULONG UMdhpdev = 0;
HANDLE hspool = NULL;
+
+ if ( !ghSpooler && !LoadTheSpoolerDrv())
+ {
+ DPRINT1("WinSpooler.Drv Did not load!\n");
+ }
+ else
+ {
+ DPRINT("WinSpooler.Drv Loaded! hMod -> 0x%x\n", ghSpooler);
+ }
if ((!lpwszDevice) && (!lpwszDriver))
{
Modified: trunk/reactos/dll/win32/gdi32/objects/printdrv.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/pr…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/printdrv.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/objects/printdrv.c [iso-8859-1] Tue May 26 09:50:15
2009
@@ -1,7 +1,229 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS Kernel
+ * PURPOSE: GDI Printing Support
+ * FILE: dll/win32/gdi32/objects/printdrv.c
+ * PROGRAMER:
+ *
+ */
+
+// For the wine code:
+/*
+ * Implementation of some printer driver bits
+ *
+ * Copyright 1996 John Harvey
+ * Copyright 1998 Huw Davies
+ * Copyright 1998 Andreas Mohr
+ * Copyright 1999 Klaas van Gend
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
#include "precomp.h"
#define NDEBUG
#include <debug.h>
+
+/* GLOBALS *******************************************************************/
+HANDLE ghSpooler = NULL;
+
+static ABORTPRINTER fpAbortPrinter;
+static CLOSEPRINTER fpClosePrinter;
+static CLOSESPOOLFILEHANDLE fpCloseSpoolFileHandle;
+static COMMITSPOOLDATA fpCommitSpoolData;
+//static fpConnectToLd64In32Server;
+static DOCUMENTEVENT fpDocumentEvent;
+static DOCUMENTPROPERTIESW fpDocumentPropertiesW;
+static ENDDOCPRINTER fpEndDocPrinter;
+static ENDPAGEPRINTER fpEndPagePrinter;
+static GETSPOOLFILEHANDLE fpGetSpoolFileHandle;
+static GETPRINTERW fpGetPrinterW;
+static GETPRINTERDRIVERW fpGetPrinterDriverW;
+static ISVALIDDEVMODEW fpIsValidDevmodeW;
+static OPENPRINTERW fpOpenPrinterW;
+static QUERYSPOOLMODE fpQuerySpoolMode;
+static QUERYREMOTEFONTS fpQueryRemoteFonts;
+static QUERYCOLORPROFILE fpQueryColorProfile;
+static READPRINTER fpReadPrinter;
+static RESETPRINTERW fpResetPrinterW;
+static SEEKPRINTER fpSeekPrinter;
+static SPLDRIVERUNLOADCOMPLETE fpSplDriverUnloadComplete;
+static SPLREADPRINTER fpSplReadPrinter;
+static STARTDOCDLGW fpStartDocDlgW;
+static STARTDOCPRINTERW fpStartDocPrinterW;
+static STARTPAGEPRINTER fpStartPagePrinter;
+
+/* PRIVATE FUNCTIONS *********************************************************/
+
+static
+int
+FASTCALL
+IntEndPage(
+ HDC hdc,
+ BOOL Form
+ )
+{
+ PLDC pldc;
+ int Ret = SP_ERROR;
+ ULONG hType = GDI_HANDLE_GET_TYPE(hdc);
+
+ if (hType == GDILoObjType_LO_DC_TYPE || hType == GDILoObjType_LO_METADC16_TYPE)
+ {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return SP_ERROR;
+ }
+
+ pldc = GdiGetLDC(hdc);
+ if ( !pldc )
+ {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return SP_ERROR;
+ }
+
+ return Ret;
+}
+
+/* FUNCTIONS *****************************************************************/
+
+int
+FASTCALL
+DocumentEventEx(
+ PVOID pvUMPDev,
+ HANDLE hPrinter,
+ HDC hdc,
+ int iEsc,
+ ULONG cbIn,
+ PVOID pvIn,
+ ULONG cbOut,
+ PVOID pvOut
+ )
+{
+ return fpDocumentEvent(hPrinter,hdc,iEsc,cbIn,pvIn,cbOut,pvOut);
+}
+
+BOOL
+FASTCALL
+EndDocPrinterEx(
+ PVOID pvUMPDev,
+ HANDLE hPrinter
+ )
+{
+ return fpEndDocPrinter(hPrinter);
+}
+
+BOOL
+FASTCALL
+EndPagePrinterEx(
+ PVOID pvUMPDev,
+ HANDLE hPrinter
+ )
+{
+ return fpEndPagePrinter(hPrinter);
+}
+
+BOOL
+FASTCALL
+LoadTheSpoolerDrv(VOID)
+{
+ HMODULE hModWinSpoolDrv;
+
+ if ( !ghSpooler )
+ {
+ RtlEnterCriticalSection(&semLocal);
+
+ hModWinSpoolDrv = LoadLibraryW(L"WINSPOOL.DRV");
+
+ if (hModWinSpoolDrv)
+ {
+ fpAbortPrinter = GetProcAddress(hModWinSpoolDrv, "AbortPrinter");
+ fpClosePrinter = GetProcAddress(hModWinSpoolDrv, "ClosePrinter");
+ fpCloseSpoolFileHandle = GetProcAddress(hModWinSpoolDrv,
"CloseSpoolFileHandle");
+ fpCommitSpoolData = (PVOID)GetProcAddress(hModWinSpoolDrv,
"CommitSpoolData");
+ // fpConnectToLd64In32Server = GetProcAddress(hModWinSpoolDrv, (LPCSTR)224);
+ fpDocumentEvent =
(PVOID)GetProcAddress(hModWinSpoolDrv,"DocumentEvent");
+ fpDocumentPropertiesW = (PVOID)GetProcAddress(hModWinSpoolDrv,
"DocumentPropertiesW");
+ fpEndDocPrinter = GetProcAddress(hModWinSpoolDrv, "EndDocPrinter");
+ fpEndPagePrinter = GetProcAddress(hModWinSpoolDrv, "EndPagePrinter");
+ fpGetPrinterW = GetProcAddress( hModWinSpoolDrv,"GetPrinterW");
+ fpGetPrinterDriverW =
GetProcAddress(hModWinSpoolDrv,"GetPrinterDriverW");
+ fpGetSpoolFileHandle = (PVOID)GetProcAddress(hModWinSpoolDrv,
"GetSpoolFileHandle");
+ fpIsValidDevmodeW = GetProcAddress(hModWinSpoolDrv,
"IsValidDevmodeW");
+ fpOpenPrinterW = GetProcAddress(hModWinSpoolDrv, "OpenPrinterW");
+ fpQueryColorProfile =
GetProcAddress(hModWinSpoolDrv,"QueryColorProfile");
+ fpQueryRemoteFonts = (PVOID)GetProcAddress(hModWinSpoolDrv,
"QueryRemoteFonts");
+ fpQuerySpoolMode = (PVOID)GetProcAddress(hModWinSpoolDrv,
"QuerySpoolMode");
+ fpReadPrinter = GetProcAddress(hModWinSpoolDrv, "ReadPrinter");
+ fpResetPrinterW = GetProcAddress(hModWinSpoolDrv, "ResetPrinterW");
+ fpSeekPrinter = GetProcAddress(hModWinSpoolDrv, "SeekPrinter");
+ fpSplDriverUnloadComplete = GetProcAddress(hModWinSpoolDrv,
"SplDriverUnloadComplete");
+ fpSplReadPrinter = GetProcAddress(hModWinSpoolDrv, (LPCSTR)205);
+ fpStartDocDlgW = GetProcAddress(hModWinSpoolDrv, "StartDocDlgW");
+ fpStartDocPrinterW = (PVOID)GetProcAddress(hModWinSpoolDrv,
"StartDocPrinterW");
+ fpStartPagePrinter = GetProcAddress(hModWinSpoolDrv,
"StartPagePrinter");
+
+ if ( !fpAbortPrinter ||
+ !fpClosePrinter ||
+ !fpCloseSpoolFileHandle ||
+ !fpCommitSpoolData ||
+ !fpDocumentEvent ||
+ !fpDocumentPropertiesW ||
+ !fpEndDocPrinter ||
+ !fpEndPagePrinter ||
+ !fpGetPrinterW ||
+ !fpGetPrinterDriverW ||
+ !fpGetSpoolFileHandle ||
+ !fpIsValidDevmodeW ||
+ !fpOpenPrinterW ||
+ !fpQueryColorProfile ||
+ !fpQueryRemoteFonts ||
+ !fpQuerySpoolMode ||
+ !fpReadPrinter ||
+ !fpResetPrinterW ||
+ !fpSeekPrinter ||
+ !fpSplDriverUnloadComplete ||
+ !fpSplReadPrinter ||
+ !fpStartDocDlgW ||
+ !fpStartDocPrinterW ||
+ !fpStartPagePrinter )
+ {
+ FreeLibrary(hModWinSpoolDrv);
+ hModWinSpoolDrv = NULL;
+ }
+ ghSpooler = hModWinSpoolDrv;
+ }
+ RtlLeaveCriticalSection(&semLocal);
+ }
+ else
+ return TRUE;
+
+ if ( !ghSpooler ) SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+
+ return (ghSpooler != NULL);
+}
+
+BOOL
+FASTCALL
+StartPagePrinterEx(
+ PVOID pvUMPDev,
+ HANDLE hPrinter
+ )
+{
+ return fpStartPagePrinter(hPrinter);
+}
+
+/* SYSCALLS ******************************************************************/
/*
* @unimplemented
@@ -21,16 +243,18 @@
SetLastError(ERROR_INVALID_HANDLE);
return SP_ERROR;
}
+
pldc = GdiGetLDC(hdc);
if ( !pldc )
{
SetLastError(ERROR_INVALID_HANDLE);
return SP_ERROR;
}
+
if ( !(pldc->Flags & LDC_INIT_DOCUMENT) ) return 1;
- /* winspool:DocumentEvent printer driver */
-
+ DocumentEventEx(NULL, pldc->hPrinter, hdc, DOCUMENTEVENT_ABORTDOC, 0, NULL, 0,
NULL);
+
((PW32CLIENTINFO)NtCurrentTeb()->Win32ClientInfo)->cSpins = 0;
if ( pldc->Flags & LDC_META_PRINT)
@@ -42,13 +266,12 @@
if (NtGdiAbortDoc(hdc))
{
- /* winspool:AbortPrinter driver */
- Ret = 1;
+ if (fpAbortPrinter(pldc->hPrinter)) Ret = 1;
}
else
Ret = SP_ERROR;
- pldc->Flags &=
~(LDC_META_PRINT|LDC_STARTPAGE|LDC_INIT_PAGE|LDC_INIT_DOCUMENT|LDC_SAPCALLBACK);
+ pldc->Flags &=
~(LDC_ATENDPAGE|LDC_META_PRINT|LDC_STARTPAGE|LDC_INIT_PAGE|LDC_INIT_DOCUMENT|LDC_SAPCALLBACK);
return Ret;
}
@@ -62,64 +285,66 @@
HDC hdc
)
{
+ PLDC pldc;
+ int Ret = SP_ERROR;
+ ULONG hType = GDI_HANDLE_GET_TYPE(hdc);
+
+ if (hType == GDILoObjType_LO_DC_TYPE || hType == GDILoObjType_LO_METADC16_TYPE)
+ {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return SP_ERROR;
+ }
+
+ pldc = GdiGetLDC(hdc);
+ if ( !pldc )
+ {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return SP_ERROR;
+ }
+
+ if (pldc->Flags & LDC_META_PRINT)
+ {
UNIMPLEMENTED;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-/*
- * @unimplemented
- */
-HANDLE
-WINAPI
-GdiGetSpoolFileHandle(LPWSTR pwszPrinterName,
- LPDEVMODEW pDevmode,
- LPWSTR pwszDocName)
-{
- UNIMPLEMENTED;
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-WINAPI
-GdiDeleteSpoolFileHandle(HANDLE SpoolFileHandle)
-{
- UNIMPLEMENTED;
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-/*
- * @unimplemented
- */
-DWORD
-WINAPI
-GdiGetPageCount(HANDLE SpoolFileHandle)
-{
- UNIMPLEMENTED;
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-
-/*
- * @unimplemented
+ return Ret;
+ }
+
+ if (pldc->Flags & LDC_INIT_DOCUMENT)
+ {
+ BOOL Good;
+ if (pldc->Flags & LDC_ENDPAGE_MFDC) EndPage(hdc);
+
+ DocumentEventEx(NULL, pldc->hPrinter, hdc, DOCUMENTEVENT_ENDDOC, 0, NULL, 0,
NULL);
+
+ ((PW32CLIENTINFO)NtCurrentTeb()->Win32ClientInfo)->cSpins = 0;
+
+ Good = NtGdiEndDoc(hdc);
+
+ if (Good)
+ Good = EndDocPrinterEx(NULL,pldc->hPrinter);
+
+ if (Good)
+ {
+ DocumentEventEx(NULL, pldc->hPrinter, hdc, DOCUMENTEVENT_ENDDOCPOST, 0, NULL,
0, NULL);
+ Ret = 1;
+ }
+ pldc->Flags &=
~(LDC_ATENDPAGE|LDC_STARTPAGE|LDC_INIT_DOCUMENT|LDC_SAPCALLBACK);
+ }
+ return Ret;
+}
+
+/*
+ * @implemented
*/
int
WINAPI
EndFormPage(HDC hdc)
{
- UNIMPLEMENTED;
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-/*
- * @unimplemented
+ return IntEndPage(hdc,TRUE);
+}
+
+/*
+ * @implemented
*/
int
WINAPI
@@ -127,9 +352,138 @@
HDC hdc
)
{
+ return IntEndPage(hdc,FALSE);
+}
+
+/*
+ * @unimplemented
+ */
+int
+WINAPI
+StartDocW(
+ HDC hdc,
+ CONST DOCINFOW *lpdi
+ )
+{
+ PLDC pldc;
+ ULONG hType = GDI_HANDLE_GET_TYPE(hdc);
+
+ if (hType == GDILoObjType_LO_DC_TYPE || hType == GDILoObjType_LO_METADC16_TYPE)
+ {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return SP_ERROR;
+ }
+
+ pldc = GdiGetLDC(hdc);
+ if ( !pldc )
+ {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return SP_ERROR;
+ }
+
+ return NtGdiStartDoc ( hdc, (DOCINFOW *)lpdi, NULL, 0);
+}
+
+/*
+ * @implemented
+ */
+int
+WINAPI
+StartDocA(
+ HDC hdc,
+ CONST DOCINFOA *lpdi
+ )
+{
+ LPWSTR szDocName = NULL, szOutput = NULL, szDatatype = NULL;
+ DOCINFOW docW;
+ INT ret, len;
+
+ docW.cbSize = lpdi->cbSize;
+ if (lpdi->lpszDocName)
+ {
+ len = MultiByteToWideChar(CP_ACP,0,lpdi->lpszDocName,-1,NULL,0);
+ szDocName = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP,0,lpdi->lpszDocName,-1,szDocName,len);
+ }
+ if (lpdi->lpszOutput)
+ {
+ len = MultiByteToWideChar(CP_ACP,0,lpdi->lpszOutput,-1,NULL,0);
+ szOutput = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP,0,lpdi->lpszOutput,-1,szOutput,len);
+ }
+ if (lpdi->lpszDatatype)
+ {
+ len = MultiByteToWideChar(CP_ACP,0,lpdi->lpszDatatype,-1,NULL,0);
+ szDatatype = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP,0,lpdi->lpszDatatype,-1,szDatatype,len);
+ }
+
+ docW.lpszDocName = szDocName;
+ docW.lpszOutput = szOutput;
+ docW.lpszDatatype = szDatatype;
+ docW.fwType = lpdi->fwType;
+
+ ret = StartDocW(hdc, &docW);
+
+ HeapFree( GetProcessHeap(), 0, szDocName );
+ HeapFree( GetProcessHeap(), 0, szOutput );
+ HeapFree( GetProcessHeap(), 0, szDatatype );
+
+ return ret;
+}
+
+/*
+ * @unimplemented
+ */
+int
+WINAPI
+StartPage(
+ HDC hdc
+ )
+{
+ PLDC pldc;
+ ULONG hType = GDI_HANDLE_GET_TYPE(hdc);
+
+ if (hType == GDILoObjType_LO_DC_TYPE || hType == GDILoObjType_LO_METADC16_TYPE)
+ {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return SP_ERROR;
+ }
+
+ pldc = GdiGetLDC(hdc);
+ if ( !pldc )
+ {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return SP_ERROR;
+ }
+
+ if (pldc->Flags & LDC_META_PRINT)
+ {
UNIMPLEMENTED;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
+ return SP_ERROR;
+ }
+
+ pldc->Flags &= ~(LDC_STARTPAGE);
+
+ if (pldc->Flags & LDC_ENDPAGE_MFDC) return 1;
+
+ if (DocumentEventEx(NULL, pldc->hPrinter, hdc, DOCUMENTEVENT_STARTPAGE, 0, NULL, 0,
NULL) != SP_ERROR)
+ {
+ pldc->Flags |= LDC_INIT_PAGE;
+
+ ((PW32CLIENTINFO)NtCurrentTeb()->Win32ClientInfo)->cSpins = 0;
+
+ if (StartPagePrinterEx(NULL, pldc->hPrinter))
+ {
+ if (NtGdiStartPage(hdc)) return 1;
+ }
+
+ pldc->Flags &= ~(LDC_INIT_PAGE);
+ EndDoc(hdc);
+ SetLastError(ERROR_INVALID_HANDLE);
+ }
+ return SP_ERROR;
}
/*
@@ -172,45 +526,3 @@
return SP_ERROR;
}
-/*
- * @unimplemented
- */
-int
-WINAPI
-StartDocW(
- HDC hdc,
- CONST DOCINFOW *a1
- )
-{
- return NtGdiStartDoc ( hdc, (DOCINFOW *)a1, NULL, 0);
-}
-
-/*
- * @unimplemented
- */
-int
-WINAPI
-StartDocA(
- HDC hdc,
- CONST DOCINFOA *lpdi
- )
-{
- UNIMPLEMENTED;
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
-/*
- * @unimplemented
- */
-int
-WINAPI
-StartPage(
- HDC hdc
- )
-{
- UNIMPLEMENTED;
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
Modified: trunk/reactos/dll/win32/winspool/winspool.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winspool/winspoo…
==============================================================================
--- trunk/reactos/dll/win32/winspool/winspool.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/winspool/winspool.spec [iso-8859-1] Tue May 26 09:50:15 2009
@@ -65,11 +65,13 @@
@ stdcall AdvancedDocumentPropertiesW(long long wstr ptr ptr)
@ stub AdvancedSetupDialog
@ stdcall ClosePrinter(long)
+@ stub CloseSpoolFileHandle
@ stdcall ConfigurePortA(str long str)
@ stdcall ConfigurePortW(wstr long wstr)
@ stdcall ConnectToPrinterDlg(long long)
@ stub ConvertAnsiDevModeToUnicodeDevMode
@ stub ConvertUnicodeDevModeToAnsiDevMode
+@ stub CommitSpoolData
@ stub CreatePrinterIC
@ stub DEVICECAPABILITIES
@ stub DEVICEMODE
@@ -147,16 +149,23 @@
@ stdcall GetPrinterW(long long ptr long ptr)
@ stdcall GetPrintProcessorDirectoryA(str str long ptr long ptr)
@ stdcall GetPrintProcessorDirectoryW(wstr wstr long ptr long ptr)
+@ stub GetSpoolFileHandle
+@ stub IsValidDevmodeA
+@ stub IsValidDevmodeW
@ stdcall OpenPrinterA(str ptr ptr)
@ stdcall OpenPrinterW(wstr ptr ptr)
@ stub PlayGdiScriptOnPrinterIC
@ stdcall PrinterMessageBoxA(ptr long ptr str str long)
@ stdcall PrinterMessageBoxW(ptr long ptr wstr wstr long)
@ stdcall PrinterProperties(long long)
+@ stub QueryColorProfile
+@ stub QuerySpoolMode
+@ stub QueryRemoteFonts
@ stdcall ReadPrinter(long ptr long ptr)
@ stdcall ResetPrinterA(long ptr)
@ stdcall ResetPrinterW(long ptr)
@ stdcall ScheduleJob(long long)
+@ stub SeekPrinter
@ stub SetAllocFailCount
@ stdcall SetFormA(long str long ptr)
@ stdcall SetFormW(long wstr long ptr)
@@ -168,9 +177,12 @@
@ stdcall SetPrinterDataExW(long wstr wstr long ptr long)
@ stdcall SetPrinterDataW(long wstr long ptr long)
@ stdcall SetPrinterW(long long ptr long)
+@ stub SplDriverUnloadComplete
@ stub SpoolerDevQueryPrintW
@ stdcall SpoolerInit()
@ stub SpoolerPrinterEvent
+@ stub StartDocDlgA
+@ stub StartDocDlgW
@ stdcall StartDocPrinterA(long long ptr)
@ stdcall StartDocPrinterW(long long ptr)
@ stdcall StartPagePrinter(long)
Modified: trunk/reactos/include/ddk/winddiui.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/winddiui.h?rev…
==============================================================================
--- trunk/reactos/include/ddk/winddiui.h [iso-8859-1] (original)
+++ trunk/reactos/include/ddk/winddiui.h [iso-8859-1] Tue May 26 09:50:15 2009
@@ -27,6 +27,51 @@
extern "C" {
#endif
+#define DOCUMENTEVENT_FIRST 1
+#define DOCUMENTEVENT_CREATEDCPRE 1
+#define DOCUMENTEVENT_CREATEDCPOST 2
+#define DOCUMENTEVENT_RESETDCPRE 3
+#define DOCUMENTEVENT_RESETDCPOST 4
+#define DOCUMENTEVENT_STARTDOC 5
+#define DOCUMENTEVENT_STARTDOCPRE 5
+#define DOCUMENTEVENT_STARTPAGE 6
+#define DOCUMENTEVENT_ENDPAGE 7
+#define DOCUMENTEVENT_ENDDOC 8
+#define DOCUMENTEVENT_ENDDOCPRE 8
+#define DOCUMENTEVENT_ABORTDOC 9
+#define DOCUMENTEVENT_DELETEDC 10
+#define DOCUMENTEVENT_ESCAPE 11
+#define DOCUMENTEVENT_ENDDOCPOST 12
+#define DOCUMENTEVENT_STARTDOCPOST 13
+#if (NTDDI_VERSION >= NTDDI_VISTA)
+#define DOCUMENTEVENT_QUERYFILTER 14
+#define DOCUMENTEVENT_XPS_ADDFIXEDDOCUMENTSEQUENCEPRE 1
+#define DOCUMENTEVENT_XPS_ADDFIXEDDOCUMENTPRE 2
+#define DOCUMENTEVENT_XPS_ADDFIXEDPAGEEPRE 3
+#define DOCUMENTEVENT_XPS_ADDFIXEDPAGEPOST 4
+#define DOCUMENTEVENT_XPS_ADDFIXEDDOCUMENTPOST 5
+#define DOCUMENTEVENT_XPS_CANCELJOB 6
+#define DOCUMENTEVENT_XPS_ADDFIXEDDOCUMENTSEQUENCEPRINTTICKETPRE 7
+#define DOCUMENTEVENT_XPS_ADDFIXEDDOCUMENTPRINTTICKETPRE 8
+#define DOCUMENTEVENT_XPS_ADDFIXEDPAGEPRINTTICKETPRE 9
+#define DOCUMENTEVENT_XPS_ADDFIXEDPAGEPRINTTICKETPOST 10
+#define DOCUMENTEVENT_XPS_ADDFIXEDDOCUMENTPRINTTICKETPOST 11
+#define DOCUMENTEVENT_XPS_ADDFIXEDDOCUMENTSEQUENCEPRINTTICKETPOST 12
+#define DOCUMENTEVENT_XPS_ADDFIXEDDOCUMENTSEQUENCEPOST 13
+#define DOCUMENTEVENT_LAST 15
+#elif (NTDDI_VERSION >= NTDDI_WINXP)
+#define DOCUMENTEVENT_QUERYFILTER 14
+#define DOCUMENTEVENT_LAST 15
+#else
+#define DOCUMENTEVENT_LAST 14
+#endif
+#define DOCUMENTEVENT_SPOOLED 0x10000
+#define DOCUMENTEVENT_SUCCESS 1
+#define DOCUMENTEVENT_UNSUPPORTED 0
+#define DOCUMENTEVENT_FAILURE -1
+
+int WINAPI DrvDocumentEvent(HANDLE,HDC,int,ULONG,PVOID,ULONG,PVOID);
+
#define DRIVER_EVENT_INITIALIZE 1
#define DRIVER_EVENT_DELETE 2
Modified: trunk/reactos/include/psdk/winspool.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winspool.h?re…
==============================================================================
--- trunk/reactos/include/psdk/winspool.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/winspool.h [iso-8859-1] Tue May 26 09:50:15 2009
@@ -845,6 +845,10 @@
BOOL WINAPI GetPrinterDriverDirectoryW(LPWSTR,LPWSTR,DWORD,LPBYTE,DWORD,LPDWORD);
BOOL WINAPI GetPrintProcessorDirectoryA(LPSTR,LPSTR,DWORD,LPBYTE,DWORD,LPDWORD);
BOOL WINAPI GetPrintProcessorDirectoryW(LPWSTR,LPWSTR,DWORD,LPBYTE,DWORD,LPDWORD);
+#if NTDDI_VERSION >= NTDDI_WINXPSP2
+BOOL WINAPI IsValidDevmodeA(PDEVMODEA,size_t);
+BOOL WINAPI IsValidDevmodeW(PDEVMODEW,size_t);
+#endif
BOOL WINAPI OpenPrinterA(LPSTR,PHANDLE,LPPRINTER_DEFAULTSA);
BOOL WINAPI OpenPrinterW(LPWSTR,PHANDLE,LPPRINTER_DEFAULTSW);
DWORD WINAPI PrinterMessageBoxA(HANDLE,DWORD,HWND,LPSTR,LPSTR,DWORD);
@@ -934,6 +938,7 @@
#define GetPrinterDriver GetPrinterDriverW
#define GetPrinterDriverDirectory GetPrinterDriverDirectoryW
#define GetPrintProcessorDirectory GetPrintProcessorDirectoryW
+#define IsValidDevmode IsValidDevmodeW
#define OpenPrinter OpenPrinterW
#define PrinterMessageBox PrinterMessageBoxW
#define ResetPrinter ResetPrinterW
@@ -1003,6 +1008,7 @@
#define GetPrinterDriver GetPrinterDriverA
#define GetPrinterDriverDirectory GetPrinterDriverDirectoryA
#define GetPrintProcessorDirectory GetPrintProcessorDirectoryA
+#define IsValidDevmode IsValidDevmodeA
#define OpenPrinter OpenPrinterA
#define PrinterMessageBox PrinterMessageBoxA
#define ResetPrinter ResetPrinterA
Modified: trunk/reactos/include/reactos/win32k/ntgdihdl.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntg…
==============================================================================
--- trunk/reactos/include/reactos/win32k/ntgdihdl.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/win32k/ntgdihdl.h [iso-8859-1] Tue May 26 09:50:15 2009
@@ -185,6 +185,8 @@
#define LDC_META_PRINT 0x00020000
#define LDC_INFODC 0x01000000 /* If CreateIC was passed. */
#define LDC_DEVCAPS 0x02000000
+#define LDC_ATENDPAGE 0x10000000
+#define LDC_ENDPAGE_MFDC 0x80000000
/* DC_ATTR Xform Flags */
#define METAFILE_TO_WORLD_IDENTITY 0x00000001
Added: trunk/reactos/include/reactos/wine/winspool.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/wine/winsp…
==============================================================================
--- trunk/reactos/include/reactos/wine/winspool.h (added)
+++ trunk/reactos/include/reactos/wine/winspool.h [iso-8859-1] Tue May 26 09:50:15 2009
@@ -1,0 +1,51 @@
+/* Definitions for printing
+ *
+ * Copyright 1998 Huw Davies, Andreas Mohr
+ *
+ * Portions Copyright (c) 1999 Corel Corporation
+ * (Paul Quinn, Albert Den Haan)
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+#ifndef __WINE_WINSPOOL_H
+#define __WINE_WINSPOOL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Compatibility header
+ */
+
+#if !defined(_MSC_VER)
+#include_next "winspool.h"
+#endif
+
+
+/* DECLARATIONS */
+LONG WINAPI ExtDeviceMode( HWND hWnd, HANDLE hInst, LPDEVMODEA pDevModeOutput,
+ LPSTR pDeviceName, LPSTR pPort, LPDEVMODEA pDevModeInput, LPSTR pProfile,
+ DWORD fMode);
+
+LPSTR WINAPI StartDocDlgA(HANDLE hPrinter, DOCINFOA *doc);
+LPWSTR WINAPI StartDocDlgW(HANDLE hPrinter, DOCINFOW *doc);
+#define StartDocDlg WINELIB_NAME_AW(StartDocDlg)
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __WINE_WINSPOOL_H */
Propchange: trunk/reactos/include/reactos/wine/winspool.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/reactos/include/reactos/wine/winspool.h
------------------------------------------------------------------------------
svn:mime-type = text/plain