[3/5] dinput: SetActionMap setting username
Lucas Fialho Zawacki
lfzawacki at gmail.com
Mon Jan 9 11:18:35 CST 2012
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 0d29844..07d500e 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -839,6 +839,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);
}
@@ -1073,6 +1078,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