Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
6d3e81b9
Commit
6d3e81b9
authored
May 18, 2001
by
Marcus Meissner
Committed by
Alexandre Julliard
May 18, 2001
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use older cupsGetPrinters() API so we support CUPS 1.0.x too (as found
in Debian Potato). Only set the default printer if there is no entry yet or it is not WINEPS driven.
parent
7263720d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
22 deletions
+34
-22
info.c
dlls/winspool/info.c
+34
-22
No files found.
dlls/winspool/info.c
View file @
6d3e81b9
...
...
@@ -80,45 +80,60 @@ static BOOL WINSPOOL_GetPrinterDriver(HANDLE hPrinter, LPWSTR pEnvironment,
DWORD
Level
,
LPBYTE
pDriverInfo
,
DWORD
cbBuf
,
LPDWORD
pcbNeeded
,
BOOL
unicode
);
static
void
WINSPOOL_SetDefaultPrinter
(
const
char
*
devname
,
const
char
*
name
,
BOOL
force
)
{
char
qbuf
[
200
];
/* If forcing, or no profile string entry for device yet, set the entry
*
* The always change entry if not WINEPS yet is discussable.
*/
if
(
force
||
!
GetProfileStringA
(
"windows"
,
"device"
,
"*"
,
qbuf
,
sizeof
(
qbuf
))
||
!
strcmp
(
qbuf
,
"*"
)
||
!
strstr
(
qbuf
,
"WINEPS"
)
)
{
char
*
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
name
)
+
strlen
(
devname
)
+
strlen
(
",WINEPS,LPR:"
)
+
1
);
sprintf
(
buf
,
"%s,WINEPS,LPR:%s"
,
devname
,
name
);
WriteProfileStringA
(
"windows"
,
"device"
,
buf
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
}
}
#ifdef HAVE_CUPS
BOOL
CUPS_LoadPrinters
(
void
)
{
c
ups_dest_t
*
dest
s
;
c
har
**
printer
s
;
int
i
,
nrofdests
,
hadprinter
=
FALSE
;
PRINTER_INFO_2A
pinfo2a
;
const
char
*
def
=
cupsGetDefault
();
nrofdests
=
cupsGet
Dests
(
&
dest
s
);
nrofdests
=
cupsGet
Printers
(
&
printer
s
);
for
(
i
=
0
;
i
<
nrofdests
;
i
++
)
{
const
char
*
ppd
=
cupsGetPPD
(
dests
[
i
].
name
);
const
char
*
ppd
=
cupsGetPPD
(
printers
[
i
]
);
char
*
port
,
*
devline
;
if
(
!
ppd
)
{
WARN
(
"No ppd file for %s.
\n
"
,
dests
[
i
].
name
);
WARN
(
"No ppd file for %s.
\n
"
,
printers
[
i
]
);
continue
;
}
unlink
(
ppd
);
hadprinter
=
TRUE
;
if
(
!
strcmp
(
def
,
dests
[
i
].
name
))
{
char
*
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
2
*
strlen
(
dests
[
i
].
name
)
+
strlen
(
",WINEPS,LPR:"
)
+
1
);
sprintf
(
buf
,
"%s,WINEPS,LPR:%s"
,
dests
[
i
].
name
,
dests
[
i
].
name
);
WriteProfileStringA
(
"windows"
,
"device"
,
buf
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
}
if
(
!
strcmp
(
def
,
printers
[
i
]))
WINSPOOL_SetDefaultPrinter
(
printers
[
i
],
printers
[
i
],
FALSE
);
memset
(
&
pinfo2a
,
0
,
sizeof
(
pinfo2a
));
pinfo2a
.
pPrinterName
=
dests
[
i
].
name
;
pinfo2a
.
pPrinterName
=
printers
[
i
]
;
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
(
"LPR:"
)
+
strlen
(
dests
[
i
].
name
)
+
1
);
sprintf
(
port
,
"LPR:%s"
,
dests
[
i
].
name
);
port
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
"LPR:"
)
+
strlen
(
printers
[
i
]
)
+
1
);
sprintf
(
port
,
"LPR:%s"
,
printers
[
i
]
);
pinfo2a
.
pPortName
=
port
;
pinfo2a
.
pParameters
=
"<parameters?>"
;
pinfo2a
.
pShareName
=
"<share name?>"
;
...
...
@@ -126,12 +141,12 @@ CUPS_LoadPrinters(void) {
devline
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
"WINEPS,"
)
+
strlen
(
port
)
+
1
);
sprintf
(
devline
,
"WINEPS,%s"
,
port
);
WriteProfileStringA
(
"devices"
,
dests
[
i
].
name
,
devline
);
WriteProfileStringA
(
"devices"
,
printers
[
i
]
,
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
());
ERR
(
"%s not added by AddPrinterA (%ld)
\n
"
,
printers
[
i
]
,
GetLastError
());
}
HeapFree
(
GetProcessHeap
(),
0
,
port
);
}
...
...
@@ -197,13 +212,10 @@ PRINTCAP_ParseEntry(char *pent,BOOL isfirst) {
devname
=
name
;
if
(
strlen
(
devname
)
>=
CCHDEVICENAME
-
1
)
return
FALSE
;
if
(
isfirst
)
{
char
*
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
name
)
+
strlen
(
devname
)
+
strlen
(
",WINEPS,LPR:"
)
+
1
);
sprintf
(
buf
,
"%s,WINEPS,LPR:%s"
,
devname
,
name
);
WriteProfileStringA
(
"windows"
,
"device"
,
buf
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
}
if
(
isfirst
)
/* set first entry as default */
WINSPOOL_SetDefaultPrinter
(
devname
,
name
,
FALSE
);
memset
(
&
pinfo2a
,
0
,
sizeof
(
pinfo2a
));
pinfo2a
.
pPrinterName
=
devname
;
pinfo2a
.
pDatatype
=
"RAW"
;
...
...
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