For Programmers: Free Programming Magazines  


Home > Archive > Smartphone Developer Forum > December 2005 > NDIS 5.1 IOCTL_NDISUIO_QUERY_OID_VALUE with a proprietary OID









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author NDIS 5.1 IOCTL_NDISUIO_QUERY_OID_VALUE with a proprietary OID
Howard Cunningham

2005-11-22, 7:03 pm

I am trying to use IOCTL_NDISUIO_QUERY_OID_VALUE and
IOCTL_NDISUIO_SET_OID_VALUE to access a proprietary OID on an adapter served
by our NDIS 5.1 miniport. I can access standard OIDs such as OID_802_11_BSSID
without problems so I am pretty sure that my code is OK. But when I specify
our proprietary OID, the call to the MiniportSetInformation occurs but the
data to be set is not in the buffer at the driver and the call to
MiniportQueryInformation does not return the result to my DeviceIoControl
call.

It seems as though NDIS 5.1 is not 'marshalling' the user mode data to/from
the kernel mode drive for non-standard OIDs.

Is this expected behaviour for NDIS 5.1?

Thanks in advance for any help in this.

--
Howard Cunnningham
Bluefin Mobile
RTP, NC
Baranidharan Mohandoss

2005-11-29, 9:58 pm

What is the data that you are passing ? Give us more details about that
!!! May be then we could figure out something

regards
barani.

Howard Cunningham

2005-12-02, 9:36 pm

Thanks for your reply. In this case I am trying to set/query DWORD parameters
(timer values, power levels, etc.).

What I was really looking for was some assurance (and maybe a snip of sample
code) that proprietary OIDs can be passed from a user mode application to an
NDIS 5.1 miniport on WM 5.0 using DeviceIoControl
IOCTL_NDISUIO_QUERY|SET_OID_VALUE.

Thanks.
--
Howard Cunnningham
BluefinMobile
RTP, NC


"Baranidharan Mohandoss" wrote:

> What is the data that you are passing ? Give us more details about that
> !!! May be then we could figure out something
>
> regards
> barani.
>
>

Baranidharan Mohandoss

2005-12-02, 9:36 pm

Hi Howard,

Here is what you have asked for.

CHAR chData[1024];
hAdapter = CreateFile ( NDISUIO_DEVICE_NAME,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
NULL);

if (INVALID_HANDLE_VALUE == hAdapter)
{
return;
}

pBindInfo = (PNDISUIO_QUERY_BINDING) chData;
pBindInfo->BindingIndex = 0;
length = sizeof (NDISUIO_QUERY_BINDING);

bValue = DeviceIoControl (hAdapter,
IOCTL_NDISUIO_QUERY_BINDING,
pBindInfo,
length,
NULL,
1024,
&bytesconsumed,
NULL);

DEBUGMSG (TRUE, (_T("DeviceIoControl returns %d\r\n"), bValue));

if (!bValue)
{
return;
}

DWORD dwReturnedBytes;
ptcDeviceName = (PTCHAR)((PUCHAR)pBindInfo +
pBindInfo->DeviceNameOffset);

bValue = DeviceIoControl(
hAdapter,
IOCTL_NDISUIO_OPEN_DEVICE,
ptcDeviceName,
wcslen(ptcDeviceName) * sizeof(TCHAR),
NULL,
0,
&dwReturnedBytes,
NULL);

if (0 == bValue)
{
return;
}

PNDISUIO_QUERY_OID queryOid;
TCHAR DeviceName[50];
_tcscpy (DeviceName,_T("NwSamp1"));
// ULONG ulData;
PUCHAR QueryBuffer;
PULONG pulData;

QueryBuffer = (PUCHAR) malloc (1024);

queryOid = (PNDISUIO_QUERY_OID) QueryBuffer;

queryOid->Oid = 0xFF010102; // Custom OID;
queryOid->ptcDeviceName = NULL; // You dont need this once you
have done a OPEN Device.

bValue = DeviceIoControl (hAdapter,
IOCTL_NDISUIO_QUERY_OID_VALUE,
(LPVOID) queryOid,
sizeof(NDISUIO_QUERY_OID) + sizeof (DWORD),
(LPVOID) queryOid,
sizeof(NDISUIO_QUERY_OID) + sizeof (DWORD),
&bytesconsumed,
NULL);


This did the work for me. Hope this works for you too. And one more
thing, i hope you are not passing pointers across. Because in that case
the pointer cannot be directly accessed from the driver.

regards

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com