[4/6] dinput: SetActionMap setting username

Lucas Fialho Zawacki lfzawacki at gmail.com
Sat Oct 22 15:53:23 CDT 2011


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

---
 dlls/dinput/device.c         |    8 ++++++++
 dlls/dinput/device_private.h |    1 +
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index 056a03d..5ceb06f 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -821,6 +821,11 @@ HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, L
     /* Save the settings to disk */
     _save_mapping_settings(iface, lpdiaf, username);
 
+    /* Set username in device */
+    HeapFree(GetProcessHeap(), 0, This->username);
+    This->username = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * (lstrlenW(username) + 1));
+    lstrcpyW(This->username, username);
+
     return IDirectInputDevice8WImpl_SetActionMap(iface, lpdiaf, lpszUserName, dwFlags);
 }
 
@@ -1053,6 +1058,9 @@ ULONG WINAPI IDirectInputDevice2WImpl_Release(LPDIRECTINPUTDEVICE8W iface)
     /* Free action mapping */
     HeapFree(GetProcessHeap(), 0, This->action_map);
 
+    /* Free username */
+    HeapFree(GetProcessHeap(), 0, This->username);
+
     EnterCriticalSection( &This->dinput->crit );
     list_remove( &This->entry );
     LeaveCriticalSection( &This->dinput->crit );
diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h
index 660ebd7..cf253d4 100644
--- a/dlls/dinput/device_private.h
+++ b/dlls/dinput/device_private.h
@@ -81,6 +81,7 @@ struct IDirectInputDeviceImpl
     /* Action mapping */
     int                         num_actions; /* number of actions mapped */
     ActionMap                  *action_map;  /* array of mappings */
+    WCHAR                      *username;    /* username of the device assigned owner */
 };
 
 extern BOOL get_app_key(HKEY*, HKEY*) DECLSPEC_HIDDEN;
-- 
1.7.0.4




More information about the wine-patches mailing list