Vitaliy Margolen : dinput: Convert keyboard buffer from internal data format to user data format.

Alexandre Julliard julliard at winehq.org
Wed May 28 14:45:54 CDT 2008


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

Author: Vitaliy Margolen <wine-patches at kievinfo.com>
Date:   Thu Apr 24 23:32:32 2008 +0300

dinput: Convert keyboard buffer from internal data format to user data format.

---

 dlls/dinput/keyboard.c       |    6 +++---
 dlls/dinput/tests/keyboard.c |   11 ++++-------
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c
index 84d9f60..cb290f6 100644
--- a/dlls/dinput/keyboard.c
+++ b/dlls/dinput/keyboard.c
@@ -270,7 +270,7 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState(
 
     if (!This->base.acquired) return DIERR_NOTACQUIRED;
 
-    if (len != WINE_DINPUT_KEYBOARD_MAX_KEYS)
+    if (len != This->base.data_format.user_df->dwDataSize )
         return DIERR_INVALIDPARAM;
 
     EnterCriticalSection(&This->base.crit);
@@ -282,8 +282,8 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState(
 		TRACE(" - %02X: %02x\n", i, This->DInputKeyState[i]);
 	}
     }
-    
-    memcpy(ptr, This->DInputKeyState, WINE_DINPUT_KEYBOARD_MAX_KEYS);
+
+    fill_DataFormat(ptr, This->DInputKeyState, &This->base.data_format);
     LeaveCriticalSection(&This->base.crit);
 
     return DI_OK;
diff --git a/dlls/dinput/tests/keyboard.c b/dlls/dinput/tests/keyboard.c
index 440cd3c..baac4db 100644
--- a/dlls/dinput/tests/keyboard.c
+++ b/dlls/dinput/tests/keyboard.c
@@ -116,13 +116,10 @@ static void acquire_tests(LPDIRECTINPUT pDI, HWND hwnd)
     ok(SUCCEEDED(hr), "IDirectInputDevice_SetDataFormat() failed: %s\n", DXGetErrorString8(hr));
     hr = IDirectInputDevice_Acquire(pKeyboard);
     ok(SUCCEEDED(hr), "IDirectInputDevice_Acquire() failed: %s\n", DXGetErrorString8(hr));
-    todo_wine
-        {
-            hr = IDirectInputDevice_GetDeviceState(pKeyboard, sizeof(custom_state), custom_state);
-            ok(SUCCEEDED(hr), "IDirectInputDevice_GetDeviceState(4,) failed: %s\n", DXGetErrorString8(hr));
-            hr = IDirectInputDevice_GetDeviceState(pKeyboard, sizeof(kbd_state), kbd_state);
-            ok(hr == DIERR_INVALIDPARAM, "IDirectInputDevice_GetDeviceState(256,) should have failed: %s\n", DXGetErrorString8(hr));
-        }
+    hr = IDirectInputDevice_GetDeviceState(pKeyboard, sizeof(custom_state), custom_state);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_GetDeviceState(4,) failed: %s\n", DXGetErrorString8(hr));
+    hr = IDirectInputDevice_GetDeviceState(pKeyboard, sizeof(kbd_state), kbd_state);
+    ok(hr == DIERR_INVALIDPARAM, "IDirectInputDevice_GetDeviceState(256,) should have failed: %s\n", DXGetErrorString8(hr));
 
     if (pKeyboard) IUnknown_Release(pKeyboard);
 }




More information about the wine-cvs mailing list