Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
ab8b7dba
Commit
ab8b7dba
authored
Apr 27, 2001
by
Marcus Meissner
Committed by
Alexandre Julliard
Apr 27, 2001
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added CUPS printing support.
parent
485cefd0
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
188 additions
and
123 deletions
+188
-123
configure
configure
+0
-0
configure.in
configure.in
+8
-0
printdlg.c
dlls/commdlg/printdlg.c
+1
-1
printdrv.c
dlls/gdi/printdrv.c
+7
-1
Makefile.in
dlls/wineps/Makefile.in
+1
-0
init.c
dlls/wineps/init.c
+58
-104
Makefile.in
dlls/winspool/Makefile.in
+1
-0
info.c
dlls/winspool/info.c
+97
-13
wspool.c
dlls/winspool/wspool.c
+9
-4
acconfig.h
include/acconfig.h
+3
-0
config.h.in
include/config.h.in
+3
-0
No files found.
configure
View file @
ab8b7dba
This diff is collapsed.
Click to expand it.
configure.in
View file @
ab8b7dba
...
@@ -368,6 +368,14 @@ then
...
@@ -368,6 +368,14 @@ then
fi
fi
fi
fi
CUPSLIBS=""
dnl **** Check for CUPS ****
AC_CHECK_LIB(cups,cupsGetPPD,
AC_DEFINE(HAVE_CUPS)
CUPSLIBS="-lcups"
)
AC_SUBST(CUPSLIBS)
dnl **** Check for IPX (currently Linux only) ****
dnl **** Check for IPX (currently Linux only) ****
AC_CACHE_CHECK("for GNU style IPX support", ac_cv_c_ipx_gnu,
AC_CACHE_CHECK("for GNU style IPX support", ac_cv_c_ipx_gnu,
AC_TRY_COMPILE(
AC_TRY_COMPILE(
...
...
dlls/commdlg/printdlg.c
View file @
ab8b7dba
...
@@ -1554,7 +1554,7 @@ BOOL WINAPI PrintDlgW( LPPRINTDLGW printdlg )
...
@@ -1554,7 +1554,7 @@ BOOL WINAPI PrintDlgW( LPPRINTDLGW printdlg )
*/
*/
BOOL
WINAPI
PageSetupDlgA
(
LPPAGESETUPDLGA
setupdlg
)
{
BOOL
WINAPI
PageSetupDlgA
(
LPPAGESETUPDLGA
setupdlg
)
{
FIXME
(
"(%p), stub!
\n
"
,
setupdlg
);
FIXME
(
"(%p), stub!
\n
"
,
setupdlg
);
return
FALS
E
;
return
TRU
E
;
}
}
/***********************************************************************
/***********************************************************************
* PageSetupDlgW (COMDLG32.16)
* PageSetupDlgW (COMDLG32.16)
...
...
dlls/gdi/printdrv.c
View file @
ab8b7dba
...
@@ -7,6 +7,9 @@
...
@@ -7,6 +7,9 @@
* Copyright 1999 Klaas van Gend
* Copyright 1999 Klaas van Gend
*/
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include <ctype.h>
#include <ctype.h>
...
@@ -453,7 +456,10 @@ static int CreateSpoolFile(LPCSTR pszOutput)
...
@@ -453,7 +456,10 @@ static int CreateSpoolFile(LPCSTR pszOutput)
if
(
pszOutput
==
NULL
||
*
pszOutput
==
'\0'
)
if
(
pszOutput
==
NULL
||
*
pszOutput
==
'\0'
)
return
-
1
;
return
-
1
;
PROFILE_GetWineIniString
(
"spooler"
,
pszOutput
,
""
,
psCmd
,
sizeof
(
psCmd
)
);
if
(
!
strncmp
(
"CUPS:"
,
pszOutput
,
5
))
sprintf
(
psCmd
,
"|lpr -P%s"
,
pszOutput
+
5
);
else
PROFILE_GetWineIniString
(
"spooler"
,
pszOutput
,
""
,
psCmd
,
sizeof
(
psCmd
));
TRACE
(
"Got printerSpoolCommand '%s' for output device '%s'
\n
"
,
TRACE
(
"Got printerSpoolCommand '%s' for output device '%s'
\n
"
,
psCmd
,
pszOutput
);
psCmd
,
pszOutput
);
if
(
!*
psCmd
)
if
(
!*
psCmd
)
...
...
dlls/wineps/Makefile.in
View file @
ab8b7dba
...
@@ -6,6 +6,7 @@ MODULE = wineps
...
@@ -6,6 +6,7 @@ MODULE = wineps
SOVERSION
=
1.0
SOVERSION
=
1.0
ALTNAMES
=
wineps16
ALTNAMES
=
wineps16
IMPORTS
=
user32 gdi32 winspool.drv kernel32 ntdll
IMPORTS
=
user32 gdi32 winspool.drv kernel32 ntdll
EXTRALIBS
=
@CUPSLIBS@
C_SRCS
=
\
C_SRCS
=
\
afm.c
\
afm.c
\
...
...
dlls/wineps/init.c
View file @
ab8b7dba
...
@@ -2,9 +2,12 @@
...
@@ -2,9 +2,12 @@
* PostScript driver initialization functions
* PostScript driver initialization functions
*
*
* Copyright 1998 Huw D M Davies
* Copyright 1998 Huw D M Davies
* Copyright 2001 Marcus Meissner
*
*
*/
*/
#include <string.h>
#include <string.h>
#include <unistd.h>
#include "gdi.h"
#include "gdi.h"
#include "psdrv.h"
#include "psdrv.h"
...
@@ -15,6 +18,10 @@
...
@@ -15,6 +18,10 @@
#include "winerror.h"
#include "winerror.h"
#include "options.h"
#include "options.h"
#ifdef HAVE_CUPS
# include <cups/cups.h>
#endif
DEFAULT_DEBUG_CHANNEL
(
psdrv
);
DEFAULT_DEBUG_CHANNEL
(
psdrv
);
static
BOOL
PSDRV_CreateDC
(
DC
*
dc
,
LPCSTR
driver
,
LPCSTR
device
,
static
BOOL
PSDRV_CreateDC
(
DC
*
dc
,
LPCSTR
driver
,
LPCSTR
device
,
...
@@ -187,7 +194,7 @@ static PSDRV_DEVMODEA DefaultDevmode =
...
@@ -187,7 +194,7 @@ static PSDRV_DEVMODEA DefaultDevmode =
/* dmCopies */
1
,
/* dmCopies */
1
,
/* dmDefaultSource */
DMBIN_AUTO
,
/* dmDefaultSource */
DMBIN_AUTO
,
/* dmPrintQuality */
0
,
/* dmPrintQuality */
0
,
/* dmColor */
DMCOLOR_
MONOCHROME
,
/* dmColor */
DMCOLOR_
COLOR
,
/* dmDuplex */
0
,
/* dmDuplex */
0
,
/* dmYResolution */
0
,
/* dmYResolution */
0
,
/* dmTTOption */
DMTT_SUBDEV
,
/* dmTTOption */
DMTT_SUBDEV
,
...
@@ -427,13 +434,13 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
...
@@ -427,13 +434,13 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
FONTNAME
*
font
;
FONTNAME
*
font
;
AFM
*
afm
;
AFM
*
afm
;
HANDLE
hPrinter
;
HANDLE
hPrinter
;
const
char
*
ppd
=
NULL
;
TRACE
(
"'%s'
\n
"
,
name
);
TRACE
(
"'%s'
\n
"
,
name
);
for
(
;
pi
;
last
=
&
pi
->
next
,
pi
=
pi
->
next
)
{
for
(
;
pi
;
last
=
&
pi
->
next
,
pi
=
pi
->
next
)
if
(
!
strcmp
(
pi
->
FriendlyName
,
name
))
if
(
!
strcmp
(
pi
->
FriendlyName
,
name
))
return
pi
;
return
pi
;
}
pi
=
*
last
=
HeapAlloc
(
PSDRV_Heap
,
0
,
sizeof
(
*
pi
)
);
pi
=
*
last
=
HeapAlloc
(
PSDRV_Heap
,
0
,
sizeof
(
*
pi
)
);
pi
->
FriendlyName
=
HEAP_strdupA
(
PSDRV_Heap
,
0
,
name
);
pi
->
FriendlyName
=
HEAP_strdupA
(
PSDRV_Heap
,
0
,
name
);
...
@@ -443,6 +450,7 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
...
@@ -443,6 +450,7 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
if
(
res
==
ERROR_INVALID_PRINTER_NAME
||
needed
!=
sizeof
(
DefaultDevmode
))
{
if
(
res
==
ERROR_INVALID_PRINTER_NAME
||
needed
!=
sizeof
(
DefaultDevmode
))
{
pi
->
Devmode
=
HeapAlloc
(
PSDRV_Heap
,
0
,
sizeof
(
DefaultDevmode
)
);
pi
->
Devmode
=
HeapAlloc
(
PSDRV_Heap
,
0
,
sizeof
(
DefaultDevmode
)
);
memcpy
(
pi
->
Devmode
,
&
DefaultDevmode
,
sizeof
(
DefaultDevmode
)
);
memcpy
(
pi
->
Devmode
,
&
DefaultDevmode
,
sizeof
(
DefaultDevmode
)
);
strcpy
(
pi
->
Devmode
->
dmPublic
.
dmDeviceName
,
name
);
DrvSetPrinterData16
((
LPSTR
)
name
,
(
LPSTR
)
INT_PD_DEFAULT_DEVMODE
,
DrvSetPrinterData16
((
LPSTR
)
name
,
(
LPSTR
)
INT_PD_DEFAULT_DEVMODE
,
REG_BINARY
,
(
LPBYTE
)
&
DefaultDevmode
,
sizeof
(
DefaultDevmode
)
);
REG_BINARY
,
(
LPBYTE
)
&
DefaultDevmode
,
sizeof
(
DefaultDevmode
)
);
...
@@ -453,34 +461,31 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
...
@@ -453,34 +461,31 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
(
LPBYTE
)
pi
->
Devmode
,
needed
,
&
needed
);
(
LPBYTE
)
pi
->
Devmode
,
needed
,
&
needed
);
}
}
if
(
OpenPrinterA
(
pi
->
FriendlyName
,
&
hPrinter
,
NULL
)
==
0
)
if
(
OpenPrinterA
(
pi
->
FriendlyName
,
&
hPrinter
,
NULL
)
==
0
)
{
{
ERR
(
"OpenPrinterA failed with code %li
\n
"
,
GetLastError
());
ERR
(
"OpenPrinterA failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
FriendlyName
)
==
0
)
goto
cleanup
;
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
Devmode
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
*
last
=
NULL
;
return
NULL
;
}
}
pi
->
Devmode
->
dmDrvPrivate
.
ppdFileName
[
0
]
=
'\0'
;
#ifdef HAVE_CUPS
{
ppd
=
cupsGetPPD
(
name
);
if
(
ppd
)
{
strcpy
(
pi
->
Devmode
->
dmDrvPrivate
.
ppdFileName
,
ppd
);
res
=
ERROR_SUCCESS
;
/* we should unlink() that file later */
}
else
{
ERR
(
"Did not find ppd for %s
\n
"
,
name
);
}
}
#endif
if
(
!
pi
->
Devmode
->
dmDrvPrivate
.
ppdFileName
[
0
])
{
res
=
GetPrinterDataA
(
hPrinter
,
"PPD File"
,
NULL
,
res
=
GetPrinterDataA
(
hPrinter
,
"PPD File"
,
NULL
,
pi
->
Devmode
->
dmDrvPrivate
.
ppdFileName
,
256
,
&
needed
);
pi
->
Devmode
->
dmDrvPrivate
.
ppdFileName
,
256
,
&
needed
);
if
(
res
!=
ERROR_SUCCESS
)
}
{
if
(
res
!=
ERROR_SUCCESS
)
{
ERR
(
"Error %li getting PPD file name for printer '%s'
\n
"
,
res
,
name
);
ERR
(
"Error %li getting PPD file name for printer '%s'
\n
"
,
res
,
name
);
if
(
ClosePrinter
(
hPrinter
)
==
0
)
goto
closeprinter
;
WARN
(
"ClosePrinter failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
FriendlyName
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
Devmode
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
*
last
=
NULL
;
return
NULL
;
}
}
res
=
GetPrinterDataA
(
hPrinter
,
"Paper Size"
,
NULL
,
(
LPBYTE
)
&
dwPaperSize
,
res
=
GetPrinterDataA
(
hPrinter
,
"Paper Size"
,
NULL
,
(
LPBYTE
)
&
dwPaperSize
,
...
@@ -489,19 +494,9 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
...
@@ -489,19 +494,9 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
pi
->
Devmode
->
dmPublic
.
u1
.
s1
.
dmPaperSize
=
(
SHORT
)
dwPaperSize
;
pi
->
Devmode
->
dmPublic
.
u1
.
s1
.
dmPaperSize
=
(
SHORT
)
dwPaperSize
;
else
if
(
res
==
ERROR_FILE_NOT_FOUND
)
else
if
(
res
==
ERROR_FILE_NOT_FOUND
)
TRACE
(
"No 'Paper Size' for printer '%s'
\n
"
,
name
);
TRACE
(
"No 'Paper Size' for printer '%s'
\n
"
,
name
);
else
else
{
{
ERR
(
"GetPrinterDataA returned %li
\n
"
,
res
);
ERR
(
"GetPrinterDataA returned %li
\n
"
,
res
);
if
(
ClosePrinter
(
hPrinter
)
==
0
)
goto
closeprinter
;
WARN
(
"ClosePrinter failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
FriendlyName
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
Devmode
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
*
last
=
NULL
;
return
NULL
;
}
}
res
=
EnumPrinterDataExA
(
hPrinter
,
"PrinterDriverData
\\
FontSubTable"
,
NULL
,
res
=
EnumPrinterDataExA
(
hPrinter
,
"PrinterDriverData
\\
FontSubTable"
,
NULL
,
...
@@ -511,83 +506,33 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
...
@@ -511,83 +506,33 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
else
if
(
res
==
ERROR_MORE_DATA
)
else
if
(
res
==
ERROR_MORE_DATA
)
{
{
pi
->
FontSubTable
=
HeapAlloc
(
PSDRV_Heap
,
0
,
needed
);
pi
->
FontSubTable
=
HeapAlloc
(
PSDRV_Heap
,
0
,
needed
);
if
(
pi
->
FontSubTable
==
NULL
)
if
(
pi
->
FontSubTable
==
NULL
)
{
{
ERR
(
"Failed to allocate %li bytes from heap
\n
"
,
needed
);
ERR
(
"Failed to allocate %li bytes from heap
\n
"
,
needed
);
if
(
ClosePrinter
(
hPrinter
)
==
0
)
goto
closeprinter
;
WARN
(
"ClosePrinter failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
FriendlyName
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
Devmode
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
*
last
=
NULL
;
return
NULL
;
}
}
res
=
EnumPrinterDataExA
(
hPrinter
,
"PrinterDriverData
\\
FontSubTable"
,
res
=
EnumPrinterDataExA
(
hPrinter
,
"PrinterDriverData
\\
FontSubTable"
,
(
LPBYTE
)
pi
->
FontSubTable
,
needed
,
&
needed
,
(
LPBYTE
)
pi
->
FontSubTable
,
needed
,
&
needed
,
&
pi
->
FontSubTableSize
);
&
pi
->
FontSubTableSize
);
if
(
res
!=
ERROR_SUCCESS
)
if
(
res
!=
ERROR_SUCCESS
)
{
{
ERR
(
"EnumPrinterDataExA returned %li
\n
"
,
res
);
ERR
(
"EnumPrinterDataExA returned %li
\n
"
,
res
);
if
(
ClosePrinter
(
hPrinter
)
==
0
)
goto
closeprinter
;
WARN
(
"ClosePrinter failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
FontSubTable
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
FriendlyName
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
Devmode
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
*
last
=
NULL
;
return
NULL
;
}
}
}
else
/* error in 1st call to EnumPrinterDataExA */
}
else
{
{
FIXME
(
"EnumPrinterDataExA returned %li
\n
"
,
res
);
ERR
(
"EnumPrinterDataExA returned %li
\n
"
,
res
);
/* ignore error */
if
(
ClosePrinter
(
hPrinter
)
==
0
)
WARN
(
"ClosePrinter failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
FriendlyName
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
Devmode
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
*
last
=
NULL
;
return
NULL
;
}
}
if
(
ClosePrinter
(
hPrinter
)
==
0
)
if
(
ClosePrinter
(
hPrinter
)
==
0
)
{
{
ERR
(
"ClosePrinter failed with code %li
\n
"
,
GetLastError
());
ERR
(
"ClosePrinter failed with code %li
\n
"
,
GetLastError
());
if
(
ClosePrinter
(
hPrinter
)
==
0
)
goto
cleanup
;
WARN
(
"ClosePrinter failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
FontSubTable
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
FriendlyName
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
Devmode
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
if
(
HeapFree
(
PSDRV_Heap
,
0
,
pi
)
==
0
)
WARN
(
"HeapFree failed with code %li
\n
"
,
GetLastError
());
*
last
=
NULL
;
return
NULL
;
}
}
pi
->
ppd
=
PSDRV_ParsePPD
(
pi
->
Devmode
->
dmDrvPrivate
.
ppdFileName
);
pi
->
ppd
=
PSDRV_ParsePPD
(
pi
->
Devmode
->
dmDrvPrivate
.
ppdFileName
);
if
(
!
pi
->
ppd
)
{
if
(
!
pi
->
ppd
)
{
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
FontSubTable
);
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
FriendlyName
);
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
Devmode
);
HeapFree
(
PSDRV_Heap
,
0
,
pi
);
*
last
=
NULL
;
MESSAGE
(
"Couldn't find PPD file '%s', expect a crash now!
\n
"
,
MESSAGE
(
"Couldn't find PPD file '%s', expect a crash now!
\n
"
,
pi
->
Devmode
->
dmDrvPrivate
.
ppdFileName
);
pi
->
Devmode
->
dmDrvPrivate
.
ppdFileName
);
return
NULL
;
goto
cleanup
;
}
}
pi
->
next
=
NULL
;
pi
->
next
=
NULL
;
...
@@ -595,14 +540,23 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
...
@@ -595,14 +540,23 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
for
(
font
=
pi
->
ppd
->
InstalledFonts
;
font
;
font
=
font
->
next
)
{
for
(
font
=
pi
->
ppd
->
InstalledFonts
;
font
;
font
=
font
->
next
)
{
afm
=
PSDRV_FindAFMinList
(
PSDRV_AFMFontList
,
font
->
Name
);
afm
=
PSDRV_FindAFMinList
(
PSDRV_AFMFontList
,
font
->
Name
);
if
(
!
afm
)
{
if
(
!
afm
)
TRACE
(
TRACE
(
"Couldn't find AFM file for installed printer font '%s' - ignoring
\n
"
,
font
->
Name
);
"Couldn't find AFM file for installed printer font '%s' - ignoring
\n
"
,
else
font
->
Name
);
}
else
{
PSDRV_AddAFMtoList
(
&
pi
->
Fonts
,
afm
);
PSDRV_AddAFMtoList
(
&
pi
->
Fonts
,
afm
);
}
}
}
if
(
ppd
)
unlink
(
ppd
);
return
pi
;
return
pi
;
closeprinter:
ClosePrinter
(
hPrinter
);
cleanup:
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
FontSubTable
);
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
FriendlyName
);
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
Devmode
);
HeapFree
(
PSDRV_Heap
,
0
,
pi
);
if
(
ppd
)
unlink
(
ppd
);
*
last
=
NULL
;
return
NULL
;
}
}
dlls/winspool/Makefile.in
View file @
ab8b7dba
...
@@ -3,6 +3,7 @@ TOPOBJDIR = ../..
...
@@ -3,6 +3,7 @@ TOPOBJDIR = ../..
SRCDIR
=
@srcdir@
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
VPATH
=
@srcdir@
MODULE
=
winspool.drv
MODULE
=
winspool.drv
EXTRALIBS
=
@CUPSLIBS@
LDDLLFLAGS
=
@LDDLLFLAGS@
LDDLLFLAGS
=
@LDDLLFLAGS@
SYMBOLFILE
=
$(MODULE)
.tmp.o
SYMBOLFILE
=
$(MODULE)
.tmp.o
...
...
dlls/winspool/info.c
View file @
ab8b7dba
...
@@ -5,13 +5,19 @@
...
@@ -5,13 +5,19 @@
* Copyright 1998 Andreas Mohr
* Copyright 1998 Andreas Mohr
* Copyright 1999 Klaas van Gend
* Copyright 1999 Klaas van Gend
* Copyright 1999, 2000 Huw D M Davies
* Copyright 1999, 2000 Huw D M Davies
* Copyright 2001 Marcus Meissner
*/
*/
#include "config.h"
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include <ctype.h>
#include <ctype.h>
#include <stddef.h>
#include <stddef.h>
#ifdef HAVE_CUPS
# include <cups/cups.h>
#endif
#include "winspool.h"
#include "winspool.h"
#include "winbase.h"
#include "winbase.h"
#include "winerror.h"
#include "winerror.h"
...
@@ -69,6 +75,79 @@ static WCHAR Separator_FileW[] = {'S','e','p','a','r','a','t','o','r',' ','F',
...
@@ -69,6 +75,79 @@ static WCHAR Separator_FileW[] = {'S','e','p','a','r','a','t','o','r',' ','F',
static
WCHAR
Share_NameW
[]
=
{
'S'
,
'h'
,
'a'
,
'r'
,
'e'
,
' '
,
'N'
,
'a'
,
'm'
,
'e'
,
0
};
static
WCHAR
Share_NameW
[]
=
{
'S'
,
'h'
,
'a'
,
'r'
,
'e'
,
' '
,
'N'
,
'a'
,
'm'
,
'e'
,
0
};
static
WCHAR
WinPrintW
[]
=
{
'W'
,
'i'
,
'n'
,
'P'
,
'r'
,
'i'
,
'n'
,
't'
,
0
};
static
WCHAR
WinPrintW
[]
=
{
'W'
,
'i'
,
'n'
,
'P'
,
'r'
,
'i'
,
'n'
,
't'
,
0
};
static
HKEY
WINSPOOL_OpenDriverReg
(
LPVOID
pEnvironment
,
BOOL
unicode
);
#ifdef HAVE_CUPS
void
CUPS_LoadPrinters
(
void
)
{
cups_dest_t
*
dests
;
int
i
,
nrofdests
;
PRINTER_INFO_2A
pinfo2a
;
DRIVER_INFO_3A
di3a
;
const
char
*
def
=
cupsGetDefault
();
nrofdests
=
cupsGetDests
(
&
dests
);
di3a
.
cVersion
=
0x400
;
di3a
.
pName
=
"PS Driver"
;
di3a
.
pEnvironment
=
NULL
;
/* NULL means auto */
di3a
.
pDriverPath
=
"wineps.drv"
;
di3a
.
pDataFile
=
"<datafile?>"
;
di3a
.
pConfigFile
=
"wineps.drv"
;
di3a
.
pHelpFile
=
"<helpfile?>"
;
di3a
.
pDependentFiles
=
"<dependend files?>"
;
di3a
.
pMonitorName
=
"<monitor name?>"
;
di3a
.
pDefaultDataType
=
"RAW"
;
if
(
!
AddPrinterDriverA
(
NULL
,
3
,(
LPBYTE
)
&
di3a
))
{
ERR
(
"Failed adding PS Driver (%ld)
\n
"
,
GetLastError
());
return
;
}
for
(
i
=
0
;
i
<
nrofdests
;
i
++
)
{
const
char
*
ppd
=
cupsGetPPD
(
dests
[
i
].
name
);
char
*
port
,
*
devline
;
if
(
!
ppd
)
continue
;
unlink
(
ppd
);
if
(
!
strcmp
(
def
,
dests
[
i
].
name
))
{
char
*
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
2
*
strlen
(
dests
[
i
].
name
)
+
strlen
(
",WINEPS,CUPS:"
)
+
1
);
sprintf
(
buf
,
"%s,WINEPS,CUPS:%s"
,
dests
[
i
].
name
,
dests
[
i
].
name
);
WriteProfileStringA
(
"windows"
,
"device"
,
buf
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
}
memset
(
&
pinfo2a
,
0
,
sizeof
(
pinfo2a
));
pinfo2a
.
pPrinterName
=
dests
[
i
].
name
;
pinfo2a
.
pDatatype
=
"RAW"
;
pinfo2a
.
pPrintProcessor
=
"WinPrint"
;
pinfo2a
.
pDriverName
=
"PS Driver"
;
pinfo2a
.
pComment
=
"WINEPS Printer using CUPS"
;
pinfo2a
.
pLocation
=
"<physical location of printer>"
;
port
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
"CUPS:"
)
+
strlen
(
dests
[
i
].
name
)
+
1
);
sprintf
(
port
,
"CUPS:%s"
,
dests
[
i
].
name
);
pinfo2a
.
pPortName
=
port
;
pinfo2a
.
pParameters
=
"<parameters?>"
;
pinfo2a
.
pShareName
=
"<share name?>"
;
pinfo2a
.
pSepFile
=
"<sep file?>"
;
devline
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
"WINEPS,"
)
+
strlen
(
port
)
+
1
);
sprintf
(
devline
,
"WINEPS,%s"
,
port
);
WriteProfileStringA
(
"devices"
,
dests
[
i
].
name
,
devline
);
HeapFree
(
GetProcessHeap
(),
0
,
devline
);
if
(
!
AddPrinterA
(
NULL
,
2
,(
LPBYTE
)
&
pinfo2a
))
{
if
(
GetLastError
()
!=
ERROR_PRINTER_ALREADY_EXISTS
)
ERR
(
"%s not added by AddPrinterA (%ld)
\n
"
,
dests
[
i
].
name
,
GetLastError
());
}
HeapFree
(
GetProcessHeap
(),
0
,
port
);
}
}
#endif
/******************************************************************
/******************************************************************
* WINSPOOL_GetOpenedPrinterEntry
* WINSPOOL_GetOpenedPrinterEntry
* Get the first place empty in the opened printer table
* Get the first place empty in the opened printer table
...
@@ -374,7 +453,10 @@ LONG WINAPI DocumentPropertiesA(HWND hWnd,HANDLE hPrinter,
...
@@ -374,7 +453,10 @@ LONG WINAPI DocumentPropertiesA(HWND hWnd,HANDLE hPrinter,
if
(
!
pDeviceName
)
{
if
(
!
pDeviceName
)
{
LPCWSTR
lpNameW
=
WINSPOOL_GetOpenedPrinter
(
hPrinter
);
LPCWSTR
lpNameW
=
WINSPOOL_GetOpenedPrinter
(
hPrinter
);
if
(
!
lpNameW
)
return
-
1
;
if
(
!
lpNameW
)
{
ERR
(
"no name from hPrinter?
\n
"
);
return
-
1
;
}
lpName
=
HEAP_strdupWtoA
(
GetProcessHeap
(),
0
,
lpNameW
);
lpName
=
HEAP_strdupWtoA
(
GetProcessHeap
(),
0
,
lpNameW
);
}
}
...
@@ -382,7 +464,10 @@ LONG WINAPI DocumentPropertiesA(HWND hWnd,HANDLE hPrinter,
...
@@ -382,7 +464,10 @@ LONG WINAPI DocumentPropertiesA(HWND hWnd,HANDLE hPrinter,
{
{
GDI_CallExtDeviceMode16
=
(
void
*
)
GetProcAddress
(
GetModuleHandleA
(
"gdi32"
),
GDI_CallExtDeviceMode16
=
(
void
*
)
GetProcAddress
(
GetModuleHandleA
(
"gdi32"
),
(
LPCSTR
)
102
);
(
LPCSTR
)
102
);
if
(
!
GDI_CallExtDeviceMode16
)
return
-
1
;
if
(
!
GDI_CallExtDeviceMode16
)
{
ERR
(
"No CallExtDeviceMode16?
\n
"
);
return
-
1
;
}
}
}
ret
=
GDI_CallExtDeviceMode16
(
hWnd
,
pDevModeOutput
,
lpName
,
"LPT1:"
,
ret
=
GDI_CallExtDeviceMode16
(
hWnd
,
pDevModeOutput
,
lpName
,
"LPT1:"
,
pDevModeInput
,
NULL
,
fMode
);
pDevModeInput
,
NULL
,
fMode
);
...
@@ -484,7 +569,7 @@ BOOL WINAPI OpenPrinterW(LPWSTR lpPrinterName,HANDLE *phPrinter,
...
@@ -484,7 +569,7 @@ BOOL WINAPI OpenPrinterW(LPWSTR lpPrinterName,HANDLE *phPrinter,
if
(
RegOpenKeyW
(
hkeyPrinters
,
lpPrinterName
,
&
hkeyPrinter
)
if
(
RegOpenKeyW
(
hkeyPrinters
,
lpPrinterName
,
&
hkeyPrinter
)
!=
ERROR_SUCCESS
)
{
!=
ERROR_SUCCESS
)
{
WARN
(
"Can't find printer %s in registry
\n
"
,
debugstr_w
(
lpPrinterName
));
ERR
(
"Can't find printer %s in registry
\n
"
,
debugstr_w
(
lpPrinterName
));
RegCloseKey
(
hkeyPrinters
);
RegCloseKey
(
hkeyPrinters
);
SetLastError
(
ERROR_INVALID_PARAMETER
);
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
return
FALSE
;
...
@@ -698,12 +783,12 @@ HANDLE WINAPI AddPrinterW(LPWSTR pName, DWORD Level, LPBYTE pPrinter)
...
@@ -698,12 +783,12 @@ HANDLE WINAPI AddPrinterW(LPWSTR pName, DWORD Level, LPBYTE pPrinter)
TRACE
(
"(%s,%ld,%p)
\n
"
,
debugstr_w
(
pName
),
Level
,
pPrinter
);
TRACE
(
"(%s,%ld,%p)
\n
"
,
debugstr_w
(
pName
),
Level
,
pPrinter
);
if
(
pName
!=
NULL
)
{
if
(
pName
!=
NULL
)
{
FIXME
(
"pName = %s - unsupported
\n
"
,
debugstr_w
(
pName
));
ERR
(
"pName = %s - unsupported
\n
"
,
debugstr_w
(
pName
));
SetLastError
(
ERROR_INVALID_PARAMETER
);
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
return
0
;
}
}
if
(
Level
!=
2
)
{
if
(
Level
!=
2
)
{
WARN
(
"Level = %ld
\n
"
,
Level
);
ERR
(
"Level = %ld, unsupported!
\n
"
,
Level
);
SetLastError
(
ERROR_INVALID_LEVEL
);
SetLastError
(
ERROR_INVALID_LEVEL
);
return
0
;
return
0
;
}
}
...
@@ -741,7 +826,7 @@ HANDLE WINAPI AddPrinterW(LPWSTR pName, DWORD Level, LPBYTE pPrinter)
...
@@ -741,7 +826,7 @@ HANDLE WINAPI AddPrinterW(LPWSTR pName, DWORD Level, LPBYTE pPrinter)
RegCloseKey
(
hkeyDrivers
);
RegCloseKey
(
hkeyDrivers
);
if
(
lstrcmpiW
(
pi
->
pPrintProcessor
,
WinPrintW
))
{
/* FIXME */
if
(
lstrcmpiW
(
pi
->
pPrintProcessor
,
WinPrintW
))
{
/* FIXME */
WARN
(
"Can't find processor %s
\n
"
,
debugstr_w
(
pi
->
pPrintProcessor
));
FIXME
(
"Can't find processor %s
\n
"
,
debugstr_w
(
pi
->
pPrintProcessor
));
SetLastError
(
ERROR_UNKNOWN_PRINTPROCESSOR
);
SetLastError
(
ERROR_UNKNOWN_PRINTPROCESSOR
);
RegCloseKey
(
hkeyPrinters
);
RegCloseKey
(
hkeyPrinters
);
return
0
;
return
0
;
...
@@ -751,20 +836,20 @@ HANDLE WINAPI AddPrinterW(LPWSTR pName, DWORD Level, LPBYTE pPrinter)
...
@@ -751,20 +836,20 @@ HANDLE WINAPI AddPrinterW(LPWSTR pName, DWORD Level, LPBYTE pPrinter)
*/
*/
size
=
DocumentPropertiesW
(
0
,
-
1
,
pi
->
pPrinterName
,
NULL
,
NULL
,
0
);
size
=
DocumentPropertiesW
(
0
,
-
1
,
pi
->
pPrinterName
,
NULL
,
NULL
,
0
);
if
(
size
<
0
)
{
if
(
size
<
0
)
{
WARN
(
"DocumentProperties fails
\n
"
);
FIXME
(
"DocumentProperties fails
\n
"
);
SetLastError
(
ERROR_UNKNOWN_PRINTER_DRIVER
);
size
=
sizeof
(
DEVMODEW
);
return
0
;
}
}
if
(
pi
->
pDevMode
)
{
if
(
pi
->
pDevMode
)
{
dmW
=
pi
->
pDevMode
;
dmW
=
pi
->
pDevMode
;
}
else
{
}
else
{
dmW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
dmW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
dmW
->
dmSize
=
size
;
DocumentPropertiesW
(
0
,
-
1
,
pi
->
pPrinterName
,
dmW
,
NULL
,
DM_OUT_BUFFER
);
DocumentPropertiesW
(
0
,
-
1
,
pi
->
pPrinterName
,
dmW
,
NULL
,
DM_OUT_BUFFER
);
}
}
if
(
RegCreateKeyW
(
hkeyPrinters
,
pi
->
pPrinterName
,
&
hkeyPrinter
)
!=
if
(
RegCreateKeyW
(
hkeyPrinters
,
pi
->
pPrinterName
,
&
hkeyPrinter
)
!=
ERROR_SUCCESS
)
{
ERROR_SUCCESS
)
{
WARN
(
"Can't create printer %s
\n
"
,
debugstr_w
(
pi
->
pPrinterName
));
FIXME
(
"Can't create printer %s
\n
"
,
debugstr_w
(
pi
->
pPrinterName
));
SetLastError
(
ERROR_INVALID_PRINTER_NAME
);
SetLastError
(
ERROR_INVALID_PRINTER_NAME
);
RegCloseKey
(
hkeyPrinters
);
RegCloseKey
(
hkeyPrinters
);
if
(
!
pi
->
pDevMode
)
if
(
!
pi
->
pDevMode
)
...
@@ -775,7 +860,6 @@ HANDLE WINAPI AddPrinterW(LPWSTR pName, DWORD Level, LPBYTE pPrinter)
...
@@ -775,7 +860,6 @@ HANDLE WINAPI AddPrinterW(LPWSTR pName, DWORD Level, LPBYTE pPrinter)
(
LPBYTE
)
&
pi
->
Attributes
,
sizeof
(
DWORD
));
(
LPBYTE
)
&
pi
->
Attributes
,
sizeof
(
DWORD
));
RegSetValueExW
(
hkeyPrinter
,
DatatypeW
,
0
,
REG_SZ
,
(
LPBYTE
)
pi
->
pDatatype
,
RegSetValueExW
(
hkeyPrinter
,
DatatypeW
,
0
,
REG_SZ
,
(
LPBYTE
)
pi
->
pDatatype
,
0
);
0
);
/* Write DEVMODEA not DEVMODEW into reg. This is what win9x does
/* Write DEVMODEA not DEVMODEW into reg. This is what win9x does
and we support these drivers. NT writes DEVMODEW so somehow
and we support these drivers. NT writes DEVMODEW so somehow
we'll need to distinguish between these when we support NT
we'll need to distinguish between these when we support NT
...
@@ -832,7 +916,7 @@ HANDLE WINAPI AddPrinterA(LPSTR pName, DWORD Level, LPBYTE pPrinter)
...
@@ -832,7 +916,7 @@ HANDLE WINAPI AddPrinterA(LPSTR pName, DWORD Level, LPBYTE pPrinter)
TRACE
(
"(%s,%ld,%p): stub
\n
"
,
debugstr_a
(
pName
),
Level
,
pPrinter
);
TRACE
(
"(%s,%ld,%p): stub
\n
"
,
debugstr_a
(
pName
),
Level
,
pPrinter
);
if
(
Level
!=
2
)
{
if
(
Level
!=
2
)
{
WARN
(
"Level = %ld
\n
"
,
Level
);
ERR
(
"Level = %ld, unsupported!
\n
"
,
Level
);
SetLastError
(
ERROR_INVALID_LEVEL
);
SetLastError
(
ERROR_INVALID_LEVEL
);
return
0
;
return
0
;
}
}
...
@@ -1080,7 +1164,7 @@ static BOOL WINSPOOL_GetDevModeFromReg(HKEY hkey, LPCWSTR ValueName,
...
@@ -1080,7 +1164,7 @@ static BOOL WINSPOOL_GetDevModeFromReg(HKEY hkey, LPCWSTR ValueName,
if
((
ret
!=
ERROR_SUCCESS
&&
ret
!=
ERROR_MORE_DATA
))
sz
=
0
;
if
((
ret
!=
ERROR_SUCCESS
&&
ret
!=
ERROR_MORE_DATA
))
sz
=
0
;
if
(
sz
<
sizeof
(
DEVMODEA
))
if
(
sz
<
sizeof
(
DEVMODEA
))
{
{
ERR
(
"corrupted registry for %s
\n
"
,
debugstr_w
(
ValueName
)
);
ERR
(
"corrupted registry for %s
( size %ld)
\n
"
,
debugstr_w
(
ValueName
),
sz
);
sz
=
sizeof
(
DEVMODEA
);
sz
=
sizeof
(
DEVMODEA
);
}
}
/* ensures that dmSize is not erratically bogus if registry is invalid */
/* ensures that dmSize is not erratically bogus if registry is invalid */
...
...
dlls/winspool/wspool.c
View file @
ab8b7dba
...
@@ -5,6 +5,9 @@
...
@@ -5,6 +5,9 @@
* Copyright 1999 Thuy Nguyen
* Copyright 1999 Thuy Nguyen
*/
*/
#include "config.h"
#include "winspool.h"
#include "debugtools.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL
(
winspool
);
DEFAULT_DEBUG_CHANNEL
(
winspool
);
...
@@ -22,14 +25,16 @@ BOOL WINAPI WINSPOOL_EntryPoint(HINSTANCE hInstance,
...
@@ -22,14 +25,16 @@ BOOL WINAPI WINSPOOL_EntryPoint(HINSTANCE hInstance,
{
{
switch
(
reason
)
switch
(
reason
)
{
{
case
DLL_PROCESS_ATTACH
:
case
DLL_PROCESS_ATTACH
:
{
#ifdef HAVE_CUPS
extern
void
CUPS_LoadPrinters
();
CUPS_LoadPrinters
();
#endif
break
;
break
;
}
case
DLL_PROCESS_DETACH
:
case
DLL_PROCESS_DETACH
:
break
;
break
;
}
}
return
TRUE
;
return
TRUE
;
}
}
include/acconfig.h
View file @
ab8b7dba
...
@@ -119,3 +119,6 @@
...
@@ -119,3 +119,6 @@
/* Define if we have linux/input.h AND it contains the INPUT event API */
/* Define if we have linux/input.h AND it contains the INPUT event API */
#undef HAVE_CORRECT_LINUXINPUT_H
#undef HAVE_CORRECT_LINUXINPUT_H
/* Define if we have CUPS */
#undef HAVE_CUPS
include/config.h.in
View file @
ab8b7dba
...
@@ -151,6 +151,9 @@
...
@@ -151,6 +151,9 @@
/* Define if we have linux/input.h AND it contains the INPUT event API */
/* Define if we have linux/input.h AND it contains the INPUT event API */
#undef HAVE_CORRECT_LINUXINPUT_H
#undef HAVE_CORRECT_LINUXINPUT_H
/* Define if we have CUPS */
#undef HAVE_CUPS
/* The number of bytes in a long long. */
/* The number of bytes in a long long. */
#undef SIZEOF_LONG_LONG
#undef SIZEOF_LONG_LONG
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment