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
a675c016
Commit
a675c016
authored
Jul 10, 2008
by
Gal Topper
Committed by
Alexandre Julliard
Jul 17, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comdlg32: PrintDlgEx: Add support for RETURNDEFAULT.
parent
ef397a56
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
2 deletions
+76
-2
printdlg.c
dlls/comdlg32/printdlg.c
+76
-2
No files found.
dlls/comdlg32/printdlg.c
View file @
a675c016
...
...
@@ -3749,13 +3749,16 @@ HRESULT WINAPI PrintDlgExA(LPPRINTDLGEXA lppd)
* driver-specific property pages.
*
* BUGS
*
Only a Stub
*
Not fully implemented
*
*/
HRESULT
WINAPI
PrintDlgExW
(
LPPRINTDLGEXW
lppd
)
{
DWORD
ret
=
E_FAIL
;
LPVOID
ptr
;
FIXME
(
"(%p) not fully implemented
\n
"
,
lppd
);
FIXME
(
"(%p) stub
\n
"
,
lppd
);
if
((
lppd
==
NULL
)
||
(
lppd
->
lStructSize
!=
sizeof
(
PRINTDLGEXW
)))
{
return
E_INVALIDARG
;
}
...
...
@@ -3764,5 +3767,76 @@ HRESULT WINAPI PrintDlgExW(LPPRINTDLGEXW lppd)
return
E_HANDLE
;
}
if
(
lppd
->
Flags
&
PD_RETURNDEFAULT
)
{
PRINTER_INFO_2W
*
pbuf
;
DRIVER_INFO_2W
*
dbuf
;
HANDLE
hprn
;
DWORD
needed
=
1024
;
BOOL
bRet
;
if
(
lppd
->
hDevMode
||
lppd
->
hDevNames
)
{
WARN
(
"hDevMode or hDevNames non-zero for PD_RETURNDEFAULT
\n
"
);
COMDLG32_SetCommDlgExtendedError
(
PDERR_RETDEFFAILURE
);
return
E_INVALIDARG
;
}
if
(
!
PRINTDLG_OpenDefaultPrinter
(
&
hprn
))
{
WARN
(
"Can't find default printer
\n
"
);
COMDLG32_SetCommDlgExtendedError
(
PDERR_NODEFAULTPRN
);
return
E_FAIL
;
}
pbuf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
needed
);
bRet
=
GetPrinterW
(
hprn
,
2
,
(
LPBYTE
)
pbuf
,
needed
,
&
needed
);
if
(
!
bRet
&&
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
))
{
HeapFree
(
GetProcessHeap
(),
0
,
pbuf
);
pbuf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
needed
);
bRet
=
GetPrinterW
(
hprn
,
2
,
(
LPBYTE
)
pbuf
,
needed
,
&
needed
);
}
if
(
!
bRet
)
{
HeapFree
(
GetProcessHeap
(),
0
,
pbuf
);
ClosePrinter
(
hprn
);
return
E_FAIL
;
}
needed
=
1024
;
dbuf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
needed
);
bRet
=
GetPrinterDriverW
(
hprn
,
NULL
,
3
,
(
LPBYTE
)
dbuf
,
needed
,
&
needed
);
if
(
!
bRet
&&
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
))
{
HeapFree
(
GetProcessHeap
(),
0
,
dbuf
);
dbuf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
needed
);
bRet
=
GetPrinterDriverW
(
hprn
,
NULL
,
3
,
(
LPBYTE
)
dbuf
,
needed
,
&
needed
);
}
if
(
!
bRet
)
{
ERR
(
"GetPrinterDriverW failed, last error %d, fix your config for printer %s!
\n
"
,
GetLastError
(),
debugstr_w
(
pbuf
->
pPrinterName
));
HeapFree
(
GetProcessHeap
(),
0
,
dbuf
);
HeapFree
(
GetProcessHeap
(),
0
,
pbuf
);
COMDLG32_SetCommDlgExtendedError
(
PDERR_RETDEFFAILURE
);
ClosePrinter
(
hprn
);
return
E_FAIL
;
}
ClosePrinter
(
hprn
);
PRINTDLG_CreateDevNamesW
(
&
(
lppd
->
hDevNames
),
dbuf
->
pDriverPath
,
pbuf
->
pPrinterName
,
pbuf
->
pPortName
);
lppd
->
hDevMode
=
GlobalAlloc
(
GMEM_MOVEABLE
,
pbuf
->
pDevMode
->
dmSize
+
pbuf
->
pDevMode
->
dmDriverExtra
);
if
(
lppd
->
hDevMode
)
{
ptr
=
GlobalLock
(
lppd
->
hDevMode
);
if
(
ptr
)
{
memcpy
(
ptr
,
pbuf
->
pDevMode
,
pbuf
->
pDevMode
->
dmSize
+
pbuf
->
pDevMode
->
dmDriverExtra
);
GlobalUnlock
(
lppd
->
hDevMode
);
ret
=
S_OK
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
pbuf
);
HeapFree
(
GetProcessHeap
(),
0
,
dbuf
);
return
ret
;
}
return
E_NOTIMPL
;
}
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