James Hawkins : setupapi: Convert InfSpec to unicode if SearchControl is not

Alexandre Julliard julliard at wine.codeweavers.com
Thu Feb 9 05:47:40 CST 2006


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

Author: James Hawkins <truiken at gmail.com>
Date:   Thu Feb  9 12:12:11 2006 +0100

setupapi: Convert InfSpec to unicode if SearchControl is not
INFINFO_INF_SPEC_IS_HINF.

---

 dlls/setupapi/query.c |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/dlls/setupapi/query.c b/dlls/setupapi/query.c
index 6edf856..b70ce80 100644
--- a/dlls/setupapi/query.c
+++ b/dlls/setupapi/query.c
@@ -63,16 +63,29 @@ static BOOL fill_inf_info(HINF inf, PSP_
 /***********************************************************************
  *      SetupGetInfInformationA    (SETUPAPI.@)
  *
- * BUGS
- *   If SearchControl is anything other than INFINFO_INF_SPEC_IS_HINF,
- *   then InfSpec needs to be converted to unicode.
  */
 BOOL WINAPI SetupGetInfInformationA(LPCVOID InfSpec, DWORD SearchControl,
                                     PSP_INF_INFORMATION ReturnBuffer,
                                     DWORD ReturnBufferSize, PDWORD RequiredSize)
 {
-    return SetupGetInfInformationW(InfSpec, SearchControl, ReturnBuffer,
-                                   ReturnBufferSize, RequiredSize);
+    LPWSTR inf = (LPWSTR)InfSpec;
+    DWORD len;
+    BOOL ret;
+
+    if (InfSpec && SearchControl >= INFINFO_INF_NAME_IS_ABSOLUTE)
+    {
+        len = lstrlenA(InfSpec) + 1;
+        inf = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+        MultiByteToWideChar(CP_ACP, 0, InfSpec, -1, inf, len);
+    }
+
+    ret = SetupGetInfInformationW(inf, SearchControl, ReturnBuffer,
+                                  ReturnBufferSize, RequiredSize);
+
+    if (SearchControl >= INFINFO_INF_NAME_IS_ABSOLUTE)
+        HeapFree(GetProcessHeap(), 0, inf);
+
+    return ret;
 }
 
 /***********************************************************************




More information about the wine-cvs mailing list