Intermec CN2B Manual de usuario Pagina 179

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 264
  • Tabla de contenidos
  • SOLUCIÓN DE PROBLEMAS
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 178
Chapter 7 — Programming
CN2B Mobile Computer User’s Manual 161
Network Selection APIs
The Network Selection APIs change the network adapter configuration
programmatically. Both drivers support the same IOCTL function num-
bers for loading and unloading the drivers. Loading and unloading of the
802.11b/g driver is performed by the FWL1: device in the system by per-
forming DeviceIOControl() calls to the driver. Loading and unloading of
the driver for the built-in Ethernet adapter is performed by the SYI1: device
in the system by performing DeviceIOControl() calls to the driver.
For loading an NDIS driver associated with an adapter, the IOCTL is
IOCTL_LOAD_NDIS_MINIPORT.
For unloading NDIS drivers associated with an adapter the IOCTL is
IOCTL_UNLOAD_NDIS_MINIPORT.
Example
#include <winioctl.h>
#include “sysio.h”
void DoLoad(int nDevice) {
LPTSTR devs[] = { _T(“SYI1:”), _T(“FWL1:”) };
HANDLE hLoaderDev;
DWORD bytesReturned;
hLoaderDev = CreateFile(devs[nDevice], GENERIC_READ|GENERIC_WRITE, 0,
NULL, OPEN_EXISTING, 0, NULL);
if (hLoaderDev != INVALID_HANDLE_VALUE) {
if (!DeviceIoControl( hLoaderDev, IOCTL_LOAD_NDIS_MINIPORT, NULL, -1,
NULL, 0,
&bytesReturned, NULL)){
MessageBox(NULL, TEXT(“SYSIO IoControl Failed”), TEXT(“Network
loader”),MB_ICONHAND);
if (hLoaderDev!=INVALID_HANDLE_VALUE) CloseHandle(hLoaderDev);
hLoaderDev = INVALID_HANDLE_VALUE; // bad handle
}else {
CloseHandle(hLoaderDev);
}
}
}
void DoUnload(int nDevice) {
LPTSTR devs[] = { _T(“SYI1:”), _T(“FWL1:”) };
HANDLE hLoaderDev;
DWORD bytesReturned;
hLoaderDev = CreateFile(devs[nDevice], GENERIC_READ|GENERIC_WRITE, 0,
NULL, OPEN_EXISTING, 0, NULL);
if (hLoaderDev != INVALID_HANDLE_VALUE) {
if (!DeviceIoControl( hLoaderDev, IOCTL_UNLOAD_NDIS_MINIPORT, NULL, -1,
NULL, 0,
&bytesReturned, NULL)){
MessageBox(NULL, TEXT(“SYSIO IoControl Failed”),TEXT(“Network
loader”),MB_ICONHAND);
if (hLoaderDev!=INVALID_HANDLE_VALUE) CloseHandle(hLoaderDev);
hLoaderDev = INVALID_HANDLE_VALUE; // bad handle
}else {
CloseHandle(hLoaderDev);
}
}
}
The API provided by Intermec exposes a limited set of routines for a pro-
grammer to access and affect the 802.11b/g network interface card from
Vista de pagina 178
1 2 ... 174 175 176 177 178 179 180 181 182 183 184 ... 263 264

Comentarios a estos manuales

Sin comentarios