`MulDiv` doesn't match the correct Windows behavior for the function, which actually differs in some edge cases for 32-bit and 64-bit.
Test case:
```c
MulDiv(1, 0x80000000, 0x80000000);
// WINE - both 32-bit and 64-bit: 0
// Windows (32-bit/kernel32.dll): 2
// Windows (64-bit/kernelbase.dll): -1
```
On Windows 32-bit, this would return 2. On 64-bit, it'd return -1.
However, on WINE, this call would return 0 for both 32-bit and 64-bit. This discrepancy was previously abused by threat actors to detect if the application runs under WINE.
---
On Windows, `MulDiv` has a different implementation for 32-bit (from `kernel32.dll`) and 64-bit (leveraged to `kernelbase.dll` from `kernel32.dll`).
After adjusting the 64-bit code to be an exact replica of the original code from `kernelbase.dll`, it'd still return the incorrect value due to Microsoft's code having undefined behavior with negation. It could be avoided with `-O0` but I opted into rewriting it with the undefined behavior to be, well.. defined.
To clarify, the original code from Microsoft has a bug (logically, at least). But WINE is supposed to have matching behavior so we can run Windows programs as intended.
The 32-bit version of `MulDiv` in Windows has a more complicated bug; I've documented it in the code.
---
This is my first contribution to WINE - I cannot find any `CONTRIBUTING.md` or similar file with guidelines so I did my best to follow the convention of other merge requests.
I've added unit testing for `MulDiv` to ensure there won't be a regression in the future.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7916
This MR adds an initial implementation of the winsock `WSALookupsService*` methods for performing Bluetooth device discovery (`LUP_CONTAINERS`).
--
v17: ws2_32: Implement WSALookupServiceNext for Bluetooth device discovery.
ws2_32: Implement WSALookupServiceBegin for Bluetooth device discovery.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7542
This MR adds an initial implementation of the winsock `WSALookupsService*` methods for performing Bluetooth device discovery (`LUP_CONTAINERS`).
--
v16: ws2_32: Implement WSALookupServiceNext for Bluetooth device discovery.
ws2_32: Implement WSALookupServiceBegin for Bluetooth device discovery.
ws2_32/tests: Add tests for the Bluetooth namespace (NS_BTH) in WSALookupServiceBegin/Next.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7542
Add `IOCTL_WINEBTH_RADIO_START_AUTH`, which gets used to implement `BluetoothAuthenticateDeviceEx`.
--
v5: bluetoothapis/tests: Add tests for BluetoothAuthenticateDeviceEx.
bluetoothapis: Use a wizard GUI to respond to pairing requests if an authentication callback is not registered.
bluetoothapis: Implement BluetoothAuthenticateDeviceEx.
winebth.sys: Implement IOCTL_WINEBTH_RADIO_START_AUTH.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7885