Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2007)

Unified Diff: device/bluetooth/bluetooth_low_energy_win.h

Issue 2317773002: Fix bluetooth callback function declaration (Closed)
Patch Set: Updating typedef comment per code-review feedback Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_low_energy_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_low_energy_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698