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
f101e276
Commit
f101e276
authored
Oct 22, 2001
by
Francois Gouget
Committed by
Alexandre Julliard
Oct 22, 2001
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for environment variables in the printer settings.
Remove the fixed-size buffers.
parent
a45907c4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
19 deletions
+41
-19
init.c
dlls/wineps/init.c
+41
-19
No files found.
dlls/wineps/init.c
View file @
f101e276
...
...
@@ -432,7 +432,8 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
const
AFM
*
afm
;
HANDLE
hPrinter
;
const
char
*
ppd
=
NULL
;
char
ppdFileName
[
256
];
DWORD
ppdType
;
char
*
ppdFileName
=
NULL
;
HKEY
hkey
;
TRACE
(
"'%s'
\n
"
,
name
);
...
...
@@ -479,14 +480,15 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
goto
cleanup
;
}
ppdFileName
[
0
]
=
'\0'
;
#ifdef HAVE_CUPS
{
ppd
=
cupsGetPPD
(
name
);
if
(
ppd
)
{
strncpy
(
ppdFileName
,
ppd
,
sizeof
(
ppdFileName
));
needed
=
strlen
(
ppd
)
+
1
;
ppdFileName
=
HeapAlloc
(
PSDRV_Heap
,
0
,
needed
);
memcpy
(
ppdFileName
,
ppd
,
needed
);
ppdType
=
REG_SZ
;
res
=
ERROR_SUCCESS
;
/* we should unlink() that file later */
}
else
{
...
...
@@ -496,33 +498,51 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
}
#endif
if
(
!
ppdFileName
[
0
])
{
res
=
GetPrinterDataA
(
hPrinter
,
"PPD File"
,
NULL
,
ppdFileName
,
sizeof
(
ppdFileName
),
&
needed
);
if
(
!
ppdFileName
)
{
res
=
GetPrinterDataA
(
hPrinter
,
"PPD File"
,
NULL
,
NULL
,
0
,
&
needed
);
if
((
res
==
ERROR_SUCCESS
)
||
(
res
==
ERROR_MORE_DATA
))
{
ppdFileName
=
HeapAlloc
(
PSDRV_Heap
,
0
,
needed
);
res
=
GetPrinterDataA
(
hPrinter
,
"PPD File"
,
&
ppdType
,
ppdFileName
,
needed
,
&
needed
);
}
}
/* Look for a ppd file for this printer in the config file.
* First look
for the names of the printer, then fo
r 'generic'
* First look
under that printer's name, and then unde
r 'generic'
*/
if
((
res
!=
ERROR_SUCCESS
)
&&
!
RegOpenKeyA
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Wine
\\
Wine
\\
Config
\\
ppd"
,
&
hkey
))
{
DWORD
count
=
sizeof
(
ppdFileName
);
ppdFileName
[
0
]
=
0
;
if
(
RegQueryValueExA
(
hkey
,
name
,
0
,
&
type
,
ppdFileName
,
&
count
)
!=
ERROR_SUCCESS
)
RegQueryValueExA
(
hkey
,
"generic"
,
0
,
&
type
,
ppdFileName
,
&
count
);
const
char
*
value_name
;
if
(
RegQueryValueExA
(
hkey
,
name
,
0
,
NULL
,
NULL
,
&
needed
)
==
ERROR_SUCCESS
)
{
value_name
=
name
;
}
else
if
(
RegQueryValueExA
(
hkey
,
"generic"
,
0
,
NULL
,
NULL
,
&
needed
)
==
ERROR_SUCCESS
)
{
value_name
=
"generic"
;
}
else
{
value_name
=
NULL
;
}
if
(
value_name
)
{
ppdFileName
=
HeapAlloc
(
PSDRV_Heap
,
0
,
needed
);
RegQueryValueExA
(
hkey
,
value_name
,
0
,
&
ppdType
,
ppdFileName
,
&
needed
);
}
RegCloseKey
(
hkey
);
}
if
(
!
ppdFileName
[
0
])
if
(
!
ppdFileName
)
{
res
=
ERROR_FILE_NOT_FOUND
;
else
res
=
ERROR_SUCCESS
;
if
(
res
!=
ERROR_SUCCESS
)
{
ERR
(
"Error %li getting PPD file name for printer '%s'
\n
"
,
res
,
name
);
goto
closeprinter
;
}
}
else
{
res
=
ERROR_SUCCESS
;
if
(
ppdType
==
REG_EXPAND_SZ
)
{
char
*
tmp
;
ppdFileName
[
sizeof
(
ppdFileName
)
-
1
]
=
'\0'
;
/* Expand environment variable references */
needed
=
ExpandEnvironmentStringsA
(
ppdFileName
,
NULL
,
0
);
tmp
=
HeapAlloc
(
PSDRV_Heap
,
0
,
needed
);
ExpandEnvironmentStringsA
(
ppdFileName
,
tmp
,
needed
);
HeapFree
(
PSDRV_Heap
,
0
,
ppdFileName
);
ppdFileName
=
tmp
;
}
}
pi
->
ppd
=
PSDRV_ParsePPD
(
ppdFileName
);
if
(
!
pi
->
ppd
)
{
...
...
@@ -601,6 +621,8 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
closeprinter:
ClosePrinter
(
hPrinter
);
cleanup:
if
(
ppdFileName
)
HeapFree
(
PSDRV_Heap
,
0
,
ppdFileName
);
if
(
pi
->
FontSubTable
)
HeapFree
(
PSDRV_Heap
,
0
,
pi
->
FontSubTable
);
if
(
pi
->
FriendlyName
)
...
...
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