Monitor Ethernet (2) PACKET32 Package Description cont.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.