dinput: Move get_config_key to a common place.

This commit is contained in:
Vitaliy Margolen 2007-09-24 19:34:27 -06:00 committed by Alexandre Julliard
parent bb3275ce97
commit 319097f563
3 changed files with 18 additions and 16 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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.
*/