Author Topic: I'am writing a software about wlan, but I don't have wlanapi.inc  (Read 12030 times)

dycaly

  • Regular Member
  • *
  • Posts: 10
I had searched on the Internel, but I found nothing. How can I do with it, could you help me?

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 7540
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: I'am writing a software about wlan, but I don't have wlanapi.inc
« Reply #1 on: August 21, 2014, 11:07:06 AM »
It does not appear to be a Microsoft API library, do you know who wrote the original library that the include file prototypes ?
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

dycaly

  • Regular Member
  • *
  • Posts: 10
Re: I'am writing a software about wlan, but I don't have wlanapi.inc
« Reply #2 on: August 21, 2014, 11:09:07 AM »
I have found wlanapi.h wlanapi.lib wlanapi.dll in VS2013

dycaly

  • Regular Member
  • *
  • Posts: 10
Re: I'am writing a software about wlan, but I don't have wlanapi.inc
« Reply #3 on: August 21, 2014, 11:13:08 AM »
It does not appear to be a Microsoft API library, do you know who wrote the original library that the include file prototypes ?
masm32 also doesn't have wlanapi.inc, why they don't develop it for us 

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 7540
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: I'am writing a software about wlan, but I don't have wlanapi.inc
« Reply #4 on: August 21, 2014, 11:25:20 AM »
I have pulled a function list from the Win7 DLL of the same name but I don't have the library to get the parameter count. Please post the LIB file and I will see what I can do. I gather it will also need to have structures and equates which I don't have any data for.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

dycaly

  • Regular Member
  • *
  • Posts: 10
Re: I'am writing a software about wlan, but I don't have wlanapi.inc
« Reply #5 on: August 21, 2014, 11:35:47 AM »
I have pulled a function list from the Win7 DLL of the same name but I don't have the library to get the parameter count. Please post the LIB file and I will see what I can do. I gather it will also need to have structures and equates which I don't have any data for.
This is the file. Thank you

jj2007

  • Member
  • *****
  • Posts: 10544
  • Assembler is fun ;-)
    • MasmBasic
Re: I'am writing a software about wlan, but I don't have wlanapi.inc
« Reply #6 on: August 21, 2014, 11:58:20 AM »
The WlanAPI.dll is present on XP SP3. This code works in principle but my wlan is not working, so I get error messages. Warning: While testing an early version, I got a BSOD and spontaneous reboot - this snippet seems to be safe, though.

include \masm32\MasmBasic\MasmBasic.inc            ; download
  SetGlobals dwNegotiatedVersion, hClientHandle    ; see MSDN
  Init
  SetGlobals
  Dll "WlanApi"
  Declare WlanOpenHandle, 4         ; 4 paras expected
  Declare WlanCloseHandle, 2        ; 2 paras expected
  Print Str$("WlanOpenHandle returns\t%i\n", WlanOpenHandle(1, 0, addr dwNegotiatedVersion, addr hClientHandle))
  Print Str$("The version is\t%i\n", dwNegotiatedVersion)
  Print Str$("The client handle is\t%i\n", hClientHandle)
  Inkey Str$("Closing yields %i", WlanCloseHandle(hClientHandle, 0))
  Exit
end start


Output (on Win XP SP3 without WLAN):

WlanOpenHandle returns  1062 (="service not started")
The version is  0
The client handle is    0
Closing yields 87


P.S.: After launching "Windows Zero Configuration Service" (who invented that name? Ballmer far away from the peak?), the snippet's output is as follows:

WlanOpenHandle returns  0
The version is  1
The client handle is    1
Closing yields 0

dycaly

  • Regular Member
  • *
  • Posts: 10
Re: I'am writing a software about wlan, but I don't have wlanapi.inc
« Reply #7 on: August 21, 2014, 12:09:46 PM »
The WlanAPI.dll is present on XP SP3. This code works in principle but my wlan is not working, so I get error messages. Warning: While testing an early version, I got a BSOD and spontaneous reboot - this snippet seems to be safe, though.

include \masm32\MasmBasic\MasmBasic.inc            ; download
  SetGlobals dwNegotiatedVersion, hClientHandle    ; see MSDN
  Init
  SetGlobals
  Dll "WlanApi"
  Declare WlanOpenHandle, 4         ; 4 paras expected
  Declare WlanCloseHandle, 2        ; 2 paras expected
  Print Str$("WlanOpenHandle returns\t%i\n", WlanOpenHandle(1, 0, addr dwNegotiatedVersion, addr hClientHandle))
  Print Str$("The version is\t%i\n", dwNegotiatedVersion)
  Print Str$("The client handle is\t%i\n", hClientHandle)
  Inkey Str$("Closing yields %i", WlanCloseHandle(hClientHandle, 0))
  Exit
end start


Output (on Win XP SP3 without WLAN):

WlanOpenHandle returns  1062
The version is  0
The client handle is    0
Closing yields 87

Are you using DLL directly in asm? But I got known that the effection of  .inc file in asm was the as .h file in C/C++, so I guess there is none of DLL's business

jj2007

  • Member
  • *****
  • Posts: 10544
  • Assembler is fun ;-)
    • MasmBasic
Re: I'am writing a software about wlan, but I don't have wlanapi.inc
« Reply #8 on: August 21, 2014, 12:24:26 PM »
Are you using DLL directly in asm?

Yes. Under the hood of Dll & Declare, LoadLibrary and GetProcAddress do the work (successfully, see P.S. above)

Having a proper .inc file will make the job easier, though. The question is if it's worth the effort - don't forget this is a volunteer site, and Hutch doesn't get paid for it. You can bring him a sixpack, though :biggrin:

dycaly

  • Regular Member
  • *
  • Posts: 10
Re: I'am writing a software about wlan, but I don't have wlanapi.inc
« Reply #9 on: August 21, 2014, 12:47:40 PM »
Are you using DLL directly in asm?

Yes. Under the hood of Dll & Declare, LoadLibrary and GetProcAddress do the work (successfully, see P.S. above)

Having a proper .inc file will make the job easier, though. The question is if it's worth the effort - don't forget this is a volunteer site, and Hutch doesn't get paid for it. You can bring him a sixpack, though :biggrin:
I am in a quandary´╝îbecause I'm a new learner, so I haven't saw the code that you have written before, what I learn just like
"
         invoke   WlanOpenHandle,2,NULL,NULL,hWlanHandle
         invoke   WlanEnumInterfaces,hWlanHandle,NULL,addr @stWlanList
         invoke   WlanScan,hWlanHandle,addr @stWlanList.InterfaceInfo.InterfaceGuid,NULL,NULL,NULL
         invoke   WlanGetAvailableNetworkList,hWlanHandle,addr @stWlanList.InterfaceInfo.InterfaceGuid,1,NULL,addr   @stWlanAvalibe
"
Especially the "Declare" in your code


dycaly

  • Regular Member
  • *
  • Posts: 10
Re: I'am writing a software about wlan, but I don't have wlanapi.inc
« Reply #10 on: August 21, 2014, 12:51:05 PM »
Are you using DLL directly in asm?

Yes. Under the hood of Dll & Declare, LoadLibrary and GetProcAddress do the work (successfully, see P.S. above)

Having a proper .inc file will make the job easier, though. The question is if it's worth the effort - don't forget this is a volunteer site, and Hutch doesn't get paid for it. You can bring him a sixpack, though :biggrin:
I'm curious about why there is no such .inc file. Does it means that there is no one write software about wlan using asm?

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: I'am writing a software about wlan, but I don't have wlanapi.inc
« Reply #11 on: August 21, 2014, 12:59:28 PM »
you might check Yves' "ready-to-use" includes - or Japheth's WinInc/WinIncEx
otherwise - this one wouldn't be that hard to convert, compared to some i've seen   :biggrin:

http://masm32.com/board/index.php?topic=563.0
http://www.japheth.de/WinInc.html

jj2007

  • Member
  • *****
  • Posts: 10544
  • Assembler is fun ;-)
    • MasmBasic
Re: I'am writing a software about wlan, but I don't have wlanapi.inc
« Reply #12 on: August 21, 2014, 01:03:03 PM »
         invoke   WlanOpenHandle,2,NULL,NULL,hWlanHandle
...
Especially the "Declare" in your code

Declare is a macro that you can use in a similar way as in Visual Basic. It uses internally an invoke GetProcAddress().

Once you have the inc and lib files, you can indeed use the invoke syntax.
However, hWlanHandle does not seem a correct parameter - WlanOpenHandle expects the address of a handle, as in my example above.

dycaly

  • Regular Member
  • *
  • Posts: 10
Re: I'am writing a software about wlan, but I don't have wlanapi.inc
« Reply #13 on: August 21, 2014, 01:15:25 PM »
         invoke   WlanOpenHandle,2,NULL,NULL,hWlanHandle
...
Especially the "Declare" in your code

Declare is a macro that you can use in a similar way as in Visual Basic. It uses internally an invoke GetProcAddress().

Once you have the inc and lib files, you can indeed use the invoke syntax.
However, hWlanHandle does not seem a correct parameter - WlanOpenHandle expects the address of a handle, as in my example above.
yes, I made a mistake.  :t, 
Once you have the inc and lib files, you can indeed use the invoke syntax.
Does it means that if I don't have inc file, I can use  the syntax that you written in your code and it also work?

dycaly

  • Regular Member
  • *
  • Posts: 10
Re: I'am writing a software about wlan, but I don't have wlanapi.inc
« Reply #14 on: August 21, 2014, 01:17:56 PM »
you might check Yves' "ready-to-use" includes - or Japheth's WinInc/WinIncEx
otherwise - this one wouldn't be that hard to convert, compared to some i've seen   :biggrin:

http://masm32.com/board/index.php?topic=563.0
http://www.japheth.de/WinInc.html
It is a good idea, I think I should have a try. Thanks