[RFC 1/11] Linux FF: Joystick control panel program
aeikum at codeweavers.com
Wed Mar 5 08:49:57 CST 2014
On Tue, Mar 04, 2014 at 08:19:16PM +0100, Elias Vanderstuyft wrote:
> a) When unloading conditional effects in joy.cpl, the program crashes:
> When unloading the conditional effect array entries,
> Wine tries to access an invalid (high) address because
> dieffect.lpvTypeSpecificParams was not set at the time the
> effect was created.
> So declare a valid 'standard' (maxed out) conditional effect.
> For other unknown effects:
> - The same can happen when CustomForce effects are available,
> but because Wine's FF dinput->linux translation does
> not support this yet,
> we simply print a FIXME to indicate a possible cause
> if a crash would happen.
> - The same for other (unsupported) effects (this is
> probably not safe?),
> but then we print a WARN.
For unhandled types, it's probably best to print a FIXME and return
DIENUM_CONTINUE, rather than continue to rely on uninitialized data.
Additionally, our IDirectInputEffect implementations could check for
NULL lpvTypeSpecificParams and fail appropriately instead of crashing,
if this is what Windows does.
> b) Weirdly, I had to add these commands that evaluates the DIEFFECT
> pointers at the end of each if-case,
> otherwise the pointers seemed to point to other address or data on
> that address was getting overwritten:
> TRACE("&rforce=0x%x\n", &rforce);
> TRACE("&cforce=0x%x\n", &cforce);
> TRACE("&pforce=0x%x\n", &pforce);
> TRACE("&cxyforce=0x%x; &cxyforce=0x%x\n",
> &(cxyforce), &(cxyforce));
This is an out of scope problem. pforce, rforce, etc are local to the
body of the if-blocks and fall out of scope when the if-blocks close.
They should be moved to the top of the function.
By the way, when you begin to send patches to wine-patches, please
only send up to 2-4 at a time, in logical groups. That way they can be
reasonably reviewed & resubmitted as necessary.
More information about the wine-devel