From c2aeac3cc07b80d67866e66a6c25e7aadaaa2b09 Mon Sep 17 00:00:00 2001 From: Detlef Riekenberg Date: Sun, 18 Mar 2012 22:14:18 +0100 Subject: [PATCH] comdlg32: Validate more parameters in PrintDlgEx. --- dlls/comdlg32/printdlg.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c index 7ce9148cd1f..b2edda945ff 100644 --- a/dlls/comdlg32/printdlg.c +++ b/dlls/comdlg32/printdlg.c @@ -3785,6 +3785,20 @@ HRESULT WINAPI PrintDlgExA(LPPRINTDLGEXA lppd) if (!IsWindow(lppd->hwndOwner)) return E_HANDLE; + if (lppd->nStartPage != START_PAGE_GENERAL) + { + if (!lppd->nPropertyPages) + return E_INVALIDARG; + + FIXME("custom property sheets (%d at %p) not supported\n", lppd->nPropertyPages, lppd->lphPropertyPages); + } + + /* Use PD_NOPAGENUMS or set nMaxPageRanges and lpPageRanges */ + if (!(lppd->Flags & PD_NOPAGENUMS) && (!lppd->nMaxPageRanges || !lppd->lpPageRanges)) + { + return E_INVALIDARG; + } + if (lppd->Flags & PD_RETURNDEFAULT) { PRINTER_INFO_2A *pbuf; @@ -3909,6 +3923,20 @@ HRESULT WINAPI PrintDlgExW(LPPRINTDLGEXW lppd) return E_HANDLE; } + if (lppd->nStartPage != START_PAGE_GENERAL) + { + if (!lppd->nPropertyPages) + return E_INVALIDARG; + + FIXME("custom property sheets (%d at %p) not supported\n", lppd->nPropertyPages, lppd->lphPropertyPages); + } + + /* Use PD_NOPAGENUMS or set nMaxPageRanges and lpPageRanges */ + if (!(lppd->Flags & PD_NOPAGENUMS) && (!lppd->nMaxPageRanges || !lppd->lpPageRanges)) + { + return E_INVALIDARG; + } + if (lppd->Flags & PD_RETURNDEFAULT) { PRINTER_INFO_2W *pbuf; DRIVER_INFO_2W *dbuf; -- 2.11.4.GIT