Packet Sniffer SDK DLL Edition

HNAdapter :: Methods :: AdpSyncRequest

 Previous Next

Execute synchronous NDIS request.

Syntax:

DWORD __stdcall AdpSyncRequest(HANDLE hAdp, DWORD RequestType, DWORD Oid, 
   LPVOID pBuffer, DWORD BufferSize, DWORD *pBytesUsed, DWORD *pBytesNeeded, DWORD *pNdisStatus);

Parameters:

hAdp

[in] HNAdapter object handle.

RequestType

[in] NDIS request type (see NDIS REQUEST TYPE).

Oid

[in] NDIS request code (see NDIS OIDs).

pBuffer

[in,out] Buffer for NDIS request input parameters, also is used for request result.

BufferSize

[in] Data buffer size.

pBytesUsed

[out] On request completion specifies the read/sent data size in bytes.

pBytesNeeded

[out] If the buffer size is not enough, on the NDIS request completion this parameter contains necessary buffer size (see NDIS_STATUS_INVALID_LENGTH or NDIS_STATUS_BUFFER_TOO_SHORT)

pNdisStatus

[out] The status returned by OS NDIS driver (see NDIS STATUS)

Return values:

HNERR_OKThe packet has been sent successfully.
HNERR_ADAPTER_NOT_OPENEDThe adapter has not been opened, see the AdpOpenAdapter function.
HNERR_ADAPTER_REQ_ERRAn internal driver request error.
HNERR_INVALID_HANDLEhAdp parameter is not the HNAdapter object handle.

Description:

NDIS technology is significant part of the network stack in the Windows OS family, it is realized as OS driver NDIS.VXD for Windows 9x/Me or NDIS.SYS for Windows NT/2k/XP/2k3/Vista.

NDIS provides interconnection between NIC drivers and protocol drivers (internal PSSDK driver is a protocol driver). Protocol driver can manage NIC driver by NDIS requests, also protocol driver can obtain necessary information from the NIC driver.

After successfully opening of the network adapter by AdpOpenAdapter function you can execute synchronous NDIS request to the NIC driver.

For details please refer to MSDN, DDK documentation, and NIC vendor's specifications.

// Get quantity of the succesfully sent packets.

#define OID_GEN_XMIT_OK 0x00020101 

ULARGE_INTEGER Value;

HANDLE hAdp = AdpOpenAdapter();
...
DWORD Res = AdpSyncRequest(hAdp,NdisRequestQueryInformation,OID_GEN_XMIT_OK,
             &Value,sizeof(Value),NULL,NULL,NULL);
See also:HNAdapter, AdpOpenAdapter, AdpAsyncRequest, NDIS_REQUEST_TYPE, NDIS_OIDs, NDIS_STATUS