2009-03-14 14:32:48 +00:00
|
|
|
/*
|
|
|
|
* Wireless LAN API (wlanapi.dll)
|
|
|
|
*
|
|
|
|
* Copyright 2009 Christoph von Wittich (Christoph@ApiViewer.de)
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2009-10-27 10:34:16 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2009-03-14 14:32:48 +00:00
|
|
|
*/
|
|
|
|
|
2009-03-16 08:23:58 +00:00
|
|
|
|
|
|
|
/* INCLUDES ****************************************************************/
|
2009-03-20 13:44:06 +00:00
|
|
|
#define WIN32_NO_STATUS
|
2013-01-24 23:00:42 +00:00
|
|
|
#define _INC_WINDOWS
|
|
|
|
#define COM_NO_WINDOWS_H
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <windef.h>
|
|
|
|
#include <winbase.h>
|
|
|
|
#include <wlansvc_c.h>
|
2009-03-14 14:32:48 +00:00
|
|
|
|
2013-01-24 23:00:42 +00:00
|
|
|
#include <wine/debug.h>
|
2009-03-16 13:40:25 +00:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(wlanapi);
|
|
|
|
|
|
|
|
handle_t __RPC_USER
|
|
|
|
WLANSVC_HANDLE_bind(WLANSVC_HANDLE szMachineName)
|
|
|
|
{
|
|
|
|
handle_t hBinding = NULL;
|
|
|
|
LPWSTR pszStringBinding;
|
|
|
|
RPC_STATUS Status;
|
|
|
|
|
|
|
|
TRACE("RPC_SERVICE_STATUS_HANDLE_bind() called\n");
|
|
|
|
|
|
|
|
Status = RpcStringBindingComposeW(NULL,
|
2009-03-20 13:44:06 +00:00
|
|
|
L"ncalrpc",
|
2009-03-16 13:40:25 +00:00
|
|
|
szMachineName,
|
2009-03-20 13:44:06 +00:00
|
|
|
L"wlansvc",
|
2009-03-16 13:40:25 +00:00
|
|
|
NULL,
|
|
|
|
&pszStringBinding);
|
|
|
|
if (Status != RPC_S_OK)
|
|
|
|
{
|
|
|
|
ERR("RpcStringBindingCompose returned 0x%x\n", Status);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set the binding handle that will be used to bind to the server. */
|
|
|
|
Status = RpcBindingFromStringBindingW(pszStringBinding,
|
|
|
|
&hBinding);
|
|
|
|
if (Status != RPC_S_OK)
|
|
|
|
{
|
|
|
|
ERR("RpcBindingFromStringBinding returned 0x%x\n", Status);
|
|
|
|
}
|
|
|
|
|
|
|
|
Status = RpcStringFreeW(&pszStringBinding);
|
|
|
|
if (Status != RPC_S_OK)
|
|
|
|
{
|
|
|
|
ERR("RpcStringFree returned 0x%x\n", Status);
|
|
|
|
}
|
|
|
|
|
|
|
|
return hBinding;
|
|
|
|
}
|
|
|
|
|
|
|
|
void __RPC_USER
|
|
|
|
WLANSVC_HANDLE_unbind(WLANSVC_HANDLE szMachineName,
|
|
|
|
handle_t hBinding)
|
|
|
|
{
|
|
|
|
RPC_STATUS Status;
|
|
|
|
|
|
|
|
TRACE("WLANSVC_HANDLE_unbind() called\n");
|
|
|
|
|
|
|
|
Status = RpcBindingFree(&hBinding);
|
|
|
|
if (Status != RPC_S_OK)
|
|
|
|
{
|
|
|
|
ERR("RpcBindingFree returned 0x%x\n", Status);
|
|
|
|
}
|
|
|
|
}
|
2009-03-14 14:32:48 +00:00
|
|
|
|
|
|
|
PVOID
|
|
|
|
WINAPI
|
|
|
|
WlanAllocateMemory(IN DWORD dwSize)
|
|
|
|
{
|
|
|
|
return HeapAlloc(GetProcessHeap(), 0, dwSize);
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
WINAPI
|
|
|
|
WlanFreeMemory(IN PVOID pMem)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, pMem);
|
|
|
|
}
|
|
|
|
|
2009-03-16 13:40:25 +00:00
|
|
|
DWORD
|
|
|
|
WINAPI
|
|
|
|
WlanOpenHandle(IN DWORD dwClientVersion,
|
|
|
|
PVOID pReserved,
|
|
|
|
OUT DWORD *pdwNegotiatedVersion,
|
|
|
|
OUT HANDLE *phClientHandle)
|
|
|
|
{
|
|
|
|
DWORD dwError = ERROR_SUCCESS;
|
2009-03-20 13:44:06 +00:00
|
|
|
WCHAR szDummy[] = L"localhost";
|
2009-03-16 13:40:25 +00:00
|
|
|
|
|
|
|
if ((pReserved != NULL) || (pdwNegotiatedVersion == NULL) || (phClientHandle == NULL))
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
RpcTryExcept
|
|
|
|
{
|
2009-03-20 13:44:06 +00:00
|
|
|
dwError = _RpcOpenHandle(szDummy,
|
2009-03-16 13:40:25 +00:00
|
|
|
dwClientVersion,
|
|
|
|
pdwNegotiatedVersion,
|
|
|
|
(WLANSVC_RPC_HANDLE) phClientHandle);
|
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
dwError = RpcExceptionCode();
|
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
|
|
|
return dwError;
|
|
|
|
}
|
|
|
|
|
2009-03-16 08:23:58 +00:00
|
|
|
DWORD
|
|
|
|
WINAPI
|
|
|
|
WlanCloseHandle(IN HANDLE hClientHandle,
|
|
|
|
PVOID pReserved)
|
|
|
|
{
|
|
|
|
DWORD dwError = ERROR_SUCCESS;
|
|
|
|
|
2009-03-16 13:40:25 +00:00
|
|
|
if ((pReserved != NULL) || (hClientHandle == NULL))
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
|
|
|
|
2009-03-16 08:23:58 +00:00
|
|
|
RpcTryExcept
|
|
|
|
{
|
|
|
|
_RpcCloseHandle(hClientHandle);
|
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
dwError = RpcExceptionCode();
|
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
|
|
|
return dwError;
|
|
|
|
}
|
|
|
|
|
2009-03-16 09:22:25 +00:00
|
|
|
DWORD
|
|
|
|
WINAPI
|
|
|
|
WlanEnumInterfaces(IN HANDLE hClientHandle,
|
|
|
|
PVOID pReserved,
|
|
|
|
OUT PWLAN_INTERFACE_INFO_LIST *ppInterfaceList)
|
|
|
|
{
|
|
|
|
DWORD dwError = ERROR_SUCCESS;
|
|
|
|
|
|
|
|
if ((pReserved != NULL) || (ppInterfaceList == NULL) || (hClientHandle == NULL))
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
RpcTryExcept
|
|
|
|
{
|
|
|
|
_RpcEnumInterfaces(hClientHandle, ppInterfaceList);
|
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
dwError = RpcExceptionCode();
|
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
|
|
|
return dwError;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD
|
|
|
|
WINAPI
|
|
|
|
WlanScan(IN HANDLE hClientHandle,
|
|
|
|
IN GUID *pInterfaceGuid,
|
|
|
|
IN PDOT11_SSID pDot11Ssid,
|
|
|
|
IN PWLAN_RAW_DATA pIeData,
|
|
|
|
PVOID pReserved)
|
|
|
|
{
|
|
|
|
DWORD dwError = ERROR_SUCCESS;
|
|
|
|
|
|
|
|
if ((pReserved != NULL) || (pInterfaceGuid == NULL) || (hClientHandle == NULL))
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
RpcTryExcept
|
|
|
|
{
|
|
|
|
_RpcScan(hClientHandle, pInterfaceGuid, pDot11Ssid, pIeData);
|
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
dwError = RpcExceptionCode();
|
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
|
|
|
return dwError;
|
|
|
|
}
|
|
|
|
|
2009-03-16 08:23:58 +00:00
|
|
|
void __RPC_FAR * __RPC_USER
|
2009-08-07 20:15:12 +00:00
|
|
|
midl_user_allocate(SIZE_T len)
|
2009-03-16 08:23:58 +00:00
|
|
|
{
|
|
|
|
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
void __RPC_USER
|
|
|
|
midl_user_free(void __RPC_FAR * ptr)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, ptr);
|
|
|
|
}
|
|
|
|
|