Index: device/bluetooth/bluetooth_low_energy_win.h |
diff --git a/device/bluetooth/bluetooth_low_energy_win.h b/device/bluetooth/bluetooth_low_energy_win.h |
index edb17e933caa729b14afed0458d59cf649bd9a25..5e819a9c918a6b8d597c188f271fa8a92c17933e 100644 |
--- a/device/bluetooth/bluetooth_low_energy_win.h |
+++ b/device/bluetooth/bluetooth_low_energy_win.h |
@@ -20,6 +20,21 @@ |
namespace device { |
namespace win { |
+// |
+// Callback function signature for Bluetooth GATT events. This fixes a bug in |
+// this typedef in the Windows 10.0.10586 SDK which is missing the CALLBACK |
+// modifier. This corrected typedef should be used throughout Chromium except |
+// when casting to the 'official' definition when calling Microsoft functions. |
+// This allows Chromium to build with 10.0.14393 or later SDKs (which have the |
+// fixed typedef) while doing the correct thing even when built with 10.0.10586. |
+// The CALLBACK modifier affects how function parameters are cleaned up from the |
+// stack and having a mismatch can lead to misalignment of the stack pointer. |
+// |
+typedef VOID(CALLBACK* PFNBLUETOOTH_GATT_EVENT_CALLBACK_CORRECTED)( |
+ _In_ BTH_LE_GATT_EVENT_TYPE EventType, |
+ _In_ PVOID EventOutParameter, |
+ _In_opt_ PVOID Context); |
+ |
// Represents a device registry property value |
class DEVICE_BLUETOOTH_EXPORT DeviceRegistryPropertyValue { |
public: |
@@ -181,12 +196,13 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothLowEnergyWrapper { |
// is the function to be invoked if the event happened. |context| is the input |
// parameter to be given back through |callback|. |*out_handle| stores the |
// unique handle in OS for this registration. |
- virtual HRESULT RegisterGattEvents(base::FilePath& service_path, |
- BTH_LE_GATT_EVENT_TYPE event_type, |
- PVOID event_parameter, |
- PFNBLUETOOTH_GATT_EVENT_CALLBACK callback, |
- PVOID context, |
- BLUETOOTH_GATT_EVENT_HANDLE* out_handle); |
+ virtual HRESULT RegisterGattEvents( |
+ base::FilePath& service_path, |
+ BTH_LE_GATT_EVENT_TYPE event_type, |
+ PVOID event_parameter, |
+ PFNBLUETOOTH_GATT_EVENT_CALLBACK_CORRECTED callback, |
+ PVOID context, |
+ BLUETOOTH_GATT_EVENT_HANDLE* out_handle); |
virtual HRESULT UnregisterGattEvent(BLUETOOTH_GATT_EVENT_HANDLE event_handle); |
// Writes |descriptor| value in service with service device path |