From 319097f563bcb610c2eb8a1d1b0e4448fd07f92b Mon Sep 17 00:00:00 2001 From: Vitaliy Margolen Date: Mon, 24 Sep 2007 19:34:27 -0600 Subject: [PATCH] dinput: Move get_config_key to a common place. --- dlls/dinput/device.c | 16 ++++++++++++++++ dlls/dinput/device_private.h | 2 ++ dlls/dinput/joystick_linux.c | 16 ---------------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 10e31cd412c..d1c94fc6de1 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -32,6 +32,7 @@ #include "wine/unicode.h" #include "windef.h" #include "winbase.h" +#include "winreg.h" #include "winuser.h" #include "winerror.h" #include "dinput.h" @@ -216,6 +217,21 @@ void _dump_DIDATAFORMAT(const DIDATAFORMAT *df) { } } +/****************************************************************************** + * Get a config key from either the app-specific or the default config + */ +DWORD get_config_key( HKEY defkey, HKEY appkey, const char *name, + char *buffer, DWORD size ) +{ + if (appkey && !RegQueryValueExA( appkey, name, 0, NULL, (LPBYTE)buffer, &size )) + return 0; + + if (defkey && !RegQueryValueExA( defkey, name, 0, NULL, (LPBYTE)buffer, &size )) + return 0; + + return ERROR_FILE_NOT_FOUND; +} + /* Conversion between internal data buffer and external data buffer */ void fill_DataFormat(void *out, const void *in, const DataFormat *df) { int i; diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index 6686577b13c..b855c1b264d 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -72,6 +72,8 @@ struct IDirectInputDevice2AImpl DataFormat data_format; /* user data format and wine to user format converter */ }; +extern DWORD get_config_key(HKEY, HKEY, const char*, char*, DWORD); + /* Routines to do DataFormat / WineFormat conversions */ extern void fill_DataFormat(void *out, const void *in, const DataFormat *df) ; extern HRESULT create_DataFormat(LPCDIDATAFORMAT asked_format, DataFormat *format); diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c index e15e32e128b..0f821de4e81 100644 --- a/dlls/dinput/joystick_linux.c +++ b/dlls/dinput/joystick_linux.c @@ -262,22 +262,6 @@ static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN return FALSE; } -/* - * Get a config key from either the app-specific or the default config - */ - -static inline DWORD get_config_key( HKEY defkey, HKEY appkey, const char *name, - char *buffer, DWORD size ) -{ - if (appkey && !RegQueryValueExA( appkey, name, 0, NULL, (LPBYTE)buffer, &size )) - return 0; - - if (defkey && !RegQueryValueExA( defkey, name, 0, NULL, (LPBYTE)buffer, &size )) - return 0; - - return ERROR_FILE_NOT_FOUND; -} - /* * Setup the dinput options. */