Yjx_driver_015_ddk_helloworld Unload Routines Refinement

Source: Internet
Author: User

1.

"178" Copy the Code of Lesson 12th, open with vs2003 (VC7.0)

"360" put part of the code in the new header file (mini_ddk.h), then the project "Add Existing Item"

"592" At this time "rebuild solution", OK

ZC: Can be "L" \\Device\\yjxDDK_Device "" and "L" \ \?? \\yjx888 "" Into global variables, unified management

ZC: or Devname and symlinkname into global variables, unified management

"1125" Iodeletesymboliclink function

The "1445" unload routine has an incoming parameter of Pdriver_object, but it is a driver object pointer, but underneath it is a device object it is also a linked list

"1500" Remove the read connection before deleting the device object

VOID ddk_unload (in Pdriver_object _pdrvierobject)
{

Pdevice_object Pdev; Used to get the device object to delete

Unicode_string Symlinkname;

Pdev = _pdrvierobject->deviceobject;

Iodeletedevice (Pdev); Remove device

Get the name of the symbolic link

Rtlinitunicodestring (&symlinkname, L "\ \?? \\yjx888 ");

Iodeletesymboliclink (&symlinkname);

Kdprint ("Driver successfully uninstalled ... OK----------"));
}

"1800" _pdrvierobject->deviceobject; Get the head of the device chain list. It is a linked list, and if there are multiple devices, use Device_object. Nextdevice to Traverse (ZC: specifically to use the device name or something else (attributes) to match, he didn't say ... There is no need to match, ∵ is in the download driver, so the driver object below all the device object/symbol links are deleted, directly all of the deleted can be removed.

∵ We only create a device here, so we do not need to traverse the search, directly delete the first one

"2460" in the case of multiple devices, we generally save it to the device extension (IoCreateDevice space) inside, the symbolic link and device objects are present in the device extension, and then through the loop to delete all the symbolic links and device objects

"2690" and compile it with DDK.

"2727" Driver file name change

"2755" Drivermonitor load Driver "2816" see the driver can be repeatedly loaded/run/unload "2870" and then "Kernel detecive v1.3.0" Look, there is no such driver, has been normal uninstall. Then use Drivermonitor to run the driver, and then see "Kernel detecive" drive in the list. Uninstall the driver with Drivermonitor, then see "Kernel detecive" driver is not in the list, is normal uninstall.

"3100" again with DDK to compile the 12th lesson drive, test see phenomenon

"3205" although Drivermonitor prompt uninstall success, but see "Kernel detecive" driver or in the list (no real uninstall success), and then use the Drivermonitor to run the driver, the error

2.

Yjx_driver_015_ddk_helloworld Unload Routines Refinement

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.