[PATCH] winmm: Attempt only once to load the default joystick driver

Andrew Eikum aeikum at codeweavers.com
Mon Nov 12 10:17:38 CST 2018


Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>

On Fri, Nov 09, 2018 at 12:45:19AM +0200, Baruch Rutman wrote:
> Reduce disk usage by preventing frequent calls to load an non-existant driver.
> 
> ReactOS issue:
> https://jira.reactos.org/browse/CORE-15336
> 
> Signed-off-by: Baruch Rutman <peterooch at gmail.com>
> ---
>  dlls/winmm/joystick.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/dlls/winmm/joystick.c b/dlls/winmm/joystick.c
> index 8a52942ca6..5a12b3685b 100644
> --- a/dlls/winmm/joystick.c
> +++ b/dlls/winmm/joystick.c
> @@ -68,12 +68,21 @@ static	WINE_JOYSTICK	JOY_Sticks[MAXJOYSTICK];
>   */
>  static	BOOL JOY_LoadDriver(DWORD dwJoyID)
>  {
> -    if (dwJoyID >= MAXJOYSTICK)
> +    static BOOL winejoystick_missing = FALSE;
> +
> +    if (dwJoyID >= MAXJOYSTICK || winejoystick_missing)
>  	return FALSE;
>      if (JOY_Sticks[dwJoyID].hDriver)
>  	return TRUE;
>  
>      JOY_Sticks[dwJoyID].hDriver = OpenDriverA("winejoystick.drv", 0, dwJoyID);
> +
> +    if (!JOY_Sticks[dwJoyID].hDriver)
> +    {
> +        /* The default driver is missing, don't attempt to load it again */
> +        winejoystick_missing = TRUE;
> +    }
> +
>      return (JOY_Sticks[dwJoyID].hDriver != 0);
>  }
>  
> -- 
> 2.19.1.windows.1
> 
> 
> 



More information about the wine-devel mailing list