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
d07673ec
Commit
d07673ec
authored
Oct 18, 2010
by
Detlef Riekenberg
Committed by
Alexandre Julliard
Oct 18, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winspool: Use Unicode to add a driver entry for a unix printer.
parent
815c24b3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
30 deletions
+32
-30
info.c
dlls/winspool.drv/info.c
+32
-30
No files found.
dlls/winspool.drv/info.c
View file @
d07673ec
...
...
@@ -167,9 +167,9 @@ static const WCHAR WinNT_CV_PrinterPortsW[] = { 'S','o','f','t','w','a','r','e',
'P'
,
'r'
,
'i'
,
'n'
,
't'
,
'e'
,
'r'
,
'P'
,
'o'
,
'r'
,
't'
,
's'
,
0
};
static
const
WCHAR
DefaultEnvironmentW
[]
=
{
'W'
,
'i'
,
'n'
,
'e'
,
0
};
static
const
WCHAR
envname_win40W
[]
=
{
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
' '
,
'4'
,
'.'
,
'0'
,
0
};
static
WCHAR
envname_win40W
[]
=
{
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
' '
,
'4'
,
'.'
,
'0'
,
0
};
static
const
WCHAR
envname_x64W
[]
=
{
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
' '
,
'x'
,
'6'
,
'4'
,
0
};
static
const
WCHAR
envname_x86W
[]
=
{
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
' '
,
'N'
,
'T'
,
' '
,
'x'
,
'8'
,
'6'
,
0
};
static
WCHAR
envname_x86W
[]
=
{
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
' '
,
'N'
,
'T'
,
' '
,
'x'
,
'8'
,
'6'
,
0
};
static
const
WCHAR
subdir_win40W
[]
=
{
'w'
,
'i'
,
'n'
,
'4'
,
'0'
,
0
};
static
const
WCHAR
subdir_x64W
[]
=
{
'x'
,
'6'
,
'4'
,
0
};
static
const
WCHAR
subdir_x86W
[]
=
{
'w'
,
'3'
,
'2'
,
'x'
,
'8'
,
'6'
,
0
};
...
...
@@ -212,7 +212,10 @@ static const WCHAR WinPrintW[] = {'W','i','n','P','r','i','n','t',0};
static
const
WCHAR
deviceW
[]
=
{
'd'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
0
};
static
const
WCHAR
devicesW
[]
=
{
'd'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
's'
,
0
};
static
const
WCHAR
windowsW
[]
=
{
'w'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
0
};
static
const
WCHAR
driver_nt
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
'p'
,
's'
,
'.'
,
'd'
,
'r'
,
'v'
,
0
};
static
WCHAR
generic_ppdW
[]
=
{
'g'
,
'e'
,
'n'
,
'e'
,
'r'
,
'i'
,
'c'
,
'.'
,
'p'
,
'p'
,
'd'
,
0
};
static
WCHAR
rawW
[]
=
{
'R'
,
'A'
,
'W'
,
0
};
static
WCHAR
driver_9x
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
'p'
,
's'
,
'1'
,
'6'
,
'.'
,
'd'
,
'r'
,
'v'
,
0
};
static
WCHAR
driver_nt
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
'p'
,
's'
,
'.'
,
'd'
,
'r'
,
'v'
,
0
};
static
const
WCHAR
timeout_15_45
[]
=
{
','
,
'1'
,
'5'
,
','
,
'4'
,
'5'
,
0
};
static
const
WCHAR
commaW
[]
=
{
','
,
0
};
static
const
WCHAR
emptyStringW
[]
=
{
0
};
...
...
@@ -380,41 +383,33 @@ WINSPOOL_SetDefaultPrinter(const char *devname, const char *name, BOOL force) {
}
}
static
BOOL
add_printer_driver
(
const
char
*
name
)
static
BOOL
add_printer_driver
(
WCHAR
*
name
)
{
DRIVER_INFO_3
A
di3a
;
DRIVER_INFO_3
W
di3
;
static
char
driver_9x
[]
=
"wineps16.drv"
,
driver_nt
[]
=
"wineps.drv"
,
env_9x
[]
=
"Windows 4.0"
,
env_nt
[]
=
"Windows NT x86"
,
data_file
[]
=
"generic.ppd"
,
default_data_type
[]
=
"RAW"
;
ZeroMemory
(
&
di3
,
sizeof
(
DRIVER_INFO_3W
));
di3
.
cVersion
=
3
;
di3
.
pName
=
name
;
di3
.
pEnvironment
=
envname_x86W
;
di3
.
pDriverPath
=
driver_nt
;
di3
.
pDataFile
=
generic_ppdW
;
di3
.
pConfigFile
=
driver_nt
;
di3
.
pDefaultDataType
=
rawW
;
ZeroMemory
(
&
di3a
,
sizeof
(
DRIVER_INFO_3A
));
di3a
.
cVersion
=
3
;
di3a
.
pName
=
(
char
*
)
name
;
di3a
.
pEnvironment
=
env_nt
;
di3a
.
pDriverPath
=
driver_nt
;
di3a
.
pDataFile
=
data_file
;
di3a
.
pConfigFile
=
driver_nt
;
di3a
.
pDefaultDataType
=
default_data_type
;
if
(
AddPrinterDriverA
(
NULL
,
3
,
(
LPBYTE
)
&
di3a
)
||
if
(
AddPrinterDriverW
(
NULL
,
3
,
(
LPBYTE
)
&
di3
)
||
(
GetLastError
()
==
ERROR_PRINTER_DRIVER_ALREADY_INSTALLED
))
{
di3
a
.
cVersion
=
0
;
di3
a
.
pEnvironment
=
env_9x
;
di3
a
.
pDriverPath
=
driver_9x
;
di3
a
.
pConfigFile
=
driver_9x
;
if
(
AddPrinterDriver
A
(
NULL
,
3
,
(
LPBYTE
)
&
di3a
)
||
di3
.
cVersion
=
0
;
di3
.
pEnvironment
=
envname_win40W
;
di3
.
pDriverPath
=
driver_9x
;
di3
.
pConfigFile
=
driver_9x
;
if
(
AddPrinterDriver
W
(
NULL
,
3
,
(
LPBYTE
)
&
di3
)
||
(
GetLastError
()
==
ERROR_PRINTER_DRIVER_ALREADY_INSTALLED
))
{
return
TRUE
;
}
}
ERR
(
"Failed adding driver %s (%s): %u
\n
"
,
debugstr_a
(
di3a
.
pDriverPath
),
debugstr_a
(
di3a
.
pEnvironment
),
GetLastError
());
ERR
(
"failed with %u for %s (%s)
\n
"
,
GetLastError
(),
debugstr_w
(
di3
.
pDriverPath
),
debugstr_w
(
di3
.
pEnvironment
));
return
FALSE
;
}
...
...
@@ -434,6 +429,7 @@ static BOOL CUPS_LoadPrinters(void)
char
*
port
;
HKEY
hkeyPrinter
,
hkeyPrinters
;
char
loaderror
[
256
];
WCHAR
nameW
[
MAX_PATH
];
cupshandle
=
wine_dlopen
(
SONAME_LIBCUPS
,
RTLD_NOW
,
loaderror
,
sizeof
(
loaderror
));
if
(
!
cupshandle
)
{
...
...
@@ -461,6 +457,8 @@ static BOOL CUPS_LoadPrinters(void)
nrofdests
=
pcupsGetDests
(
&
dests
);
TRACE
(
"Found %d CUPS %s:
\n
"
,
nrofdests
,
(
nrofdests
==
1
)
?
"printer"
:
"printers"
);
for
(
i
=
0
;
i
<
nrofdests
;
i
++
)
{
MultiByteToWideChar
(
CP_ACP
,
0
,
dests
[
i
].
name
,
-
1
,
nameW
,
sizeof
(
nameW
)
/
sizeof
(
WCHAR
));
port
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
"CUPS:"
)
+
strlen
(
dests
[
i
].
name
)
+
1
);
sprintf
(
port
,
"CUPS:%s"
,
dests
[
i
].
name
);
...
...
@@ -481,7 +479,7 @@ static BOOL CUPS_LoadPrinters(void)
share_name
[]
=
"<share name?>"
,
sep_file
[]
=
"<sep file?>"
;
add_printer_driver
(
dests
[
i
].
name
);
add_printer_driver
(
nameW
);
memset
(
&
pinfo2a
,
0
,
sizeof
(
pinfo2a
));
pinfo2a
.
pPrinterName
=
dests
[
i
].
name
;
...
...
@@ -523,6 +521,7 @@ PRINTCAP_ParseEntry(const char *pent, BOOL isfirst) {
BOOL
ret
=
FALSE
,
set_default
=
FALSE
;
char
*
port
=
NULL
,
*
env_default
;
HKEY
hkeyPrinter
,
hkeyPrinters
;
WCHAR
devnameW
[
MAX_PATH
];
while
(
isspace
(
*
pent
))
pent
++
;
s
=
strchr
(
pent
,
':'
);
...
...
@@ -586,6 +585,9 @@ PRINTCAP_ParseEntry(const char *pent, BOOL isfirst) {
ret
=
FALSE
;
goto
end
;
}
MultiByteToWideChar
(
CP_ACP
,
0
,
devname
,
-
1
,
devnameW
,
sizeof
(
devnameW
)
/
sizeof
(
WCHAR
));
if
(
RegOpenKeyA
(
hkeyPrinters
,
devname
,
&
hkeyPrinter
)
==
ERROR_SUCCESS
)
{
/* Printer already in registry, delete the tag added in WINSPOOL_LoadSystemPrinters
and continue */
...
...
@@ -600,7 +602,7 @@ PRINTCAP_ParseEntry(const char *pent, BOOL isfirst) {
share_name
[]
=
"<share name?>"
,
sep_file
[]
=
"<sep file?>"
;
add_printer_driver
(
devname
);
add_printer_driver
(
devname
W
);
memset
(
&
pinfo2a
,
0
,
sizeof
(
pinfo2a
));
pinfo2a
.
pPrinterName
=
devname
;
...
...
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