winex11: Avoid using sprintfW.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-05-02 00:43:14 +02:00 committed by Alexandre Julliard
parent 17afa30577
commit 30d5a04f6d
2 changed files with 9 additions and 5 deletions

View File

@ -1053,7 +1053,6 @@ static int find_fallback_shape( const char *name )
*/
static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info )
{
static const WCHAR idW[] = {'%','h','u',0};
const struct system_cursors *cursors;
unsigned int i;
Cursor cursor = 0;
@ -1070,7 +1069,12 @@ static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info )
p = name + strlenW( name );
*p++ = ',';
if (info->szResName[0]) strcpyW( p, info->szResName );
else sprintfW( p, idW, info->wResID );
else
{
char buf[16];
sprintf( buf, "%hu", info->wResID );
asciiz_to_unicode( p, buf );
}
valueA[0] = 0;
/* @@ Wine registry key: HKCU\Software\Wine\X11 Driver\Cursors */

View File

@ -217,8 +217,6 @@ void init_registry_display_settings(void)
static HKEY get_display_device_reg_key( const WCHAR *device_name )
{
static const WCHAR display[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y'};
static const WCHAR video_value_fmt[] = {'\\','D','e','v','i','c','e','\\',
'V','i','d','e','o','%','d',0};
static const WCHAR video_key[] = {
'\\','R','e','g','i','s','t','r','y',
'\\','M','a','c','h','i','n','e',
@ -235,6 +233,7 @@ static HKEY get_display_device_reg_key( const WCHAR *device_name )
WCHAR value_name[MAX_PATH], buffer[4096], *end_ptr;
KEY_VALUE_PARTIAL_INFORMATION *value = (void *)buffer;
DWORD adapter_index, size;
char adapter_name[100];
HKEY hkey;
/* Device name has to be \\.\DISPLAY%d */
@ -248,7 +247,8 @@ static HKEY get_display_device_reg_key( const WCHAR *device_name )
/* Open \Device\Video* in HKLM\HARDWARE\DEVICEMAP\VIDEO\ */
if (!(hkey = reg_open_key( NULL, video_key, sizeof(video_key) ))) return FALSE;
sprintfW(value_name, video_value_fmt, adapter_index);
sprintf( adapter_name, "\\Device\\Video%d", adapter_index );
asciiz_to_unicode( value_name, adapter_name );
size = query_reg_value( hkey, value_name, value, sizeof(buffer) );
NtClose( hkey );
if (!size || value->Type != REG_SZ) return FALSE;