From: Vibhav Pant vibhavp@gmail.com
--- dlls/bluetoothapis/sdp.c | 34 ++++++++++++++++++++++++++++++++-- dlls/bluetoothapis/tests/sdp.c | 16 +++++++--------- 2 files changed, 39 insertions(+), 11 deletions(-)
diff --git a/dlls/bluetoothapis/sdp.c b/dlls/bluetoothapis/sdp.c index a08db9da571..a5bc325390e 100644 --- a/dlls/bluetoothapis/sdp.c +++ b/dlls/bluetoothapis/sdp.c @@ -387,12 +387,42 @@ BOOL WINAPI BluetoothSdpEnumAttributes( BYTE *stream, ULONG stream_size, } }
+struct get_attr_value_data +{ + USHORT attr_id; + BYTE *attr_stream; + ULONG stream_size; +}; + +static BOOL WINAPI get_attr_value_callback( ULONG attr_id, BYTE *stream, ULONG stream_size, + void *params ) +{ + struct get_attr_value_data *args = params; + if (attr_id == args->attr_id) + { + args->attr_stream = stream; + args->stream_size = stream_size; + return FALSE; + } + return TRUE; +} + /********************************************************************* * BluetoothSdpGetAttributeValue */ DWORD WINAPI BluetoothSdpGetAttributeValue( BYTE *stream, ULONG stream_size, USHORT attr_id, SDP_ELEMENT_DATA *data ) { - FIXME( "(%p %lu %u %p) stub!\n", stream, stream_size, attr_id, data ); - return ERROR_CALL_NOT_IMPLEMENTED; + struct get_attr_value_data args = {0}; + + TRACE( "(%p %lu %u %p)\n", stream, stream_size, attr_id, data ); + + if (stream == NULL || data == NULL) return ERROR_INVALID_PARAMETER; + + args.attr_id = attr_id; + if (!BluetoothSdpEnumAttributes( stream, stream_size, get_attr_value_callback, &args )) + return ERROR_INVALID_PARAMETER; + if (!args.attr_stream) return ERROR_FILE_NOT_FOUND; + + return BluetoothSdpGetElementData( args.attr_stream, args.stream_size, data ); } diff --git a/dlls/bluetoothapis/tests/sdp.c b/dlls/bluetoothapis/tests/sdp.c index f6e6b415d71..118071704f2 100644 --- a/dlls/bluetoothapis/tests/sdp.c +++ b/dlls/bluetoothapis/tests/sdp.c @@ -539,12 +539,10 @@ static BOOL WINAPI enum_attr_callback( ULONG attr_id, BYTE *stream, ULONG stream
result = BluetoothSdpGetAttributeValue( sdp_record_bytes, ARRAY_SIZE( sdp_record_bytes ), params->attrs_id[params->i], &data2 ); - todo_wine ok( result == ERROR_SUCCESS, "BluetoothSdpGetAttributeValue failed: %ld.\n", - result ); - todo_wine ok( !memcmp( ¶ms->attrs[params->i], &data2, sizeof( data2 ) ), - "Expected %s, got %s.\n", - debugstr_SDP_ELEMENT_DATA( ¶ms->attrs[params->i] ), - debugstr_SDP_ELEMENT_DATA( &data2 ) ); + ok( result == ERROR_SUCCESS, "BluetoothSdpGetAttributeValue failed: %ld.\n", result ); + ok( !memcmp( ¶ms->attrs[params->i], &data2, sizeof( data2 ) ), "Expected %s, got %s.\n", + debugstr_SDP_ELEMENT_DATA( ¶ms->attrs[params->i] ), + debugstr_SDP_ELEMENT_DATA( &data2 ) );
params->i++; } @@ -581,9 +579,9 @@ static void test_BluetoothSdpEnumAttributes( void )
result = BluetoothSdpGetAttributeValue( sdp_record_bytes, ARRAY_SIZE( sdp_record_bytes ), 0xff, &elem_data ); - todo_wine ok( result == ERROR_FILE_NOT_FOUND, - "Expected BluetoothSdpGetAttributeValue to return %d, got %ld.\n", - ERROR_FILE_NOT_FOUND, result ); + ok( result == ERROR_FILE_NOT_FOUND, + "Expected BluetoothSdpGetAttributeValue to return %d, got %ld.\n", ERROR_FILE_NOT_FOUND, + result ); }
START_TEST( sdp )