Re: CreateFile api call failing

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



You have to tell it what adapter to open. Since that's either not all of
your code or it doesn't do that... Here's a piece of code from one of my
programs to get the BSSID list. You'll have to ignore some of the calls
which I haven't included and, of course, error handling is minimal:

-----

HRESULT GetSSIDList( TCHAR *adapName, NDIS_802_11_BSSID_LIST *&bssidList,
BOOL clearCache = FALSE )
{
// If we are going to clear the cache, send the OID_802_11_BSSID_LIST_SCAN
// OID to the driver.
if ( clearCache )
{
RefreshSSIDList( adapName );

// A delay seems to be needed here to allow time to find the SSID
// values.
Sleep( 1000 );
}

// Retrieve a list of NDIS_802_11_BSSID_LIST structures from the driver
// and return that list, as well as the number of entries found. The
// list must be deleted by calling FreeSSIDList().
DWORD dwBytesReturned = 0;
DWORD size = sizeof( NDISUIO_QUERY_OID ) + 2000;
PNDISUIO_QUERY_OID queryOID = (PNDISUIO_QUERY_OID)LocalAlloc( LPTR, size );
HANDLE ndisAccess = INVALID_HANDLE_VALUE;
BOOL retval;
HRESULT hr;

// Attach to NDISUIO.
ndisAccess = CreateFile( NDISUIO_DEVICE_NAME, 0, 0, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, INVALID_HANDLE_VALUE );
if ( ndisAccess == INVALID_HANDLE_VALUE )
return E_FAIL; // ????

// Get list
queryOID->ptcDeviceName = adapName;
queryOID->Oid = OID_802_11_BSSID_LIST;

retval = DeviceIoControl( ndisAccess,
IOCTL_NDISUIO_QUERY_OID_VALUE,
(LPVOID) queryOID,
size,
(LPVOID) queryOID,
size,
&dwBytesReturned,
NULL);
if( retval )
{
bssidList = (NDIS_802_11_BSSID_LIST *)( &queryOID->Data );
}
else
{
// We might just need more room.
// ????

LocalFree( queryOID );
bssidList = 0;

hr = E_FAIL;
}

CloseHandle( ndisAccess );

return hr;
}

-----

Paul T.

"joy" <joy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:11A812D1-A18E-4478-B5FE-47DED91638C9@xxxxxxxxxxxxxxxx
Hi ,
thanks for your help ,
i have opened the device handle.
but i m getting invalid parameter error when i m trying to use the
following
call after it
pQueryOid = (PNDISUIO_QUERY_OID)&QueryBuffer[o];
pQueryOid->Oid = (NDIS_OID)OidCode
DeviceIoControl(hMac,
//handle obtained after create file and IOCTL_NDISUIO_OPEN_DEVICE
IOCTL_NDISUIO_QUERY_OID_VALUE,
(LPVOID)pQueryOid,
sizeof(NDISUIO_QUERY_OID) + sizeof(DWORD)
MyReturnedCount,
lpOverlapped)

please advice me.
can i use the above call fo all the OIDS eg for fetching BSSID list
or only for long values.
thanks
joy



"Paul G. Tobey [eMVP]" wrote:

You would not use CreateFile( adaptername, ... ) to do that. Look up
NDISUIO and use that to send OIDs to the driver. Obviously, Windows CE
is
*not* XP, so expecting this back door method of accessing drivers from
applications to work the same is, at best, naive.

Paul T.

"joy" <joy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D8BA7E87-D0F4-411A-99A4-FE6290CC9C5E@xxxxxxxxxxxxxxxx
Hi,
i m trying to configure n check the driver using oids.
hence i m trying to open the interface to get a valid handle.
is there any other call which you would advice to achieve the same or
there
is some important thing i m missing out.
i would like to mention here that the same call succedds in normal xp
desktops.
thanks
joy


"Paul G. Tobey [eMVP]" wrote:

No, that's still not what you're trying to do; it's how you're trying
to
do
it. You want to, what, send raw packets over the interface? Query
some
status or information about the interface?

Paul T.

"joy" <joy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C9760CE3-2381-4E2E-8080-70261FA6E814@xxxxxxxxxxxxxxxx
hi ,
i m trying to open ISL1 interface and want to get a valid handle,to
use
them
furthe rin
devioctl calls.
thanks
joyjit

"Paul G. Tobey [eMVP]" wrote:

If you're trying to open "NE20001", that will never work. *What*
are
you
trying to accomplish (you've told us *how* you've decided to do it,
but
not
what you're trying to do)?

Paul T.

"joy" <joy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:8C7CAA72-9DA3-4C01-9800-D22B0F592F78@xxxxxxxxxxxxxxxx
os used : wince5.0
hi ,
i m trying to open a wlan driver interface using this call,
the call is failing with an error code 55.and the
HANDLE hMac ;
szMacFileName is the interafce name:
hMac = CreateFile(szMacFileName,
GENERIC_READ,
0, // FILE_SHARE_READ |
FILE_SHARE_WRITE,
&SecurityAttributes,
OPEN_EXISTING,
dwFileAttributes,(value is
FILE_ATTRIBUTE_NORMAL)
NULL
);
please advice me on the relevant solutions
thanks in advance
joy











.



Relevant Pages

  • Re: OID_DOT11_XXX OIDs?
    ... the Cisco driver, ... > Hi Paul: ... > Or these OIDs are not implemented in the miniport driver? ...
    (microsoft.public.windowsce.platbuilder)
  • Re: CreateFile api call failing
    ... but i m getting invalid parameter error when i m trying to use the following ... NDISUIO and use that to send OIDs to the driver. ... Paul T. ... hence i m trying to open the interface to get a valid handle. ...
    (microsoft.public.windowsce.app.development)
  • Re: CreateFile api call failing
    ... NDISUIO and use that to send OIDs to the driver. ... Paul T. ... hence i m trying to open the interface to get a valid handle. ...
    (microsoft.public.windowsce.app.development)
  • Re: C# Service for Windows CE 6.0 R2
    ... In the CE5 help, which is what I have on this computer, look under Windows ... Paul T. ... will not require a "user interface" in the form of a GUI. ...
    (microsoft.public.windowsce.embedded)
  • Re: CreateFile api call failing
    ... i m trying to configure n check the driver using oids. ... hence i m trying to open the interface to get a valid handle. ... Paul T. ... HANDLE hMac; ...
    (microsoft.public.windowsce.app.development)