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>
This commit is contained in:
Bernhard Übelacker 2016-08-05 00:50:51 +02:00 committed by Alexandre Julliard
parent 0b49495b8e
commit 86cdf0b1cb
2 changed files with 20 additions and 10 deletions

View File

@ -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)
{

View File

@ -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)
{