[1/2] setupapi: implement SetupPromptForDiskA by wrapping around W version

Ricardo Filipe ricardojdfilipe at gmail.com
Mon Feb 23 13:57:21 CST 2009


now the output parameter is not copied, just allocates memory for it.
the buffer size handling is done only after clicking Ok button in windows
too.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winehq.org/pipermail/wine-patches/attachments/20090223/b0888781/attachment.htm 
-------------- next part --------------
From 823f23551aec66dfdc534dddc4345fd349845f3d Mon Sep 17 00:00:00 2001
From: Ricardo Filipe <ricardo_barbano at hotmail.com>
Date: Wed, 18 Feb 2009 09:58:28 +0000
Subject: setupapi: implement SetupPromptForDiskA by wrapping around W version

---
 dlls/setupapi/dialog.c |   39 +++++++++++++++++++++++++++++++++++++++
 dlls/setupapi/stubs.c  |   14 --------------
 2 files changed, 39 insertions(+), 14 deletions(-)

diff --git a/dlls/setupapi/dialog.c b/dlls/setupapi/dialog.c
index aaa9453..6a26230 100644
--- a/dlls/setupapi/dialog.c
+++ b/dlls/setupapi/dialog.c
@@ -183,6 +183,45 @@ static INT_PTR CALLBACK promptdisk_proc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
 }
 
 /***********************************************************************
+ *      SetupPromptForDiskA (SETUPAPI.@)
+ */
+UINT WINAPI SetupPromptForDiskA(HWND hwndParent, PCSTR DialogTitle, PCSTR DiskName,
+        PCSTR PathToSource, PCSTR FileSought, PCSTR TagFile, DWORD DiskPromptStyle,
+        PSTR PathBuffer, DWORD PathBufferSize, PDWORD PathRequiredSize)
+{
+    WCHAR *DialogTitleW, *DiskNameW, *PathToSourceW;
+    WCHAR *FileSoughtW, *TagFileW, *PathBufferW;
+    UINT ret;
+
+    TRACE("%p, %s, %s, %s, %s, %s, 0x%08x, %p, %d, %p\n", hwndParent, debugstr_a(DialogTitle),
+          debugstr_a(DiskName), debugstr_a(PathToSource), debugstr_a(FileSought),
+          debugstr_a(TagFile), DiskPromptStyle, PathBuffer, PathBufferSize,
+          PathRequiredSize);
+
+    DialogTitleW = strdupAtoW(DialogTitle);
+    DiskNameW = strdupAtoW(DiskName);
+    PathToSourceW = strdupAtoW(PathToSource);
+    FileSoughtW = strdupAtoW(FileSought);
+    TagFileW = strdupAtoW(TagFile);
+    PathBufferW = HeapAlloc(GetProcessHeap(), 0, PathBufferSize * sizeof(WCHAR));
+
+    ret = SetupPromptForDiskW(hwndParent, DialogTitleW, DiskNameW, PathToSourceW,
+              FileSoughtW, TagFileW, DiskPromptStyle, PathBufferW, PathBufferSize,
+              PathRequiredSize);
+
+    HeapFree(GetProcessHeap(), 0, DialogTitleW);
+    HeapFree(GetProcessHeap(), 0, DiskNameW);
+    HeapFree(GetProcessHeap(), 0, PathToSourceW);
+    HeapFree(GetProcessHeap(), 0, FileSoughtW);
+    HeapFree(GetProcessHeap(), 0, TagFileW);
+
+    if(ret == DPROMPT_SUCCESS && PathBufferW)
+        WideCharToMultiByte(CP_ACP, 0, PathBufferW, -1, PathBuffer, PathBufferSize, NULL, NULL);
+    HeapFree(GetProcessHeap(), 0, PathBufferW);
+    return ret;
+}
+
+/***********************************************************************
  *      SetupPromptForDiskW (SETUPAPI.@)
  */
 UINT WINAPI SetupPromptForDiskW(HWND hwndParent, PCWSTR DialogTitle, PCWSTR DiskName,
diff --git a/dlls/setupapi/stubs.c b/dlls/setupapi/stubs.c
index 287cb7e..3997447 100644
--- a/dlls/setupapi/stubs.c
+++ b/dlls/setupapi/stubs.c
@@ -247,20 +247,6 @@ BOOL WINAPI SetupDiGetClassImageList(PSP_CLASSIMAGELIST_DATA ClassImageListData)
 }
 
 /***********************************************************************
- *      SetupPromptForDiskA (SETUPAPI.@)
- */
-UINT WINAPI SetupPromptForDiskA(HWND hwndParent, PCSTR DialogTitle, PCSTR DiskName,
-        PCSTR PathToSource, PCSTR FileSought, PCSTR TagFile, DWORD DiskPromptStyle,
-        PSTR PathBuffer, DWORD PathBufferSize, PDWORD PathRequiredSize)
-{
-    FIXME("%p %s %s %s %s %s %d %p %d %p: stub\n", hwndParent, debugstr_a(DialogTitle),
-          debugstr_a(DiskName), debugstr_a(PathToSource), debugstr_a(FileSought),
-          debugstr_a(TagFile), DiskPromptStyle, PathBuffer, PathBufferSize,
-          PathRequiredSize);
-    return 0;
-}
-
-/***********************************************************************
  *      CM_Locate_DevNodeA (SETUPAPI.@)
  */
 CONFIGRET WINAPI CM_Locate_DevNodeA(PDEVINST pdnDevInst, DEVINSTID_A pDeviceID, ULONG ulFlags)
-- 
1.5.6.3


More information about the wine-patches mailing list