Maarten Lankhorst : quartz: Implement AMGetErrorTextA on top of AMGetErrorTextW.

Alexandre Julliard julliard at winehq.org
Fri Dec 3 09:31:41 CST 2010


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

Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date:   Fri Dec  3 09:38:11 2010 +0100

quartz: Implement AMGetErrorTextA on top of AMGetErrorTextW.

---

 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);
 }
 
 /***********************************************************************




More information about the wine-cvs mailing list