From a84204fc75a6a6da5a96b2cb6e931720c4de1540 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 16 Mar 2025 20:27:28 +0300 Subject: [PATCH] engine: partial fix to explicitly call ascii or wide Win32 API function calls --- engine/client/identification.c | 11 ++++++----- engine/platform/win32/sys_win.c | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/engine/client/identification.c b/engine/client/identification.c index 6f5adc52..8fee8403 100644 --- a/engine/client/identification.c +++ b/engine/client/identification.c @@ -365,10 +365,10 @@ static int ID_GetKeyData( HKEY hRootKey, char *subKey, char *value, LPBYTE data, { HKEY hKey; - if( RegOpenKeyEx( hRootKey, subKey, 0, KEY_QUERY_VALUE, &hKey ) != ERROR_SUCCESS ) + if( RegOpenKeyExA( hRootKey, subKey, 0, KEY_QUERY_VALUE, &hKey ) != ERROR_SUCCESS ) return 0; - if( RegQueryValueEx( hKey, value, NULL, NULL, data, &cbData ) != ERROR_SUCCESS ) + if( RegQueryValueExA( hKey, value, NULL, NULL, data, &cbData ) != ERROR_SUCCESS ) { RegCloseKey( hKey ); return 0; @@ -377,13 +377,14 @@ static int ID_GetKeyData( HKEY hRootKey, char *subKey, char *value, LPBYTE data, RegCloseKey( hKey ); return 1; } -static int ID_SetKeyData( HKEY hRootKey, char *subKey, DWORD dwType, char *value, LPBYTE data, DWORD cbData) + +static int ID_SetKeyData( HKEY hRootKey, char *subKey, DWORD dwType, char *value, LPBYTE data, DWORD cbData ) { HKEY hKey; - if( RegCreateKey( hRootKey, subKey, &hKey ) != ERROR_SUCCESS ) + if( RegCreateKeyA( hRootKey, subKey, &hKey ) != ERROR_SUCCESS ) return 0; - if( RegSetValueEx( hKey, value, 0, dwType, data, cbData ) != ERROR_SUCCESS ) + if( RegSetValueExA( hKey, value, 0, dwType, data, cbData ) != ERROR_SUCCESS ) { RegCloseKey( hKey ); return 0; diff --git a/engine/platform/win32/sys_win.c b/engine/platform/win32/sys_win.c index fe5723fd..5eeaaa0a 100644 --- a/engine/platform/win32/sys_win.c +++ b/engine/platform/win32/sys_win.c @@ -45,7 +45,7 @@ void Platform_Sleep( int msec ) void Win32_Init( qboolean con_showalways ) { - HMODULE hModule = LoadLibrary( "kernel32.dll" ); + HMODULE hModule = LoadLibraryW( L"kernel32.dll" ); if( hModule ) { HANDLE ( __stdcall *pfnCreateWaitableTimerExW)( LPSECURITY_ATTRIBUTES lpTimerAttributes, LPCWSTR lpTimerName, DWORD dwFlags, DWORD dwDesiredAccess ); @@ -114,13 +114,13 @@ void Platform_ShellExecute( const char *path, const char *parms ) if( !Q_strcmp( path, GENERIC_UPDATE_PAGE ) || !Q_strcmp( path, PLATFORM_UPDATE_PAGE )) path = DEFAULT_UPDATE_PAGE; - ShellExecute( NULL, "open", path, parms, NULL, SW_SHOW ); + ShellExecuteA( NULL, "open", path, parms, NULL, SW_SHOW ); } #if XASH_MESSAGEBOX == MSGBOX_WIN32 void Platform_MessageBox( const char *title, const char *message, qboolean parentMainWindow ) { - MessageBox( parentMainWindow ? host.hWnd : NULL, message, title, MB_OK|MB_SETFOREGROUND|MB_ICONSTOP ); + MessageBoxA( parentMainWindow ? host.hWnd : NULL, message, title, MB_OK|MB_SETFOREGROUND|MB_ICONSTOP ); } #endif // XASH_MESSAGEBOX == MSGBOX_WIN32