Before this, stopping and restarting the media session
could cause MFT streams to get stuck in the "already pending"
state, which would lead to no more samples getting delivered.
This also reverts 18c0dd7390b354d2e505e54cd3f3f9b08226b265,
my previous attempt to fix the problem which for some reason
seemed to help - but with the new fix, it does not make any
difference.
The reverted commit is faulty since the Flush() method - which is called at session Stop, but runs after sample_grabber_set_state - already releases pending items, while processing markers immediately.
Sorry for the trouble.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8175
Generic ATTribute Profile (GATT) is a protocol used by BLE devices for data exchange. Broadly, every LE device contains one or more GATT services, with each service having multiple characteristics, which contain the actual piece of data to be exchanged. The Win32 BLE api is defined in [`bluetoothleapis.h`](https://learn.microsoft.com/en-us/windows/win32/api/bluetoothleapis/), and operates on `HANDLE`s to PDOs created by the driver to remote devices and services, using the `GUID_BLUETOOTHLE_DEVICE_INTERFACE` and `GUID_BLUETOOTH_GATT_SERVICE_DEVICE_INTERFACE` class interfaces respectively.
This MR introduces initial support for accessing GATT services on LE devices by:
* Creating PDOs for remote devices that we discover GATT services on, and enabling `GUID_BLUETOOTHLE_DEVICE_INTERFACE` for them.
* Because the driver also creates PDOs for bluetooth radios, a tagged union is used to distinguish between device extension values to dispatch IOCTL and PnP IRPs appropriately.
* Enumerate through all `org.bluez.GattService1` objects on BlueZ, and store them on the PE driver inside the associated devices.
* Implement IOCTL_WINEBTH_LE_DEVICE_GET_GATT_SERVICES for device PDOs.
* Use the newly added IOCTL to implement [`BluetoothGATTGetServices`](https://learn.microsoft.com/en-us/windows/win32/api/bluetoothleapis/nf-bluetoothleapis-bluetoothgattgetservices).
--
v2: bluetoothapis/tests: Add tests for BluetoothGATTGetServices.
bluetoothapis: Implement BluetoothGATTGetServices.
winebth.sys: Implement IOCTL_WINEBTH_LE_DEVICE_GET_GATT_SERVICES.
winebth.sys: Store a list of GATT services discovered on LE devices.
https://gitlab.winehq.org/wine/wine/-/merge_requests/8174
Function GdipGetImageAttributesAdjustedPalette gets [called with type = -1](https://gitlab.winehq.org/wine/wine/-/blob/22af42ac22279e6c0c671f033661f95c1761b4bb/dlls/gdiplus/tests/image.c?page=6#L5649) and therefore accesses several arrays at index -1.
This patch adds a helper which additionally checks for `type >= ColorAdjustTypeDefault`.
<details>
<summary>ASan output</summary>
```
=================================================================
==gdiplus_test.exe==308==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f21342c57f8 at pc 0x6ffffadfd25b bp 0x7ffffe1ff750 sp 0x7ffffe1ff798
READ of size 4 at 0x7f21342c57f8 thread T0
#0 0x6ffffadfd25a in apply_image_attributes .../dlls/gdiplus/graphics.c:929:41
#1 0x6ffffae5c2f2 in GdipGetImageAttributesAdjustedPalette .../dlls/gdiplus/imageattributes.c:123:5
#2 0x000140084b59 in test_getadjustedpalette .../dlls/gdiplus/tests/image.c:5649:12
#3 0x000140062be6 in func_image .../dlls/gdiplus/tests/image.c:6719:5
#4 0x0001400c9132 in run_test .../include/wine/test.h:765:5
#5 0x0001400c8b50 in main .../include/wine/test.h:884:12
#6 0x0001400cad3a in mainCRTStartup .../dlls/msvcrt/crt_main.c:60:11
#7 0x6fffffc45aa0 in BaseThreadInitThunk .../dlls/kernel32/thread.c:61:24
#8 0x6fffffdcc776 in RtlUserThreadStart (C:\windows\system32\ntdll.dll+0x17004c776)
0x7f21342c57f8 is located 144 bytes after 1256-byte region [0x7f21342c5280,0x7f21342c5768)
freed by thread T0 here:
#0 0x6ffffe88aab1 in free C:/llvm-mingw/llvm-mingw/llvm-project/compiler-rt/lib/asan\asan_malloc_win.cpp:71:3
#1 0x6ffffae5c21d in GdipDisposeImageAttributes .../dlls/gdiplus/imageattributes.c:109:5
#2 0x000140083598 in test_colorkey .../dlls/gdiplus/tests/image.c:3709:5
#3 0x000140062bd7 in func_image .../dlls/gdiplus/tests/image.c:6716:5
#4 0x0001400c9132 in run_test .../include/wine/test.h:765:5
#5 0x0001400c8b50 in main .../include/wine/test.h:884:12
#6 0x0001400cad3a in mainCRTStartup .../dlls/msvcrt/crt_main.c:60:11
#7 0x6fffffc45aa0 in BaseThreadInitThunk .../dlls/kernel32/thread.c:61:24
#8 0x6fffffdcc776 in RtlUserThreadStart (C:\windows\system32\ntdll.dll+0x17004c776)
previously allocated by thread T0 here:
#0 0x6ffffe88ace6 in calloc C:/llvm-mingw/llvm-mingw/llvm-project/compiler-rt/lib/asan\asan_malloc_win.cpp:91:3
#1 0x6ffffae5c0fc in GdipCreateImageAttributes .../dlls/gdiplus/imageattributes.c:87:18
#2 0x000140082bf9 in test_colorkey .../dlls/gdiplus/tests/image.c:3629:12
#3 0x000140062bd7 in func_image .../dlls/gdiplus/tests/image.c:6716:5
#4 0x0001400c9132 in run_test .../include/wine/test.h:765:5
#5 0x0001400c8b50 in main .../include/wine/test.h:884:12
#6 0x0001400cad3a in mainCRTStartup .../dlls/msvcrt/crt_main.c:60:11
#7 0x6fffffc45aa0 in BaseThreadInitThunk .../dlls/kernel32/thread.c:61:24
#8 0x6fffffdcc776 in RtlUserThreadStart (C:\windows\system32\ntdll.dll+0x17004c776)
SUMMARY: AddressSanitizer: heap-buffer-overflow .../dlls/gdiplus/graphics.c:929:41 in apply_image_attributes
Shadow bytes around the buggy address:
0x7f21342c5500: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x7f21342c5580: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x7f21342c5600: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x7f21342c5680: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x7f21342c5700: fd fd fd fd fd fd fd fd fd fd fd fd fd fa fa fa
=>0x7f21342c5780: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa[fa]
0x7f21342c5800: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x7f21342c5880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x7f21342c5900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x7f21342c5980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x7f21342c5a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==gdiplus_test.exe==308==ABORTING
```
</details>
--
v2: gdiplus: Add check of type parameter to be positive (ASan).
https://gitlab.winehq.org/wine/wine/-/merge_requests/8141
Visual testing shows that using Shift+Ctrl adds to the selection,
which is what existing code already does. The problem is that it
updates selection mark when it shouldn't.
And the bigger problem of course is that it's using static variable
for state.
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8165
Streams hold a reference to the source, but this reference should not be taken until `Start()` is called because freeing the media source depends on release in `Shutdown()` of the stream's reference to the source. We could create the streams in `media_source_create()` and take source refs for them in `Start()`, but that's potentially confusing and fragile.
Streams can persist after the media source is destroyed. In that case, they cannot access the source object and it should be released and set to null. Windows behaviour is to release references to the source in `Shutdown()`. If we don't do this and a buggy app were to leak a stream object, the media source object would also leak and `wg_parser_destroy()` would not be called.
--
v6: winegstreamer: Release stream references to the media source in Shutdown().
winegstreamer: Do not create MF stream objects until the media source is started.
mfplat/tests: Test video stream release after media source release.
mfplat/tests: Add more media source refcount checks.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6783
Description:
When flags does not include DT_CALCRECT, since len is calculated in the middle,
it will be reduced to zero. Resulting in the length of the processed string that
is finally returned to zero and the non-processing string length is unchanged.
But some application taking the non-processing string length to zero as the loop
end condition.
Log:
Signed-off-by: chenjiangyi <chenjiangyi(a)uniontech.com>
Change-Id: Icc0f250f5f4faba1bee8326fc911a4fc9cd7c012
--
v6: user32: Fix the number of characters processed by DrawTextExW.
user32/tests: Add tests for DrawTextExW.
https://gitlab.winehq.org/wine/wine/-/merge_requests/4812