[PATCH 4/7] quartz: Implement AMGetErrorTextA on top of AMGetErrorTextW

Maarten Lankhorst m.b.lankhorst at gmail.com
Fri Dec 3 07:38:28 CST 2010


---
 dlls/quartz/main.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/dlls/quartz/main.c b/dlls/quartz/main.c
index 93c93a0..c40d220 100644
--- a/dlls/quartz/main.c
+++ b/dlls/quartz/main.c
@@ -297,17 +297,15 @@ LONG WINAPI DBToAmpFactor(LONG db)
  */
 DWORD WINAPI AMGetErrorTextA(HRESULT hr, LPSTR buffer, DWORD maxlen)
 {
-    unsigned int len;
-    static const char format[] = "Error: 0x%x";
-    char error[MAX_ERROR_TEXT_LEN];
+    DWORD res;
+    WCHAR errorW[MAX_ERROR_TEXT_LEN];
 
-    FIXME("(%x,%p,%d) stub\n", hr, buffer, maxlen);
+    TRACE("(%x,%p,%d)\n", hr, buffer, maxlen);
+    if (!buffer)
+        return 0;
 
-    if (!buffer) return 0;
-    wsprintfA(error, format, hr);
-    if ((len = strlen(error)) >= maxlen) return 0;
-    lstrcpyA(buffer, error);
-    return len;
+    res = AMGetErrorTextW(hr, errorW, sizeof(errorW)/sizeof(*errorW));
+    return WideCharToMultiByte(CP_ACP, 0, errorW, res, buffer, maxlen, 0, 0);
 }
 
 /***********************************************************************
-- 
1.7.1




More information about the wine-patches mailing list