std::string GetErrorString(DWORD err) {
    char buf[256];
    if (!FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
                        NULL, err, 0, buf, sizeof(buf), NULL))
        sprintf_s(buf, sizeof(buf), "FormatMessageA(%lu): %lu", err, GetLastError());

    TrimEnd(buf);
    return buf;
}
/**
   Initialise the role UUIDs.
   @internalComponent
*/
void RBnepSetupConnectionRequestControl::SetRolesL (TUUID& aLocalRole, TUUID& aRemoteRole)
    {
    LOG_FUNC
    TInt uuidSize = Max(aLocalRole.MinimumSize(), aRemoteRole.MinimumSize());
    TBuf8<2*sizeof(TUint8)> header;
    header.SetMax();
    header[KControlTypeOffset] = EBnepSetupConnectionRequestMessage;
    header[KUUIDSizeOffset] = static_cast<TUint8>(uuidSize);
    CopyIn(header);
    TPtrC8 uuid;
    uuid.Set(aRemoteRole.SpecifiedLengthL(uuidSize));
    CopyIn(uuid, KUUIDOffset);
    uuid.Set(aLocalRole.SpecifiedLengthL(uuidSize));
    CopyIn(uuid, KUUIDOffset + uuidSize);
    TrimEnd(KUUIDOffset + (2 * uuidSize));
    DUMPFRAME(_L8("RBnepSetupConnectionRequestControl"));
    }