James Hawkins : msi: Forward MsiGetPatchInfoExA to MsiGetPatchInfoExW.

Alexandre Julliard julliard at winehq.org
Mon Dec 15 08:27:19 CST 2008


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

Author: James Hawkins <jhawkins at codeweavers.com>
Date:   Sun Dec 14 21:07:02 2008 -0600

msi: Forward MsiGetPatchInfoExA to MsiGetPatchInfoExW.

---

 dlls/msi/msi.c |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index 7c980ee..c49f86d 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -1194,11 +1194,67 @@ UINT WINAPI MsiGetPatchInfoExA(LPCSTR szPatchCode, LPCSTR szProductCode,
                                LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext,
                                LPCSTR szProperty, LPSTR lpValue, DWORD *pcchValue)
 {
-    FIXME("(%s, %s, %s, %d, %s, %p, %p): stub!\n", debugstr_a(szPatchCode),
+    LPWSTR patch = NULL, product = NULL, usersid = NULL;
+    LPWSTR property = NULL, val = NULL;
+    DWORD len;
+    UINT r;
+
+    TRACE("(%s, %s, %s, %d, %s, %p, %p)\n", debugstr_a(szPatchCode),
           debugstr_a(szProductCode), debugstr_a(szUserSid), dwContext,
           debugstr_a(szProperty), lpValue, pcchValue);
 
-    return ERROR_CALL_NOT_IMPLEMENTED;
+    if (lpValue && !pcchValue)
+        return ERROR_INVALID_PARAMETER;
+
+    if (szPatchCode) patch = strdupAtoW(szPatchCode);
+    if (szProductCode) product = strdupAtoW(szProductCode);
+    if (szUserSid) usersid = strdupAtoW(szUserSid);
+    if (szProperty) property = strdupAtoW(szProperty);
+
+    len = 0;
+    r = MsiGetPatchInfoExW(patch, product, usersid, dwContext, property,
+                           NULL, &len);
+    if (r != ERROR_SUCCESS)
+        goto done;
+
+    val = msi_alloc(++len * sizeof(WCHAR));
+    if (!val)
+    {
+        r = ERROR_OUTOFMEMORY;
+        goto done;
+    }
+
+    r = MsiGetPatchInfoExW(patch, product, usersid, dwContext, property,
+                           val, &len);
+    if (r != ERROR_SUCCESS || !pcchValue)
+        goto done;
+
+    if (lpValue)
+        WideCharToMultiByte(CP_ACP, 0, val, -1, lpValue,
+                            *pcchValue - 1, NULL, NULL);
+
+    len = lstrlenW(val);
+    if ((*val && *pcchValue < len + 1) || !lpValue)
+    {
+        if (lpValue)
+        {
+            r = ERROR_MORE_DATA;
+            lpValue[*pcchValue - 1] = '\0';
+        }
+
+        *pcchValue = len * sizeof(WCHAR);
+    }
+    else
+        *pcchValue = len;
+
+done:
+    msi_free(val);
+    msi_free(patch);
+    msi_free(product);
+    msi_free(usersid);
+    msi_free(property);
+
+    return r;
 }
 
 UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode,




More information about the wine-cvs mailing list