The function description in the Packet32 package:
No.2.packetopenadapter (open NIC)
Open it according to the incoming device name.
LPADAPTER PacketOpenAdapter(
LPTSTR AdapterName
);
Parameters:
AdapterName:
The name of the device [in] to open.
Return Values:
If it succeeds, returns a pointer to a properly initialized adapter Object.
Otherwise, NULL is returned.
Usage:
[C + +]
C + + Usage Sample
Lpadapter adapter;
adapter = Packetopenadapter (Pstr+rewind);
Remarks:
This function attempts to load and start packet driver so that the management driver is transparent to the application.
The windows9x version of the NPF driver is encoded in ASCII, and the Windowsntx with Unicode encoding. So draw attention to this input parameter adaptername, under Windows9x, must be the correct encoding format! Under Windowsntx, this function can monitor the ASCII encoding and convert it to Unicode before giving it to driver.
The operation of this function is roughly:
Call OpenSCManager First, connect the service control Manager as administrators, and the permissions are sc_manager_all_access. This also means that you must be a member of the local Administrators group to use Packet.dll.