setupapi: check if the file exists when requested

Ricardo Filipe ricardojdfilipe at gmail.com
Mon Aug 17 14:45:53 CDT 2009


this patch implements the IDF_CHECKFIRST DiskPromptStyle for
SetupPromptForDisk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20090817/6f956859/attachment.htm>
-------------- next part --------------
From 69965d08bda112026ba4364259bc0cf5e4bd0ee8 Mon Sep 17 00:00:00 2001
From: Ricardo Filipe <ricardojdfilipe at gmail.com>
Date: Mon, 17 Aug 2009 12:41:33 -0700
Subject: setupapi: check if the file exists when requested

---
 dlls/setupapi/dialog.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/dlls/setupapi/dialog.c b/dlls/setupapi/dialog.c
index 948fa74..3d3be73 100644
--- a/dlls/setupapi/dialog.c
+++ b/dlls/setupapi/dialog.c
@@ -30,6 +30,7 @@
 #include "setupapi.h"
 #include "winnls.h"
 #include "setupapi_private.h"
+#include "shlwapi.h"
 
 #include "wine/unicode.h"
 
@@ -246,6 +247,19 @@ UINT WINAPI SetupPromptForDiskW(HWND hwndParent, PCWSTR DialogTitle, PCWSTR Disk
         SetLastError(ERROR_INVALID_PARAMETER);
         return DPROMPT_CANCEL;
     }
+    if(DiskPromptStyle & IDF_CHECKFIRST && PathToSource)
+    {
+        WCHAR full_path[MAX_PATH];
+	static const WCHAR backslash[] = {'\\',0};
+
+        strcpyW(full_path, PathToSource);
+        strcatW(full_path, backslash);
+        strcatW(full_path, FileSought);
+
+        if(PathFileExistsW(full_path))
+            return DPROMPT_SUCCESS;
+    }
+
     params.DialogTitle = DialogTitle;
     params.DiskName = DiskName;
     params.PathToSource = PathToSource;
-- 
1.6.0.4


More information about the wine-patches mailing list