驱动牛犊
|
阅读:2307回复:0
Regmon(3)
case IRP_MJ_SHUTDOWN:
导出所有累计的缓冲区。由于我们在系统进程中,所以不需要为用户线程排队 while(old = RegmonOldestStore()) { RegmonWriteBootLog(old); if(old == store) break; } break; case IRP_MJ_CLOSE: DbgPrint((“Regmon: IRP_MJ_CLOSE\n”)); GUIActive = FALSE; DbgPrint((“ GUI Closing: %d\n”, GUIActive); RegmonResetStore(); break; case IRP_MJ_DEVICE_CONTROL: DbgPrint( “Regmon: IRP_MJ_DEVICE_CONTROL\n”); 检查数据缓冲区是否就是我们刚才导出数据的缓冲区 if(CONTROL_TRANSFER_TYPE(ioControlCode) == METHOD_NEITHER) { outputBuffer = Irp->UserBuffer; } 来自GUI的请求 RegmonDeviceControl(irpStack->FileObject, TRUE, inputBuffer, inputBufferLength, outputBuffer, outputBufferLength, ioControlCode, &Irp->IoStatus, DeviceObject); break; } IoCompleteRequest(Irp, IO_NO_INCREMENT); return STATUS_SUCCESS; } VOID RegmonUnload(IN PDRIVER_OBJECT DriverObject) { WCHAR deviceLinkBuffer[] = L\\DosDevice\\Regmon; UNICODE_STRING deviceLinkUnicodeString; DbgPrint((“Regmon.sys : unloading\n”)); 解除拦截注册表 if(RegHooked) UnhookRegistry(); 删除我们设备的符号连接 RtlInitUnicodeString(&deviceLinkUnicodeString, deviceLinkBuffer); IoDeleteSymbolLink(&deviceLinkUnicodeString); 删除设备对象 IoDeleteDevice(DriverObject->Deviceobject); DbgPrint((“Regmon.sys : delete devices.\n”)); 释放保留的内存 RegmonHashCleanup(); RegmonFreeStore(); DbgPrint((“Regmon.sys: free memory\n”)); } |
|