diff --git a/dlls/setupapi/En.rc b/dlls/setupapi/En.rc index 5d45feb2d76..84619f6bd80 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 e6d3e807378..700fce3d41e 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 00000000000..b2bca9f8396 --- /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 + +#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)¶ms); + + if(ret == DPROMPT_CANCEL) + SetLastError(ERROR_CANCELLED); + return ret; +} diff --git a/dlls/setupapi/setupapi_private.h b/dlls/setupapi/setupapi_private.h index 428cba48fb2..9aba8cf3afc 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 4db264b0e80..287cb7e475d 100644 --- a/dlls/setupapi/stubs.c +++ b/dlls/setupapi/stubs.c @@ -260,20 +260,6 @@ UINT WINAPI SetupPromptForDiskA(HWND hwndParent, PCSTR DialogTitle, PCSTR DiskNa return 0; } -/*********************************************************************** - * 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.@) */