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
e61f2729
Commit
e61f2729
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 for CUPS printer names.
parent
d07673ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
34 deletions
+33
-34
info.c
dlls/winspool.drv/info.c
+33
-34
No files found.
dlls/winspool.drv/info.c
View file @
e61f2729
...
...
@@ -208,7 +208,7 @@ static const WCHAR ProviderW[] = {'P','r','o','v','i','d','e','r',0};
static
const
WCHAR
Separator_FileW
[]
=
{
'S'
,
'e'
,
'p'
,
'a'
,
'r'
,
'a'
,
't'
,
'o'
,
'r'
,
' '
,
'F'
,
'i'
,
'l'
,
'e'
,
0
};
static
const
WCHAR
Share_NameW
[]
=
{
'S'
,
'h'
,
'a'
,
'r'
,
'e'
,
' '
,
'N'
,
'a'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
VersionW
[]
=
{
'V'
,
'e'
,
'r'
,
's'
,
'i'
,
'o'
,
'n'
,
0
};
static
const
WCHAR
WinPrintW
[]
=
{
'W'
,
'i'
,
'n'
,
'P'
,
'r'
,
'i'
,
'n'
,
't'
,
0
};
static
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
};
...
...
@@ -218,7 +218,7 @@ static WCHAR driver_9x[] = {'w','i','n','e','p','s','1','6','.','d','r','v
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
};
static
WCHAR
emptyStringW
[]
=
{
0
};
static
const
WCHAR
May_Delete_Value
[]
=
{
'W'
,
'i'
,
'n'
,
'e'
,
'M'
,
'a'
,
'y'
,
'D'
,
'e'
,
'l'
,
'e'
,
't'
,
'e'
,
'M'
,
'e'
,
0
};
...
...
@@ -425,8 +425,8 @@ static BOOL CUPS_LoadPrinters(void)
int
i
,
nrofdests
;
BOOL
hadprinter
=
FALSE
,
haddefault
=
FALSE
;
cups_dest_t
*
dests
;
PRINTER_INFO_2
A
pinfo2a
;
char
*
port
;
PRINTER_INFO_2
W
pi2
;
WCHAR
*
port
;
HKEY
hkeyPrinter
,
hkeyPrinters
;
char
loaderror
[
256
];
WCHAR
nameW
[
MAX_PATH
];
...
...
@@ -457,57 +457,56 @@ 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_
A
CP
,
0
,
dests
[
i
].
name
,
-
1
,
nameW
,
sizeof
(
nameW
)
/
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_
UNIX
CP
,
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
);
port
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
CUPS_Port
)
+
lstrlenW
(
nameW
)
*
sizeof
(
WCHAR
));
lstrcpyW
(
port
,
CUPS_Port
);
lstrcatW
(
port
,
nameW
);
TRACE
(
"Printer %d: %s
\n
"
,
i
,
de
sts
[
i
].
name
);
if
(
RegOpenKey
A
(
hkeyPrinters
,
dests
[
i
].
name
,
&
hkeyPrinter
)
==
ERROR_SUCCESS
)
{
TRACE
(
"Printer %d: %s
\n
"
,
i
,
de
bugstr_w
(
nameW
)
);
if
(
RegOpenKey
W
(
hkeyPrinters
,
nameW
,
&
hkeyPrinter
)
==
ERROR_SUCCESS
)
{
/* Printer already in registry, delete the tag added in WINSPOOL_LoadSystemPrinters
and continue */
TRACE
(
"Printer already exists
\n
"
);
RegSetValueExA
(
hkeyPrinter
,
"Port"
,
0
,
REG_SZ
,
(
LPBYTE
)
port
,
strlen
(
port
)
+
1
);
/* overwrite LPR:* port */
/* overwrite old LPR:* port */
RegSetValueExW
(
hkeyPrinter
,
PortW
,
0
,
REG_SZ
,
(
LPBYTE
)
port
,
(
lstrlenW
(
port
)
+
1
)
*
sizeof
(
WCHAR
));
RegDeleteValueW
(
hkeyPrinter
,
May_Delete_Value
);
RegCloseKey
(
hkeyPrinter
);
}
else
{
static
CHAR
data_type
[]
=
"RAW"
,
print_proc
[]
=
"WinPrint"
,
comment
[]
=
"WINEPS Printer using CUPS"
,
location
[]
=
"<physical location of printer>"
,
params
[]
=
"<parameters?>"
,
share_name
[]
=
"<share name?>"
,
sep_file
[]
=
"<sep file?>"
;
static
WCHAR
comment_cups
[]
=
{
'W'
,
'I'
,
'N'
,
'E'
,
'P'
,
'S'
,
' '
,
'P'
,
'r'
,
'i'
,
'n'
,
't'
,
'e'
,
'r'
,
' '
,
'u'
,
's'
,
'i'
,
'n'
,
'g'
,
' '
,
'C'
,
'U'
,
'P'
,
'S'
,
0
};
add_printer_driver
(
nameW
);
memset
(
&
pi
nfo2a
,
0
,
sizeof
(
pinfo2a
));
pi
nfo2a
.
pPrinterName
=
dests
[
i
].
name
;
pi
nfo2a
.
pDatatype
=
data_type
;
pi
nfo2a
.
pPrintProcessor
=
print_proc
;
pi
nfo2a
.
pDriverName
=
dests
[
i
].
name
;
pi
nfo2a
.
pComment
=
comment
;
pi
nfo2a
.
pLocation
=
location
;
pi
nfo2a
.
pPortName
=
port
;
pi
nfo2a
.
pParameters
=
params
;
pi
nfo2a
.
pShareName
=
share_name
;
pi
nfo2a
.
pSepFile
=
sep_file
;
if
(
!
AddPrinter
A
(
NULL
,
2
,(
LPBYTE
)
&
pinfo2a
))
{
memset
(
&
pi
2
,
0
,
sizeof
(
PRINTER_INFO_2W
));
pi
2
.
pPrinterName
=
nameW
;
pi
2
.
pDatatype
=
rawW
;
pi
2
.
pPrintProcessor
=
WinPrintW
;
pi
2
.
pDriverName
=
nameW
;
pi
2
.
pComment
=
comment_cups
;
pi
2
.
pLocation
=
emptyStringW
;
pi
2
.
pPortName
=
port
;
pi
2
.
pParameters
=
emptyStringW
;
pi
2
.
pShareName
=
emptyStringW
;
pi
2
.
pSepFile
=
emptyStringW
;
if
(
!
AddPrinter
W
(
NULL
,
2
,
(
LPBYTE
)
&
pi2
))
{
if
(
GetLastError
()
!=
ERROR_PRINTER_ALREADY_EXISTS
)
ERR
(
"printer '%s' not added by AddPrinter
A (error %d)
\n
"
,
dests
[
i
].
name
,
GetLastError
());
ERR
(
"printer '%s' not added by AddPrinter
(error %d)
\n
"
,
debugstr_w
(
nameW
),
GetLastError
());
}
}
HeapFree
(
GetProcessHeap
(),
0
,
port
);
hadprinter
=
TRUE
;
if
(
dests
[
i
].
is_default
)
{
SetDefaultPrinter
A
(
dests
[
i
].
name
);
SetDefaultPrinter
W
(
nameW
);
haddefault
=
TRUE
;
}
}
if
(
hadprinter
&
!
haddefault
)
SetDefaultPrinterA
(
dests
[
0
].
name
);
if
(
hadprinter
&
!
haddefault
)
{
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
dests
[
0
].
name
,
-
1
,
nameW
,
sizeof
(
nameW
)
/
sizeof
(
WCHAR
));
SetDefaultPrinterW
(
nameW
);
}
pcupsFreeDests
(
nrofdests
,
dests
);
RegCloseKey
(
hkeyPrinters
);
return
hadprinter
;
...
...
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