All pastes #752611 Raw Edit

Unnamed

public c v1 · immutable
#752611 ·published 2007-10-28 15:47 UTC
rendered paste body
#include "timeline.h"NTSTATUS DriverEntry(PDRIVER_OBJECT pDriverObject, PUNICODE_STRING pRegistryPath) {	NTSTATUS NtStatus = STATUS_SUCCESS;	UINT uiIndex = 0;	PDEVICE_OBJECT pDeviceObject = NULL;	UNICODE_STRING usDriverName;		DbgPrint("Timeline loading\r\n");		RtlInitUnicodeString(&usDriverName, L"\\Device\\Timeline");		NtStatus = IoCreateDevice(pDriverObject, 0, &usDriverName, FILE_DEVICE_UNKNOWN, FILE_DEVICE_SECURE_OPEN, FALSE, &pDeviceObject);	if(NtStatus == STATUS_SUCCESS) {		for(uiIndex = 0; uiIndex < IRP_MJ_MAXIMUM_FUNCTION; ++uiIndex)			pDriverObject->MajorFunction[uiIndex] = Timeline_UnsupportedFunction;				pDriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = Timeline_IoControl;        pDriverObject->DriverUnload = Timeline_Unload;                pDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;                DbgPrint("Timeline loaded\r\n");	} else		DbgPrint("Timeline did not load successfully\r\n");		return NtStatus;}NTSTATUS Timeline_IoControl(PDEVICE_OBJECT DeviceObject, PIRP Irp) {	DbgPrint("Woot, ioctl called\r\n");		return STATUS_NOT_SUPPORTED;}NTSTATUS Timeline_UnsupportedFunction(PDEVICE_OBJECT DeviceObject, PIRP Irp) {	return STATUS_NOT_SUPPORTED;}VOID Timeline_Unload(PDRIVER_OBJECT pDriverObject) {	DbgPrint("Timeline unloading\r\n");		IoDeleteDevice(pDriverObject->DeviceObject);}