cli icon indicating copy to clipboard operation
cli copied to clipboard

Windows `Udp` Discovery on `NearShare` send

Open ShortDevelopment opened this issue 1 year ago • 0 comments
trafficstars

Issue

Although supported by the RemoteSystemWatcher, the Windows Nearby-Sharing implementation does not send PresenceRequest messages via Udp to discover devices on the local network. Only scanning for Ble-Beacons guarantees spacial-proximity but excludes devices that cannot advertise Ble-Beacons with custom ManufacturingData like MacOs from receiving (See https://github.com/nearby-sharing/cli/issues/1#issuecomment-1983223095).

Context

The scanning for devices happens in Windows.Internal.ShellCommon.ShareExperience.dll

void lambda_39d726f72da8464f6b354668a4acec0b_() {
   RemoteSystemDiscoveryTypeFilter filter1;
   if (Feature<SEBTTest>::IsEnabled) {
      filter1 = new(RemoteSystemDiscoveryType.SpatiallyProximal); // Ble scanning
   } else {
      filter1 = new(RemoteSystemDiscoveryType.Proximal); // Includes everything (i.e. Udp) except Cloud
   }
   ...
}

Windows hits the first path (RemoteSystemDiscoveryType.SpatiallyProximal) by default.

Solution 1

We could create a seperate app using ...

  • the RemoteSystemWatcher with RemoteSystemDiscoveryType.Proximal and the internal ShareSenderBroker from cdprt.dll to invoke the nearshare transfer.
  • our custom implementation ignoring the built-in implementation.

Solution 2

We could try to disable the feature SEBTTEST (might be 0x29DDC94) via mach2.

[!CAUTION] This might break something and I did not had success in doing so!

Solution 3

Hope that Microsoft implements a switch to allow discovery of non-spatially-proximal devices on the whole network.


@sidevesh

ShortDevelopment avatar Mar 12 '24 17:03 ShortDevelopment