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
24215194
Commit
24215194
authored
Apr 05, 2012
by
Huw Davies
Committed by
Alexandre Julliard
Apr 05, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winspool: Generalise the A to W printer info conversion to cope with other levels.
parent
ebeff88e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
43 deletions
+94
-43
info.c
dlls/winspool.drv/info.c
+94
-43
No files found.
dlls/winspool.drv/info.c
View file @
24215194
...
...
@@ -1585,54 +1585,105 @@ static void convert_driverinfo_W_to_A(LPBYTE out, LPBYTE pDriversW,
/***********************************************************
* PRINTER_INFO_2AtoW
* Creates a unicode copy of PRINTER_INFO_2A on heap
* printer_info_AtoW
*/
static
LPPRINTER_INFO_2W
PRINTER_INFO_2AtoW
(
HANDLE
heap
,
LPPRINTER_INFO_2A
piA
)
static
void
*
printer_info_AtoW
(
const
void
*
data
,
DWORD
level
)
{
LPPRINTER_INFO_2W
piW
;
void
*
ret
;
UNICODE_STRING
usBuffer
;
if
(
!
piA
)
return
NULL
;
piW
=
HeapAlloc
(
heap
,
0
,
sizeof
(
*
piW
));
memcpy
(
piW
,
piA
,
sizeof
(
*
piW
));
/* copy everything first */
piW
->
pServerName
=
asciitounicode
(
&
usBuffer
,
piA
->
pServerName
);
piW
->
pPrinterName
=
asciitounicode
(
&
usBuffer
,
piA
->
pPrinterName
);
piW
->
pShareName
=
asciitounicode
(
&
usBuffer
,
piA
->
pShareName
);
piW
->
pPortName
=
asciitounicode
(
&
usBuffer
,
piA
->
pPortName
);
piW
->
pDriverName
=
asciitounicode
(
&
usBuffer
,
piA
->
pDriverName
);
piW
->
pComment
=
asciitounicode
(
&
usBuffer
,
piA
->
pComment
);
piW
->
pLocation
=
asciitounicode
(
&
usBuffer
,
piA
->
pLocation
);
piW
->
pDevMode
=
piA
->
pDevMode
?
GdiConvertToDevmodeW
(
piA
->
pDevMode
)
:
NULL
;
piW
->
pSepFile
=
asciitounicode
(
&
usBuffer
,
piA
->
pSepFile
);
piW
->
pPrintProcessor
=
asciitounicode
(
&
usBuffer
,
piA
->
pPrintProcessor
);
piW
->
pDatatype
=
asciitounicode
(
&
usBuffer
,
piA
->
pDatatype
);
piW
->
pParameters
=
asciitounicode
(
&
usBuffer
,
piA
->
pParameters
);
return
piW
;
if
(
!
data
)
return
NULL
;
if
(
level
<
1
||
level
>
9
)
return
NULL
;
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
pi_sizeof
[
level
]
);
if
(
!
ret
)
return
NULL
;
memcpy
(
ret
,
data
,
pi_sizeof
[
level
]
);
/* copy everything first */
switch
(
level
)
{
case
2
:
{
const
PRINTER_INFO_2A
*
piA
=
(
const
PRINTER_INFO_2A
*
)
data
;
PRINTER_INFO_2W
*
piW
=
(
PRINTER_INFO_2W
*
)
ret
;
piW
->
pServerName
=
asciitounicode
(
&
usBuffer
,
piA
->
pServerName
);
piW
->
pPrinterName
=
asciitounicode
(
&
usBuffer
,
piA
->
pPrinterName
);
piW
->
pShareName
=
asciitounicode
(
&
usBuffer
,
piA
->
pShareName
);
piW
->
pPortName
=
asciitounicode
(
&
usBuffer
,
piA
->
pPortName
);
piW
->
pDriverName
=
asciitounicode
(
&
usBuffer
,
piA
->
pDriverName
);
piW
->
pComment
=
asciitounicode
(
&
usBuffer
,
piA
->
pComment
);
piW
->
pLocation
=
asciitounicode
(
&
usBuffer
,
piA
->
pLocation
);
piW
->
pDevMode
=
piA
->
pDevMode
?
GdiConvertToDevmodeW
(
piA
->
pDevMode
)
:
NULL
;
piW
->
pSepFile
=
asciitounicode
(
&
usBuffer
,
piA
->
pSepFile
);
piW
->
pPrintProcessor
=
asciitounicode
(
&
usBuffer
,
piA
->
pPrintProcessor
);
piW
->
pDatatype
=
asciitounicode
(
&
usBuffer
,
piA
->
pDatatype
);
piW
->
pParameters
=
asciitounicode
(
&
usBuffer
,
piA
->
pParameters
);
break
;
}
case
8
:
case
9
:
{
const
PRINTER_INFO_9A
*
piA
=
(
const
PRINTER_INFO_9A
*
)
data
;
PRINTER_INFO_9W
*
piW
=
(
PRINTER_INFO_9W
*
)
ret
;
piW
->
pDevMode
=
piA
->
pDevMode
?
GdiConvertToDevmodeW
(
piA
->
pDevMode
)
:
NULL
;
break
;
}
default:
FIXME
(
"Unhandled level %d
\n
"
,
level
);
HeapFree
(
GetProcessHeap
(),
0
,
ret
);
return
NULL
;
}
return
ret
;
}
/***********************************************************
* FREE_PRINTER_INFO_2W
* Free PRINTER_INFO_2W and all strings
*/
static
void
FREE_PRINTER_INFO_2W
(
HANDLE
heap
,
LPPRINTER_INFO_2W
piW
)
{
if
(
!
piW
)
return
;
HeapFree
(
heap
,
0
,
piW
->
pServerName
);
HeapFree
(
heap
,
0
,
piW
->
pPrinterName
);
HeapFree
(
heap
,
0
,
piW
->
pShareName
);
HeapFree
(
heap
,
0
,
piW
->
pPortName
);
HeapFree
(
heap
,
0
,
piW
->
pDriverName
);
HeapFree
(
heap
,
0
,
piW
->
pComment
);
HeapFree
(
heap
,
0
,
piW
->
pLocation
);
HeapFree
(
heap
,
0
,
piW
->
pDevMode
);
HeapFree
(
heap
,
0
,
piW
->
pSepFile
);
HeapFree
(
heap
,
0
,
piW
->
pPrintProcessor
);
HeapFree
(
heap
,
0
,
piW
->
pDatatype
);
HeapFree
(
heap
,
0
,
piW
->
pParameters
);
HeapFree
(
heap
,
0
,
piW
);
* free_printer_info
*/
static
void
free_printer_info
(
void
*
data
,
DWORD
level
)
{
if
(
!
data
)
return
;
switch
(
level
)
{
case
2
:
{
PRINTER_INFO_2W
*
piW
=
(
PRINTER_INFO_2W
*
)
data
;
HeapFree
(
GetProcessHeap
(),
0
,
piW
->
pServerName
);
HeapFree
(
GetProcessHeap
(),
0
,
piW
->
pPrinterName
);
HeapFree
(
GetProcessHeap
(),
0
,
piW
->
pShareName
);
HeapFree
(
GetProcessHeap
(),
0
,
piW
->
pPortName
);
HeapFree
(
GetProcessHeap
(),
0
,
piW
->
pDriverName
);
HeapFree
(
GetProcessHeap
(),
0
,
piW
->
pComment
);
HeapFree
(
GetProcessHeap
(),
0
,
piW
->
pLocation
);
HeapFree
(
GetProcessHeap
(),
0
,
piW
->
pDevMode
);
HeapFree
(
GetProcessHeap
(),
0
,
piW
->
pSepFile
);
HeapFree
(
GetProcessHeap
(),
0
,
piW
->
pPrintProcessor
);
HeapFree
(
GetProcessHeap
(),
0
,
piW
->
pDatatype
);
HeapFree
(
GetProcessHeap
(),
0
,
piW
->
pParameters
);
break
;
}
case
8
:
case
9
:
{
PRINTER_INFO_9W
*
piW
=
(
PRINTER_INFO_9W
*
)
data
;
HeapFree
(
GetProcessHeap
(),
0
,
piW
->
pDevMode
);
break
;
}
default:
FIXME
(
"Unhandled level %d
\n
"
,
level
);
}
HeapFree
(
GetProcessHeap
(),
0
,
data
);
return
;
}
...
...
@@ -2679,11 +2730,11 @@ HANDLE WINAPI AddPrinterA(LPSTR pName, DWORD Level, LPBYTE pPrinter)
return
0
;
}
pwstrNameW
=
asciitounicode
(
&
pNameW
,
pName
);
piW
=
PRINTER_INFO_2AtoW
(
GetProcessHeap
(),
piA
);
piW
=
printer_info_AtoW
(
piA
,
Level
);
ret
=
AddPrinterW
(
pwstrNameW
,
Level
,
(
LPBYTE
)
piW
);
FREE_PRINTER_INFO_2W
(
GetProcessHeap
(),
piW
);
free_printer_info
(
piW
,
Level
);
RtlFreeUnicodeString
(
&
pNameW
);
return
ret
;
}
...
...
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