[PATCH 4/6] dinput: Build with msvcrt.
Rémi Bernon
rbernon at codeweavers.com
Mon Oct 11 03:10:58 CDT 2021
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/dinput/Makefile.in | 2 --
dlls/dinput/config.c | 10 +++++-----
dlls/dinput/device.c | 23 ++++++++++++-----------
dlls/dinput/dinput_main.c | 12 ++++++------
dlls/dinput/joystick_hid.c | 3 +--
dlls/dinput/keyboard.c | 4 ----
dlls/dinput/mouse.c | 21 +++++++++------------
dlls/dinput8/Makefile.in | 2 --
8 files changed, 33 insertions(+), 44 deletions(-)
diff --git a/dlls/dinput/Makefile.in b/dlls/dinput/Makefile.in
index 7bd5951a7a1..e1dd52cf67d 100644
--- a/dlls/dinput/Makefile.in
+++ b/dlls/dinput/Makefile.in
@@ -3,8 +3,6 @@ IMPORTLIB = dinput
IMPORTS = dinput dxguid uuid comctl32 ole32 user32 advapi32 hid setupapi
EXTRADEFS = -DDIRECTINPUT_VERSION=0x0700
-EXTRADLLFLAGS = -mcygwin
-
C_SRCS = \
ansi.c \
config.c \
diff --git a/dlls/dinput/config.c b/dlls/dinput/config.c
index bf448985893..0b76b8e077c 100644
--- a/dlls/dinput/config.c
+++ b/dlls/dinput/config.c
@@ -18,8 +18,8 @@
#define NONAMELESSUNION
-#include "wine/unicode.h"
#include "objbase.h"
+
#include "dinput_private.h"
#include "device_private.h"
#include "resource.h"
@@ -97,7 +97,7 @@ static void init_listview_columns(HWND dialog)
LoadStringW(DINPUT_instance, IDS_OBJECTCOLUMN, column, ARRAY_SIZE(column));
listColumn.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
listColumn.pszText = column;
- listColumn.cchTextMax = lstrlenW(listColumn.pszText);
+ listColumn.cchTextMax = wcslen( listColumn.pszText );
listColumn.cx = width;
SendDlgItemMessageW (dialog, IDC_DEVICEOBJECTSLIST, LVM_INSERTCOLUMNW, 0, (LPARAM) &listColumn);
@@ -105,7 +105,7 @@ static void init_listview_columns(HWND dialog)
LoadStringW(DINPUT_instance, IDS_ACTIONCOLUMN, column, ARRAY_SIZE(column));
listColumn.cx = width;
listColumn.pszText = column;
- listColumn.cchTextMax = lstrlenW(listColumn.pszText);
+ listColumn.cchTextMax = wcslen( listColumn.pszText );
SendDlgItemMessageW(dialog, IDC_DEVICEOBJECTSLIST, LVM_INSERTCOLUMNW, 1, (LPARAM) &listColumn);
}
@@ -154,7 +154,7 @@ static void lv_set_action(HWND dialog, int item, int action, LPDIACTIONFORMATW l
lvItem.mask = LVIF_TEXT;
lvItem.iSubItem = 1;
lvItem.pszText = (WCHAR *)action_text;
- lvItem.cchTextMax = lstrlenW(lvItem.pszText);
+ lvItem.cchTextMax = wcslen( lvItem.pszText );
/* Text */
SendDlgItemMessageW(dialog, IDC_DEVICEOBJECTSLIST, LVM_SETITEMW, 0, (LPARAM) &lvItem);
@@ -237,7 +237,7 @@ static void fill_device_object_list(HWND dialog)
item.iItem = i;
item.iSubItem = 0;
item.pszText = device->ddo[i].tszName;
- item.cchTextMax = lstrlenW(item.pszText);
+ item.cchTextMax = wcslen( item.pszText );
/* Add the item */
SendDlgItemMessageW(dialog, IDC_DEVICEOBJECTSLIST, LVM_INSERTITEMW, 0, (LPARAM) &item);
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index 65698ad64f5..a8ba16afe59 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -24,12 +24,10 @@
It also contains all the helper functions.
*/
-#include "config.h"
#include <stdarg.h>
#include <string.h>
-#include "wine/debug.h"
-#include "wine/unicode.h"
+
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
@@ -42,6 +40,8 @@
#include "device_private.h"
#include "dinput_private.h"
+#include "wine/debug.h"
+
#define WM_WINE_NOTIFY_ACTIVITY WM_USER
WINE_DEFAULT_DEBUG_CHANNEL(dinput);
@@ -348,12 +348,12 @@ BOOL device_instance_is_disabled( DIDEVICEINSTANCEW *instance, BOOL *override )
/* Look for the "controllername"="disabled" key */
if (!get_config_key( hkey, appkey, instance->tszInstanceName, buffer, sizeof(buffer) ))
{
- if (!strcmpW( disabled_str, buffer ))
+ if (!wcscmp( disabled_str, buffer ))
{
TRACE( "Disabling joystick '%s' based on registry key.\n", debugstr_w(instance->tszInstanceName) );
disable = TRUE;
}
- else if (override && !strcmpW( override_str, buffer ))
+ else if (override && !wcscmp( override_str, buffer ))
{
TRACE( "Force enabling joystick '%s' based on registry key.\n", debugstr_w(instance->tszInstanceName) );
*override = TRUE;
@@ -694,9 +694,9 @@ static HKEY get_mapping_key(const WCHAR *device, const WCHAR *username, const WC
HKEY hkey;
WCHAR *keyname;
- keyname = HeapAlloc(GetProcessHeap(), 0,
- sizeof(WCHAR) * (lstrlenW(subkey) + strlenW(username) + strlenW(device) + strlenW(guid)));
- sprintfW(keyname, subkey, username, device, guid);
+ SIZE_T len = wcslen( subkey ) + wcslen( username ) + wcslen( device ) + wcslen( guid ) + 1;
+ keyname = HeapAlloc( GetProcessHeap(), 0, sizeof(WCHAR) * len );
+ swprintf( keyname, len, subkey, username, device, guid );
/* The key used is HKCU\Software\Wine\DirectInput\Mappings\[username]\[device]\[mapping_guid] */
if (RegCreateKeyW(HKEY_CURRENT_USER, keyname, &hkey))
@@ -739,8 +739,9 @@ static HRESULT save_mapping_settings(IDirectInputDevice8W *iface, LPDIACTIONFORM
if (IsEqualGUID(&didev.guidInstance, &lpdiaf->rgoAction[i].guidInstance) &&
lpdiaf->rgoAction[i].dwHow != DIAH_UNMAPPED)
{
- sprintfW(label, format, lpdiaf->rgoAction[i].dwSemantic);
- RegSetValueExW(hkey, label, 0, REG_DWORD, (const BYTE*) &lpdiaf->rgoAction[i].dwObjID, sizeof(DWORD));
+ swprintf( label, 9, format, lpdiaf->rgoAction[i].dwSemantic );
+ RegSetValueExW( hkey, label, 0, REG_DWORD, (const BYTE *)&lpdiaf->rgoAction[i].dwObjID,
+ sizeof(DWORD) );
}
}
@@ -778,7 +779,7 @@ static BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMAT
DWORD id, size = sizeof(DWORD);
WCHAR label[9];
- sprintfW(label, format, lpdiaf->rgoAction[i].dwSemantic);
+ swprintf( label, 9, format, lpdiaf->rgoAction[i].dwSemantic );
if (!RegQueryValueExW(hkey, label, 0, NULL, (LPBYTE) &id, &size))
{
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c
index 88f338a426d..06eef8aa168 100644
--- a/dlls/dinput/dinput_main.c
+++ b/dlls/dinput/dinput_main.c
@@ -30,7 +30,6 @@
* - Fallout : works great in X and DGA mode
*/
-#include "config.h"
#include <assert.h>
#include <stdarg.h>
#include <string.h>
@@ -38,9 +37,6 @@
#define COBJMACROS
#define NONAMELESSUNION
-#include "wine/debug.h"
-#include "wine/unicode.h"
-#include "wine/asm.h"
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
@@ -49,9 +45,13 @@
#include "rpcproxy.h"
#include "initguid.h"
#include "devguid.h"
+#include "dinputd.h"
+
#include "dinput_private.h"
#include "device_private.h"
-#include "dinputd.h"
+
+#include "wine/asm.h"
+#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(dinput);
@@ -769,7 +769,7 @@ static BOOL should_enumerate_device(const WCHAR *username, DWORD dwFlags,
{
if (IsEqualGUID(&device_player->instance_guid, guid))
{
- if (*device_player->username && !lstrcmpW(username, device_player->username))
+ if (*device_player->username && !wcscmp( username, device_player->username ))
return TRUE; /* Device username matches */
break;
}
diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c
index 9af4ef8ba3f..c6345baf53d 100644
--- a/dlls/dinput/joystick_hid.c
+++ b/dlls/dinput/joystick_hid.c
@@ -43,7 +43,6 @@
#include "initguid.h"
#include "devpkey.h"
-#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/hid.h"
@@ -1857,7 +1856,7 @@ static HRESULT hid_joystick_device_open( int index, DIDEVICEINSTANCEW *filter, W
if (override)
{
if (!SetupDiGetDeviceInstanceIdW( set, &devinfo, device_id, MAX_PATH, NULL ) ||
- !(tmp = strstrW( device_id, ig_w )))
+ !(tmp = wcsstr( device_id, ig_w )))
goto next;
memcpy( tmp, xi_w, sizeof(xi_w) - sizeof(WCHAR) );
if (!SetupDiOpenDeviceInfoW( xi_set, device_id, NULL, 0, &devinfo ))
diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c
index 3e1cac1733f..fc821e2399d 100644
--- a/dlls/dinput/keyboard.c
+++ b/dlls/dinput/keyboard.c
@@ -20,9 +20,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "config.h"
-#include "wine/port.h"
-
#include <stdarg.h>
#include <string.h>
#include "windef.h"
@@ -34,7 +31,6 @@
#include "dinput_private.h"
#include "device_private.h"
#include "wine/debug.h"
-#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(dinput);
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c
index 0ab791c69a5..34710c5cdb0 100644
--- a/dlls/dinput/mouse.c
+++ b/dlls/dinput/mouse.c
@@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "config.h"
-#include "wine/port.h"
-
#include <stdarg.h>
#include <string.h>
@@ -37,7 +34,6 @@
#include "dinput_private.h"
#include "device_private.h"
#include "wine/debug.h"
-#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(dinput);
@@ -160,10 +156,8 @@ static HRESULT alloc_device( REFGUID rguid, IDirectInputImpl *dinput, SysMouseIm
get_app_key(&hkey, &appkey);
if (!get_config_key(hkey, appkey, mouse_wrap_override_w, buffer, sizeof(buffer)))
{
- if (!strncmpiW(buffer, disable_w, -1))
- newDevice->warp_override = WARP_DISABLE;
- else if (!strncmpiW(buffer, force_w, -1))
- newDevice->warp_override = WARP_FORCE_ON;
+ if (!wcsnicmp( buffer, disable_w, -1 )) newDevice->warp_override = WARP_DISABLE;
+ else if (!wcsnicmp( buffer, force_w, -1 )) newDevice->warp_override = WARP_FORCE_ON;
}
if (appkey) RegCloseKey(appkey);
if (hkey) RegCloseKey(hkey);
@@ -702,11 +696,14 @@ static HRESULT WINAPI SysMouseWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
res = IDirectInputDevice2WImpl_GetObjectInfo(iface, pdidoi, dwObj, dwHow);
if (res != DI_OK) return res;
- if (IsEqualGUID(&pdidoi->guidType, &GUID_XAxis)) strcpyW(pdidoi->tszName, x_axisW);
- else if (IsEqualGUID(&pdidoi->guidType, &GUID_YAxis)) strcpyW(pdidoi->tszName, y_axisW);
- else if (IsEqualGUID(&pdidoi->guidType, &GUID_ZAxis)) strcpyW(pdidoi->tszName, wheelW);
+ if (IsEqualGUID( &pdidoi->guidType, &GUID_XAxis ))
+ wcscpy( pdidoi->tszName, x_axisW );
+ else if (IsEqualGUID( &pdidoi->guidType, &GUID_YAxis ))
+ wcscpy( pdidoi->tszName, y_axisW );
+ else if (IsEqualGUID( &pdidoi->guidType, &GUID_ZAxis ))
+ wcscpy( pdidoi->tszName, wheelW );
else if (pdidoi->dwType & DIDFT_BUTTON)
- wsprintfW(pdidoi->tszName, buttonW, DIDFT_GETINSTANCE(pdidoi->dwType) - 3);
+ swprintf( pdidoi->tszName, MAX_PATH, buttonW, DIDFT_GETINSTANCE( pdidoi->dwType ) - 3 );
if(pdidoi->dwType & DIDFT_AXIS)
pdidoi->dwFlags |= DIDOI_ASPECTPOSITION;
diff --git a/dlls/dinput8/Makefile.in b/dlls/dinput8/Makefile.in
index 1d3574aa1a0..164f2458da7 100644
--- a/dlls/dinput8/Makefile.in
+++ b/dlls/dinput8/Makefile.in
@@ -4,8 +4,6 @@ IMPORTS = dinput8 dxguid uuid comctl32 ole32 user32 advapi32 hid setupapi
EXTRADEFS = -DDIRECTINPUT_VERSION=0x0800
PARENTSRC = ../dinput
-EXTRADLLFLAGS = -mcygwin
-
C_SRCS = \
ansi.c \
config.c \
--
2.33.0
More information about the wine-devel
mailing list