ReactOS  0.4.14-dev-342-gdc047f9
main.c
Go to the documentation of this file.
1 /*
2  * Wireless LAN API (wlanapi.dll)
3  *
4  * Copyright 2009 Christoph von Wittich (Christoph@ApiViewer.de)
5  *
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.
10  *
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.
15  *
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
19  */
20 
21 
22 /* INCLUDES ****************************************************************/
23 #define WIN32_NO_STATUS
24 #define _INC_WINDOWS
25 #define COM_NO_WINDOWS_H
26 #include <stdarg.h>
27 #include <windef.h>
28 #include <winbase.h>
29 #include <wlansvc_c.h>
30 
31 #include <wine/debug.h>
32 
34 
35 DWORD
37 {
38  switch (Status)
39  {
42  return ERROR_INVALID_HANDLE;
43 
47 
49  return ERROR_INVALID_ADDRESS;
50 
51  default:
52  return (DWORD)Status;
53  }
54 }
55 
58 {
60  LPWSTR pszStringBinding;
62 
63  TRACE("RPC_SERVICE_STATUS_HANDLE_bind() called\n");
64 
66  L"ncalrpc",
67  szMachineName,
68  L"wlansvc",
69  NULL,
70  &pszStringBinding);
71  if (Status != RPC_S_OK)
72  {
73  ERR("RpcStringBindingCompose returned 0x%x\n", Status);
74  return NULL;
75  }
76 
77  /* Set the binding handle that will be used to bind to the server. */
78  Status = RpcBindingFromStringBindingW(pszStringBinding,
79  &hBinding);
80  if (Status != RPC_S_OK)
81  {
82  ERR("RpcBindingFromStringBinding returned 0x%x\n", Status);
83  }
84 
85  Status = RpcStringFreeW(&pszStringBinding);
86  if (Status != RPC_S_OK)
87  {
88  ERR("RpcStringFree returned 0x%x\n", Status);
89  }
90 
91  return hBinding;
92 }
93 
94 void __RPC_USER
97 {
99 
100  TRACE("WLANSVC_HANDLE_unbind() called\n");
101 
103  if (Status != RPC_S_OK)
104  {
105  ERR("RpcBindingFree returned 0x%x\n", Status);
106  }
107 }
108 
109 PVOID
110 WINAPI
112 {
113  return HeapAlloc(GetProcessHeap(), 0, dwSize);
114 }
115 
116 VOID
117 WINAPI
119 {
120  HeapFree(GetProcessHeap(), 0, pMem);
121 }
122 
123 DWORD
124 WINAPI
125 WlanConnect(IN HANDLE hClientHandle,
126  IN const GUID *pInterfaceGuid,
127  IN const PWLAN_CONNECTION_PARAMETERS pConnectionParameters,
128  PVOID pReserved)
129 {
130  DWORD dwResult = ERROR_SUCCESS;
131 
132  if ((pReserved != NULL) || (hClientHandle == NULL) || (pInterfaceGuid == NULL) || (pConnectionParameters == NULL))
134 
136  {
137  dwResult = _RpcConnect(hClientHandle, pInterfaceGuid, &pConnectionParameters);
138  }
140  {
142  }
143  RpcEndExcept;
144 
145  return dwResult;
146 }
147 
148 DWORD
149 WINAPI
150 WlanDisconnect(IN HANDLE hClientHandle,
151  IN const GUID *pInterfaceGuid,
152  PVOID pReserved)
153 {
154  DWORD dwResult = ERROR_SUCCESS;
155 
156  if ((pReserved != NULL) || (hClientHandle == NULL) || (pInterfaceGuid == NULL))
158 
160  {
161  dwResult = _RpcDisconnect(hClientHandle, pInterfaceGuid);
162  }
164  {
166  }
167  RpcEndExcept;
168 
169  return dwResult;
170 }
171 
172 DWORD
173 WINAPI
174 WlanOpenHandle(IN DWORD dwClientVersion,
175  PVOID pReserved,
176  OUT DWORD *pdwNegotiatedVersion,
177  OUT HANDLE *phClientHandle)
178 {
179  DWORD dwResult = ERROR_SUCCESS;
180  WCHAR szDummy[] = L"localhost";
181 
182  if ((pReserved != NULL) || (pdwNegotiatedVersion == NULL) || (phClientHandle == NULL))
184 
186  {
187  dwResult = _RpcOpenHandle(szDummy,
188  dwClientVersion,
189  pdwNegotiatedVersion,
190  (WLANSVC_RPC_HANDLE) phClientHandle);
191  }
193  {
195  }
196  RpcEndExcept;
197 
198  return dwResult;
199 }
200 
201 DWORD
202 WINAPI
203 WlanCloseHandle(IN HANDLE hClientHandle,
204  PVOID pReserved)
205 {
206  DWORD dwResult = ERROR_SUCCESS;
207 
208  if ((pReserved != NULL) || (hClientHandle == NULL))
210 
212  {
213  dwResult = _RpcCloseHandle(&hClientHandle);
214  }
216  {
218  }
219  RpcEndExcept;
220 
221  return dwResult;
222 }
223 
224 DWORD
225 WINAPI
227  PVOID pReserved,
228  OUT PWLAN_INTERFACE_INFO_LIST *ppInterfaceList)
229 {
230  DWORD dwResult = ERROR_SUCCESS;
231 
232  if ((pReserved != NULL) || (ppInterfaceList == NULL) || (hClientHandle == NULL))
234 
236  {
237  dwResult = _RpcEnumInterfaces(hClientHandle, ppInterfaceList);
238  }
240  {
242  }
243  RpcEndExcept;
244 
245  return dwResult;
246 }
247 
248 DWORD
249 WINAPI
250 WlanScan(IN HANDLE hClientHandle,
251  IN const GUID *pInterfaceGuid,
252  IN PDOT11_SSID pDot11Ssid,
253  IN PWLAN_RAW_DATA pIeData,
254  PVOID pReserved)
255 {
256  DWORD dwResult = ERROR_SUCCESS;
257 
258  if ((pReserved != NULL) || (pInterfaceGuid == NULL) || (hClientHandle == NULL))
260 
262  {
263  dwResult = _RpcScan(hClientHandle, pInterfaceGuid, pDot11Ssid, pIeData);
264  }
266  {
268  }
269  RpcEndExcept;
270 
271  return dwResult;
272 }
273 
274 DWORD
275 WINAPI
277  IN const GUID *pInterfaceGuid,
279  PVOID pReserved,
280  OUT PDWORD pdwDataSize,
281  OUT PVOID *ppData,
282  WLAN_OPCODE_VALUE_TYPE *pWlanOpcodeValueType)
283 {
284  if ((pReserved != NULL) || (pInterfaceGuid == NULL) || (hClientHandle == NULL) || (pdwDataSize == NULL) || (ppData == NULL))
286 
288  return ERROR_SUCCESS;
289 }
290 
291 DWORD
292 WINAPI
294  IN const GUID *pInterfaceGuid,
295  PVOID pReserved,
296  OUT PWLAN_INTERFACE_CAPABILITY *ppCapability)
297 {
298  if ((pReserved != NULL) || (pInterfaceGuid == NULL) || (hClientHandle == NULL) || (ppCapability == NULL))
300 
302  return ERROR_SUCCESS;
303 }
304 
306  IN DWORD dwNotifSource,
307  IN BOOL bIgnoreDuplicate,
308  WLAN_NOTIFICATION_CALLBACK funcCallback,
309  PVOID pCallbackContext,
310  PVOID pReserved,
311  PDWORD pdwPrevNotifSource)
312 {
314  return ERROR_SUCCESS;
315 }
316 
317 DWORD
318 WINAPI
320  IN DWORD dwBufferSize,
321  IN PWCHAR pStringBuffer,
322  PVOID pReserved)
323 {
324  if ((pReserved != NULL) || (pStringBuffer == NULL) || (dwBufferSize == 0))
326 
328  return ERROR_SUCCESS;
329 }
330 
331 DWORD
332 WINAPI
333 WlanIhvControl(IN HANDLE hClientHandle,
334  IN const GUID *pInterfaceGuid,
336  IN DWORD dwInBufferSize,
337  IN PVOID pInBuffer,
338  IN DWORD dwOutBufferSize,
339  PVOID pOutBuffer,
340  OUT PDWORD pdwBytesReturned)
341 {
342  if ((hClientHandle == NULL) || (pInterfaceGuid == NULL) || (pdwBytesReturned == NULL))
344 
346  return ERROR_SUCCESS;
347 }
348 
349 DWORD
350 WINAPI
352  IN WLAN_SECURABLE_OBJECT SecurableObject,
353  IN LPCWSTR strModifiedSDDL)
354 {
355  DWORD dwResult = ERROR_SUCCESS;
356 
357  if ((hClientHandle == NULL) || (strModifiedSDDL == NULL) || (SecurableObject >= WLAN_SECURABLE_OBJECT_COUNT))
359 
361  {
362  dwResult = _RpcSetSecuritySettings(hClientHandle, SecurableObject, strModifiedSDDL);
363  }
365  {
367  }
368  RpcEndExcept;
369 
370  return dwResult;
371 }
372 
373 DWORD
374 WINAPI
376  IN const GUID *pInterfaceGuid,
377  IN DWORD dwFlags,
378  PVOID pReserved,
379  OUT PWLAN_AVAILABLE_NETWORK_LIST *ppAvailableNetworkList)
380 {
381  if ((pReserved != NULL) || (pInterfaceGuid == NULL) || (hClientHandle == NULL) || (ppAvailableNetworkList == NULL))
383 
385  return ERROR_SUCCESS;
386 }
387 
388 void __RPC_FAR * __RPC_USER
390 {
392 }
393 
394 void __RPC_USER
396 {
397  HeapFree(GetProcessHeap(), 0, ptr);
398 }
399 
DWORD WINAPI WlanDisconnect(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, PVOID pReserved)
Definition: main.c:150
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
RPC_STATUS WINAPI RpcBindingFromStringBindingW(RPC_WSTR StringBinding, RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:877
#define RPC_X_SS_IN_NULL_CONTEXT
Definition: winerror.h:1083
DWORD _RpcCloseHandle(LPWLANSVC_RPC_HANDLE phClientHandle)
Definition: rpcserver.c:97
#define IN
Definition: typedefs.h:38
#define RpcEndExcept
Definition: rpc.h:128
RPC_STATUS WINAPI RpcBindingFree(RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:784
DWORD WINAPI WlanScan(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, IN PDOT11_SSID pDot11Ssid, IN PWLAN_RAW_DATA pIeData, PVOID pReserved)
Definition: main.c:250
Type
Definition: Type.h:6
#define ERROR_SUCCESS
Definition: deptool.c:10
#define RPC_X_NULL_REF_POINTER
Definition: winerror.h:1087
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
handle_t hBinding
Definition: ctx_c.c:54
WINE_DEFAULT_DEBUG_CHANNEL(wmic)
DWORD _RpcSetSecuritySettings(WLANSVC_RPC_HANDLE hClientHandle, WLAN_SECURABLE_OBJECT SecurableObject, const wchar_t *strModifiedSDDL)
Definition: rpcserver.c:599
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:177
void(__stdcall * WLAN_NOTIFICATION_CALLBACK)(PWLAN_NOTIFICATION_DATA, PVOID)
Definition: wlanapi.h:232
VOID WINAPI WlanFreeMemory(IN PVOID pMem)
Definition: main.c:118
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
enum _WLAN_SECURABLE_OBJECT WLAN_SECURABLE_OBJECT
void __RPC_USER WLANSVC_HANDLE_unbind(WLANSVC_HANDLE szMachineName, handle_t hBinding)
Definition: main.c:95
#define RPC_X_BYTE_COUNT_TOO_SMALL
Definition: winerror.h:1089
enum _WLAN_INTF_OPCODE WLAN_INTF_OPCODE
DWORD WINAPI WlanIhvControl(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, IN WLAN_IHV_CONTROL_TYPE Type, IN DWORD dwInBufferSize, IN PVOID pInBuffer, IN DWORD dwOutBufferSize, PVOID pOutBuffer, OUT PDWORD pdwBytesReturned)
Definition: main.c:333
uint16_t * PWCHAR
Definition: typedefs.h:54
DWORD WINAPI WlanReasonCodeToString(IN DWORD dwReasonCode, IN DWORD dwBufferSize, IN PWCHAR pStringBuffer, PVOID pReserved)
Definition: main.c:319
RPC_STATUS WINAPI RpcStringBindingComposeW(RPC_WSTR ObjUuid, RPC_WSTR Protseq, RPC_WSTR NetworkAddr, RPC_WSTR Endpoint, RPC_WSTR Options, RPC_WSTR *StringBinding)
Definition: rpc_binding.c:511
DWORD WINAPI WlanSetSecuritySettings(IN HANDLE hClientHandle, IN WLAN_SECURABLE_OBJECT SecurableObject, IN LPCWSTR strModifiedSDDL)
Definition: main.c:351
DWORD _RpcEnumInterfaces(WLANSVC_RPC_HANDLE hClientHandle, PWLAN_INTERFACE_INFO_LIST *ppInterfaceList)
Definition: rpcserver.c:114
enum _WLAN_OPCODE_VALUE_TYPE WLAN_OPCODE_VALUE_TYPE
long RPC_STATUS
Definition: rpc.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
enum _WLAN_IHV_CONTROL_TYPE WLAN_IHV_CONTROL_TYPE
static PVOID ptr
Definition: dispmode.c:27
#define RpcTryExcept
Definition: rpc.h:126
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
DWORD _RpcConnect(WLANSVC_RPC_HANDLE hClientHandle, const GUID *pInterfaceGuid, const PWLAN_CONNECTION_PARAMETERS *pConnectionParameters)
Definition: rpcserver.c:310
#define RPC_S_INVALID_BINDING
Definition: winerror.h:1013
smooth NULL
Definition: ftsmooth.c:416
LPWSTR WLANSVC_HANDLE
Definition: wlansvc.idl:10
DWORD WlanRpcStatusToWinError(RPC_STATUS Status)
Definition: main.c:36
#define __RPC_FAR
Definition: rpc.h:56
#define __RPC_USER
Definition: rpc.h:65
PVOID WINAPI WlanAllocateMemory(IN DWORD dwSize)
Definition: main.c:111
#define RpcExceptionCode()
Definition: rpc.h:132
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WINAPI
Definition: msvc.h:8
DWORD WINAPI WlanRegisterNotification(IN HANDLE hClientHandle, IN DWORD dwNotifSource, IN BOOL bIgnoreDuplicate, WLAN_NOTIFICATION_CALLBACK funcCallback, PVOID pCallbackContext, PVOID pReserved, PDWORD pdwPrevNotifSource)
Definition: main.c:305
DWORD WINAPI WlanGetAvailableNetworkList(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, IN DWORD dwFlags, PVOID pReserved, OUT PWLAN_AVAILABLE_NETWORK_LIST *ppAvailableNetworkList)
Definition: main.c:375
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI WlanGetInterfaceCapability(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, PVOID pReserved, OUT PWLAN_INTERFACE_CAPABILITY *ppCapability)
Definition: main.c:293
DWORD WINAPI WlanQueryInterface(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, IN WLAN_INTF_OPCODE OpCode, PVOID pReserved, OUT PDWORD pdwDataSize, OUT PVOID *ppData, WLAN_OPCODE_VALUE_TYPE *pWlanOpcodeValueType)
Definition: main.c:276
DWORD _RpcOpenHandle(wchar_t *arg_1, DWORD dwClientVersion, DWORD *pdwNegotiatedVersion, LPWLANSVC_RPC_HANDLE phClientHandle)
Definition: rpcserver.c:67
PSDBQUERYRESULT_VISTA PVOID * ppData
Definition: env.c:54
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: main.c:395
#define ERROR_INVALID_ADDRESS
Definition: compat.h:96
#define RPC_X_ENUM_VALUE_OUT_OF_RANGE
Definition: winerror.h:1088
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
GLenum GLsizei len
Definition: glext.h:6722
DWORD _RpcDisconnect(WLANSVC_RPC_HANDLE hClientHandle, const GUID *pInterfaceGUID)
Definition: rpcserver.c:319
DWORD _RpcScan(WLANSVC_RPC_HANDLE hClientHandle, const GUID *pInterfaceGuid, PDOT11_SSID pDot11Ssid, PWLAN_RAW_DATA pIeData)
Definition: rpcserver.c:254
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
ULONG_PTR SIZE_T
Definition: typedefs.h:78
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: main.c:389
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
DWORD * PDWORD
Definition: pedump.c:68
DWORD WINAPI WlanCloseHandle(IN HANDLE hClientHandle, PVOID pReserved)
Definition: main.c:203
#define OUT
Definition: typedefs.h:39
DWORD WINAPI WlanEnumInterfaces(IN HANDLE hClientHandle, PVOID pReserved, OUT PWLAN_INTERFACE_INFO_LIST *ppInterfaceList)
Definition: main.c:226
#define UNIMPLEMENTED
Definition: debug.h:114
OpCode
Definition: dlist.c:229
DWORD WINAPI WlanConnect(IN HANDLE hClientHandle, IN const GUID *pInterfaceGuid, IN const PWLAN_CONNECTION_PARAMETERS pConnectionParameters, PVOID pReserved)
Definition: main.c:125
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:402
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define RPC_S_OK
Definition: rpcnterr.h:22
#define RpcExcept(expr)
Definition: rpc.h:127
DWORD WINAPI WlanOpenHandle(IN DWORD dwClientVersion, PVOID pReserved, OUT DWORD *pdwNegotiatedVersion, OUT HANDLE *phClientHandle)
Definition: main.c:174
handle_t __RPC_USER WLANSVC_HANDLE_bind(WLANSVC_HANDLE szMachineName)
Definition: main.c:57