0

I am trying to call CreateFile() on a symbolic link that is listed in WinObj under the GLOBAL?? namespace.

In WinObj, the name is:

\GLOBAL??\BTHENUM#{00001801-0000-1000-8000-00805f9b34fb}_VID&00010075_PID&0100#7&39ffa139&0&F0F56456EDD3_C00000000#{00001801-0000-1000-8000-00805f9b34fb}

where Type is SymbolicLink and Symbolic Link Target is \Device\00000275.

In the C++ code, pTCHARDevicePath_in is:

\\?\BTHENUM#{00001801-0000-1000-8000-00805f9b34fb}_VID&00010075_PID&0100#7&39ffa139&0&F0F56456EDD3_C00000000#{00001801-0000-1000-8000-00805f9b34fb}

The C++ code is:

HANDLE l_HANDLE = CreateFile(
    pTCHARDevicePath_in,
    GENERIC_READ,         // | GENERIC_WRITE, 
    FILE_SHARE_READ,      // | FILE_SHARE_WRITE, 
    NULL,
    OPEN_EXISTING,        // OPEN_EXISTING,
    0,                    // FILE_FLAG_OVERLAPPED, 
    NULL);

The call to CreateFile() fails, and GetLastError() returns 32, which is ERROR_NOT_SUPPORTED ('The request is not supported'), and l_HANDLE is set to INVALID_HANDLE_VALUE.

This code is to access a Bluetooth device (an Android phone), which is connected and paired to the Windows 10 computer where the code above is running.

I am trying to get the HANDLE to the symbolic link above to be able to call the Win32 Bluetooth APIs, where each Bluetooth function requires a 'Handle to the service', which is supposed to come from the CreateFile() that is failing.

I know this is a Device Interface. This code is running in user-mode (not kernel-mode), however.

The 1801 is a Bluetooth UUID for the 'Generic Attribute' BlueTooth service on the remote device (Android).

I need to use Win32 APIs (and not WinRT APIs) for this code.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
A LaMark
  • 3
  • 3
  • 1
    you can not open file on this device - the device say you this *The request is not supported* – RbMm Aug 01 '22 at 23:09
  • 1
    and this is not duplicate of [Open device name using CreateFile](https://stackoverflow.com/questions/21703592/open-device-name-using-createfile). there error was in invalid file path passed to create file. here file path is correct, the error code clear say about this too. request is reached to device. but device not want let open file on self. this is normal situation. question here in another - how this name is received ? why OP decide open this name ? correct way enum `GUID_BTHPORT_DEVICE_INTERFACE` devices and open it – RbMm Aug 01 '22 at 23:25

0 Answers0