[4/5] dinput: Added device's owner username set by SetActionMap and the respective GetProperty to retrieve it
Lucas Fialho Zawacki
lfzawacki at gmail.com
Fri Jul 8 13:01:12 CDT 2011
---
dlls/dinput/device.c | 22 ++++++++++++++++++++++
dlls/dinput/device_private.h | 1 +
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index 5d81227..99c854c 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -953,6 +953,16 @@ HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface,
TRACE("buffersize = %d\n", pd->dwData);
break;
}
+ case (DWORD_PTR) DIPROP_USERNAME:
+ {
+ LPDIPROPSTRING ps = (LPDIPROPSTRING)pdiph;
+
+ if (pdiph->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM;
+ if (strlenW(This->owner) == 0) return S_FALSE;
+
+ memcpy(ps->wsz, This->owner, strlenW(This->owner)*sizeof(WCHAR));
+ break;
+ }
case (DWORD_PTR) DIPROP_VIDPID:
FIXME("DIPROP_VIDPID not implemented\n");
return DIERR_UNSUPPORTED;
@@ -1459,10 +1469,22 @@ HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface
LPCWSTR lpszUserName,
DWORD dwFlags)
{
+ IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
DIPROPDWORD dp;
+ DWORD username_size = MAX_PATH;
+ WCHAR username[MAX_PATH];
FIXME("(%p)->(%p,%s,%08x): semi-stub !\n", iface, lpdiaf, debugstr_w(lpszUserName), dwFlags);
+ /* NULL username defaults to the logged user */
+ if (lpszUserName == NULL)
+ {
+ GetUserNameW(username, &username_size);
+ lpszUserName = username;
+ }
+
+ memcpy(This->owner, lpszUserName, strlenW(lpszUserName)*sizeof(WCHAR));
+
if (lpdiaf->dwBufferSize > 0)
{
dp.diph.dwSize = sizeof(DIPROPDWORD);
diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h
index 503698a..6df8d93 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 owner[MAX_PATH]; /* username of the device's owner */
};
extern BOOL get_app_key(HKEY*, HKEY*) DECLSPEC_HIDDEN;
--
1.7.0.4
More information about the wine-patches
mailing list