[in,out] Buffer for NDIS request input parameters, also is used for request result.
BufferSize
[in] Data buffer size.
Key
[in] A user-defined parameter.
Return values:
HNERR_OK
The packet has been sent successfully.
HNERR_ADAPTER_NOT_OPENED
The adapter has not been opened, see the OpenAdapter function.
HNERR_ADAPTER_REQ_ERR
An internal driver request error.
Description:
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 OpenAdapter
function you can execute synchronous NDIS request to the NIC driver. The main difference of the
AsyncRequest function from the SyncRequest function is that the
NDIS request is completed in the OnAsyncRequest event
handler, in the context of the PSSDK internal thread. So, you can make NDIS/NIC driver requests and
process returned results in different threads: your application and PSSDK respectively.
For details please refer to MSDN, DDK documentation, and NIC vendor's specifications.
// Get quantity of the succesfully sent packets.
const OID_802_3_CURRENT_ADDRESS = $01010102;
MacAddrr :array[0..5] of Byte;
HNAdapter.OpenAdapter();
...
HNAdapter.AsyncRequest(NdisRequestQueryInformation,
OID_802_3_CURRENT_ADDRESS,@MacAddrr[0],sizeof(MacAddrr),nil);
...
procedure THNAdapter.OnAsyncRequest(Key: Pointer; RequestType: DWORD; Oid: DWORD;
pBuffer: Pointer; BufferSize: DWORD; BytesUsed: DWORD; BytesNeeded: DWORD; NdisStatus: DWORD);
var
pMacAddr : PByte;
begin
if (Oid = OID_802_3_CURRENT_ADDRESS) then
begin
pMacAddr = PByte(pBuffer);
...
end
end;