[DINPUT] Fix some stupid game :-)

Lionel Ulmer lionel.ulmer at free.fr
Sun Feb 2 05:46:22 CST 2003


Hi all,

Some games only Acquire the mouse device *if* we return an error on
GetDeviceData when the mouse in unacquired...

So report this error as we should :-)

Changelog:
 Report an error if GetDeviceData is called on an Unacquired device

-- 
		 Lionel Ulmer - http://www.bbrox.org/
-------------- next part --------------
--- ../wine_base/dlls/dinput/device.c	Sat Oct 19 08:18:22 2002
+++ dlls/dinput/device.c	Sun Feb  2 12:21:35 2003
@@ -299,8 +299,10 @@
 ) {
 	ICOM_THIS(IDirectInputDevice2AImpl,iface);
 	TRACE("(this=%p,0x%08lx,0x%08lx)\n",This,(DWORD)hwnd,dwflags);
-	if (TRACE_ON(dinput))
-	  _dump_cooperativelevel_DI(dwflags);
+	if (TRACE_ON(dinput)) {
+	    TRACE(" cooperative level : ");
+	    _dump_cooperativelevel_DI(dwflags);
+	}
 	return 0;
 }
 
--- ../wine_base/dlls/dinput/mouse/main.c	Thu Jan 30 22:07:23 2003
+++ dlls/dinput/mouse/main.c	Sun Feb  2 12:29:23 2003
@@ -270,8 +270,10 @@
 
   TRACE("(this=%p,0x%08lx,0x%08lx)\n",This,(DWORD)hwnd,dwflags);
 
-  if (TRACE_ON(dinput))
-    _dump_cooperativelevel_DI(dwflags);
+  if (TRACE_ON(dinput)) {
+      TRACE(" cooperative level : ");
+      _dump_cooperativelevel_DI(dwflags);
+  }
 
   /* Store the window which asks for the mouse */
   if (!hwnd)
@@ -640,8 +642,14 @@
   ICOM_THIS(SysMouseAImpl,iface);
   DWORD len, nqtail;
 
-  EnterCriticalSection(&(This->crit));
   TRACE("(%p)->(dods=%ld,entries=%ld,fl=0x%08lx)\n",This,dodsize,*entries,flags);
+
+  if (This->acquired == 0) {
+      WARN(" application tries to get data from an unacquired device !\n");
+      return DIERR_NOTACQUIRED;
+  }
+  
+  EnterCriticalSection(&(This->crit));
 
   len = ((This->queue_head < This->queue_tail) ? This->queue_len : 0)
       + (This->queue_head - This->queue_tail);


More information about the wine-patches mailing list