Ricardo Filipe : setupapi: Implement SetupPromptForDiskW with only Cancel button active.

Alexandre Julliard julliard at winehq.org
Mon Feb 23 10:00:39 CST 2009


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

Author: Ricardo Filipe <ricardo_barbano at hotmail.com>
Date:   Wed Feb 18 08:44:15 2009 +0000

setupapi: Implement SetupPromptForDiskW with only Cancel button active.

---

 dlls/setupapi/En.rc              |   23 ++++++++
 dlls/setupapi/Makefile.in        |    3 +-
 dlls/setupapi/dialog.c           |  103 ++++++++++++++++++++++++++++++++++++++
 dlls/setupapi/setupapi_private.h |   11 ++++
 dlls/setupapi/stubs.c            |   14 -----
 5 files changed, 139 insertions(+), 15 deletions(-)

diff --git a/dlls/setupapi/En.rc b/dlls/setupapi/En.rc
index 5d45feb..84619f6 100644
--- a/dlls/setupapi/En.rc
+++ b/dlls/setupapi/En.rc
@@ -2,6 +2,7 @@
  * English resources for SETUPAPI
  *
  * Copyright 2001 Andreas Mohr
+ * Copyright 2009 Ricardo Filipe
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -20,6 +21,14 @@
 
 LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
 
+STRINGTABLE DISCARDABLE
+{
+        IDS_PROMPTDISK   "The file '%s' on %s is needed"
+        IDS_UNKNOWN      "Unknown"
+        IDS_COPYFROM     "Copy files from:"
+        IDS_INFO         "Type the path where the file is located, and then click OK."
+}
+
 COPYFILEDLGORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 20, 20, 208, 105
 STYLE DS_MODALFRAME | DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION
 CAPTION "Copying Files..."
@@ -32,3 +41,17 @@ BEGIN
 	LTEXT "", DESTSTRORD, 7, 41, 194, 22, WS_CHILD | WS_VISIBLE | WS_GROUP
 	CONTROL "", PROGRESSORD, "setupx_progress", 7, 63, 194, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP
 END
+
+IDPROMPTFORDISK DIALOG MOVEABLE DISCARDABLE 0, 0, 250, 120
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION "Files Needed"
+FONT 8, "MS Shell Dlg"
+BEGIN
+	LTEXT "Insert the manufacturer's installation disk, and then\nmake sure the correct drive is selected below", IDC_FILENEEDED, 10, 10, 175, 22, WS_CHILD | WS_VISIBLE | WS_GROUP
+	LTEXT "", IDC_INFO, 10, 50, 175, 22, WS_CHILD | WS_VISIBLE | WS_GROUP
+	LTEXT "Copy manufacturer's files from:", IDC_COPYFROM, 10, 90, 175, 11, WS_CHILD | WS_VISIBLE | WS_GROUP
+	CONTROL "", IDC_PATH, "COMBOBOX", WS_TABSTOP | WS_GROUP | WS_VSCROLL | WS_VISIBLE | CBS_DISABLENOSCROLL | CBS_AUTOHSCROLL | CBS_DROPDOWN, 10, 100, 175, 14
+	PUSHBUTTON "OK", IDOK, 195, 10, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+	PUSHBUTTON "Cancel", IDCANCEL, 195, 30, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+	PUSHBUTTON "Browse...", IDC_RUNDLG_BROWSE, 195, 100, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+END
diff --git a/dlls/setupapi/Makefile.in b/dlls/setupapi/Makefile.in
index e6d3e80..700fce3 100644
--- a/dlls/setupapi/Makefile.in
+++ b/dlls/setupapi/Makefile.in
@@ -6,10 +6,11 @@ VPATH     = @srcdir@
 MODULE    = setupapi.dll
 IMPORTLIB = setupapi
 IMPORTS   = uuid user32 version advapi32 rpcrt4 kernel32 ntdll
-DELAYIMPORTS = shell32 wintrust ole32 winspool
+DELAYIMPORTS = shell32 wintrust ole32 winspool comdlg32
 
 C_SRCS = \
 	devinst.c \
+	dialog.c \
 	dirid.c \
 	diskspace.c \
 	fakedll.c \
diff --git a/dlls/setupapi/dialog.c b/dlls/setupapi/dialog.c
new file mode 100644
index 0000000..b2bca9f
--- /dev/null
+++ b/dlls/setupapi/dialog.c
@@ -0,0 +1,103 @@
+/*
+ * SetupAPI dialog functions
+ *
+ * Copyright 2009 Ricardo Filipe
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+
+#include "wine/debug.h"
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "winreg.h"
+#include "commdlg.h"
+#include "setupapi.h"
+#include "winnls.h"
+#include "setupapi_private.h"
+
+#include "wine/unicode.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
+
+struct promptdisk_params {
+    PCWSTR DialogTitle;
+    PCWSTR DiskName;
+    PCWSTR PathToSource;
+    PCWSTR FileSought;
+    PCWSTR TagFile;
+    DWORD DiskPromptStyle;
+    PWSTR PathBuffer;
+    DWORD PathBufferSize;
+    PDWORD PathRequiredSize;
+};
+
+/* Handles the messages sent to the SetupPromptForDisk dialog
+*/
+static INT_PTR CALLBACK promptdisk_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+    switch(msg)
+    {
+        case WM_COMMAND:
+            switch(wParam)
+            {
+                case IDCANCEL:
+                    EndDialog(hwnd, DPROMPT_CANCEL);
+                    return TRUE;
+            }
+    }
+    return FALSE;
+}
+
+/***********************************************************************
+ *      SetupPromptForDiskW (SETUPAPI.@)
+ */
+UINT WINAPI SetupPromptForDiskW(HWND hwndParent, PCWSTR DialogTitle, PCWSTR DiskName,
+        PCWSTR PathToSource, PCWSTR FileSought, PCWSTR TagFile, DWORD DiskPromptStyle,
+        PWSTR PathBuffer, DWORD PathBufferSize, PDWORD PathRequiredSize)
+{
+    struct promptdisk_params params;
+    UINT ret;
+
+    TRACE("%p, %s, %s, %s, %s, %s, 0x%08x, %p, %d, %p\n", hwndParent, debugstr_w(DialogTitle),
+          debugstr_w(DiskName), debugstr_w(PathToSource), debugstr_w(FileSought),
+          debugstr_w(TagFile), DiskPromptStyle, PathBuffer, PathBufferSize,
+          PathRequiredSize);
+
+    if(!FileSought)
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return DPROMPT_CANCEL;
+    }
+    params.DialogTitle = DialogTitle;
+    params.DiskName = DiskName;
+    params.PathToSource = PathToSource;
+    params.FileSought = FileSought;
+    params.TagFile = TagFile;
+    params.DiskPromptStyle = DiskPromptStyle;
+    params.PathBuffer = PathBuffer;
+    params.PathBufferSize = PathBufferSize;
+    params.PathRequiredSize = PathRequiredSize;
+
+    ret = DialogBoxParamW(SETUPAPI_hInstance, MAKEINTRESOURCEW(IDPROMPTFORDISK),
+        hwndParent, promptdisk_proc, (LPARAM)&params);
+
+    if(ret == DPROMPT_CANCEL)
+        SetLastError(ERROR_CANCELLED);
+    return ret;
+}
diff --git a/dlls/setupapi/setupapi_private.h b/dlls/setupapi/setupapi_private.h
index 428cba4..9aba8cf 100644
--- a/dlls/setupapi/setupapi_private.h
+++ b/dlls/setupapi/setupapi_private.h
@@ -24,6 +24,17 @@
 #define DESTSTRORD	501
 #define PROGRESSORD	502
 
+#define IDPROMPTFORDISK   1001
+#define IDC_FILENEEDED    503
+#define IDC_INFO          504
+#define IDC_COPYFROM      505
+#define IDC_PATH          506
+#define IDC_RUNDLG_BROWSE 507
+
+#define IDS_PROMPTDISK  508
+#define IDS_UNKNOWN     509
+#define IDS_COPYFROM    510
+#define IDS_INFO        511
 
 #define REG_INSTALLEDFILES "System\\CurrentControlSet\\Control\\InstalledFiles"
 #define REGPART_RENAME "\\Rename"
diff --git a/dlls/setupapi/stubs.c b/dlls/setupapi/stubs.c
index 4db264b..287cb7e 100644
--- a/dlls/setupapi/stubs.c
+++ b/dlls/setupapi/stubs.c
@@ -261,20 +261,6 @@ UINT WINAPI SetupPromptForDiskA(HWND hwndParent, PCSTR DialogTitle, PCSTR DiskNa
 }
 
 /***********************************************************************
- *      SetupPromptForDiskW (SETUPAPI.@)
- */
-UINT WINAPI SetupPromptForDiskW(HWND hwndParent, PCWSTR DialogTitle, PCWSTR DiskName,
-        PCWSTR PathToSource, PCWSTR FileSought, PCWSTR TagFile, DWORD DiskPromptStyle,
-        PWSTR PathBuffer, DWORD PathBufferSize, PDWORD PathRequiredSize)
-{
-    FIXME("%p %s %s %s %s %s %d %p %d %p: stub\n", hwndParent, debugstr_w(DialogTitle),
-          debugstr_w(DiskName), debugstr_w(PathToSource), debugstr_w(FileSought),
-          debugstr_w(TagFile), DiskPromptStyle, PathBuffer, PathBufferSize,
-          PathRequiredSize);
-    return 0;
-}
-
-/***********************************************************************
  *      CM_Locate_DevNodeA (SETUPAPI.@)
  */
 CONFIGRET WINAPI CM_Locate_DevNodeA(PDEVINST pdnDevInst, DEVINSTID_A pDeviceID, ULONG ulFlags)




More information about the wine-cvs mailing list