Re: NDISUIO_QUERY_BINDING
From: Paul G. Tobey [eMVP] (ptobey)
Date: 01/24/05
- Next message: Susan Fairo [MSFT]: "This week: PB documentation chat"
- Previous message: bigus_dingus_at_yahoo.com: "MmMapIoSpace is it really uncached??"
- In reply to: Johns: "NDISUIO_QUERY_BINDING"
- Next in thread: Johns: "Re: NDISUIO_QUERY_BINDING"
- Reply: Johns: "Re: NDISUIO_QUERY_BINDING"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 24 Jan 2005 15:27:28 -0700
I think that you're just interpreting things incorrectly, probably. This
code works just fine:
-----
HANDLE ndisuio = CreateFile(NDISUIO_DEVICE_NAME, GENERIC_READ |
GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
NULL);
CHAR Buf[1024];
DWORD dwReturnedBytes;
PNDISUIO_QUERY_BINDING pQueryBinding;
int queryBindingResult;
pQueryBinding = (PNDISUIO_QUERY_BINDING)&Buf[0];
// The binding index is an *INPUT* to the operation.
// You have to set it to a valid value.
pQueryBinding->BindingIndex = 0;
queryBindingResult = DeviceIoControl(ndisuio,
IOCTL_NDISUIO_QUERY_BINDING,
pQueryBinding,
sizeof(NDISUIO_QUERY_BINDING),NULL, 1024,
&dwReturnedBytes, NULL);
if ( !queryBindingResult )
{
DWORD err = GetLastError();
DEBUGMSG( 1, ( TEXT( "Error from DeviceIoControl %d 0x%x\r\n" ), err,
err ) );
}
else
{
DEBUGMSG( 1, ( TEXT( "Binding index 0x%x\r\nDeviceNameLength
%d\r\nDeviceDescrLength %d\r\n" ),
pQueryBinding->BindingIndex,
pQueryBinding->DeviceNameLength,
pQueryBinding->DeviceDescrLength ) );
// Get the actual data for the description, etc.
DEBUGMSG( 1, ( TEXT( "Device name %s\r\nDevice description %s\r\n" ),
(TCHAR*)&Buf[ pQueryBinding->DeviceNameOffset ],
(TCHAR*)&Buf[ pQueryBinding->DeviceDescrOffset ] ) );
}
-----
Paul T.
"Johns" <johnysmart@yahoo.com> wrote in message
news:%23OSAzSRAFHA.600@TK2MSFTNGP09.phx.gbl...
> Hi All,
> I am using NDISUIO to query/set the OID values. Inorder to do this, as in
> the documentation, I got the handle to the device using CreateFile.
> g_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););
> This returns me a handle. Now I use this handle to make the
> IOCTL_NDISUIO_QUERY_BINDING call as shown below:
> CHAR Buf[1024];
> DWORD dwReturnedBytes;
> PNDISUIO_QUERY_BINDING pQueryBinding;
>
> pQueryBinding = (PNDISUIO_QUERY_BINDING)Buf;
> bQueryBinding = DeviceIoControl(g_hAdapter, IOCTL_NDISUIO_QUERY_BINDING,
> pQueryBinding,
> sizeof(NDISUIO_QUERY_BINDING),NULL, 1024,
> &dwReturnedBytes, NULL);
> I print out all the members of the pQueryBinding and are as follows:
> pQueryBinding->BindingIndex: 0
> pQueryBinding->DeviceNameLength: 24
> pQueryBinding->DeviceDescrLength : 24
> pQueryBinding->DeviceNameOffset: 20
> pQueryBinding->DeviceDescrOffset : 44
>
> But how do i get the device name from this?
> Printing out Buf value did not give me anything
>
> Could any one help me on this??
>
> Johns
>
>
>
- Next message: Susan Fairo [MSFT]: "This week: PB documentation chat"
- Previous message: bigus_dingus_at_yahoo.com: "MmMapIoSpace is it really uncached??"
- In reply to: Johns: "NDISUIO_QUERY_BINDING"
- Next in thread: Johns: "Re: NDISUIO_QUERY_BINDING"
- Reply: Johns: "Re: NDISUIO_QUERY_BINDING"
- Messages sorted by: [ date ] [ thread ]