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
b806e130
Commit
b806e130
authored
Dec 23, 2009
by
Jeremy White
Committed by
Alexandre Julliard
Dec 24, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winspool: Correctly zero printer driver buffer on failure, with tests.
parent
09401dd4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
info.c
dlls/winspool.drv/info.c
+6
-1
info.c
dlls/winspool.drv/tests/info.c
+8
-0
No files found.
dlls/winspool.drv/info.c
View file @
b806e130
...
...
@@ -4388,6 +4388,8 @@ BOOL WINAPI GetPrinterDriverW(HANDLE hPrinter, LPWSTR pEnvironment,
TRACE
(
"(%p,%s,%d,%p,%d,%p)
\n
"
,
hPrinter
,
debugstr_w
(
pEnvironment
),
Level
,
pDriverInfo
,
cbBuf
,
pcbNeeded
);
if
(
cbBuf
>
0
)
ZeroMemory
(
pDriverInfo
,
cbBuf
);
if
(
!
(
name
=
get_opened_printer_name
(
hPrinter
)))
{
SetLastError
(
ERROR_INVALID_HANDLE
);
...
...
@@ -4465,8 +4467,11 @@ BOOL WINAPI GetPrinterDriverA(HANDLE hPrinter, LPSTR pEnvironment,
LPBYTE
buf
=
NULL
;
if
(
cbBuf
)
{
ZeroMemory
(
pDriverInfo
,
cbBuf
);
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
cbBuf
);
}
pwstrEnvW
=
asciitounicode
(
&
pEnvW
,
pEnvironment
);
ret
=
GetPrinterDriverW
(
hPrinter
,
pwstrEnvW
,
Level
,
buf
,
cbBuf
,
pcbNeeded
);
...
...
dlls/winspool.drv/tests/info.c
View file @
b806e130
...
...
@@ -2414,6 +2414,14 @@ static void test_GetPrinterDriver(void)
/* XP allocates memory for both ANSI and unicode names */
ok
(
filled
>=
calculated
,
"calculated %d != filled %d
\n
"
,
calculated
,
filled
);
/* Obscure test - demonstrate that Windows zero fills the buffer, even on failure */
if
(
di_2
->
pDataFile
)
{
ret
=
GetPrinterDriver
(
hprn
,
NULL
,
level
,
buf
,
needed
-
2
,
&
filled
);
ok
(
!
ret
,
"level %d: GetPrinterDriver succeeded with less buffer than it should
\n
"
,
level
);
ok
(
di_2
->
pDataFile
==
NULL
,
"Even on failure, GetPrinterDriver clears the buffer to zeros
\n
"
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
...
...
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