From: Vibhav Pant <vibhavp@gmail.com> --- dlls/bluetoothapis/gatt.c | 21 +++++++++++---------- dlls/bluetoothapis/tests/gatt.c | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/dlls/bluetoothapis/gatt.c b/dlls/bluetoothapis/gatt.c index 3432faf321b..38cd8a1694e 100644 --- a/dlls/bluetoothapis/gatt.c +++ b/dlls/bluetoothapis/gatt.c @@ -111,16 +111,17 @@ HRESULT WINAPI BluetoothGATTGetCharacteristics( HANDLE device, BTH_LE_GATT_SERVI if (!actual) return E_POINTER; - if ((buf && !count) || !service) - return E_INVALIDARG; - - size = offsetof( struct winebth_le_device_get_gatt_characteristics_params, characteristics[count] ); - chars = calloc( 1, size ); - if (!chars) - return HRESULT_FROM_WIN32( ERROR_NO_SYSTEM_RESOURCES ); - chars->service = *service; - if (!DeviceIoControl( device, IOCTL_WINEBTH_LE_DEVICE_GET_GATT_CHARACTERISTICS, chars, size, chars, - size, &bytes, NULL ) && GetLastError() != ERROR_MORE_DATA) + if (buf && !count) + return E_INVALIDARG; + + size = offsetof( struct winebth_le_device_get_gatt_characteristics_params, characteristics[count] ); + chars = calloc( 1, size ); + if (!chars) + return HRESULT_FROM_WIN32( ERROR_NO_SYSTEM_RESOURCES ); + if (service) + chars->service = *service; + if (!DeviceIoControl( device, IOCTL_WINEBTH_LE_DEVICE_GET_GATT_CHARACTERISTICS, chars, size, chars, + size, &bytes, NULL ) && GetLastError() != ERROR_MORE_DATA) { free( chars ); return HRESULT_FROM_WIN32( GetLastError() ); diff --git a/dlls/bluetoothapis/tests/gatt.c b/dlls/bluetoothapis/tests/gatt.c index dec81a5a014..d442ab21f67 100644 --- a/dlls/bluetoothapis/tests/gatt.c +++ b/dlls/bluetoothapis/tests/gatt.c @@ -125,7 +125,7 @@ static void test_service_BluetoothGATTGetCharacteristics( HANDLE service, const BTH_LE_GATT_CHARACTERISTIC *chars2; ret = BluetoothGATTGetCharacteristics( service, NULL, 0, NULL, &actual, 0 ); - todo_wine ok( ret == HRESULT_FROM_WIN32( ERROR_MORE_DATA ), "got ret %#lx\n", ret ); + ok( ret == HRESULT_FROM_WIN32( ERROR_MORE_DATA ), "got ret %#lx\n", ret ); if (!actual) return; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10099