Detlef Riekenberg : comdlg32: Validate more parameters in PrintDlgEx.

Alexandre Julliard julliard at winehq.org
Tue Mar 27 12:48:05 CDT 2012


Module: wine
Branch: master
Commit: c2aeac3cc07b80d67866e66a6c25e7aadaaa2b09
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c2aeac3cc07b80d67866e66a6c25e7aadaaa2b09

Author: Detlef Riekenberg <wine.dev at web.de>
Date:   Sun Mar 18 22:14:18 2012 +0100

comdlg32: Validate more parameters in PrintDlgEx.

---

 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..b2edda9 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;




More information about the wine-cvs mailing list