ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

main.c
Go to the documentation of this file.
00001 /*
00002  * Wireless LAN API (wlanapi.dll)
00003  *
00004  * Copyright 2009 Christoph von Wittich (Christoph@ApiViewer.de)
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00019  */
00020 
00021 
00022 /* INCLUDES ****************************************************************/
00023 #define WIN32_NO_STATUS
00024 #include <windows.h>
00025 #include "wlansvc_c.h"
00026 
00027 #include "wine/debug.h"
00028 
00029 WINE_DEFAULT_DEBUG_CHANNEL(wlanapi);
00030 
00031 handle_t __RPC_USER
00032 WLANSVC_HANDLE_bind(WLANSVC_HANDLE szMachineName)
00033 {
00034     handle_t hBinding = NULL;
00035     LPWSTR pszStringBinding;
00036     RPC_STATUS Status;
00037 
00038     TRACE("RPC_SERVICE_STATUS_HANDLE_bind() called\n");
00039 
00040     Status = RpcStringBindingComposeW(NULL,
00041                                       L"ncalrpc",
00042                                       szMachineName,
00043                                       L"wlansvc",
00044                                       NULL,
00045                                       &pszStringBinding);
00046     if (Status != RPC_S_OK)
00047     {
00048         ERR("RpcStringBindingCompose returned 0x%x\n", Status);
00049         return NULL;
00050     }
00051 
00052     /* Set the binding handle that will be used to bind to the server. */
00053     Status = RpcBindingFromStringBindingW(pszStringBinding,
00054                                           &hBinding);
00055     if (Status != RPC_S_OK)
00056     {
00057         ERR("RpcBindingFromStringBinding returned 0x%x\n", Status);
00058     }
00059 
00060     Status = RpcStringFreeW(&pszStringBinding);
00061     if (Status != RPC_S_OK)
00062     {
00063         ERR("RpcStringFree returned 0x%x\n", Status);
00064     }
00065 
00066     return hBinding;
00067 }
00068 
00069 void __RPC_USER
00070 WLANSVC_HANDLE_unbind(WLANSVC_HANDLE szMachineName,
00071                                  handle_t hBinding)
00072 {
00073     RPC_STATUS Status;
00074 
00075     TRACE("WLANSVC_HANDLE_unbind() called\n");
00076 
00077     Status = RpcBindingFree(&hBinding);
00078     if (Status != RPC_S_OK)
00079     {
00080         ERR("RpcBindingFree returned 0x%x\n", Status);
00081     }
00082 }
00083 
00084 PVOID
00085 WINAPI
00086 WlanAllocateMemory(IN DWORD dwSize)
00087 {
00088     return HeapAlloc(GetProcessHeap(), 0, dwSize);
00089 }
00090 
00091 VOID
00092 WINAPI
00093 WlanFreeMemory(IN PVOID pMem)
00094 {
00095     HeapFree(GetProcessHeap(), 0, pMem);
00096 }
00097 
00098 DWORD
00099 WINAPI
00100 WlanOpenHandle(IN DWORD dwClientVersion,
00101                PVOID pReserved,
00102                OUT DWORD *pdwNegotiatedVersion,
00103                OUT HANDLE *phClientHandle)
00104 {
00105     DWORD dwError = ERROR_SUCCESS;
00106     WCHAR szDummy[] = L"localhost";
00107 
00108     if ((pReserved != NULL) || (pdwNegotiatedVersion == NULL) || (phClientHandle == NULL))
00109         return ERROR_INVALID_PARAMETER;
00110 
00111     RpcTryExcept
00112     {
00113         dwError = _RpcOpenHandle(szDummy,
00114                                 dwClientVersion,
00115                                 pdwNegotiatedVersion,
00116                                 (WLANSVC_RPC_HANDLE) phClientHandle);
00117     }
00118     RpcExcept(EXCEPTION_EXECUTE_HANDLER)
00119     {
00120         dwError = RpcExceptionCode();
00121     }
00122     RpcEndExcept;
00123 
00124     return dwError;
00125 }
00126 
00127 DWORD
00128 WINAPI
00129 WlanCloseHandle(IN HANDLE hClientHandle,
00130                 PVOID pReserved)
00131 {
00132     DWORD dwError = ERROR_SUCCESS;
00133 
00134     if ((pReserved != NULL) || (hClientHandle == NULL))
00135         return ERROR_INVALID_PARAMETER;
00136 
00137     RpcTryExcept
00138     {
00139         _RpcCloseHandle(hClientHandle);
00140     }
00141     RpcExcept(EXCEPTION_EXECUTE_HANDLER)
00142     {
00143         dwError = RpcExceptionCode();
00144     }
00145     RpcEndExcept;
00146 
00147     return dwError;
00148 }
00149 
00150 DWORD
00151 WINAPI
00152 WlanEnumInterfaces(IN HANDLE hClientHandle,
00153                    PVOID pReserved,
00154                    OUT PWLAN_INTERFACE_INFO_LIST *ppInterfaceList)
00155 {
00156     DWORD dwError = ERROR_SUCCESS;
00157 
00158     if ((pReserved != NULL) || (ppInterfaceList == NULL) || (hClientHandle == NULL))
00159         return ERROR_INVALID_PARAMETER;
00160 
00161     RpcTryExcept
00162     {
00163         _RpcEnumInterfaces(hClientHandle, ppInterfaceList);
00164     }
00165     RpcExcept(EXCEPTION_EXECUTE_HANDLER)
00166     {
00167         dwError = RpcExceptionCode();
00168     }
00169     RpcEndExcept;
00170 
00171     return dwError;
00172 }
00173 
00174 DWORD
00175 WINAPI
00176 WlanScan(IN HANDLE hClientHandle,
00177          IN GUID *pInterfaceGuid,
00178          IN PDOT11_SSID pDot11Ssid,
00179          IN PWLAN_RAW_DATA pIeData,
00180          PVOID pReserved)
00181 {
00182     DWORD dwError = ERROR_SUCCESS;
00183 
00184     if ((pReserved != NULL) || (pInterfaceGuid == NULL) || (hClientHandle == NULL))
00185         return ERROR_INVALID_PARAMETER;
00186 
00187     RpcTryExcept
00188     {
00189         _RpcScan(hClientHandle, pInterfaceGuid, pDot11Ssid, pIeData);
00190     }
00191     RpcExcept(EXCEPTION_EXECUTE_HANDLER)
00192     {
00193         dwError = RpcExceptionCode();
00194     }
00195     RpcEndExcept;
00196 
00197     return dwError;
00198 }
00199 
00200 void __RPC_FAR * __RPC_USER
00201 midl_user_allocate(SIZE_T len)
00202 {
00203     return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
00204 }
00205 
00206 void __RPC_USER
00207 midl_user_free(void __RPC_FAR * ptr)
00208 {
00209     HeapFree(GetProcessHeap(), 0, ptr);
00210 }
00211 

Generated on Sun May 27 2012 04:16:43 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.