wine/dlls/dinput joystick_linuxinput.c

Alexandre Julliard julliard at wine.codeweavers.com
Sat Nov 12 13:10:38 CST 2005


ChangeSet ID:	21232
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/12 13:10:38

Modified files:
	dlls/dinput    : joystick_linuxinput.c 

Log message:
	Daniel Remenak <dtremenak at gmail.com>
	Add additional sanity checks to the linux input system dinput joystick
	implementation.

Patch: http://cvs.winehq.org/patch.py?id=21232

Old revision  New revision  Changes     Path
 1.33          1.34          +20 -4      wine/dlls/dinput/joystick_linuxinput.c

Index: wine/dlls/dinput/joystick_linuxinput.c
diff -u -p wine/dlls/dinput/joystick_linuxinput.c:1.33 wine/dlls/dinput/joystick_linuxinput.c:1.34
--- wine/dlls/dinput/joystick_linuxinput.c:1.33	12 Nov 2005 19:10:38 -0000
+++ wine/dlls/dinput/joystick_linuxinput.c	12 Nov 2005 19:10:38 -0000
@@ -419,8 +419,6 @@ static HRESULT WINAPI JoystickAImpl_SetD
 
   TRACE("(this=%p,%p)\n",This,df);
 
-  _dump_DIDATAFORMAT(df);
-  
   if (df == NULL) {
     WARN("invalid pointer\n");
     return E_POINTER;
@@ -431,6 +429,8 @@ static HRESULT WINAPI JoystickAImpl_SetD
     return DIERR_INVALIDPARAM;
   }
 
+  _dump_DIDATAFORMAT(df);
+
   if (This->joyfd!=-1) {
     WARN("acquired\n");
     return DIERR_ACQUIRED;
@@ -906,8 +906,13 @@ static HRESULT WINAPI JoystickAImpl_SetP
 {
   JoystickImpl *This = (JoystickImpl *)iface;
 
-  FIXME("(this=%p,%s,%p)\n",This,debugstr_guid(rguid),ph);
-  FIXME("ph.dwSize = %ld, ph.dwHeaderSize =%ld, ph.dwObj = %ld, ph.dwHow= %ld\n",ph->dwSize, ph->dwHeaderSize,ph->dwObj,ph->dwHow);
+  if (!ph) {
+    WARN("invalid argument\n");
+    return DIERR_INVALIDPARAM;
+  }
+
+  TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(rguid),ph);
+  TRACE("ph.dwSize = %ld, ph.dwHeaderSize =%ld, ph.dwObj = %ld, ph.dwHow= %ld\n",ph->dwSize, ph->dwHeaderSize,ph->dwObj,ph->dwHow);
 
   if (!HIWORD(rguid)) {
     switch (LOWORD(rguid)) {
@@ -993,6 +998,17 @@ static HRESULT WINAPI JoystickAImpl_GetC
     int		i,axes,buttons;
 
     TRACE("%p->(%p)\n",iface,lpDIDevCaps);
+
+    if (!lpDIDevCaps) {
+	WARN("invalid pointer\n");
+	return E_POINTER;
+    }
+
+    if (lpDIDevCaps->dwSize != sizeof(DIDEVCAPS)) {
+        WARN("invalid argument\n");
+        return DIERR_INVALIDPARAM;
+    }
+
     if (xfd==-1) {
 	/* yes, games assume we return something, even if unacquired */
 	JoystickAImpl_Acquire(iface);



More information about the wine-cvs mailing list