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:
* Create 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).
--
v6: 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.
winebth.sys: Create PDOs for remote Bluetooth devices.
https://gitlab.winehq.org/wine/wine/-/merge_requests/8174
Microsoft's documentation says:
> The `vsnprintf` function always writes a null terminator, even if it truncates the output. When you use `_vsnprintf` and `_vsnwprintf`, the buffer is null-terminated only if there's room at the end (that is, if the number of characters to write is less than count).
For `_UCRT` and `_MSVCR_VER >= 140`, `vsnprintf` calls `__stdio_common_vsprintf` with `_CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR`, and everything works, a null byte is appended, everything is fine.
If not, `vsnprintf` calls `_vsnprintf` directly and no null byte will be added if the buffer is not big enough. This happens in, for example, kernel32. And this breaks `wine_dbg_vsprintf`, which passes result of `vsnprintf` to `strlen` and goes out-of-bound.
In msvcrt.spec, we also have `vsnprintf` as an alias of `_vsnprintf`, I didn't touch that since I don't know if that's deliberate. But this alias _is_ used (by e.g. winecrt0, i think?), if this one is also wrong then it might break other things.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8256
For React Native. React Native applications use HLSL shader linking extensively. Obviously, these two functions are not enough because they are just stubs. But I think it's good to get them in the tree so they don't get lost. Currently, React Native applications need to rely on the bundled native d3dcompiler.
--
v2: d3dcompiler_47: Implement D3DCreateFunctionLinkingGraph().
d3dcompiler_47: Implement D3DCreateLinker().
https://gitlab.winehq.org/wine/wine/-/merge_requests/8245
These patches replace the existing libtxc_dxtn texture compression/decompression source files with new libraries that can handle more formats. This is will be helpful when we begin to share code with d3dx10/d3dx11, as we will be able to use bcdec to decode all supported compressed formats, and stb_dxt to compress BC1-BC5.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8226
IWinInetHttpInfo_QueryInfo returns a multibyte string, not a wide string. We
were also wrongly expecting it to have a NUL terminator.
* * *
this one doesn't feel good. IWinInetHttpInfo_QueryInfo calls HttpInfo_QueryInfo (urlmon), which calls HttpQueryInfoA (wininet), so it returns char*. but inside, HttpQueryInfoA is calling HttpQueryInfoW and does charset conversion. so we are converting the string to multibyte and back.
maybe there's an API that returns wchar* i don't know about.
--
v4: mshtml: Fix misuse of IWinInetHttpInfo_QueryInfo.
https://gitlab.winehq.org/wine/wine/-/merge_requests/8228
IWinInetHttpInfo_QueryInfo returns a multibyte string, not a wide string. We
were also wrongly expecting it to have a NUL terminator.
* * *
this one doesn't feel good. IWinInetHttpInfo_QueryInfo calls HttpInfo_QueryInfo (urlmon), which calls HttpQueryInfoA (wininet), so it returns char*. but inside, HttpQueryInfoA is calling HttpQueryInfoW and does charset conversion. so we are converting the string to multibyte and back.
maybe there's an API that returns wchar* i don't know about.
--
v3: mshtml: Fix misuse of IWinInetHttpInfo_QueryInfo.
https://gitlab.winehq.org/wine/wine/-/merge_requests/8228
I think it's not possible to implement it correctly using floating point operations when 24bit precision is used. We would either need to implement it without floating point operations (I'll look into that) or set the precision.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8242#note_106331
Wine applications crash in VNC/headless environments due to invalid all-zero monitor coordinates.
The root cause is:
- Environment Issue: VNC systems report all displays as RR_Disconnected
- Faulty Fallback: Wine incorrectly reverts to legacy XRandR 1.0 API when no "connected" displays are detected
- API Incompatibility: Modern XRandR 1.6 doesn't support Wine's XRandR 1.0 implementation, causing XRRSizes() to return empty display modes
- Uninitialized Data: This leaves critical display fields (dmPelsWidth/Height) at initialization value 0
--
v3: winex11: handle fallback display modes when XRandR fails
https://gitlab.winehq.org/wine/wine/-/merge_requests/8216
eric pouech (@epo) commented about programs/cmd/wcmdmain.c:
> * Otherwise, parse the buffer to find the last parameter in the buffer,
> * where tab was pressed.
> */
> - if (len && inputBuffer[len-1] == L' ') {
you should support the same parameters as below
likely you'd better have the {cc=len; } body when parameter_with_delims() fails
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8200#note_106328
eric pouech (@epo) commented about programs/cmd/wcmdmain.c:
> /* Handle paths here. Find last '\\'.
> * If '\\' isn't found then insert pos is the same as search pos.
> */
> - while (cc > sc->search_pos && inputBuffer[cc] != L'\\') {
ditto is there a reason to not handle the other delimiters here?
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8200#note_106327
In kernel32/tests/loader.c, child_process will try to write to stdout after
calling LdrShutdownProcess. LdrShutdownProcess calls DLL_PROCESS_DETACH on
msvcrt, which calls msvcrt_free_io, which frees the ioinfo blocks. So to
prevent use after free in this case, we don't free them.
* * *
Supersedes !8273
--
v4: msvcrt: Don't release io memory in msvcrt_free_io during shutdown.
https://gitlab.winehq.org/wine/wine/-/merge_requests/8288
FileRenameInfoEx is already handled by NtSetInformationFile, SetFileInformationByHandle need only pass it through correctly.
As of version 5.3, Apple's Metal Developer Tools are dependent on SetFileInformationByHandle to handle FileRenameInfoEx in this fashion.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8293
Updating the GL drawables on/offscreen dynamically, similarly to how we do it for Vulkan, and in order to ultimately converge and factor both GL and VK client surfaces.
--
v2: winex11: Rename context drawables to draw / read.
winex11: Drop pixmap-based child window workaround.
winex11: Update drawable size and offscreen when presenting.
winex11: Update every window GL drawable on resize / reparent.
winex11: Update GL drawable offscreen status instead of recreating.
https://gitlab.winehq.org/wine/wine/-/merge_requests/8291
Updating the GL drawables on/offscreen dynamically, similarly to how we do it for Vulkan, and in order to ultimately converge and factor both GL and VK client surfaces.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8291
OSmesa is deprecated and has been removed from latest mesa releases, this replaces it with pbuffer rendering and flushing of the surface onto the bitmap at some specific sync points. The tests show that this is roughly how Windows seem to behave anyway, instead of rendering directly to the memory as OSmesa does.
--
v5: win32u: Remove now unnecessary context and pbuffer funcs.
win32u: Drop now unnecessary OSMesa dependency.
win32u: Use a pbuffer to implement GL on memory DCs.
opengl32: Flush the contexts on gl(Draw|Read)Pixels and glViewport.
https://gitlab.winehq.org/wine/wine/-/merge_requests/8210
MSVC supports enum type forward declarations and doesn't complain if the
enum is only defined in a later included file, but GCC requires enums to
be defined before being used in parameters or fields.
This emits every WinRT enum definition, unlike MIDL, before any typedef,
so that the generated headers then work with GCC.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/8248