Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8861629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:32:02+00:00 2026-06-14T15:32:02+00:00

#include <Bthsdpdef.h> #include <BluetoothAPIs.h> #include <Winsock2.h> #include <Ws2bth.h> #include <stdio.h> #pragma comment(lib, "Bthprops.lib") int

  • 0
#include <Bthsdpdef.h>
#include <BluetoothAPIs.h>
#include <Winsock2.h>
#include <Ws2bth.h>
#include <stdio.h>

#pragma comment(lib, "Bthprops.lib")


int main(void){
    WSADATA wsaData;
    int err;
    DWORD qs_len;
    WSAQUERYSET *qs;
    DWORD flags;
    HANDLE lphLookup;
    int iRet;
    char buff[4096];
    LPWSAQUERYSET pwsaResult = (LPWSAQUERYSET) buff;
    DWORD buffLen = sizeof(buff);
    BTH_ADDR result;

    WORD wVersionRquested = MAKEWORD(2,2);
    err = WSAStartup(wVersionRquested, &wsaData);   //Statrup function

    if(err != 0){
        printf("WSAStartup failed");
        return 1;
    }

    qs_len = sizeof(WSAQUERYSET);
    qs = (WSAQUERYSET *) malloc(qs_len); // Save memory for  WSAQUERYSET structere
    ZeroMemory(qs, qs_len); //zero WSAQUERYSET out

    qs->dwSize = sizeof(WSAQUERYSET);
    qs->dwNameSpace = NS_BTH;
    qs->lpcsaBuffer = NULL;
    flags = LUP_CONTAINERS | LUP_FLUSHCACHE | LUP_RETURN_NAME | LUP_RETURN_ADDR; //details of the device discovery

    iRet = WSALookupServiceBegin(qs, flags, &lphLookup);
    if(iRet == ERROR_SUCCESS){
        printf("WSALookupServiceBegin failed");
        return 1;
    }
    printf("\r\n\t\t\t\tScanning...");

    ZeroMemory(pwsaResult, sizeof(LPWSAQUERYSET));
    pwsaResult->dwSize = sizeof(WSAQUERYSET);
    pwsaResult->dwNameSpace = NS_BTH;
    pwsaResult->lpBlob = NULL;

    while(WSALookupServiceNext(lphLookup, flags, &buffLen, pwsaResult) != ERROR_SUCCESS){
        result = ((BTH_ADDR)qs->lpcsaBuffer->RemoteAddr.lpSockaddr);
        WSAAddressToString(qs->lpcsaBuffer->RemoteAddr.lpSockaddr, sizeof(SOCKADDR_BTH), NULL, (LPWSTR)buff, &buffLen);
        printf("Found: %s - %s", buff, qs->lpszServiceInstanceName);
    }

    WSALookupServiceEnd(lphLookup);
    free(qs);
    WSACleanup();
    return 0;
}

I got alot of syntax and missing type errors in bthsdpdef.h which is in microsoft sdk folder.
such as:

bthsdpdef.h(11): error C2146: syntax error : missing ‘;’ before identifier ‘LowPart’,

bthsdpdef.h(11): error C4430: missing type specifier – int assumed. Note: C++ does not support default-int

what’s the problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:32:03+00:00Added an answer on June 14, 2026 at 3:32 pm

    Add the following lines at the top of your file (above your #include’s). That fixes the compilation for me.

    #define WIN32_LEAN_AND_MEAN 1 // Don't include Winsock v1
    #include <windows.h>
    #include <stdlib.h>
    #pragma comment(lib, "ws2_32.lib")
    

    Your code needs to include the base header file(s). Otherwise when the compiler comes to bthsdpdef.h and sees the following it does not know the definition of type ULONGLONG.

    struct SDP_LARGE_INTEGER_16 {
        ULONGLONG LowPart;
        LONGLONG HighPart;
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

#include <stdio.h> #include <stdlib.h> int main(void) { int x; int *in, *begin; in =
#include <stdio.h> #include <math.h> void main() { int i, diff, sum = 0, num1
#include <stdio.h> void main() { int x=5,y=6; printf(%d%d%d,x++,(y=x++),(x=y++)); } Can anyone please explain why
#include <stdio.h> int main(void){ float a = 1.1; double b = 1.1; if(a ==
#include <stdio.h> #include <string.h> int main(void) { char s[]= 9; printf(atoi = %d,atoi(s)); system(pause);
#include <stdio.h> int main(void) { int i = 0; i = i++ + ++i;
#include<stdio.h> #include<conio.h> #define SQUARE(x) (x*x) void main() { clrscr(); int i=3,j,k; j=SQUARE(i++); k=SQUARE(++i); printf(\n%d\n%d\n%d,j,k,i);
#include <stdio.h> #include <stdlib.h> void setZero (double **, int); int main (void) { double
#include<stdio.h> #include<stdlib.h> char* re() { char *p = hello; return p; } int main()
#include <stdio.h> #include <limits.h> void sanity_check(int x) { if (x < 0) { x

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.