/* ULONG __RPC_FAR *pSdpVersion; * ULONG __RPC_FAR *pRecordHandle; * ULONG Reserved[ 4 ]; * ULONG fSecurity; * ULONG fOptions; * ULONG ulRecordLength; * UCHAR pRecord[ 1 ]; * * public IntPtr pRecordHandle; * private uint fSecurity; * private uint fOptions; * public uint ulRecordLength; * public byte pRecord;*/ // // * Win32 //typedef struct _BTH_SET_SERVICE { // PULONG pSdpVersion; // HANDLE *pRecordHandle; // ULONG fCodService; // COD_SERVICE_* bits // ULONG Reserved[5]; // Reserved by system. Must be zero. // ULONG ulRecordLength; // length of pRecord which follows // UCHAR pRecord[1]; // SDP record as defined by bluetooth spec //} // * WinCE //struct _BTHNS_SETBLOB //{ // ULONG __RPC_FAR *pSdpVersion; // ULONG __RPC_FAR *pRecordHandle; // ULONG Reserved[ 4 ]; // ULONG fSecurity; // ULONG fOptions; // ULONG ulRecordLength; // UCHAR pRecord[ 1 ]; //} public BTHNS_SETBLOB(byte[] record) { BTHNS_SETBLOB.AssertCheckLayout(); //create data buffer m_data = new byte[StructLength_36 + record.Length]; pVersionHandle = GCHandle.Alloc(BTH_SDP_VERSION, GCHandleType.Pinned); pRecordHandle = GCHandle.Alloc((IntPtr)0, GCHandleType.Pinned); IntPtr vaddr = pVersionHandle.AddrOfPinnedObject(); IntPtr haddr = pRecordHandle.AddrOfPinnedObject(); Marshal32.WriteIntPtr(m_data, Offset_pSdpVersion_0, vaddr); Marshal32.WriteIntPtr(m_data, Offset_pRecordHandle_4, haddr); BitConverter.GetBytes(record.Length).CopyTo(m_data, Offset_ulRecordLength_32); //copy sdp record Buffer.BlockCopy(record, 0, m_data, StructLength_36, record.Length); }