[5/5] dinput: GetProperty for DIPROP_USERNAME

Lucas Fialho Zawacki lfzawacki at gmail.com
Mon Jan 9 11:18:37 CST 2012


From: Lucas Fialho Zawacki <lfzawacki at gmail.com>

---
 dlls/dinput/device.c        |   17 +++++++++++++++++
 dlls/dinput8/tests/device.c |    4 ++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index 5ec9ead..83f5bce 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -1306,6 +1306,23 @@ HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface,
         case (DWORD_PTR) DIPROP_VIDPID:
             FIXME("DIPROP_VIDPID not implemented\n");
             return DIERR_UNSUPPORTED;
+        case (DWORD_PTR) DIPROP_USERNAME:
+        {
+            LPDIPROPSTRING ps = (LPDIPROPSTRING)pdiph;
+
+            if (pdiph->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM;
+
+            if (This->username == NULL)
+            {
+                /* Some applications seem to rely on an empty string here it fails */
+                ps->wsz[0] = '\0';
+                return S_FALSE;
+            }
+
+            lstrcpynW(ps->wsz, This->username, MAX_PATH);
+            TRACE("username = %s\n", debugstr_w(ps->wsz));
+            break;
+        }
         default:
             FIXME("Unknown property %s\n", debugstr_guid(rguid));
             return DIERR_INVALIDPARAM;
diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c
index 7fbdfaa..74d0d4b 100644
--- a/dlls/dinput8/tests/device.c
+++ b/dlls/dinput8/tests/device.c
@@ -217,8 +217,8 @@ static BOOL CALLBACK enumeration_callback(
     dps.wsz[0] = '\0';
 
     hr = IDirectInputDevice_GetProperty(lpdid, DIPROP_USERNAME, &dps.diph);
-    todo_wine ok (SUCCEEDED(hr), "GetProperty failed hr=%08x\n", hr);
-    todo_wine ok (!lstrcmpW(usernameW, dps.wsz), "Username not set correctly expected=%s, got=%s\n", wine_dbgstr_wn(usernameW, -1), wine_dbgstr_wn(dps.wsz, -1));
+    ok (SUCCEEDED(hr), "GetProperty failed hr=%08x\n", hr);
+    ok (!lstrcmpW(usernameW, dps.wsz), "Username not set correctly expected=%s, got=%s\n", wine_dbgstr_wn(usernameW, -1), wine_dbgstr_wn(dps.wsz, -1));
 
     /* Test buffer size */
     memset(&dp, 0, sizeof(dp));
-- 
1.7.0.4




More information about the wine-patches mailing list