[PATCH 2/8] comdlg32: Validate more Parameter in PrintDlgEx

Detlef Riekenberg wine.dev at web.de
Sun Mar 18 16:14:18 CDT 2012


--
By by ... Detlef
---
 dlls/comdlg32/printdlg.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c
index 7ce9148..66be1cf 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;
-- 
1.7.5.4




More information about the wine-patches mailing list