 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
ahklerner
Joined: 26 Jun 2006 Posts: 1202 Location: USA
|
Posted: Wed Jul 16, 2008 1:54 am Post subject: [StdLib] Wlanapi.dll Control your WiFi adapter |
|
|
Here is how far I have gotten wrapping the Wlanapi.dll. Some of this stuff is over my head. If anyone could review and see if the types for the dllcall args are correct, it would be greatly appreciated. I am also unclear as to exactly when I should be using byref parameters for the function.
Thanks in advance for taking the time to review.
ALL OF THE FUNCTIONS ON MSDN (FOR THE WLANAPI.DLL) ARE NOW INCLUDED.
Thanks again for taking the time to review this....
| Code: | ; By: ahklerner & Sean <- he did the hard stuff
; see forum post for more info
; http://www.autohotkey.com/forum/viewtopic.php?t=33726
;Test Script Showing available interfaces.
/*
hWlan := WLAN_Init()
hClientHandle := WLAN_WlanOpenHandle()
pEnum := WLAN_WlanEnumInterfaces(hClientHandle)
InterfaceCount := NumGet(pEnum+0)
Loop, % InterfaceCount
{
CurrentItem := NumGet(pEnum+4) ;<- shouldn't A_Index be in there somewhere ?
Interface_%A_Index%_GUID := Wlan_String4GUID(pEnum+8+(A_Index-1)*532)
Interface_%A_Index%_DESC := Wlan_Ansi4Unicode(pEnum+8+(A_Index-1)*532+16)
Interface_%A_Index%_STATE := NumGet(pEnum+8+(A_Index-1)*532+528)
}
pInterfaceGuid := WLAN_GUID4String(GUID,Interface_1_GUID)
pNetworkList := WLAN_WlanGetAvailableNetworkList(hClientHandle,pInterfaceGuid,dwFlags)
MsgBox % "hClientHandle: " . hClientHandle
. "`npEnum: " . pEnum
. "`nInterfaceCount: " . InterfaceCount
. "`nCurrentItem: " . CurrentItem
. "`nInterface_1_GUID: " . Interface_1_GUID
. "`nInterface_1_DESC: " . Interface_1_DESC
. "`nInterface_1_STATE: " . Interface_1_STATE
. "`npInterfaceGuid: " . pInterfaceGuid
. "`npNetworkList: " . pNetworkList
WLAN_WlanFreeMemory(pNetworkList)
WLAN_WlanFreeMemory(pEnum)
WLAN_WlanCloseHandle(hClientHandle)
WLAN_UnInit(hWlan)
ExitApp
*/
WLAN_WlanAllocateMemory(dwMemorySize){
;http://msdn.microsoft.com/en-us/library/ms706603(VS.85).aspx
Return DllCall("Wlanapi.dll\WlanAllocateMemory", "UInt", dwMemorySize)
}
WLAN_WlanCloseHandle(hClientHandle){
;http://msdn.microsoft.com/en-us/library/ms706610(VS.85).aspx
Return DllCall("Wlanapi.dll\WlanCloseHandle", "UInt", hClientHandle, "UInt", 0)
}
WLAN_WlanConnect(hClientHandle,pInterfaceGuid,pConnectionParameters){
;http://msdn.microsoft.com/en-us/library/ms706613(VS.85).aspx
Return DllCall("Wlanapi.dll\WlanConnect", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", pConnectionParameters, "UInt", 0)
}
WLAN_WlanDeleteProfile(hClientHandle,pInterfaceGuid,strProfileName){
;http://msdn.microsoft.com/en-us/library/ms706617(VS.85).aspx
Return DllCall("Wlanapi.dll\WlanDeleteProfile", "UInt", hClientHandle, "UInt", pInterfaceGuid, "Uint", Wlan_Unicode4Ansi(strProfileName,strProfileName), "UInt", 0)
}
WLAN_WlanDisconnect(hClientHandle,pInterfaceGuid){
;http://msdn.microsoft.com/en-us/library/ms706714(VS.85).aspx
Return DllCall("Wlanapi.dll\WlanDisconnect", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", 0)
}
WLAN_WlanEnumInterfaces(hClientHandle){
;http://msdn.microsoft.com/en-us/library/ms706716(VS.85).aspx
If DllCall("Wlanapi.dll\WlanEnumInterfaces", "UInt", hClientHandle, "UInt", 0, "UInt*", pInterfaceList)=0
Return pInterfaceList
}
WLAN_WlanExtractPsdIEDataList(hClientHandle,dwIeDataSize, pRawIeData,strFormat){
;http://msdn.microsoft.com/en-us/library/ms706720(VS.85).aspx
If DllCall("Wlanapi.dll\WlanExtractPsdIEDataList", "UInt", hClientHandle, "UInt", dwIeDataSize, "Uint", pRawIeData, "Uint", Wlan_Unicode4Ansi(strFormat,strFormat), "UInt", 0, "UInt*",pPsdIEDataList)=0
Return pPsdIEDataList
}
WLAN_WlanFreeMemory(pMemory){
;http://msdn.microsoft.com/en-us/library/ms706722(VS.85).aspx
DllCall("Wlanapi.dll\WlanFreeMemory", "UInt", pMemory)
}
WLAN_WlanGetAvailableNetworkList(hClientHandle,pInterfaceGuid,dwFlags){
;http://msdn.microsoft.com/en-us/library/ms706749(VS.85).aspx
If DllCall("Wlanapi.dll\WlanGetAvailableNetworkList", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", dwFlags, "UInt", 0, "UInt*", pAvailableNetworkList)=0
Return pAvailableNetworkList
}
WLAN_WlanGetFilterList(hClientHandle,wlanFilterListType){
;http://msdn.microsoft.com/en-us/library/ms706729(VS.85).aspx
If DllCall("Wlanapi.dll\WlanGetFilterList", "UInt", hClientHandle, "Uint", wlanFilterListType, "UInt", 0, "UInt*", pNetworkList)=0
Return pNetworkList
}
WLAN_WlanGetInterfaceCapability(hClientHandle,pInterfaceGuid){
;http://msdn.microsoft.com/en-us/library/ms706733(VS.85).aspx
If DllCall("Wlanapi.dll\WlanGetInterfaceCapability", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", 0, "UInt*", pCapability)=0
Return pCapability
}
WLAN_WlanGetNetworkBssList(hClientHandle,pInterfaceGuid,pDot11Ssid,dot11BssType,bSecurityEnabled){
;http://msdn.microsoft.com/en-us/library/ms706735(VS.85).aspx
If DllCall("Wlanapi.dll\WlanGetNetworkBssList", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", pDot11Ssid, "UInt", dot11BssType, "Int", bSecurityEnabled, "UInt", 0, "UInt*", pWlanBssList)=0
Return pWlanBssList
}
WLAN_WlanGetProfile(hClientHandle,pInterfaceGuid,strProfileName,ByRef dwFlags,ByRef dwGrantedAccess){
;http://msdn.microsoft.com/en-us/library/ms706738(VS.85).aspx
If DllCall("Wlanapi.dll\WlanGetProfile", "UInt", hClientHandle, "UInt", pInterfaceGuid, "Uint", Wlan_Unicode4Ansi(strProfileName,strProfileName), "UInt", 0, "Uint*", pstrProfileXml, "UInt*", dwFlags, "UInt*", dwGrantedAccess)=0
Return Wlan_Ansi4Unicode(pstrProfileXml) . WLAN_WlanFreeMemory(pstrProfileXml)
}
WLAN_WlanGetProfileCustomUserData(hClientHandle,pInterfaceGuid,strProfileName,ByRef dwDataSize){
;http://msdn.microsoft.com/en-us/library/ms706740(VS.85).aspx
If DllCall("Wlanapi.dll\WlanGetProfileCustomUserData","UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", Wlan_Unicode4Ansi(strProfileName,strProfileName), "UInt", 0, "UInt*", dwDataSize, "UInt*", pData)=0
Return pData
}
WLAN_WlanGetProfileList(hClientHandle,pInterfaceGuid){
;http://msdn.microsoft.com/en-us/library/ms706743(VS.85).aspx
If DllCall("Wlanapi.dll\WlanGetProfileList", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", 0, "UInt*", pProfileList)=0
Return pProfileList
}
WLAN_WlanGetSecuritySettings(hClientHandle,SecurableObject, ByRef ValueType,ByRef dwGrantedAccess){
;http://msdn.microsoft.com/en-us/library/ms706746(VS.85).aspx
If DllCall("Wlanapi.dll\WlanGetSecuritySettings", "UInt", hClientHandle, "UInt", SecurableObject, "UInt*", ValueType, "UInt*", pstrCurrentSDDL, "UInt*", dwGrantedAccess)=0
Return Wlan_Ansi4Unicode(pstrCurrentSDDL) . WLAN_WlanFreeMemory(pstrCurrentSDDL)
}
WLAN_WlanIhvControl(hClientHandle,pInterfaceGuid,Type,dwInBufferSize,pInBuffer,dwOutBufferSize,pOutBuffer){
;http://msdn.microsoft.com/en-us/library/ms706754(VS.85).aspx
If DllCall("Wlanapi.dll\WlanIhvControl","UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", Type, "UInt", dwInBufferSize, "UInt", pInBuffer, "UInt", dwOutBufferSize, "UInt", pOutBuffer, "UInt*", dwBytesReturned)=0
Return dwBytesReturned
}
WLAN_WlanOpenHandle(dwClientVersion = 1, ByRef dwNegotiatedVersion = ""){ ; 2 for Vista
;http://msdn.microsoft.com/en-us/library/ms706759(VS.85).aspx
If DllCall("wlanapi\WlanOpenHandle", "Uint", dwClientVersion, "Uint", 0, "Uint*", dwNegotiatedVersion, "Uint*", hClientHandle)=0
Return hClientHandle
}
WLAN_WlanQueryAutoConfigParameter(hClientHandle,OpCode,ByRef dwDataSize,ByRef WlanOpcodeValueType){
;http://msdn.microsoft.com/en-us/library/ms706761(VS.85).aspx
If DllCall("Wlanapi.dll\WlanQueryAutoConfigParameter", "UInt", hClientHandle, "UInt", OpCode, "UInt", 0, "UInt*", dwDataSize, "UInt*", pData, "UInt*", WlanOpcodeValueType)=0
Return pData
}
WLAN_WlanQueryInterface(hClientHandle,pInterfaceGuid,OpCode,ByRef dwDataSize,ByRef WlanOpcodeValueType){
;http://msdn.microsoft.com/en-us/library/ms706765(VS.85).aspx
If DllCall("Wlanapi.dll\WlanQueryInterface", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", OpCode, "UInt", 0, "UInt*", dwDataSize, "UInt*", pData, "UInt*", WlanOpcodeValueType)=0
Return pData
}
WLAN_WlanReasonCodeToString(dwReasonCode){
;http://msdn.microsoft.com/en-us/library/ms706768(VS.85).aspx
If DllCall("Wlanapi.dll\WlanReasonCodeToString", "UInt", dwReasonCode, "UInt", VarSetCapacity(String,1024*2)//2, "UInt", &String, "UInt", 0)=0
Return Wlan_Ansi4Unicode(&String)
}
WLAN_WlanRegisterNotification(hClientHandle,dwNotifSource,bIgnoreDuplicate,funcCallback,pCallbackContext){
;http://msdn.microsoft.com/en-us/library/ms706771(VS.85).aspx
If DllCall("Wlanapi.dll\WlanRegisterNotification", "UInt", hClientHandle, "UInt", dwNotifSource, "Int", bIgnoreDuplicate, "UInt", funcCallback, "UInt", pCallbackContext, "UInt", 0, "UInt*", dwPrevNotifSource)=0
Return dwPrevNotifSource
}
WLAN_WlanRenameProfile(hClientHandle, pInterfaceGuid, strOldProfileName, strNewProfileName){
;http://msdn.microsoft.com/en-us/library/ms706773(VS.85).aspx
Return DllCall("Wlanapi.dll\WlanRenameProfile", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", Wlan_Unicode4Ansi(strOldProfileName,strOldProfileName), "UInt", Wlan_Unicode4Ansi(strNewProfileName,strNewProfileName), "UInt", 0)
}
WLAN_WlanSaveTemporaryProfile(hClientHandle,pInterfaceGuid,strProfileName, strAllUserProfileSecurity,dwFlags,bOverWrite){
;http://msdn.microsoft.com/en-us/library/ms706778(VS.85).aspx
Return DllCall("Wlanapi.dll\WlanSaveTemporaryProfile", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", Wlan_Unicode4Ansi(strProfileName,strProfileName), "UInt", Wlan_Unicode4Ansi(strAllUserProfileSecurity,strAllUserProfileSecurity), "UInt", dwFlags, "Int", bOverWrite, "UInt", 0)
}
WLAN_WlanScan(hClientHandle, pInterfaceGuid, pDot11Ssid, pIeData){
;http://msdn.microsoft.com/en-us/library/ms706783(VS.85).aspx
Return DllCall("Wlanapi.dll\WlanScan", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", pDot11Ssid, "UInt", pIeData, "UInt", 0)
}
WLAN_WlanSetAutoConfigParameter(hClientHandle,OpCode,dwDataSize,pData){
;http://msdn.microsoft.com/en-us/library/ms706786(VS.85).aspx
Return DllCall("Wlanapi.dll\WlanSetAutoConfigParameter", "UInt", hClientHandle, "UInt", OpCode, "UInt", dwDataSize, "UInt", pData, "UInt", 0)
}
WLAN_WlanSetFilterList(hClientHandle,wlanFilterListType,pNetworkList){
;http://msdn.microsoft.com/en-us/library/ms706788(VS.85).aspx
Return DllCall("Wlanapi.dll\WlanSetFilterList", "UInt", hClientHandle, "UInt", wlanFilterListType, "UInt", pNetworkList, "UInt", 0)
}
WLAN_WlanSetInterface(hClientHandle,pInterfaceGuid,OpCode,dwDataSize,pData){
;http://msdn.microsoft.com/en-us/library/ms706791(VS.85).aspx
Return DllCall("Wlanapi.dll\WlanSetInterface", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", OpCode, "UInt", dwDataSize, "UInt", pData, "UInt", 0)
}
WLAN_WlanSetProfile(hClientHandle, pInterfaceGuid, dwFlags, strProfileXml, strAllUserProfileSecurity, bOverwrite,ByRef dwReasonCode){
;http://msdn.microsoft.com/en-us/library/ms706795(VS.85).aspx
Return DllCall("Wlanapi.dll\WlanSetProfile", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", dwFlags, "UInt", Wlan_Unicode4Ansi(strProfileXml,strProfileXml), "UInt", Wlan_Unicode4Ansi(strAllUserProfileSecurity,strAllUserProfileSecurity), "UInt", bOverwrite, "UInt", 0, "UInt*", dwReasonCode)
}
WLAN_WlanSetProfileCustomUserData(hClientHandle,pInterfaceGuid,strProfileName,dwDataSize,pData){
;http://msdn.microsoft.com/en-us/library/ms706822(VS.85).aspx
Return DllCall("Wlanapi.dll\WlanSetProfileCustomUserData", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", Wlan_Unicode4Ansi(strProfileName,strProfileName), "UInt", dwDataSize, "UInt", pData, "UInt", 0)
}
WLAN_WlanSetProfileEapUserData(hClientHandle,pInterfaceGuid,strProfileName,eapType,dwFlags,dwEapUserDataSize,pbEapUserData){
;http://msdn.microsoft.com/en-us/library/ms706797(VS.85).aspx
Return DllCall("Wlanapi.dll\WlanSetProfileEapUserData", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", Wlan_Unicode4Ansi(strProfileName,strProfileName), "UInt", eapType, "UInt", dwFlags, "UInt", dwEapUserDataSize, "UInt", pbEapUserData, "UInt", 0)
}
WLAN_WlanSetProfileEapXmlUserData(hClientHandle,pInterfaceGuid,strProfileName,dwFlags,strEapXmlUserData){
;http://msdn.microsoft.com/en-us/library/ms706802(VS.85).aspx
Return DllCall("Wlanapi.dll\WlanSetProfileEapXmlUserData", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", Wlan_Unicode4Ansi(strProfileName,strProfileName), "UInt", dwFlags, "UInt", Wlan_Unicode4Ansi(strEapXmlUserData,strEapXmlUserData), "UInt", 0)
}
WLAN_WlanSetProfileList(hClientHandle,pInterfaceGuid,dwItems,pwstrProfileNames){
;http://msdn.microsoft.com/en-us/library/ms706805(VS.85).aspx
Return DllCall("Wlanapi.dll\WlanSetProfileList", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", dwItems, "UInt", pwstrProfileNames, "UInt", 0)
}
WLAN_WlanSetProfilePosition(hClientHandle,pInterfaceGuid,strProfileName,dwPosition){
;http://msdn.microsoft.com/en-us/library/ms706810(VS.85).aspx
Return DllCall("Wlanapi.dll\WlanSetProfilePosition", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", Wlan_Unicode4Ansi(strProfileName,strProfileName), "UInt", dwPosition, "UInt", 0)
}
WLAN_WlanSetPsdIEDataList(hClientHandle,strFormat,pPsdIEDataList){
;http://msdn.microsoft.com/en-us/library/ms706815(VS.85).aspx
Return DllCall("Wlanapi.dll\WlanSetPsdIEDataList", "UInt", hClientHandle, "UInt", Wlan_Unicode4Ansi(strFormat,strFormat), "UInt", pPsdIEDataList, "UInt", 0)
}
WLAN_WlanSetSecuritySettings(hClientHandle,SecurableObject,strModifiedSDDL){
;http://msdn.microsoft.com/en-us/library/ms706819(VS.85).aspx
Return DllCall("Wlanapi.dll\WlanSetSecuritySettings", "UInt", hClientHandle, "UInt", SecurableObject, "UInt", Wlan_Unicode4Ansi(strModifiedSDDL,strModifiedSDDL))
}
WLAN_WlanUIEditProfile(dwClientVersion,strProfileName,pInterfaceGuid,hWnd,wlStartPage,ByRef dwReasonCode){
;http://msdn.microsoft.com/en-us/library/ms706825(VS.85).aspx
Return DllCall("Wlanapi.dll\WlanUIEditProfile", "UInt", dwClientVersion, "UInt", Wlan_Unicode4Ansi(strProfileName,strProfileName), "UInt", pInterfaceGuid, "UInt", hWnd, "UInt", wlStartPage, "UInt", 0, "UInt*", dwReasonCode)
}
WLAN_Init(){
Return DllCall("LoadLibrary", "str", "wlanapi.dll")
}
WLAN_UnInit(hWlan){
DllCall("FreeLibrary", "UInt", hWlan)
}
Wlan_GUID4String(ByRef GUID, String)
{
VarSetCapacity(GUID,16,0)
If DllCall("ole32\IIDFromString", "Uint", Wlan_Unicode4Ansi(String,String), "Uint", &GUID)=0
Return &GUID
}
Wlan_String4GUID(pGUID)
{
VarSetCapacity(String,38*2+1,0)
If DllCall("ole32\StringFromGUID2", "Uint", pGUID, "Uint", &String, "int", 39)
Return Wlan_Ansi4Unicode(&String)
}
Wlan_Ansi4Unicode(pString)
{
nSize:= DllCall("kernel32\WideCharToMultiByte", "Uint", 0, "Uint", 0, "Uint", pString, "int", -1, "Uint", 0, "int", 0, "Uint", 0, "Uint", 0), VarSetCapacity(sString,nSize)
If DllCall("kernel32\WideCharToMultiByte", "Uint", 0, "Uint", 0, "Uint", pString, "int", -1, "str", sString, "int", nSize, "Uint", 0, "Uint", 0)
Return sString
}
Wlan_Unicode4Ansi(ByRef wString, sString)
{
nSize:= DllCall("kernel32\MultiByteToWideChar", "Uint", 0, "Uint", 0, "Uint", &sString, "int", -1, "Uint", 0, "int", 0), VarSetCapacity(wString,nSize*2)
If DllCall("kernel32\MultiByteToWideChar", "Uint", 0, "Uint", 0, "Uint", &sString, "int", -1, "Uint", &wString, "int", nSize)
Return &wString
}
|
_________________

Last edited by ahklerner on Wed Jul 30, 2008 5:33 pm; edited 2 times in total |
|
| Back to top |
|
 |
Fry
Joined: 01 Nov 2007 Posts: 602
|
Posted: Wed Jul 16, 2008 2:18 am Post subject: |
|
|
DUDE OMG THANK YOU
but really I really needed this _________________ check out my site
www.eliteknifesquad.com |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1202 Location: USA
|
Posted: Wed Jul 16, 2008 2:22 am Post subject: |
|
|
for what? _________________
 |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1331
|
Posted: Wed Jul 16, 2008 3:05 am Post subject: |
|
|
Here is a straightforward translation of your codes. I haven't run them at all, and checked the MSDN except about what they return on success.
| Code: | WLAN_WlanAllocateMemory(dwMemorySize){
Return DllCall("Wlanapi.dll\WlanAllocateMemory", "UInt", dwMemorySize)
}
WLAN_WlanCloseHandle(hClientHandle){
Return DllCall("Wlanapi.dll\WlanCloseHandle", "UInt", hClientHandle, "UInt", 0)
}
WLAN_WlanConnect(hClientHandle,pInterfaceGuid,pConnectionParameters){
Return DllCall("Wlanapi.dll\WlanConnect", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", pConnectionParameters, "UInt", 0)
}
WLAN_WlanDeleteProfile(hClientHandle,pInterfaceGuid,strProfileName){
Return DllCall("Wlanapi.dll\WlanDeleteProfile", "UInt", hClientHandle, "UInt", pInterfaceGuid, "Uint", Wlan_Unicode4Ansi(strProfileName,strProfileName), "UInt", 0)
}
WLAN_WlanDisconnect(hClientHandle,pInterfaceGuid){
Return DllCall("Wlanapi.dll\WlanDisconnect", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", 0)
}
WLAN_WlanEnumInterfaces(hClientHandle){
If DllCall("Wlanapi.dll\WlanEnumInterfaces", "UInt", hClientHandle, "UInt", 0, "UInt*", pInterfaceList)=0
Return pInterfaceList
}
WLAN_WlanExtractPsdIEDataList(hClientHandle,dwIeDataSize, pRawIeData,strFormat){
If DllCall("Wlanapi.dll\WlanExtractPsdIEDataList", "UInt", hClientHandle, "UInt", dwIeDataSize, "Uint", pRawIeData, "Uint", Wlan_Unicode4Ansi(strFormat,strFormat), "UInt", 0, "UInt*",pPsdIEDataList)=0
Return pPsdIEDataList
}
WLAN_WlanFreeMemory(pMemory){
DllCall("Wlanapi.dll\WlanFreeMemory", "UInt", pMemory)
}
WLAN_WlanGetAvailableNetworkList(hClientHandle,pInterfaceGuid,dwFlags){
If DllCall("Wlanapi.dll\WlanGetAvailableNetworkList", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", dwFlags, "UInt", 0, "UInt*", pAvailableNetworkList)=0
Return pAvailableNetworkList
}
WLAN_WlanGetFilterList(hClientHandle,wlanFilterListType){
If DllCall("Wlanapi.dll\WlanGetFilterList", "UInt", hClientHandle, "Uint", wlanFilterListType, "UInt", 0, "UInt*", pNetworkList)=0
Return pNetworkList
}
WLAN_WlanGetInterfaceCapability(hClientHandle,pInterfaceGuid){
If DllCall("Wlanapi.dll\WlanGetInterfaceCapability", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", 0, "UInt*", pCapability)=0
Return pCapability
}
WLAN_WlanGetNetworkBssList(hClientHandle,pInterfaceGuid,pDot11Ssid,dot11BssType,bSecurityEnabled){
If DllCall("Wlanapi.dll\WlanGetNetworkBssList", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", pDot11Ssid, "UInt", dot11BssType, "Int", bSecurityEnabled, "UInt", 0, "UInt*", pWlanBssList)=0
Return pWlanBssList
}
WLAN_WlanGetProfile(hClientHandle,pInterfaceGuid,strProfileName,ByRef dwFlags,ByRef dwGrantedAccess){
If DllCall("Wlanapi.dll\WlanGetProfile", "UInt", hClientHandle, "UInt", pInterfaceGuid, "Uint", Wlan_Unicode4Ansi(strProfileName,strProfileName), "UInt", 0, "Uint*", pstrProfileXml, "UInt*", dwFlags, "UInt*", dwGrantedAccess)=0
Return Wlan_Ansi4Unicode(pstrProfileXml) . WLAN_WlanFreeMemory(pstrProfileXml)
}
WLAN_WlanGetProfileCustomUserData(hClientHandle,pInterfaceGuid,strProfileName,ByRef dwDataSize){
If DllCall("Wlanapi.dll\WlanGetProfileCustomUserData","UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", Wlan_Unicode4Ansi(strProfileName,strProfileName), "UInt", 0, "UInt*", dwDataSize, "UInt*", pData)=0
Return pData
}
WLAN_WlanGetProfileList(hClientHandle,pInterfaceGuid){
If DllCall("Wlanapi.dll\WlanGetProfileList", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", 0, "UInt*", pProfileList)=0
Return pProfileList
}
WLAN_WlanGetSecuritySettings(hClientHandle,SecurableObject, ByRef ValueType,ByRef dwGrantedAccess){
If DllCall("Wlanapi.dll\WlanGetSecuritySettings", "UInt", hClientHandle, "UInt", SecurableObject, "UInt*", ValueType, "UInt*", pstrCurrentSDDL, "UInt*", dwGrantedAccess)=0
Return Wlan_Ansi4Unicode(pstrCurrentSDDL) . WLAN_WlanFreeMemory(pstrCurrentSDDL)
}
WLAN_WlanIhvControl(hClientHandle,pInterfaceGuid,Type,dwInBufferSize,pInBuffer,dwOutBufferSize,pOutBuffer){
If DllCall("Wlanapi.dll\WlanIhvControl","UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", Type, "UInt", dwInBufferSize, "UInt", pInBuffer, "UInt", dwOutBufferSize, "UInt", pOutBuffer, "UInt*", dwBytesReturned)=0
Return dwBytesReturned
}
WLAN_WlanOpenHandle(dwClientVersion = 1, ByRef dwNegotiatedVersion = "") ; 2 for Vista
{
If DllCall("wlanapi\WlanOpenHandle", "Uint", dwClientVersion, "Uint", 0, "Uint*", dwNegotiatedVersion, "Uint*", hClientHandle)=0
Return hClientHandle
}
WLAN_WlanQueryAutoConfigParameter(hClientHandle,OpCode,ByRef dwDataSize,ByRef WlanOpcodeValueType){
If DllCall("Wlanapi.dll\WlanQueryAutoConfigParameter", "UInt", hClientHandle, "UInt", OpCode, "UInt", 0, "UInt*", dwDataSize, "UInt*", pData, "UInt*", WlanOpcodeValueType)=0
Return pData
}
WLAN_WlanQueryInterface(hClientHandle,pInterfaceGuid,OpCode,ByRef dwDataSize,ByRef WlanOpcodeValueType){
If DllCall("Wlanapi.dll\WlanQueryInterface", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", OpCode, "UInt", 0, "UInt*", dwDataSize, "UInt*", pData, "UInt*", WlanOpcodeValueType)=0
Return pData
}
WLAN_WlanReasonCodeToString(dwReasonCode){
If DllCall("Wlanapi.dll\WlanReasonCodeToString", "UInt", dwReasonCode, "UInt", VarSetCapacity(String,1024*2)//2, "UInt", &String, "UInt", 0)=0
Return Wlan_Ansi4Unicode(&String)
}
WLAN_WlanRegisterNotification(hClientHandle,dwNotifSource,bIgnoreDuplicate,funcCallback,pCallbackContext){
If DllCall("Wlanapi.dll\WlanRegisterNotification", "UInt", hClientHandle, "UInt", dwNotifSource, "Int", bIgnoreDuplicate, "UInt", funcCallback, "UInt", pCallbackContext, "UInt", 0, "UInt*", dwPrevNotifSource)=0
Return dwPrevNotifSource
}
WLAN_WlanRenameProfile(hClientHandle, pInterfaceGuid, strOldProfileName, strNewProfileName){
Return DllCall("Wlanapi.dll\WlanRenameProfile", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", Wlan_Unicode4Ansi(strOldProfileName,strOldProfileName), "UInt", Wlan_Unicode4Ansi(strNewProfileName,strNewProfileName), "UInt", 0)
}
WLAN_WlanSaveTemporaryProfile(hClientHandle,pInterfaceGuid,strProfileName, strAllUserProfileSecurity,dwFlags,bOverWrite){
Return DllCall("Wlanapi.dll\WlanSaveTemporaryProfile", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", Wlan_Unicode4Ansi(strProfileName,strProfileName), "UInt", Wlan_Unicode4Ansi(strAllUserProfileSecurity,strAllUserProfileSecurity), "UInt", dwFlags, "Int", bOverWrite, "UInt", 0)
}
WLAN_WlanScan(hClientHandle, pInterfaceGuid, pDot11Ssid, pIeData){
Return DllCall("Wlanapi.dll\WlanScan", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", pDot11Ssid, "UInt", pIeData, "UInt", 0)
}
WLAN_WlanSetAutoConfigParameter(hClientHandle,OpCode,dwDataSize,pData){
Return DllCall("Wlanapi.dll\WlanSetAutoConfigParameter", "UInt", hClientHandle, "UInt", OpCode, "UInt", dwDataSize, "UInt", pData, "UInt", 0)
}
WLAN_WlanSetFilterList(hClientHandle,wlanFilterListType,pNetworkList){
Return DllCall("Wlanapi.dll\WlanSetFilterList", "UInt", hClientHandle, "UInt", wlanFilterListType, "UInt", pNetworkList, "UInt", 0)
}
WLAN_WlanSetInterface(hClientHandle,pInterfaceGuid,OpCode,dwDataSize,pData){
Return DllCall("Wlanapi.dll\WlanSetInterface", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", OpCode, "UInt", dwDataSize, "UInt", pData, "UInt", 0)
}
WLAN_WlanSetProfile(hClientHandle, pInterfaceGuid, dwFlags, strProfileXml, strAllUserProfileSecurity, bOverwrite,ByRef dwReasonCode){
Return DllCall("Wlanapi.dll\WlanSetProfile", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", dwFlags, "UInt", Wlan_Unicode4Ansi(strProfileXml,strProfileXml), "UInt", Wlan_Unicode4Ansi(strAllUserProfileSecurity,strAllUserProfileSecurity), "UInt", bOverwrite, "UInt", 0, "UInt*", dwReasonCode)
}
WLAN_WlanSetProfileCustomUserData(hClientHandle,pInterfaceGuid,strProfileName,dwDataSize,pData){
Return DllCall("Wlanapi.dll\WlanSetProfileCustomUserData", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", Wlan_Unicode4Ansi(strProfileName,strProfileName), "UInt", dwDataSize, "UInt", pData, "UInt", 0)
}
WLAN_WlanSetProfileEapUserData(hClientHandle,pInterfaceGuid,strProfileName,eapType,dwFlags,dwEapUserDataSize,pbEapUserData){
Return DllCall("Wlanapi.dll\WlanSetProfileEapUserData", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", Wlan_Unicode4Ansi(strProfileName,strProfileName), "UInt", eapType, "UInt", dwFlags, "UInt", dwEapUserDataSize, "UInt", pbEapUserData, "UInt", 0)
}
WLAN_WlanSetProfileEapXmlUserData(hClientHandle,pInterfaceGuid,strProfileName,dwFlags,strEapXmlUserData){
Return DllCall("Wlanapi.dll\WlanSetProfileEapXmlUserData", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", Wlan_Unicode4Ansi(strProfileName,strProfileName), "UInt", dwFlags, "UInt", Wlan_Unicode4Ansi(strEapXmlUserData,strEapXmlUserData), "UInt", 0)
}
WLAN_WlanSetProfileList(hClientHandle,pInterfaceGuid,dwItems,pwstrProfileNames){
Return DllCall("Wlanapi.dll\WlanSetProfileList", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", dwItems, "UInt", pwstrProfileNames, "UInt", 0)
}
WLAN_WlanSetProfilePosition(hClientHandle,pInterfaceGuid,strProfileName,dwPosition){
Return DllCall("Wlanapi.dll\WlanSetProfilePosition", "UInt", hClientHandle, "UInt", pInterfaceGuid, "UInt", Wlan_Unicode4Ansi(strProfileName,strProfileName), "UInt", dwPosition, "UInt", 0)
}
WLAN_WlanSetPsdIEDataList(hClientHandle,strFormat,pPsdIEDataList){
Return DllCall("Wlanapi.dll\WlanSetPsdIEDataList", "UInt", hClientHandle, "UInt", Wlan_Unicode4Ansi(strFormat,strFormat), "UInt", pPsdIEDataList, "UInt", 0)
}
WLAN_WlanSetSecuritySettings(hClientHandle,SecurableObject,strModifiedSDDL){
Return DllCall("Wlanapi.dll\WlanSetSecuritySettings", "UInt", hClientHandle, "UInt", SecurableObject, "UInt", Wlan_Unicode4Ansi(strModifiedSDDL,strModifiedSDDL))
}
WLAN_WlanUIEditProfile(dwClientVersion,strProfileName,pInterfaceGuid,hWnd,wlStartPage,ByRef dwReasonCode){
Return DllCall("Wlanapi.dll\WlanUIEditProfile", "UInt", dwClientVersion, "UInt", Wlan_Unicode4Ansi(strProfileName,strProfileName), "UInt", pInterfaceGuid, "UInt", hWnd, "UInt", wlStartPage, "UInt", 0, "UInt*", dwReasonCode)
}
WLAN_Init(){
Return DllCall("LoadLibrary", "str", "wlanapi.dll")
}
WLAN_UnInit(hWlan){
DllCall("FreeLibrary", "UInt", hWlan)
}
Wlan_GUID4String(ByRef GUID, String)
{
VarSetCapacity(GUID,16,0)
If DllCall("ole32\IIDFromString", "Uint", Wlan_Unicode4Ansi(String,String), "Uint", &GUID)=0
Return &GUID
}
Wlan_String4GUID(pGUID)
{
VarSetCapacity(String,38*2+1,0)
If DllCall("ole32\StringFromGUID2", "Uint", pGUID, "Uint", &String, "int", 39)
Return Wlan_Ansi4Unicode(&String)
}
Wlan_Ansi4Unicode(pString)
{
nSize:= DllCall("kernel32\WideCharToMultiByte", "Uint", 0, "Uint", 0, "Uint", pString, "int", -1, "Uint", 0, "int", 0, "Uint", 0, "Uint", 0), VarSetCapacity(sString,nSize)
If DllCall("kernel32\WideCharToMultiByte", "Uint", 0, "Uint", 0, "Uint", pString, "int", -1, "str", sString, "int", nSize, "Uint", 0, "Uint", 0)
Return sString
}
Wlan_Unicode4Ansi(ByRef wString, sString)
{
nSize:= DllCall("kernel32\MultiByteToWideChar", "Uint", 0, "Uint", 0, "Uint", &sString, "int", -1, "Uint", 0, "int", 0), VarSetCapacity(wString,nSize*2)
If DllCall("kernel32\MultiByteToWideChar", "Uint", 0, "Uint", 0, "Uint", &sString, "int", -1, "Uint", &wString, "int", nSize)
Return &wString
}
|
Last edited by Sean on Wed Jul 30, 2008 11:39 am; edited 2 times in total |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1202 Location: USA
|
Posted: Wed Jul 16, 2008 3:16 am Post subject: |
|
|
Thanks very much Sean. _________________
 |
|
| Back to top |
|
 |
Fry
Joined: 01 Nov 2007 Posts: 602
|
Posted: Wed Jul 16, 2008 3:41 am Post subject: |
|
|
It seems Sean the forgot the important command OpenHandle
without this you cannot get the handles for these functions
Also what commands are used to see the the protection (WEP,WPA,TKIP) for a wireless network and the signal strength
Also if you can, please make a documentation to help people (me) _________________ check out my site
www.eliteknifesquad.com |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1202 Location: USA
|
Posted: Wed Jul 16, 2008 3:57 am Post subject: |
|
|
dude ... Sean did not 'forget' anything. He reviewed the codes I did and provided the requested modifications. You may be too young to realize that what you are saying seems un-appreciative. In the future, please attempt to (at least make it look like) you are grateful for Sean's help, instead of saying 'oh lookie at what you didn't do, you need to do it'
I mean, this is not the first time you have um...came across as an un-appreciative little kid...especially when you were taking peoples codes and reposting them as your own.
EDIT:
besides, you still have not given a reason that you NEED these codez so badly.
And just for the record, the ONLY reason I am going to finish this is because Sean took the time to review what I had posted and provided corrections. As I stated in the other thread, I am just bored. You gave something to keep me occupied for a while as I am stuck in this stupid hotel. and the stupid wi-fi here does not let me on IRC (using a client or mibbit ) _________________
 |
|
| Back to top |
|
 |
Fry
Joined: 01 Nov 2007 Posts: 602
|
Posted: Wed Jul 16, 2008 4:07 am Post subject: |
|
|
Oh, the reason.
Well, I dont like the interface of the wireless program that came with my wireless card i would to create a simplified version of it _________________ check out my site
www.eliteknifesquad.com |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1202 Location: USA
|
Posted: Wed Jul 16, 2008 4:19 am Post subject: |
|
|
unless you have a cisco wireless card, why even install the software for it? i mean like 99% of wireless cards can be controlled by the native Wireless Zero Configuration...and those that can't most likely cant use this api. _________________
 |
|
| Back to top |
|
 |
Fry
Joined: 01 Nov 2007 Posts: 602
|
Posted: Wed Jul 16, 2008 4:19 am Post subject: |
|
|
I still would like create my own _________________ check out my site
www.eliteknifesquad.com |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1331
|
Posted: Wed Jul 16, 2008 12:31 pm Post subject: |
|
|
| Fry wrote: | | It seems Sean the forgot the important command OpenHandle | You must wait until ahklerner releases the final script. If you're in urgent need of it you can use it temporarily.
| Code: | WLAN_WlanOpenHandle(dwClientVersion = 1, ByRef dwNegotiatedVersion = ""){ ; 2 for Vista
If DllCall("Wlanapi.dll\WlanOpenHandle", "UInt", dwClientVersion, "UInt", 0, "UInt*", dwNegotiatedVersion, "UInt*", hClientHandle)=0
Return hClientHandle
}
|
|
|
| Back to top |
|
 |
Fry
Joined: 01 Nov 2007 Posts: 602
|
|
| Back to top |
|
 |
Fry
Joined: 01 Nov 2007 Posts: 602
|
Posted: Wed Jul 16, 2008 8:31 pm Post subject: |
|
|
In some of the functions, it says interfaceguid.
what is that?
and what do i put in there?
Also with the allocate memory function do i have to call that before every other function? _________________ check out my site
www.eliteknifesquad.com |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1202 Location: USA
|
Posted: Wed Jul 16, 2008 10:20 pm Post subject: |
|
|
i am assuming any of the functions that receive pointers, the memory will need to be allocated with that function. _________________
 |
|
| Back to top |
|
 |
Fry
Joined: 01 Nov 2007 Posts: 602
|
Posted: Wed Jul 16, 2008 10:57 pm Post subject: |
|
|
I know nothing of C++ whats a pointer _________________ check out my site
www.eliteknifesquad.com |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|