Module: wine Branch: master Commit: 86cdf0b1cb7a15cb43dd0c600b66f6665aea87d2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=86cdf0b1cb7a15cb43dd0c600b...
Author: Bernhard Übelacker bernhardu@mailbox.org Date: Fri Aug 5 00:50:51 2016 +0200
dinput8/tests: Add valid wide string termination to actionName member.
Signed-off-by: Bernhard Übelacker bernhardu@mailbox.org Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/dinput8/tests/device.c | 15 ++++++++++----- dlls/dinput8/tests/dinput.c | 15 ++++++++++----- 2 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c index fc415b7..6753b73 100644 --- a/dlls/dinput8/tests/device.c +++ b/dlls/dinput8/tests/device.c @@ -49,16 +49,21 @@ enum { static DIACTIONA actionMapping[]= { /* axis */ - { 0, 0x01008A01 /* DIAXIS_DRIVINGR_STEER */ , 0, { "Steer" } }, + { 0, 0x01008A01 /* DIAXIS_DRIVINGR_STEER */, 0, { "Steer.\0" } }, /* button */ - { 1, 0x01000C01 /* DIBUTTON_DRIVINGR_SHIFTUP */ , 0, { "Upshift" } }, + { 1, 0x01000C01 /* DIBUTTON_DRIVINGR_SHIFTUP */, 0, { "Upshift.\0" } }, /* keyboard key */ - { 2, DIKEYBOARD_SPACE , 0, { "Missile" } }, + { 2, DIKEYBOARD_SPACE, 0, { "Missile.\0" } }, /* mouse button */ - { 3, DIMOUSE_BUTTON0, 0, { "Select" } }, + { 3, DIMOUSE_BUTTON0, 0, { "Select\0" } }, /* mouse axis */ - { 4, DIMOUSE_YAXIS, 0, { "Y Axis" } } + { 4, DIMOUSE_YAXIS, 0, { "Y Axis\0" } } }; +/* By placing the memory pointed to by lptszActionName right before memory with PAGE_NOACCESS + * one can find out that the regular ansi string termination is not respected by EnumDevicesBySemantics. + * Adding a double termination, making it a valid wide string termination, made the test succeed. + * Therefore it looks like ansi version of EnumDevicesBySemantics forwards the string to + * the wide variant without conversation. */
static void flush_events(void) { diff --git a/dlls/dinput8/tests/dinput.c b/dlls/dinput8/tests/dinput.c index 57f5505..c3f80c6 100644 --- a/dlls/dinput8/tests/dinput.c +++ b/dlls/dinput8/tests/dinput.c @@ -443,16 +443,21 @@ struct enum_semantics_test static DIACTIONA actionMapping[]= { /* axis */ - { 0, 0x01008A01 /* DIAXIS_DRIVINGR_STEER */, 0, { "Steer" } }, + { 0, 0x01008A01 /* DIAXIS_DRIVINGR_STEER */, 0, { "Steer.\0" } }, /* button */ - { 1, 0x01000C01 /* DIBUTTON_DRIVINGR_SHIFTUP */, 0, { "Upshift" } }, + { 1, 0x01000C01 /* DIBUTTON_DRIVINGR_SHIFTUP */, 0, { "Upshift.\0" } }, /* keyboard key */ - { 2, DIKEYBOARD_SPACE, 0, { "Missile" } }, + { 2, DIKEYBOARD_SPACE, 0, { "Missile.\0" } }, /* mouse button */ - { 3, DIMOUSE_BUTTON0, 0, { "Select" } }, + { 3, DIMOUSE_BUTTON0, 0, { "Select\0" } }, /* mouse axis */ - { 4, DIMOUSE_YAXIS, 0, { "Y Axis" } } + { 4, DIMOUSE_YAXIS, 0, { "Y Axis\0" } } }; +/* By placing the memory pointed to by lptszActionName right before memory with PAGE_NOACCESS + * one can find out that the regular ansi string termination is not respected by EnumDevicesBySemantics. + * Adding a double termination, making it a valid wide string termination, made the test succeed. + * Therefore it looks like ansi version of EnumDevicesBySemantics forwards the string to + * the wide variant without conversation. */
static BOOL CALLBACK enum_semantics_callback(const DIDEVICEINSTANCEA *lpddi, IDirectInputDevice8A *lpdid, DWORD dwFlags, DWORD dwRemaining, void *context) {