You must allocate a buffer of the needed length and then cast it to a
PACKET_OID_DATA structure.
You can look at the packet.dll source code inside the winpcap source
distribution for code samples. For example, see the
PacketSetMaxLookaheadsize() function.
Loris
> I am trying to use Winpcap (actually PacketCE but this does't change
> anything in that case) to send a command to a wifi card.
> I need to send a pOidData->Data buffer that is bigger than 1 char how can
I
> do that?
>
> I have tryed to use a redefinition of that struct that allowed a pointer
> instead of a fixed array and send it directly to the packet capture driver
> (using DeviceIoControl) but it does't seem to work...
>
> it is basicly a wrapper over the DeviceIoControl that i used before
starting
> using winpcap for that project but that i have adapted for use with
> winpcap... This function work but in some case I have to pass some buffer
to
> lpOutBuffer but in that situation i am blocked to 1...
>
> BOOL CWifi::MacIoctl(DWORD *lpInBuffer,VOID *lpOutBuffer,DWORD
> nOutBufferSize,DWORD *lpBytesReturned){
>
> BOOLEAN bRet;
> PPACKET_OID_DATA pOidData;
> ULONG IoCtlBufferLength = (sizeof (PACKET_OID_DATA) + nOutBufferSize);
> bool write=FALSE;
> pOidData =(PACKET_OID_DATA *) HeapAlloc (GetProcessHeap (),
> HEAP_ZERO_MEMORY, IoCtlBufferLength);
>
> pOidData->Oid = *lpInBuffer;
> pOidData->Length = nOutBufferSize;
>
> if(pOidData->Oid==OID_CW10_SETRID){
> write=TRUE;
> }else{
> write=FALSE;
> }
> *((PULONG) pOidData->Data) = *(PULONG)lpOutBuffer;
> bRet=DeviceIoControl(m_lpAdapter->hFile,(DWORD) write ? PIOC_SETOID :
> PIOC_QUERYOID,
> pOidData, sizeof(PACKET_OID_DATA) - 1 + pOidData->Length,
> pOidData, sizeof(PACKET_OID_DATA) - 1 + pOidData->Length,
> lpBytesReturned, NULL);
> memcpy(lpOutBuffer,pOidData->Data,nOutBufferSize);
> GlobalFreePtr (pOidData);
> return bRet;
> }
>
>
>
> ==================================================================
> This is the WinPcap users list. It is archived at
> http://www.mail-archive.com/[EMAIL PROTECTED]/
>
> To unsubscribe use
> mailto: [EMAIL PROTECTED]
> ==================================================================
>
==================================================================
This is the WinPcap users list. It is archived at
http://www.mail-archive.com/[EMAIL PROTECTED]/
To unsubscribe use
mailto: [EMAIL PROTECTED]
==================================================================