2 * Wireless LAN API (wlanapi.dll)
4 * Copyright 2009 Christoph von Wittich (Christoph@ApiViewer.de)
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 /* INCLUDES ****************************************************************/
23 #define WIN32_NO_STATUS
25 #define COM_NO_WINDOWS_H
29 #include <wlansvc_c.h>
31 #include <wine/debug.h>
33 WINE_DEFAULT_DEBUG_CHANNEL(wlanapi
);
36 WlanRpcStatusToWinError(RPC_STATUS Status
)
40 case RPC_S_INVALID_BINDING
:
41 case RPC_X_SS_IN_NULL_CONTEXT
:
42 return ERROR_INVALID_HANDLE
;
44 case RPC_X_ENUM_VALUE_OUT_OF_RANGE
:
45 case RPC_X_BYTE_COUNT_TOO_SMALL
:
46 return ERROR_INVALID_PARAMETER
;
48 case RPC_X_NULL_REF_POINTER
:
49 return ERROR_INVALID_ADDRESS
;
57 WLANSVC_HANDLE_bind(WLANSVC_HANDLE szMachineName
)
59 handle_t hBinding
= NULL
;
60 LPWSTR pszStringBinding
;
63 TRACE("RPC_SERVICE_STATUS_HANDLE_bind() called\n");
65 Status
= RpcStringBindingComposeW(NULL
,
71 if (Status
!= RPC_S_OK
)
73 ERR("RpcStringBindingCompose returned 0x%x\n", Status
);
77 /* Set the binding handle that will be used to bind to the server. */
78 Status
= RpcBindingFromStringBindingW(pszStringBinding
,
80 if (Status
!= RPC_S_OK
)
82 ERR("RpcBindingFromStringBinding returned 0x%x\n", Status
);
85 Status
= RpcStringFreeW(&pszStringBinding
);
86 if (Status
!= RPC_S_OK
)
88 ERR("RpcStringFree returned 0x%x\n", Status
);
95 WLANSVC_HANDLE_unbind(WLANSVC_HANDLE szMachineName
,
100 TRACE("WLANSVC_HANDLE_unbind() called\n");
102 Status
= RpcBindingFree(&hBinding
);
103 if (Status
!= RPC_S_OK
)
105 ERR("RpcBindingFree returned 0x%x\n", Status
);
111 WlanAllocateMemory(IN DWORD dwSize
)
113 return HeapAlloc(GetProcessHeap(), 0, dwSize
);
118 WlanFreeMemory(IN PVOID pMem
)
120 HeapFree(GetProcessHeap(), 0, pMem
);
125 WlanConnect(IN HANDLE hClientHandle
,
126 IN
const GUID
*pInterfaceGuid
,
127 IN
const PWLAN_CONNECTION_PARAMETERS pConnectionParameters
,
130 DWORD dwResult
= ERROR_SUCCESS
;
132 if ((pReserved
!= NULL
) || (hClientHandle
== NULL
) || (pInterfaceGuid
== NULL
) || (pConnectionParameters
== NULL
))
133 return ERROR_INVALID_PARAMETER
;
137 dwResult
= _RpcConnect(hClientHandle
, pInterfaceGuid
, &pConnectionParameters
);
139 RpcExcept(EXCEPTION_EXECUTE_HANDLER
)
141 dwResult
= WlanRpcStatusToWinError(RpcExceptionCode());
150 WlanDisconnect(IN HANDLE hClientHandle
,
151 IN
const GUID
*pInterfaceGuid
,
154 DWORD dwResult
= ERROR_SUCCESS
;
156 if ((pReserved
!= NULL
) || (hClientHandle
== NULL
) || (pInterfaceGuid
== NULL
))
157 return ERROR_INVALID_PARAMETER
;
161 dwResult
= _RpcDisconnect(hClientHandle
, pInterfaceGuid
);
163 RpcExcept(EXCEPTION_EXECUTE_HANDLER
)
165 dwResult
= WlanRpcStatusToWinError(RpcExceptionCode());
174 WlanOpenHandle(IN DWORD dwClientVersion
,
176 OUT DWORD
*pdwNegotiatedVersion
,
177 OUT HANDLE
*phClientHandle
)
179 DWORD dwResult
= ERROR_SUCCESS
;
180 WCHAR szDummy
[] = L
"localhost";
182 if ((pReserved
!= NULL
) || (pdwNegotiatedVersion
== NULL
) || (phClientHandle
== NULL
))
183 return ERROR_INVALID_PARAMETER
;
187 dwResult
= _RpcOpenHandle(szDummy
,
189 pdwNegotiatedVersion
,
190 (WLANSVC_RPC_HANDLE
) phClientHandle
);
192 RpcExcept(EXCEPTION_EXECUTE_HANDLER
)
194 dwResult
= WlanRpcStatusToWinError(RpcExceptionCode());
203 WlanCloseHandle(IN HANDLE hClientHandle
,
206 DWORD dwResult
= ERROR_SUCCESS
;
208 if ((pReserved
!= NULL
) || (hClientHandle
== NULL
))
209 return ERROR_INVALID_PARAMETER
;
213 dwResult
= _RpcCloseHandle(&hClientHandle
);
215 RpcExcept(EXCEPTION_EXECUTE_HANDLER
)
217 dwResult
= WlanRpcStatusToWinError(RpcExceptionCode());
226 WlanEnumInterfaces(IN HANDLE hClientHandle
,
228 OUT PWLAN_INTERFACE_INFO_LIST
*ppInterfaceList
)
230 DWORD dwResult
= ERROR_SUCCESS
;
232 if ((pReserved
!= NULL
) || (ppInterfaceList
== NULL
) || (hClientHandle
== NULL
))
233 return ERROR_INVALID_PARAMETER
;
237 dwResult
= _RpcEnumInterfaces(hClientHandle
, ppInterfaceList
);
239 RpcExcept(EXCEPTION_EXECUTE_HANDLER
)
241 dwResult
= WlanRpcStatusToWinError(RpcExceptionCode());
250 WlanScan(IN HANDLE hClientHandle
,
251 IN
const GUID
*pInterfaceGuid
,
252 IN PDOT11_SSID pDot11Ssid
,
253 IN PWLAN_RAW_DATA pIeData
,
256 DWORD dwResult
= ERROR_SUCCESS
;
258 if ((pReserved
!= NULL
) || (pInterfaceGuid
== NULL
) || (hClientHandle
== NULL
))
259 return ERROR_INVALID_PARAMETER
;
263 dwResult
= _RpcScan(hClientHandle
, pInterfaceGuid
, pDot11Ssid
, pIeData
);
265 RpcExcept(EXCEPTION_EXECUTE_HANDLER
)
267 dwResult
= WlanRpcStatusToWinError(RpcExceptionCode());
276 WlanQueryInterface(IN HANDLE hClientHandle
,
277 IN
const GUID
*pInterfaceGuid
,
278 IN WLAN_INTF_OPCODE OpCode
,
280 OUT PDWORD pdwDataSize
,
282 WLAN_OPCODE_VALUE_TYPE
*pWlanOpcodeValueType
)
284 if ((pReserved
!= NULL
) || (pInterfaceGuid
== NULL
) || (hClientHandle
== NULL
) || (pdwDataSize
== NULL
) || (ppData
== NULL
))
285 return ERROR_INVALID_PARAMETER
;
288 return ERROR_SUCCESS
;
293 WlanGetInterfaceCapability(IN HANDLE hClientHandle
,
294 IN
const GUID
*pInterfaceGuid
,
296 OUT PWLAN_INTERFACE_CAPABILITY
*ppCapability
)
298 if ((pReserved
!= NULL
) || (pInterfaceGuid
== NULL
) || (hClientHandle
== NULL
) || (ppCapability
== NULL
))
299 return ERROR_INVALID_PARAMETER
;
302 return ERROR_SUCCESS
;
305 DWORD WINAPI
WlanRegisterNotification(IN HANDLE hClientHandle
,
306 IN DWORD dwNotifSource
,
307 IN BOOL bIgnoreDuplicate
,
308 WLAN_NOTIFICATION_CALLBACK funcCallback
,
309 PVOID pCallbackContext
,
311 PDWORD pdwPrevNotifSource
)
314 return ERROR_SUCCESS
;
319 WlanReasonCodeToString(IN DWORD dwReasonCode
,
320 IN DWORD dwBufferSize
,
321 IN PWCHAR pStringBuffer
,
324 if ((pReserved
!= NULL
) || (pStringBuffer
== NULL
) || (dwBufferSize
== 0))
325 return ERROR_INVALID_PARAMETER
;
328 return ERROR_SUCCESS
;
333 WlanIhvControl(IN HANDLE hClientHandle
,
334 IN
const GUID
*pInterfaceGuid
,
335 IN WLAN_IHV_CONTROL_TYPE Type
,
336 IN DWORD dwInBufferSize
,
338 IN DWORD dwOutBufferSize
,
340 OUT PDWORD pdwBytesReturned
)
342 if ((hClientHandle
== NULL
) || (pInterfaceGuid
== NULL
) || (pdwBytesReturned
== NULL
))
343 return ERROR_INVALID_PARAMETER
;
346 return ERROR_SUCCESS
;
351 WlanSetSecuritySettings(IN HANDLE hClientHandle
,
352 IN WLAN_SECURABLE_OBJECT SecurableObject
,
353 IN LPCWSTR strModifiedSDDL
)
355 DWORD dwResult
= ERROR_SUCCESS
;
357 if ((hClientHandle
== NULL
) || (strModifiedSDDL
== NULL
) || (SecurableObject
>= WLAN_SECURABLE_OBJECT_COUNT
))
358 return ERROR_INVALID_PARAMETER
;
362 dwResult
= _RpcSetSecuritySettings(hClientHandle
, SecurableObject
, strModifiedSDDL
);
364 RpcExcept(EXCEPTION_EXECUTE_HANDLER
)
366 dwResult
= WlanRpcStatusToWinError(RpcExceptionCode());
375 WlanGetAvailableNetworkList(IN HANDLE hClientHandle
,
376 IN
const GUID
*pInterfaceGuid
,
379 OUT PWLAN_AVAILABLE_NETWORK_LIST
*ppAvailableNetworkList
)
381 if ((pReserved
!= NULL
) || (pInterfaceGuid
== NULL
) || (hClientHandle
== NULL
) || (ppAvailableNetworkList
== NULL
))
382 return ERROR_INVALID_PARAMETER
;
385 return ERROR_SUCCESS
;
388 void __RPC_FAR
* __RPC_USER
389 midl_user_allocate(SIZE_T len
)
391 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
395 midl_user_free(void __RPC_FAR
* ptr
)
397 HeapFree(GetProcessHeap(), 0, ptr
);