winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
October 2021
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
1165 discussions
Start a n
N
ew thread
Rémi Bernon : dinput: Always use the data format transform.
by Alexandre Julliard
28 Oct '21
28 Oct '21
Module: wine Branch: master Commit: f82cce060d9413f8b4f290228fe0916e77a8fd98 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f82cce060d9413f8b4f29022…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Oct 28 10:12:34 2021 +0200 dinput: Always use the data format transform. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/device.c | 20 ++------------------ dlls/dinput/device_private.h | 1 - 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 5e3e54e5754..6601d705462 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -342,10 +342,6 @@ static void fill_DataFormat( void *out, DWORD size, const void *in, const DataFo char *out_c = out; memset(out, 0, size); - if (df->dt == NULL) { - /* This means that the app uses Wine's internal data format */ - memcpy(out, in, min(size, df->internal_format_size)); - } else { for (i = 0; i < df->size; i++) { if (df->dt[i].offset_in >= 0) { switch (df->dt[i].size) { @@ -396,7 +392,6 @@ static void fill_DataFormat( void *out, DWORD size, const void *in, const DataFo break; } } - } } } @@ -444,7 +439,6 @@ static HRESULT dinput_device_init_user_format( struct dinput_device *impl, const DataFormat *format = &impl->data_format; DataTransform *dt; unsigned int i, j; - int same = 1; int *done; int index = 0; DWORD next = 0; @@ -517,11 +511,8 @@ static HRESULT dinput_device_init_user_format( struct dinput_device *impl, const format->offsets[i] = asked_format->rgodf[j].dwOfs; dt[index].value = 0; next = next + dt[index].size; - - if (format->wine_df->rgodf[i].dwOfs != dt[index].offset_out) - same = 0; - - index++; + + index++; break; } } @@ -540,8 +531,6 @@ static HRESULT dinput_device_init_user_format( struct dinput_device *impl, const TRACE(" * dwFlags: 0x%08x\n", asked_format->rgodf[j].dwFlags); TRACE(" "); _dump_ObjectDataFormat_flags(asked_format->rgodf[j].dwFlags); TRACE("\n"); - same = 0; - if (!(asked_format->rgodf[j].dwType & DIDFT_POV)) continue; /* fill_DataFormat memsets the buffer to 0 */ @@ -556,12 +545,7 @@ static HRESULT dinput_device_init_user_format( struct dinput_device *impl, const } } - format->internal_format_size = format->wine_df->dwDataSize; format->size = index; - if (same) { - free( dt ); - dt = NULL; - } format->dt = dt; free( done ); diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index 4420f59cc6d..1b81a374058 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -39,7 +39,6 @@ typedef struct typedef struct { int size; - int internal_format_size; DataTransform *dt; int *offsets; /* object offsets */
1
0
0
0
Rémi Bernon : dinput: Implement SetProperty DIPROP_APPDATA using enum_objects.
by Alexandre Julliard
28 Oct '21
28 Oct '21
Module: wine Branch: master Commit: 998b9d86661450e2fe4db03b68e930297e18964c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=998b9d86661450e2fe4db03b…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Oct 28 10:12:33 2021 +0200 dinput: Implement SetProperty DIPROP_APPDATA using enum_objects. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/device.c | 36 +++++++++--------------------------- dlls/dinput8/tests/hid.c | 1 - 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 52a6e14ab8d..5e3e54e5754 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -580,22 +580,6 @@ failed: return DIERR_OUTOFMEMORY; } -static int verify_offset(const DataFormat *df, int offset) -{ - int i; - - if (!df->offsets) - return -1; - - for (i = df->wine_df->dwNumObjs - 1; i >= 0; i--) - { - if (df->offsets[i] == offset) - return offset; - } - - return -1; -} - static int id_to_object( LPCDIDATAFORMAT df, int id ) { int i; @@ -1320,6 +1304,8 @@ static HRESULT WINAPI dinput_device_SetProperty( IDirectInputDevice8W *iface, co { struct set_object_property_params params = {.iface = iface, .header = header, .property = LOWORD( guid )}; struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); + DWORD object_mask = DIDFT_AXIS | DIDFT_BUTTON | DIDFT_POV; + DIDEVICEOBJECTINSTANCEW instance; DIPROPHEADER filter; HRESULT hr; @@ -1421,18 +1407,14 @@ static HRESULT WINAPI dinput_device_SetProperty( IDirectInputDevice8W *iface, co case (DWORD_PTR)DIPROP_APPDATA: { const DIPROPPOINTER *value = (const DIPROPPOINTER *)header; - int offset = -1; + int user_offset; if (header->dwSize != sizeof(DIPROPPOINTER)) return DIERR_INVALIDPARAM; - - if (header->dwHow == DIPH_BYID) - offset = id_to_offset( &impl->data_format, header->dwObj ); - else if (header->dwHow == DIPH_BYOFFSET) - offset = verify_offset( &impl->data_format, header->dwObj ); - else - return DIERR_UNSUPPORTED; - - if (offset == -1) return DIERR_OBJECTNOTFOUND; - if (!set_app_data( impl, offset, value->uData )) return DIERR_OUTOFMEMORY; + if (header->dwHow == DIPH_DEVICE) return DIERR_UNSUPPORTED; + hr = impl->vtbl->enum_objects( iface, &filter, object_mask, find_object, &instance ); + if (FAILED(hr)) return hr; + if (hr == DIENUM_CONTINUE) return DIERR_OBJECTNOTFOUND; + if ((user_offset = id_to_offset( &impl->data_format, instance.dwType )) < 0) return DIERR_OBJECTNOTFOUND; + if (!set_app_data( impl, user_offset, value->uData )) return DIERR_OUTOFMEMORY; return DI_OK; } default: diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 526e191ea41..2f2efbe09e3 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -4794,7 +4794,6 @@ static void test_simple_joystick(void) prop_pointer.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC ); prop_pointer.uData = 0xfeedcafe; hr = IDirectInputDevice8_SetProperty( device, DIPROP_APPDATA, &prop_pointer.diph ); - todo_wine ok( hr == DI_OK, "SetProperty DIPROP_APPDATA returned %#x\n", hr ); prop_dword.dwData = 0xdeadbeef;
1
0
0
0
Rémi Bernon : dinput: Move user data format to struct dinput_device.
by Alexandre Julliard
28 Oct '21
28 Oct '21
Module: wine Branch: master Commit: 8847de46ecdd9b602875006e33a926e544c9ecf6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8847de46ecdd9b602875006e…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Oct 28 10:12:32 2021 +0200 dinput: Move user data format to struct dinput_device. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/device.c | 45 ++++++++++++++++++++++---------------------- dlls/dinput/device_private.h | 2 +- dlls/dinput/mouse.c | 6 +++--- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 5b96002ea4a..52a6e14ab8d 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -400,16 +400,14 @@ static void fill_DataFormat( void *out, DWORD size, const void *in, const DataFo } } -static void release_DataFormat( DataFormat *format ) +static void dinput_device_release_user_format( struct dinput_device *impl ) { - TRACE("Deleting DataFormat: %p\n", format); - - free( format->dt ); - format->dt = NULL; - free( format->offsets ); - format->offsets = NULL; - free( format->user_df ); - format->user_df = NULL; + free( impl->data_format.dt ); + impl->data_format.dt = NULL; + free( impl->data_format.offsets ); + impl->data_format.offsets = NULL; + free( impl->user_format ); + impl->user_format = NULL; } static inline LPDIOBJECTDATAFORMAT dataformat_to_odf(LPCDIDATAFORMAT df, int idx) @@ -441,8 +439,9 @@ LPDIOBJECTDATAFORMAT dataformat_to_odf_by_type(LPCDIDATAFORMAT df, int n, DWORD return NULL; } -static HRESULT create_DataFormat(LPCDIDATAFORMAT asked_format, DataFormat *format) +static HRESULT dinput_device_init_user_format( struct dinput_device *impl, const DIDATAFORMAT *asked_format ) { + DataFormat *format = &impl->data_format; DataTransform *dt; unsigned int i, j; int same = 1; @@ -456,8 +455,8 @@ static HRESULT create_DataFormat(LPCDIDATAFORMAT asked_format, DataFormat *forma if (!dt || !done) goto failed; if (!(format->offsets = malloc( format->wine_df->dwNumObjs * sizeof(int) ))) goto failed; - if (!(format->user_df = malloc( asked_format->dwSize ))) goto failed; - memcpy(format->user_df, asked_format, asked_format->dwSize); + if (!(impl->user_format = malloc( asked_format->dwSize ))) goto failed; + memcpy( impl->user_format, asked_format, asked_format->dwSize ); TRACE("Creating DataTransform :\n"); @@ -575,8 +574,8 @@ failed: format->dt = NULL; free( format->offsets ); format->offsets = NULL; - free( format->user_df ); - format->user_df = NULL; + free( impl->user_format ); + impl->user_format = NULL; return DIERR_OUTOFMEMORY; } @@ -863,7 +862,7 @@ static HRESULT WINAPI dinput_device_Acquire( IDirectInputDevice8W *iface ) EnterCriticalSection( &impl->crit ); if (impl->acquired) hr = DI_NOEFFECT; - else if (!impl->data_format.user_df) + else if (!impl->user_format) hr = DIERR_INVALIDPARAM; else if ((impl->dwCoopLevel & DISCL_FOREGROUND) && impl->win != GetForegroundWindow()) hr = DIERR_OTHERAPPHASPRIO; @@ -934,8 +933,8 @@ static HRESULT WINAPI dinput_device_SetDataFormat( IDirectInputDevice8W *iface, This->action_map = NULL; This->num_actions = 0; - release_DataFormat(&This->data_format); - res = create_DataFormat( format, &This->data_format ); + dinput_device_release_user_format( This ); + res = dinput_device_init_user_format( This, format ); LeaveCriticalSection(&This->crit); return res; @@ -1036,7 +1035,7 @@ void dinput_device_destroy( IDirectInputDevice8W *iface ) /* Free data format */ free( This->data_format.wine_df->rgodf ); free( This->data_format.wine_df ); - release_DataFormat(&This->data_format); + dinput_device_release_user_format( This ); /* Free action mapping */ free( This->action_map ); @@ -1387,11 +1386,11 @@ static HRESULT WINAPI dinput_device_SetProperty( IDirectInputDevice8W *iface, co TRACE( "Axis mode: %s\n", value->dwData == DIPROPAXISMODE_ABS ? "absolute" : "relative" ); EnterCriticalSection( &impl->crit ); if (impl->acquired) hr = DIERR_ACQUIRED; - else if (!impl->data_format.user_df) hr = DI_OK; + else if (!impl->user_format) hr = DI_OK; else { - impl->data_format.user_df->dwFlags &= ~DIDFT_AXIS; - impl->data_format.user_df->dwFlags |= value->dwData == DIPROPAXISMODE_ABS ? DIDF_ABSAXIS : DIDF_RELAXIS; + impl->user_format->dwFlags &= ~DIDFT_AXIS; + impl->user_format->dwFlags |= value->dwData == DIPROPAXISMODE_ABS ? DIDF_ABSAXIS : DIDF_RELAXIS; hr = DI_OK; } LeaveCriticalSection( &impl->crit ); @@ -1531,12 +1530,12 @@ static HRESULT WINAPI dinput_device_GetDeviceState( IDirectInputDevice8W *iface, EnterCriticalSection( &impl->crit ); if (!impl->acquired) hr = DIERR_NOTACQUIRED; - else if (size != impl->data_format.user_df->dwDataSize) + else if (size != impl->user_format->dwDataSize) hr = DIERR_INVALIDPARAM; else { fill_DataFormat( data, size, impl->device_state, &impl->data_format ); - if (!(impl->data_format.user_df->dwFlags & DIDF_ABSAXIS)) + if (!(impl->user_format->dwFlags & DIDF_ABSAXIS)) impl->vtbl->enum_objects( iface, &filter, DIDFT_RELAXIS, reset_axis_data, impl->device_state ); hr = DI_OK; } diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index 7ee0ef312c0..4420f59cc6d 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -44,7 +44,6 @@ typedef struct int *offsets; /* object offsets */ LPDIDATAFORMAT wine_df; /* wine internal data format */ - LPDIDATAFORMAT user_df; /* user defined data format */ } DataFormat; typedef struct @@ -103,6 +102,7 @@ struct dinput_device DWORD buffersize; /* size of the queue - set in 'SetProperty' */ DataFormat data_format; /* user data format and wine to user format converter */ + DIDATAFORMAT *user_format; /* Action mapping */ int num_actions; /* number of actions mapped */ diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index 4e1762fbc50..628011c13e1 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -189,7 +189,7 @@ void dinput_mouse_rawinput_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPA state->lX += rel.x; state->lY += rel.y; - if (impl->base.data_format.user_df->dwFlags & DIDF_ABSAXIS) + if (impl->base.user_format->dwFlags & DIDF_ABSAXIS) { pt.x = state->lX; pt.y = state->lY; @@ -269,7 +269,7 @@ int dinput_mouse_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam state->lX += pt.x = hook->pt.x - pt.x; state->lY += pt.y = hook->pt.y - pt.y; - if (impl->base.data_format.user_df->dwFlags & DIDF_ABSAXIS) + if (impl->base.user_format->dwFlags & DIDF_ABSAXIS) { pt1.x = state->lX; pt1.y = state->lY; @@ -409,7 +409,7 @@ static HRESULT mouse_acquire( IDirectInputDevice8W *iface ) /* Init the mouse state */ GetCursorPos( &point ); - if (impl->base.data_format.user_df->dwFlags & DIDF_ABSAXIS) + if (impl->base.user_format->dwFlags & DIDF_ABSAXIS) { state->lX = point.x; state->lY = point.y;
1
0
0
0
Rémi Bernon : dinput8/tests: Add more HID joystick SetDataFormat tests.
by Alexandre Julliard
28 Oct '21
28 Oct '21
Module: wine Branch: master Commit: b2446501e9f785f2c6c555e28abe08c48e97e5b0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b2446501e9f785f2c6c555e2…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Oct 28 10:12:31 2021 +0200 dinput8/tests: Add more HID joystick SetDataFormat tests. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput8/tests/hid.c | 169 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index b23d3a6bfd8..526e191ea41 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -3764,6 +3764,7 @@ static void test_simple_joystick(void) .dwHeaderSize = sizeof(DIPROPHEADER), }, }; + DIOBJECTDATAFORMAT objdataformat[32] = {{0}}; WCHAR cwd[MAX_PATH], tempdir[MAX_PATH]; DIDEVICEOBJECTDATA objdata[32] = {{0}}; DIDEVICEOBJECTINSTANCEW objinst = {0}; @@ -4403,6 +4404,174 @@ static void test_simple_joystick(void) check_member( state, expect_state[3], "%#x", rgbButtons[1] ); check_member( state, expect_state[3], "%#x", rgbButtons[2] ); + hr = IDirectInputDevice8_Unacquire( device ); + ok( hr == DI_OK, "Unacquire returned: %#x\n", hr ); + + dataformat.dwSize = sizeof(DIDATAFORMAT); + dataformat.dwObjSize = sizeof(DIOBJECTDATAFORMAT); + dataformat.dwFlags = DIDF_ABSAXIS; + dataformat.dwDataSize = sizeof(buffer); + dataformat.dwNumObjs = 0; + dataformat.rgodf = objdataformat; + hr = IDirectInputDevice8_SetDataFormat( device, &dataformat ); + ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr ); + + dataformat.dwNumObjs = 1; + dataformat.dwDataSize = 8; + objdataformat[0].pguid = NULL; + objdataformat[0].dwOfs = 2; + objdataformat[0].dwType = DIDFT_AXIS|DIDFT_ANYINSTANCE; + objdataformat[0].dwFlags = 0; + hr = IDirectInputDevice8_SetDataFormat( device, &dataformat ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#x\n", hr ); + objdataformat[0].dwOfs = 4; + hr = IDirectInputDevice8_SetDataFormat( device, &dataformat ); + ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr ); + dataformat.dwDataSize = 10; + hr = IDirectInputDevice8_SetDataFormat( device, &dataformat ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#x\n", hr ); + dataformat.dwDataSize = 8; + objdataformat[0].dwOfs = 2; + objdataformat[0].dwType = DIDFT_OPTIONAL|0xff|DIDFT_ANYINSTANCE; + hr = IDirectInputDevice8_SetDataFormat( device, &dataformat ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#x\n", hr ); + + dataformat.dwNumObjs = 2; + dataformat.dwDataSize = 5; + objdataformat[0].pguid = NULL; + objdataformat[0].dwOfs = 4; + objdataformat[0].dwType = DIDFT_BUTTON|DIDFT_ANYINSTANCE; + objdataformat[0].dwFlags = 0; + objdataformat[1].pguid = NULL; + objdataformat[1].dwOfs = 0; + objdataformat[1].dwType = DIDFT_AXIS|DIDFT_MAKEINSTANCE( 0 ); + objdataformat[1].dwFlags = 0; + hr = IDirectInputDevice8_SetDataFormat( device, &dataformat ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#x\n", hr ); + dataformat.dwDataSize = 8; + hr = IDirectInputDevice8_SetDataFormat( device, &dataformat ); + ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr ); + + dataformat.dwNumObjs = 4; + dataformat.dwDataSize = 12; + objdataformat[0].pguid = NULL; + objdataformat[0].dwOfs = 0; + objdataformat[0].dwType = DIDFT_AXIS|DIDFT_MAKEINSTANCE( 0 ); + objdataformat[0].dwFlags = 0; + objdataformat[1].pguid = NULL; + objdataformat[1].dwOfs = 0; + objdataformat[1].dwType = DIDFT_AXIS|DIDFT_MAKEINSTANCE( 0 ); + objdataformat[1].dwFlags = 0; + objdataformat[2].pguid = &GUID_ZAxis; + objdataformat[2].dwOfs = 8; + objdataformat[2].dwType = 0xff|DIDFT_ANYINSTANCE; + objdataformat[2].dwFlags = 0; + objdataformat[3].pguid = &GUID_POV; + objdataformat[3].dwOfs = 0; + objdataformat[3].dwType = 0xff|DIDFT_ANYINSTANCE; + objdataformat[3].dwFlags = 0; + hr = IDirectInputDevice8_SetDataFormat( device, &dataformat ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#x\n", hr ); + objdataformat[1].dwType = DIDFT_AXIS|DIDFT_MAKEINSTANCE( 12 ); + hr = IDirectInputDevice8_SetDataFormat( device, &dataformat ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#x\n", hr ); + objdataformat[1].dwType = DIDFT_AXIS|DIDFT_MAKEINSTANCE( 0xff ); + hr = IDirectInputDevice8_SetDataFormat( device, &dataformat ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#x\n", hr ); + objdataformat[1].dwType = DIDFT_AXIS|DIDFT_MAKEINSTANCE( 1 ); + hr = IDirectInputDevice8_SetDataFormat( device, &dataformat ); + ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr ); + objdataformat[1].pguid = &GUID_RzAxis; + hr = IDirectInputDevice8_SetDataFormat( device, &dataformat ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#x\n", hr ); + objdataformat[1].pguid = &GUID_Unknown; + hr = IDirectInputDevice8_SetDataFormat( device, &dataformat ); + todo_wine + ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#x\n", hr ); + objdataformat[1].pguid = &GUID_YAxis; + hr = IDirectInputDevice8_SetDataFormat( device, &dataformat ); + ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr ); + objdataformat[1].pguid = NULL; + objdataformat[1].dwType = DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_MAKEINSTANCE( 0 ); + hr = IDirectInputDevice8_SetDataFormat( device, &dataformat ); + ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr ); + + dataformat.dwNumObjs = 0; + hr = IDirectInputDevice8_SetDataFormat( device, &dataformat ); + ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr ); + hr = IDirectInputDevice8_Acquire( device ); + ok( hr == DI_OK, "Unacquire returned: %#x\n", hr ); + + send_hid_input( file, &injected_input[4], sizeof(*injected_input) ); + res = WaitForSingleObject( event, 100 ); + todo_wine + ok( res == WAIT_TIMEOUT, "WaitForSingleObject failed\n" ); + ResetEvent( event ); + + hr = IDirectInputDevice8_GetDeviceState( device, dataformat.dwDataSize, buffer ); + ok( hr == DI_OK, "GetDeviceState returned: %#x\n", hr ); + hr = IDirectInputDevice8_Unacquire( device ); + ok( hr == DI_OK, "Unacquire returned: %#x\n", hr ); + + dataformat.dwNumObjs = 4; + hr = IDirectInputDevice8_SetDataFormat( device, &dataformat ); + ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr ); + hr = IDirectInputDevice8_Acquire( device ); + ok( hr == DI_OK, "Unacquire returned: %#x\n", hr ); + + send_hid_input( file, &injected_input[4], sizeof(*injected_input) ); + res = WaitForSingleObject( event, 100 ); + todo_wine + ok( res == WAIT_OBJECT_0, "WaitForSingleObject failed\n" ); + ResetEvent( event ); + send_hid_input( file, &injected_input[3], sizeof(*injected_input) ); + res = WaitForSingleObject( event, 100 ); + ok( res == WAIT_OBJECT_0, "WaitForSingleObject failed\n" ); + ResetEvent( event ); + + hr = IDirectInputDevice8_GetDeviceState( device, dataformat.dwDataSize, buffer ); + ok( hr == DI_OK, "GetDeviceState returned: %#x\n", hr ); + todo_wine + ok( ((ULONG *)buffer)[0] == 0x512b, "got %#x, expected %#x\n", ((ULONG *)buffer)[0], 0x512b ); + ok( ((ULONG *)buffer)[1] == 0, "got %#x, expected %#x\n", ((ULONG *)buffer)[1], 0 ); + ok( ((ULONG *)buffer)[2] == 0x7fff, "got %#x, expected %#x\n", ((ULONG *)buffer)[2], 0x7fff ); + hr = IDirectInputDevice8_Unacquire( device ); + ok( hr == DI_OK, "Unacquire returned: %#x\n", hr ); + + hr = IDirectInputDevice8_SetDataFormat( device, &c_dfDIJoystick2 ); + ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr ); + hr = IDirectInputDevice8_Acquire( device ); + ok( hr == DI_OK, "Unacquire returned: %#x\n", hr ); + + send_hid_input( file, &injected_input[4], sizeof(*injected_input) ); + res = WaitForSingleObject( event, 100 ); + ok( res == WAIT_OBJECT_0, "WaitForSingleObject failed\n" ); + ResetEvent( event ); + send_hid_input( file, &injected_input[3], sizeof(*injected_input) ); + res = WaitForSingleObject( event, 100 ); + ok( res == WAIT_OBJECT_0, "WaitForSingleObject failed\n" ); + ResetEvent( event ); + + hr = IDirectInputDevice8_GetDeviceState( device, sizeof(DIJOYSTATE2), &state ); + ok( hr == DI_OK, "GetDeviceState returned: %#x\n", hr ); + check_member( state, expect_state[3], "%d", lX ); + check_member( state, expect_state[3], "%d", lY ); + check_member( state, expect_state[3], "%d", lZ ); + check_member( state, expect_state[3], "%d", lRx ); + check_member( state, expect_state[3], "%d", rgdwPOV[0] ); + check_member( state, expect_state[3], "%d", rgdwPOV[1] ); + check_member( state, expect_state[3], "%#x", rgbButtons[0] ); + check_member( state, expect_state[3], "%#x", rgbButtons[1] ); + check_member( state, expect_state[3], "%#x", rgbButtons[2] ); + prop_range.diph.dwHow = DIPH_DEVICE; prop_range.diph.dwObj = 0; prop_range.lMin = 1000;
1
0
0
0
Rémi Bernon : dinput: Reduce data format trace verbosity.
by Alexandre Julliard
28 Oct '21
28 Oct '21
Module: wine Branch: master Commit: 6934e139d1add6732704e640767165a738693524 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6934e139d1add6732704e640…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Oct 28 10:12:30 2021 +0200 dinput: Reduce data format trace verbosity. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/device.c | 63 ++++++++++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 36 deletions(-) diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 040a97eb06b..5b96002ea4a 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -67,6 +67,20 @@ static inline IDirectInputDevice8W *IDirectInputDevice8W_from_impl( struct dinpu return &This->IDirectInputDevice8W_iface; } +static inline const char *debugstr_didataformat( const DIDATAFORMAT *data ) +{ + if (!data) return "(null)"; + return wine_dbg_sprintf( "%p dwSize %u, dwObjsize %u, dwFlags %#x, dwDataSize %u, dwNumObjs %u, rgodf %p", + data, data->dwSize, data->dwObjSize, data->dwFlags, data->dwDataSize, data->dwNumObjs, data->rgodf ); +} + +static inline const char *debugstr_diobjectdataformat( const DIOBJECTDATAFORMAT *data ) +{ + if (!data) return "(null)"; + return wine_dbg_sprintf( "%p pguid %s, dwOfs %#x, dwType %#x, dwFlags %#x", data, + debugstr_guid( data->pguid ), data->dwOfs, data->dwType, data->dwFlags ); +} + /****************************************************************************** * Various debugging tools */ @@ -225,40 +239,6 @@ static const char *_dump_dinput_GUID( const GUID *guid ) return debugstr_guid(guid); } -static void _dump_DIDATAFORMAT( const DIDATAFORMAT *df ) -{ - unsigned int i; - - TRACE("Dumping DIDATAFORMAT structure:\n"); - TRACE(" - dwSize: %d\n", df->dwSize); - if (df->dwSize != sizeof(DIDATAFORMAT)) { - WARN("Non-standard DIDATAFORMAT structure size %d\n", df->dwSize); - } - TRACE(" - dwObjsize: %d\n", df->dwObjSize); - if (df->dwObjSize != sizeof(DIOBJECTDATAFORMAT)) { - WARN("Non-standard DIOBJECTDATAFORMAT structure size %d\n", df->dwObjSize); - } - TRACE(" - dwFlags: 0x%08x (", df->dwFlags); - switch (df->dwFlags) { - case DIDF_ABSAXIS: TRACE("DIDF_ABSAXIS"); break; - case DIDF_RELAXIS: TRACE("DIDF_RELAXIS"); break; - default: TRACE("unknown"); break; - } - TRACE(")\n"); - TRACE(" - dwDataSize: %d\n", df->dwDataSize); - TRACE(" - dwNumObjs: %d\n", df->dwNumObjs); - - for (i = 0; i < df->dwNumObjs; i++) { - TRACE(" - Object %d:\n", i); - TRACE(" * GUID: %s ('%s')\n", debugstr_guid(df->rgodf[i].pguid), _dump_dinput_GUID(df->rgodf[i].pguid)); - TRACE(" * dwOfs: %d\n", df->rgodf[i].dwOfs); - TRACE(" * dwType: 0x%08x\n", df->rgodf[i].dwType); - TRACE(" "); _dump_EnumObjects_flags(df->rgodf[i].dwType); TRACE("\n"); - TRACE(" * dwFlags: 0x%08x\n", df->rgodf[i].dwFlags); - TRACE(" "); _dump_ObjectDataFormat_flags(df->rgodf[i].dwFlags); TRACE("\n"); - } -} - /****************************************************************************** * Get the default and the app-specific config keys. */ @@ -933,11 +913,16 @@ static HRESULT WINAPI dinput_device_SetDataFormat( IDirectInputDevice8W *iface, { struct dinput_device *This = impl_from_IDirectInputDevice8W( iface ); HRESULT res = DI_OK; + ULONG i; TRACE( "iface %p, format %p.\n", iface, format ); if (!format) return E_POINTER; - _dump_DIDATAFORMAT( format ); + if (TRACE_ON( dinput )) + { + TRACE( "user format %s\n", debugstr_didataformat( format ) ); + for (i = 0; i < format->dwNumObjs; ++i) TRACE( " %u: object %s\n", i, debugstr_diobjectdataformat( format->rgodf + i ) ); + } if (format->dwSize != sizeof(DIDATAFORMAT)) return DIERR_INVALIDPARAM; if (format->dwObjSize != sizeof(DIOBJECTDATAFORMAT)) return DIERR_INVALIDPARAM; @@ -2182,7 +2167,7 @@ HRESULT dinput_device_init( IDirectInputDevice8W *iface ) { struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); DIDATAFORMAT *format = impl->data_format.wine_df; - ULONG size; + ULONG i, size; IDirectInputDevice8_EnumObjects( iface, enum_objects_init, iface, DIDFT_ALL ); if (format->dwDataSize > DEVICE_STATE_MAX_SIZE) @@ -2199,5 +2184,11 @@ HRESULT dinput_device_init( IDirectInputDevice8W *iface ) format->dwNumObjs = 0; IDirectInputDevice8_EnumObjects( iface, enum_objects_init, iface, DIDFT_ALL ); + if (TRACE_ON( dinput )) + { + TRACE( "device format %s\n", debugstr_didataformat( format ) ); + for (i = 0; i < format->dwNumObjs; ++i) TRACE( " %u: object %s\n", i, debugstr_diobjectdataformat( format->rgodf + i ) ); + } + return DI_OK; }
1
0
0
0
Alexandre Julliard : sane.ds: Use CRT memory allocation functions.
by Alexandre Julliard
28 Oct '21
28 Oct '21
Module: wine Branch: master Commit: 3578b2a74fa88b922a3a13ee7d55bf0b6daf80bf URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3578b2a74fa88b922a3a13ee…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Oct 28 13:01:10 2021 +0200 sane.ds: Use CRT memory allocation functions. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/sane.ds/ui.c | 58 ++++++++++++++++++++++--------------------------------- 1 file changed, 23 insertions(+), 35 deletions(-) diff --git a/dlls/sane.ds/ui.c b/dlls/sane.ds/ui.c index 918dbe47a88..8be7ed42b70 100644 --- a/dlls/sane.ds/ui.c +++ b/dlls/sane.ds/ui.c @@ -61,7 +61,7 @@ static int create_leading_static(HDC hdc, const WCHAR *text, len += sizeof(DLGITEMTEMPLATE); len += 4*sizeof(WORD); - tpl = HeapAlloc(GetProcessHeap(),0,len); + tpl = malloc(len); tpl->style=WS_VISIBLE; tpl->dwExtendedStyle = 0; tpl->x = 4; @@ -100,7 +100,7 @@ static int create_trailing_edit(HDC hdc, LPDLGITEMTEMPLATEW* template_out, int i len += sizeof(DLGITEMTEMPLATE); len += 4*sizeof(WORD); - tpl = HeapAlloc(GetProcessHeap(),0,len); + tpl = malloc(len); tpl->style=WS_VISIBLE|ES_READONLY|WS_BORDER; tpl->dwExtendedStyle = 0; tpl->x = 1; @@ -189,12 +189,12 @@ static int create_item(HDC hdc, const struct option_descriptor *opt, } case TYPE_FIXED: { - int *i = HeapAlloc(GetProcessHeap(),0,opt->size*sizeof(int)); + int *i = calloc( opt->size, sizeof(int) ); sane_option_get_value( id - ID_BASE, i ); swprintf(buffer, ARRAY_SIZE(buffer), L"%f", *i / 65536.0); - HeapFree(GetProcessHeap(),0,i); + free( i ); switch (opt->constraint_type) { @@ -251,15 +251,9 @@ static int create_item(HDC hdc, const struct option_descriptor *opt, if (title) local_len += lstrlenW(title) * sizeof(WCHAR); local_len += 4*sizeof(WORD); - if (lead_static) - { - padding = leading_len % sizeof(DWORD); - rc = HeapReAlloc(GetProcessHeap(),0,lead_static,leading_len+local_len + padding); - tpl = (LPDLGITEMTEMPLATEW)((LPBYTE)rc + leading_len + padding); - } - else - rc = tpl = HeapAlloc(GetProcessHeap(),0,local_len); - + padding = leading_len % sizeof(DWORD); + rc = realloc(lead_static, leading_len + local_len + padding); + tpl = (LPDLGITEMTEMPLATEW)((LPBYTE)rc + leading_len + padding); tpl->style=styles; tpl->dwExtendedStyle = 0; if (lead_static) @@ -307,8 +301,7 @@ static int create_item(HDC hdc, const struct option_descriptor *opt, padding2 = (leading_len + local_len + padding)% sizeof(DWORD); - rc = HeapReAlloc(GetProcessHeap(),0,rc,leading_len+local_len + padding - +padding2+trail_len); + rc = realloc( rc, leading_len + local_len + padding +padding2 + trail_len); memcpy(((LPBYTE)rc) + leading_len + local_len + padding + padding2, trail_edit,trail_len); @@ -389,13 +382,10 @@ static LPDLGTEMPLATEW create_options_page(HDC hdc, int *from_index, if (all_controls) { - LPBYTE newone; - newone = HeapReAlloc(GetProcessHeap(),0,all_controls, - control_len + len + padding); - all_controls = newone; + all_controls = realloc(all_controls, control_len + len + padding); memcpy(all_controls+control_len,item_tpl,len); memset(all_controls+control_len+len,0xca,padding); - HeapFree(GetProcessHeap(),0,item_tpl); + free(item_tpl); } else { @@ -405,10 +395,10 @@ static LPDLGTEMPLATEW create_options_page(HDC hdc, int *from_index, } else { - all_controls = HeapAlloc(GetProcessHeap(),0,len + padding); + all_controls = malloc(len + padding); memcpy(all_controls,item_tpl,len); memset(all_controls+len,0xcb,padding); - HeapFree(GetProcessHeap(),0,item_tpl); + free(item_tpl); } } @@ -450,8 +440,7 @@ static LPDLGTEMPLATEW create_options_page(HDC hdc, int *from_index, *from_index = i-1; exit: - tpl = HeapAlloc(GetProcessHeap(),0,sizeof(DLGTEMPLATE) + 3*sizeof(WORD) + - control_len); + tpl = malloc(sizeof(DLGTEMPLATE) + 3*sizeof(WORD) + control_len); tpl->style = WS_VISIBLE | WS_OVERLAPPEDWINDOW; tpl->dwExtendedStyle = 0; @@ -469,7 +458,7 @@ exit: ptr+=sizeof(WORD); memcpy(ptr,all_controls,control_len); - HeapFree(GetProcessHeap(),0,all_controls); + free(all_controls); return tpl; } @@ -508,9 +497,7 @@ BOOL DoScannerUI(void) if (opt.type == TYPE_GROUP) { - LPWSTR title = HeapAlloc(GetProcessHeap(),0,(lstrlenW(opt.title) + 1) * sizeof(WCHAR)); - lstrcpyW( title, opt.title ); - psp[page_count].pszTitle = title; + psp[page_count].pszTitle = wcsdup( opt.title ); } if (psp[page_count].u.pResource) @@ -528,7 +515,7 @@ BOOL DoScannerUI(void) len = lstrlenA(activeDS.identity.Manufacturer) + lstrlenA(activeDS.identity.ProductName) + 2; - szCaption = HeapAlloc(GetProcessHeap(),0,len *sizeof(WCHAR)); + szCaption = malloc(len *sizeof(WCHAR)); MultiByteToWideChar(CP_ACP,0,activeDS.identity.Manufacturer,-1, szCaption,len); szCaption[lstrlenA(activeDS.identity.Manufacturer)] = ' '; @@ -549,10 +536,10 @@ BOOL DoScannerUI(void) for(index = 0; index < page_count; index ++) { - HeapFree(GetProcessHeap(),0,(LPBYTE)psp[index].u.pResource); - HeapFree(GetProcessHeap(),0,(LPBYTE)psp[index].pszTitle); + free((LPBYTE)psp[index].u.pResource); + free((LPBYTE)psp[index].pszTitle); } - HeapFree(GetProcessHeap(),0,szCaption); + free(szCaption); if (psrc == IDOK) return TRUE; @@ -739,7 +726,7 @@ static INT_PTR InitializeDialog(HWND hwnd) SendMessageA(control,SBM_SETRANGE,min,max); - sf = HeapAlloc(GetProcessHeap(),0,opt.size*sizeof(int)); + sf = calloc( opt.size, sizeof(int) ); sane_option_get_value( i, sf ); /* Note that conversion of float -> SANE_Fixed is lossy; @@ -751,7 +738,7 @@ static INT_PTR InitializeDialog(HWND hwnd) else pos = MulDiv( *sf, 100, 65536 ); - HeapFree(GetProcessHeap(),0,sf); + free(sf); SendMessageW(control, SBM_SETPOS, pos, TRUE); UpdateRelevantEdit(hwnd, &opt, pos); } @@ -851,7 +838,7 @@ static void ComboChanged(HWND hwnd, INT id, HWND control) len = SendMessageW(control,CB_GETLBTEXTLEN,selection,0); len++; - value = HeapAlloc(GetProcessHeap(),0,len); + value = malloc(len); SendMessageA(control,CB_GETLBTEXT,selection,(LPARAM)value); if (opt.type == TYPE_STRING) @@ -864,6 +851,7 @@ static void ComboChanged(HWND hwnd, INT id, HWND control) sane_option_set_value( opt.optno, &val, &changed ); } if (changed) InitializeDialog(hwnd); + free( value ); }
1
0
0
0
Alexandre Julliard : sane.ds: Build with msvcrt.
by Alexandre Julliard
28 Oct '21
28 Oct '21
Module: wine Branch: master Commit: 1fe2a12bfbc051ed49a1bd3ea28d10ee36226507 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1fe2a12bfbc051ed49a1bd3e…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Oct 27 16:59:23 2021 +0200 sane.ds: Build with msvcrt. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/sane.ds/Makefile.in | 2 -- dlls/sane.ds/capability.c | 2 -- dlls/sane.ds/ds_ctrl.c | 5 ----- dlls/sane.ds/ds_image.c | 2 -- dlls/sane.ds/options.c | 14 ++++---------- dlls/sane.ds/sane_i.h | 4 ---- dlls/sane.ds/sane_main.c | 6 +----- dlls/sane.ds/ui.c | 39 ++++++++++++++++----------------------- 8 files changed, 21 insertions(+), 53 deletions(-) diff --git a/dlls/sane.ds/Makefile.in b/dlls/sane.ds/Makefile.in index 3e7c1291093..59ceeda3fac 100644 --- a/dlls/sane.ds/Makefile.in +++ b/dlls/sane.ds/Makefile.in @@ -4,8 +4,6 @@ IMPORTS = comctl32 user32 gdi32 EXTRALIBS = $(SANE_LIBS) EXTRAINCL = $(SANE_CFLAGS) -EXTRADLLFLAGS = -mcygwin - C_SRCS = \ capability.c \ ds_ctrl.c \ diff --git a/dlls/sane.ds/capability.c b/dlls/sane.ds/capability.c index edddfe9344a..8c0922ca176 100644 --- a/dlls/sane.ds/capability.c +++ b/dlls/sane.ds/capability.c @@ -16,8 +16,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include <stdarg.h> #include <stdio.h> #include <math.h> diff --git a/dlls/sane.ds/ds_ctrl.c b/dlls/sane.ds/ds_ctrl.c index 513086ac8de..915f085a481 100644 --- a/dlls/sane.ds/ds_ctrl.c +++ b/dlls/sane.ds/ds_ctrl.c @@ -16,11 +16,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - -#ifdef HAVE_UNISTD_H -# include <unistd.h> -#endif #include <stdlib.h> #include "sane_i.h" #include "wine/debug.h" diff --git a/dlls/sane.ds/ds_image.c b/dlls/sane.ds/ds_image.c index da75dac9d4b..b2fad94c848 100644 --- a/dlls/sane.ds/ds_image.c +++ b/dlls/sane.ds/ds_image.c @@ -17,8 +17,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include <stdarg.h> #include "sane_i.h" diff --git a/dlls/sane.ds/options.c b/dlls/sane.ds/options.c index a8e7e232b07..52e73a99925 100644 --- a/dlls/sane.ds/options.c +++ b/dlls/sane.ds/options.c @@ -16,15 +16,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include <stdarg.h> #include <stdlib.h> #include "windef.h" #include "winbase.h" #include "winnls.h" #include "sane_i.h" -#include "wine/unicode.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(twain); @@ -143,14 +140,11 @@ TW_UINT16 sane_option_probe_mode(TW_UINT16 *current, TW_UINT32 *choices, int *co *count = 0; if (opt.constraint_type == CONSTRAINT_STRING_LIST) { - for (p = opt.constraint.strings; *p; p += strlenW(p) + 1) + for (p = opt.constraint.strings; *p; p += lstrlenW(p) + 1) { - static const WCHAR lineartW[] = {'L','i','n','e','a','r','t',0}; - static const WCHAR colorW[] = {'C','o','l','o','r',0}; - static const WCHAR grayW[] = {'G','r','a','y',0}; - if (!strcmpW( p, lineartW )) choices[(*count)++] = TWPT_BW; - else if (!strcmpW( p, colorW )) choices[(*count)++] = TWPT_RGB; - else if (!strncmpW( p, grayW, 4 )) choices[(*count)++] = TWPT_GRAY; + if (!wcscmp( p, L"Lineart" )) choices[(*count)++] = TWPT_BW; + else if (!wcscmp( p, L"Color" )) choices[(*count)++] = TWPT_RGB; + else if (!wcsncmp( p, L"Gray", 4 )) choices[(*count)++] = TWPT_GRAY; } } return rc; diff --git a/dlls/sane.ds/sane_i.h b/dlls/sane.ds/sane_i.h index 18ba582877f..db71b87995e 100644 --- a/dlls/sane.ds/sane_i.h +++ b/dlls/sane.ds/sane_i.h @@ -19,10 +19,6 @@ #ifndef _TWAIN32_H #define _TWAIN32_H -#ifndef __WINE_CONFIG_H -# error You must include config.h first -#endif - #include <stdarg.h> #include "windef.h" diff --git a/dlls/sane.ds/sane_main.c b/dlls/sane.ds/sane_main.c index 78e0ac06afd..c67ad8e5f8b 100644 --- a/dlls/sane.ds/sane_main.c +++ b/dlls/sane.ds/sane_main.c @@ -18,9 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include <stdarg.h> #include <stdio.h> @@ -64,8 +61,7 @@ static TW_UINT16 SANE_OpenDS( pTW_IDENTITY pOrigin, pTW_IDENTITY self) if (SANE_dsmentry == NULL) { - static const WCHAR twain32W[] = {'t','w','a','i','n','_','3','2',0}; - HMODULE moddsm = GetModuleHandleW(twain32W); + HMODULE moddsm = GetModuleHandleW(L"twain_32"); if (moddsm) SANE_dsmentry = (void*)GetProcAddress(moddsm, "DSM_Entry"); diff --git a/dlls/sane.ds/ui.c b/dlls/sane.ds/ui.c index 9c4aedc73ec..918dbe47a88 100644 --- a/dlls/sane.ds/ui.c +++ b/dlls/sane.ds/ui.c @@ -18,8 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include <stdlib.h> #include <stdarg.h> #include <stdio.h> @@ -33,7 +31,6 @@ #include "prsht.h" #include "wine/debug.h" #include "resource.h" -#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(twain); @@ -60,7 +57,7 @@ static int create_leading_static(HDC hdc, const WCHAR *text, base = GetDialogBaseUnits(); - len = strlenW(text) * sizeof(WCHAR); + len = lstrlenW(text) * sizeof(WCHAR); len += sizeof(DLGITEMTEMPLATE); len += 4*sizeof(WORD); @@ -78,8 +75,8 @@ static int create_leading_static(HDC hdc, const WCHAR *text, ptr = (WORD *)(tpl + 1); *ptr++ = 0xffff; *ptr++ = 0x0082; - strcpyW( ptr, text ); - ptr += strlenW(ptr) + 1; + lstrcpyW( ptr, text ); + ptr += lstrlenW(ptr) + 1; *ptr = 0; *template_out = tpl; @@ -99,7 +96,7 @@ static int create_trailing_edit(HDC hdc, LPDLGITEMTEMPLATEW* template_out, int i base = GetDialogBaseUnits(); - len = strlenW(text) * sizeof(WCHAR); + len = lstrlenW(text) * sizeof(WCHAR); len += sizeof(DLGITEMTEMPLATE); len += 4*sizeof(WORD); @@ -121,8 +118,8 @@ static int create_trailing_edit(HDC hdc, LPDLGITEMTEMPLATEW* template_out, int i ptr = (WORD *)(tpl + 1); *ptr++ = 0xffff; *ptr++ = 0x0081; - strcpyW( ptr, text ); - ptr += strlenW(ptr) + 1; + lstrcpyW( ptr, text ); + ptr += lstrlenW(ptr) + 1; *ptr = 0; *template_out = tpl; @@ -165,9 +162,8 @@ static int create_item(HDC hdc, const struct option_descriptor *opt, case TYPE_INT: { int i; - static const WCHAR fmtW[] = {'%','i',0}; sane_option_get_value( id - ID_BASE, &i ); - sprintfW(buffer,fmtW,i); + swprintf(buffer, ARRAY_SIZE(buffer), L"%i", i); switch (opt->constraint_type) { @@ -193,12 +189,11 @@ static int create_item(HDC hdc, const struct option_descriptor *opt, } case TYPE_FIXED: { - static const WCHAR fmtW[] = {'%','f',0}; int *i = HeapAlloc(GetProcessHeap(),0,opt->size*sizeof(int)); sane_option_get_value( id - ID_BASE, i ); - sprintfW(buffer,fmtW, *i / 65536.0); + swprintf(buffer, ARRAY_SIZE(buffer), L"%f", *i / 65536.0); HeapFree(GetProcessHeap(),0,i); switch (opt->constraint_type) @@ -253,7 +248,7 @@ static int create_item(HDC hdc, const struct option_descriptor *opt, } local_len += sizeof(DLGITEMTEMPLATE); - if (title) local_len += strlenW(title) * sizeof(WCHAR); + if (title) local_len += lstrlenW(title) * sizeof(WCHAR); local_len += 4*sizeof(WORD); if (lead_static) @@ -299,8 +294,8 @@ static int create_item(HDC hdc, const struct option_descriptor *opt, *ptr++ = class; if (title) { - strcpyW( ptr, title ); - ptr += strlenW(ptr); + lstrcpyW( ptr, title ); + ptr += lstrlenW(ptr); } *ptr++ = 0; *ptr = 0; @@ -513,8 +508,8 @@ BOOL DoScannerUI(void) if (opt.type == TYPE_GROUP) { - LPWSTR title = HeapAlloc(GetProcessHeap(),0,(strlenW(opt.title) + 1) * sizeof(WCHAR)); - strcpyW( title, opt.title ); + LPWSTR title = HeapAlloc(GetProcessHeap(),0,(lstrlenW(opt.title) + 1) * sizeof(WCHAR)); + lstrcpyW( title, opt.title ); psp[page_count].pszTitle = title; } @@ -575,7 +570,6 @@ static void UpdateRelevantEdit(HWND hwnd, const struct option_descriptor *opt, i { case TYPE_INT: { - static const WCHAR formatW[] = {'%','i',0}; INT si; if (opt->constraint.range.quant) @@ -583,12 +577,11 @@ static void UpdateRelevantEdit(HWND hwnd, const struct option_descriptor *opt, i else si = position; - len = sprintfW( buffer, formatW, si ); + len = swprintf( buffer, ARRAY_SIZE(buffer), L"%i", si ); break; } case TYPE_FIXED: { - static const WCHAR formatW[] = {'%','f',0}; double dd; if (opt->constraint.range.quant) @@ -596,7 +589,7 @@ static void UpdateRelevantEdit(HWND hwnd, const struct option_descriptor *opt, i else dd = position * 0.01; - len = sprintfW( buffer, formatW, dd ); + len = swprintf( buffer, ARRAY_SIZE(buffer), L"%f", dd ); break; } default: @@ -679,7 +672,7 @@ static INT_PTR InitializeDialog(HWND hwnd) CHAR buffer[255]; WCHAR *p; - for (p = opt.constraint.strings; *p; p += strlenW(p) + 1) + for (p = opt.constraint.strings; *p; p += lstrlenW(p) + 1) SendMessageW( control,CB_ADDSTRING,0, (LPARAM)p ); sane_option_get_value( i, buffer ); SendMessageA(control,CB_SELECTSTRING,0,(LPARAM)buffer);
1
0
0
0
Alexandre Julliard : sane.ds: Move SANE library calls to a separate Unix library.
by Alexandre Julliard
28 Oct '21
28 Oct '21
Module: wine Branch: master Commit: 64d54282d8e06b246d116b335e8b1d5a6e228099 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=64d54282d8e06b246d116b33…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Oct 27 15:27:52 2021 +0200 sane.ds: Move SANE library calls to a separate Unix library. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/sane.ds/Makefile.in | 4 +- dlls/sane.ds/capability.c | 51 ++---- dlls/sane.ds/ds_ctrl.c | 41 +---- dlls/sane.ds/ds_image.c | 142 +++++----------- dlls/sane.ds/options.c | 169 +------------------ dlls/sane.ds/sane_i.h | 38 +---- dlls/sane.ds/sane_main.c | 187 ++++++--------------- dlls/sane.ds/ui.c | 88 ++++------ dlls/sane.ds/unixlib.c | 413 ++++++++++++++++++++++++++++++++++++++++++++++ dlls/sane.ds/unixlib.h | 112 +++++++++++++ 10 files changed, 682 insertions(+), 563 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=64d54282d8e06b246d11…
1
0
0
0
Alexandre Julliard : sane.ds: Convert the SANE option descriptor to a private structure.
by Alexandre Julliard
28 Oct '21
28 Oct '21
Module: wine Branch: master Commit: 999d05f695d0e579fa1bb1bc0c4e7af63d671a42 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=999d05f695d0e579fa1bb1bc…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Oct 27 13:38:59 2021 +0200 sane.ds: Convert the SANE option descriptor to a private structure. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/sane.ds/capability.c | 25 +-- dlls/sane.ds/options.c | 287 ++++++++++++++++++++++------------ dlls/sane.ds/sane_i.h | 22 ++- dlls/sane.ds/ui.c | 380 +++++++++++++++++++++------------------------- 4 files changed, 379 insertions(+), 335 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=999d05f695d0e579fa1b…
1
0
0
0
Alexandre Julliard : sane.ds: Convert the SANE parameters to a private structure.
by Alexandre Julliard
28 Oct '21
28 Oct '21
Module: wine Branch: master Commit: 383bb720e4698db7b6b0073d67f44d1512571ed1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=383bb720e4698db7b6b0073d…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Oct 27 13:25:00 2021 +0200 sane.ds: Convert the SANE parameters to a private structure. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/sane.ds/capability.c | 15 +++--- dlls/sane.ds/ds_ctrl.c | 11 ++-- dlls/sane.ds/ds_image.c | 132 +++++++++++++++++++++++----------------------- dlls/sane.ds/options.c | 27 ++++++++++ dlls/sane.ds/sane_i.h | 15 ++++-- 5 files changed, 116 insertions(+), 84 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=383bb720e4698db7b6b0…
1
0
0
0
← Newer
1
...
5
6
7
8
9
10
11
...
117
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
Results per page:
10
25
50
100
200