//------------------------------------------------------------------------
// Function: BT_SetService
// Purpose: Registers a new SDP record
// Note: This function does not include a call to WSAStartup or WSACleanup
// as described in the procedure.
// This sample has not been tested and is not intended for production use.
//------------------------------------------------------------------------
bool BT_SetService()
{
ULONG recordHandle = 0;
#define SDP_RECORD_SIZE 0x0000004f
BYTE rgbSdpRecord[] = {
0x35, 0x4d, 0x09, 0x00, 0x01, 0x35, 0x11, 0x1c,
0x29, 0xf9, 0xc0, 0xfd, 0xbb, 0x6e, 0x47, 0x97,
0x9f, 0xa9, 0x3e, 0xc9, 0xa8, 0x54, 0x29, 0x0c,
0x09, 0x00, 0x04, 0x35, 0x0c, 0x35, 0x03, 0x19,
0x01, 0x00, 0x35, 0x05, 0x19, 0x00, 0x03, 0x08,
0x1a, 0x09, 0x00, 0x06, 0x35, 0x09, 0x09, 0x65,
0x6e, 0x09, 0x00, 0x6a, 0x09, 0x01, 0x00, 0x09,
0x00, 0x09, 0x35, 0x08, 0x35, 0x06, 0x19, 0x11,
0x05, 0x09, 0x01, 0x00, 0x09, 0x01, 0x00, 0x25,
0x06, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c
};
struct
{
BTHNS_SETBLOB b;
unsigned char uca[SDP_RECORD_SIZE];
} bigBlob;
ULONG ulSdpVersion = BTH_SDP_VERSION;
bigBlob.b.pRecordHandle = &recordHandle;
bigBlob.b.pSdpVersion = &ulSdpVersion;
bigBlob.b.fSecurity = 0;
bigBlob.b.fOptions = 0;
bigBlob.b.ulRecordLength = SDP_RECORD_SIZE;
memcpy (bigBlob.b.pRecord, rgbSdpRecord, SDP_RECORD_SIZE);
BLOB blob;
blob.cbSize = sizeof(BTHNS_SETBLOB) + SDP_RECORD_SIZE - 1;
blob.pBlobData = (PBYTE) &bigBlob;
WSAQUERYSET Service;
memset (&Service, 0, sizeof(Service));
Service.dwSize = sizeof(Service);
Service.lpBlob = &blob;
Service.dwNameSpace = NS_BTH;
if (WSASetService(&Service,RNRSERVICE_REGISTER,0) == SOCKET_ERROR)
return false;
else
return true;
}