News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

I'am writing a software about wlan, but I don't have wlanapi.inc

Started by dycaly, August 21, 2014, 11:04:04 AM

Previous topic - Next topic

dycaly

I had searched on the Internel, but I found nothing. How can I do with it, could you help me?

hutch--

It does not appear to be a Microsoft API library, do you know who wrote the original library that the include file prototypes ?

dycaly


dycaly

Quote from: hutch-- 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 ?
masm32 also doesn't have wlanapi.inc, why they don't develop it for us 

hutch--

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.

dycaly

Quote from: hutch-- 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.
This is the file. Thank you

jj2007

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

Quote from: jj2007 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
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

Quote from: dycaly on August 21, 2014, 12:09:46 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

Quote from: jj2007 on August 21, 2014, 12:24:26 PM
Quote from: dycaly on August 21, 2014, 12:09:46 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

Quote from: jj2007 on August 21, 2014, 12:24:26 PM
Quote from: dycaly on August 21, 2014, 12:09:46 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

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

Quote from: dycaly on August 21, 2014, 12:47:40 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

Quote from: jj2007 on August 21, 2014, 01:03:03 PM
Quote from: dycaly on August 21, 2014, 12:47:40 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, 
Quote from: jj2007 on August 21, 2014, 01:03:03 PM
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

Quote from: dedndave 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
It is a good idea, I think I should have a try. Thanks