Non Pnp Kmdf Driver Question

So basically with my non pnp driver I have been having some issues doing start service with my user application. So I was looking at my driver .sys file and was wondering if I was missing something. Also the usermode app error was error 2 file not found. Here is an example of what I have in my kmdf non pnp atm.
NTSTATUS Device1(WDFDRIVER Driver, PWDFDEVICE_INIT DeviceInit) {
UNREFERENCED_PARAMETER(Driver);
WdfDeviceInitAssignName(DeviceInit, &DeviceName);
status = WdfDeviceCreate(&DeviceInit, WDF_NO_OBJECT_ATTRIBUTES, &hDevice);
WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&ioQueueConfig, WdfIoQueueDispatchSequential);
ioQueueConfig.EvtIoDefault = BOBIoDefault;
WdfIoQueueCreate(hDevice, &ioQueueConfig, WDF_NO_OBJECT_ATTRIBUTES, &hQueue);
WdfDeviceCreateSymbolicLink(hDevice, &dosDeviceName);
WdfControlFinishInitializing(hDevice);
return status;
}
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) {
WDF_DRIVER_CONFIG_INIT(&config, Device1);
config.DriverInitFlags = WdfDriverInitNonPnpDriver;
config.EvtDriverUnload = Unload;
WdfDriverCreate(DriverObject, RegistryPath, WDF_NO_OBJECT_ATTRIBUTES, &config, WDF_NO_HANDLE);
return status;
}

Hi,

Non-PNP drivers do not take a EvtDriverDeviceAdd callback. In fact, WdfDriverCreate will fail with STATUS_INVALID_PARAMETER when given WdfDriverInitNonPnpDriver with a non-NULL EvtDriverDeviceAdd. See this: see this: https://msdn.microsoft.com/en-us/library/windows/hardware/ff545487(v=vs.85).aspx

I suggest taking a look at the KMDF NONPNP sample. Sys/nonpnp.c is particularly relevant and very well commented: https://code.msdn.microsoft.com/windowshardware/NONPNP-5fb0fa62

I took a look at it and it just has class after class after class of random stuff, I wanna be able to write a initialization to the bare minimum, start, stop delete. For example idk if I need to use functions such as ZwCreateFile, A Cleanup function, ZwReadFile.

Also how am I supposed to initialize Ntstatus Device1 in the driver entry with out blue screening my self?

xxxxx@gmail.com wrote:

I took a look at it and it just has class after class after class of random stuff, I wanna be able to write a initialization to the bare minimum, start, stop delete. For example idk if I need to use functions such as ZwCreateFile, A Cleanup function, ZwReadFile.

It’s really, really hard for me to resist the urge to reply unkindly to
this. What you’re whining about here is that drivers are hard, and you
don’t want to do any reading to learn about them.

There aren’t any classes in the nonPnP sample, since the entire thing is
written in C. WTF are you talking about?

You need to call WdfDriverCreate to register your driver with the
framework. You need to call WdfDeviceCreate to create a device object
that can receive requests. Everything else depends on what you need you
driver to do. If you want to handle any of the requests you receive,
then you’ll need an I/O queue, so you can register a callback to handle
the requests. If you need to unload the driver, then you’ll need to
register an unload handler when you create the driver. If you need to
contact the driver from user-mode, then you’ll either need to create a
symbolic link or register a device interface.

ZwCreateFile and ZwReadFile are completely irrelevant.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

xxxxx@gmail.com wrote:

Also how am I supposed to initialize Ntstatus Device1 in the driver entry with out blue screening my self?

I have no idea what that means. Perhaps you should include a section of
your code.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Well first of all I was not whining that drivers where hard, I was simply asking for a little help to see if my driver is finished. I finished my user application and got some errors so I turned back to the sys. I got error STATUS_INVALID_PARAMETER. So I looked into the sample as Alex recommended. I couldn’t determine what was essential and what was not so here is what I came up with.
VOID NonPnpEvtFileClose(IN WDFFILEOBJECT FileObject,size_t FileObject2)
{
PCONTROL_DEVICE_EXTENSION devExt;
ControlGetData(WdfFileObjectGetDevice(FileObject));
return;
}
VOID NonPnpEvtDeviceFileCreate(IN WDFDEVICE Device,IN WDFREQUEST Request,IN WDFFILEOBJECT FileObject)
{
PUNICODE_STRING fileName;
UNICODE_STRING absFileName, directory;
OBJECT_ATTRIBUTES fileAttributes;
IO_STATUS_BLOCK ioStatus;
PCONTROL_DEVICE_EXTENSION devExt;
USHORT length = 0;

UNREFERENCED_PARAMETER(FileObject);
devExt = ControlGetData(Device);
RtlInitUnicodeString(&directory, L"\SystemRoot\temp");
fileName = WdfFileObjectGetFileName(FileObject);
length = directory.Length + fileName->Length;
absFileName.Buffer = ExAllocatePoolWithTag(PagedPool, length, POOL_TAG);
absFileName.Length = 0;
absFileName.MaximumLength = length;
RtlAppendUnicodeStringToString(&absFileName, &directory);
RtlAppendUnicodeStringToString(&absFileName, fileName);
InitializeObjectAttributes(&fileAttributes,&absFileName,OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,NULL,NULL);
ZwCreateFile(&devExt->FileHandle,SYNCHRONIZE | GENERIC_WRITE | GENERIC_READ,&fileAttributes,&ioStatus,NULL,FILE_ATTRIBUTE_NORMAL,FILE_SHARE_READ,FILE_OPEN_IF,FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE,NULL,0);

End:
if (absFileName.Buffer != NULL) {
ExFreePool(absFileName.Buffer);
}

return;
}
WDF_FILEOBJECT_CONFIG fileConfig;
NTSTATUS BOBDevice(WDFDRIVER Driver, PWDFDEVICE_INIT DeviceInit) {
UNREFERENCED_PARAMETER(Driver);
WdfDeviceInitSetExclusive(DeviceInit, TRUE);
WdfDeviceInitSetIoType(DeviceInit, WdfDeviceIoBuffered);
WDF_FILEOBJECT_CONFIG_INIT(&fileConfig,NonPnpEvtDeviceFileCreate,NonPnpEvtFileClose,WDF_NO_EVENT_CALLBACK);
WdfDeviceInitSetFileObjectConfig(DeviceInit,&fileConfig,WDF_NO_OBJECT_ATTRIBUTES);
WdfDeviceInitAssignName(DeviceInit, &DeviceName);
status = WdfDeviceCreate(&DeviceInit, WDF_NO_OBJECT_ATTRIBUTES, &hDevice);
WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&ioQueueConfig, WdfIoQueueDispatchSequential);
ioQueueConfig.EvtIoDefault = BOBIoDefault;
WdfIoQueueCreate(hDevice, &ioQueueConfig, WDF_NO_OBJECT_ATTRIBUTES, &hQueue);
WdfDeviceCreateSymbolicLink(hDevice, &dosDeviceName);
WdfControlFinishInitializing(hDevice);
return status;
}
WDFDRIVER hDriver;
PWDFDEVICE_INIT pInit = NULL;
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) {
WDF_DRIVER_CONFIG_INIT(&config, BOBDevice);
config.DriverInitFlags |= WdfDriverInitNonPnpDriver;
config.EvtDriverUnload = Unload;
WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
attributes.EvtCleanupCallback = Unload;
status = WdfDriverCreate(DriverObject, RegistryPath, &attributes, &config, WDF_NO_HANDLE);
pInit = WdfControlDeviceInitAllocate(hDriver,&wedf);
return status;
}

xxxxx@gmail.com wrote:

Well first of all I was not whining that drivers where hard, I was simply asking for a little help to see if my driver is finished. I finished my user application and got some errors so I turned back to the sys. I got error STATUS_INVALID_PARAMETER.

Where did you get STATUS_INVALID_PARAMETER?

So I looked into the sample as Alex recommended. I couldn’t determine what was essential and what was not so here is what I came up with.

You probably do not need the FileCreate and FileClose callbacks, in
which case you don’t need to register for file object callbacks.

WDFDRIVER hDriver;
PWDFDEVICE_INIT pInit = NULL;
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) {
WDF_DRIVER_CONFIG_INIT(&config, BOBDevice);
config.DriverInitFlags |= WdfDriverInitNonPnpDriver;
config.EvtDriverUnload = Unload;
WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
attributes.EvtCleanupCallback = Unload;
status = WdfDriverCreate(DriverObject, RegistryPath, &attributes, &config, WDF_NO_HANDLE);
pInit = WdfControlDeviceInitAllocate(hDriver,&wedf);
return status;
}

The key problem here is that a non-PnP device never gets a DeviceAdd
callback, so your BOBDevice function is never being called. Thus, you
never actually create a device. You should use WDF_NO_EVENT_CALLBACK in
the WDF_DRIVER_CONFIG_INIT call, just to remind you of that.

After WdfControlDeviceInitAllocate, you need to call
BOBDevice( hDriver, pInit );


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Replace BOBDevice with NULL or WDF_NO_EVENT_CALLBACK in WDF_DRIVER_CONFIG_INIT(&config, BOBDevice). WdfDriverCreate will return STATUS_INVALID_PARAMETER if you pass a config that has the WdfDriverInitNonPnpDriver flag set and a non-NULL EvtDriverDeviceAdd callback. Look at the NONPNP DriverEntry in sys/nonpnp.c, everything you need is in the first 300 lines.

So basically I tried to cut it down to the bare minimum before and got a blue-screen, I fixed a few things like the WDF_NO_EVENT_CALLBACK and for the config.DriverInitFlags |= WdfDriverInitNonPnpDriver;
that is what it asks me to do in the example as well so I kept it. Here is what I have now, hope its not BSOD worthy.
WDF_FILEOBJECT_CONFIG fileConfig;
NTSTATUS BOBDevice(WDFDRIVER Driver, PWDFDEVICE_INIT DeviceInit) {
UNREFERENCED_PARAMETER(Driver);
WdfDeviceInitSetExclusive(DeviceInit, TRUE);
WdfDeviceInitSetIoType(DeviceInit, WdfDeviceIoBuffered);
WdfDeviceInitSetFileObjectConfig(DeviceInit,&fileConfig,WDF_NO_OBJECT_ATTRIBUTES);
WdfDeviceInitAssignName(DeviceInit, &DeviceName);
status = WdfDeviceCreate(&DeviceInit, WDF_NO_OBJECT_ATTRIBUTES, &hDevice);
WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&ioQueueConfig, WdfIoQueueDispatchSequential);
ioQueueConfig.EvtIoDefault = BOBIoDefault;
WdfIoQueueCreate(hDevice, &ioQueueConfig, WDF_NO_OBJECT_ATTRIBUTES, &hQueue);
WdfDeviceCreateSymbolicLink(hDevice, &dosDeviceName);
WdfControlFinishInitializing(hDevice);
return status;
}
WDFDRIVER hDriver;
PWDFDEVICE_INIT pInit = NULL;
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) {
WDF_DRIVER_CONFIG_INIT(&config, WDF_NO_EVENT_CALLBACK);
config.DriverInitFlags |= WdfDriverInitNonPnpDriver;
config.EvtDriverUnload = Unload;
WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
status = WdfDriverCreate(DriverObject, RegistryPath, &attributes, &config, &hDriver);
pInit = WdfControlDeviceInitAllocate(hDriver,&wedf);
BOBDevice(hDriver, pInit);
return status;
}

xxxxx@gmail.com wrote:

So basically I tried to cut it down to the bare minimum before and got a blue-screen, I fixed a few things like the WDF_NO_EVENT_CALLBACK and for the config.DriverInitFlags |= WdfDriverInitNonPnpDriver;
that is what it asks me to do in the example as well so I kept it. Here is what I have now, hope its not BSOD worthy.

windbg is your friend in figuring out why you got a blue screen.

WDF_FILEOBJECT_CONFIG fileConfig;
NTSTATUS BOBDevice(WDFDRIVER Driver, PWDFDEVICE_INIT DeviceInit) {
UNREFERENCED_PARAMETER(Driver);
WdfDeviceInitSetExclusive(DeviceInit, TRUE);
WdfDeviceInitSetIoType(DeviceInit, WdfDeviceIoBuffered);
WdfDeviceInitSetFileObjectConfig(DeviceInit,&fileConfig,WDF_NO_OBJECT_ATTRIBUTES);

The initialization of fileConfig is not shown here. If you don’t need
the Create and Close callbacks, just delete this whole line.

WdfDeviceInitAssignName(DeviceInit, &DeviceName);
status = WdfDeviceCreate(&DeviceInit, WDF_NO_OBJECT_ATTRIBUTES, &hDevice);
WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&ioQueueConfig, WdfIoQueueDispatchSequential);
ioQueueConfig.EvtIoDefault = BOBIoDefault;
WdfIoQueueCreate(hDevice, &ioQueueConfig, WDF_NO_OBJECT_ATTRIBUTES, &hQueue);
WdfDeviceCreateSymbolicLink(hDevice, &dosDeviceName);

We don’t see the creation of DeviceName and dosDeviceName, so we can’t
make a final ruling. The rough order of operations here is correct.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

DECLARE_CONST_UNICODE_STRING(dosDeviceName, L"\DosDevices\De");
DECLARE_CONST_UNICODE_STRING(DeviceName, L"\Device\De");

It seems to give me the bsod when I include the BobDevice function, I removed it and it installed and started perfectly.
WDF_FILEOBJECT_CONFIG fileConfig;
NTSTATUS BOBDevice(WDFDRIVER Driver, PWDFDEVICE_INIT DeviceInit) {
UNREFERENCED_PARAMETER(Driver);
WdfDeviceInitSetExclusive(DeviceInit, TRUE);
WdfDeviceInitSetIoType(DeviceInit, WdfDeviceIoBuffered);
WdfDeviceInitAssignName(DeviceInit, &DeviceName);
status = WdfDeviceCreate(&DeviceInit, WDF_NO_OBJECT_ATTRIBUTES, &hDevice);
WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&ioQueueConfig, WdfIoQueueDispatchSequential);
ioQueueConfig.EvtIoDefault = BOBIoDefault;
WdfIoQueueCreate(hDevice, &ioQueueConfig, WDF_NO_OBJECT_ATTRIBUTES, &hQueue);
WdfDeviceCreateSymbolicLink(hDevice, &dosDeviceName);
WdfControlFinishInitializing(hDevice);
return status;
}
WDFDRIVER hDriver;
PWDFDEVICE_INIT pInit = NULL;
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) {
WDF_DRIVER_CONFIG_INIT(&config, WDF_NO_EVENT_CALLBACK);
config.DriverInitFlags |= WdfDriverInitNonPnpDriver;
config.EvtDriverUnload = Unload;
WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
status = WdfDriverCreate(DriverObject, RegistryPath, &attributes, &config, &hDriver);
pInit = WdfControlDeviceInitAllocate(hDriver,&wedf);
//BOBDevice(hDriver, pInit);
return status;
}
Why is this, BOBDevice is my main function.

Nvm it works all fine and well now thanks for the help!

Sorry but I ran into another problem, this one I can’t rap my head around. So what is happening is I am getting a blue screen for using WdfDeviceCreateSymbolicLink(controlDevice, &dosDeviceName);
DECLARE_CONST_UNICODE_STRING(dosDeviceName, L"\DosDevices\k");
DECLARE_CONST_UNICODE_STRING(DeviceName, L"\Device\k");
NTSTATUS SSR(WDFDRIVER Driver, PWDFDEVICE_INIT DeviceInit) {
NTSTATUS status;
WDF_OBJECT_ATTRIBUTES attributes;
WDF_IO_QUEUE_CONFIG ioQueueConfig;
WDF_FILEOBJECT_CONFIG fileConfig;
WDFQUEUE hQueue;
WDFDEVICE controlDevice;

UNREFERENCED_PARAMETER(Driver);
WdfDeviceInitSetExclusive(DeviceInit, TRUE);
WdfDeviceInitSetIoType(DeviceInit, WdfDeviceIoBuffered);
status = WdfDeviceInitAssignName(DeviceInit, &DeviceName);
WDF_FILEOBJECT_CONFIG_INIT(&fileConfig, NonPnpEvtDeviceFileCreate, NonPnpEvtFileClose, WDF_NO_EVENT_CALLBACK);
WdfDeviceInitSetFileObjectConfig(DeviceInit, &fileConfig, WDF_NO_OBJECT_ATTRIBUTES);
WdfDeviceInitSetIoInCallerContextCallback(DeviceInit, NonPnpEvtDeviceIoInCallerContext);
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, CONTROL_DEVICE_EXTENSION);
status = WdfDeviceCreate(&DeviceInit, &attributes, &controlDevice);
//status = WdfDeviceCreateSymbolicLink(controlDevice, &dosDeviceName);
WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&ioQueueConfig, WdfIoQueueDispatchSequential);
ioQueueConfig.EvtIoDefault = BOBIoDefault;
//status = WdfIoQueueCreate(controlDevice, &ioQueueConfig, &attributes, &hQueue);
//WdfControlFinishInitializing(controlDevice);
return status;
}
WDFDRIVER hDriver;
PWDFDEVICE_INIT pInit = NULL;
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) {
WDF_DRIVER_CONFIG_INIT(&config, WDF_NO_EVENT_CALLBACK);
config.DriverInitFlags |= WdfDriverInitNonPnpDriver;
config.EvtDriverUnload = Unload;
WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
status = WdfDriverCreate(DriverObject, RegistryPath, &attributes, &config, &hDriver);
pInit = WdfControlDeviceInitAllocate(hDriver,&wedf);
status = SSR(hDriver, pInit);
return status;
}

Hi Bob, a suggestion: why don’t you use WinDbg with kernel debugging and provide the output of “!analyze -v” and “!wdfkd.wdflogdump” instead of just saying you have a BSOD? You may also find that you end up solving your own problems that way.

GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
Unable to get current machine context, NTSTATUS 0xC0000147
GetContextState failed, 0xD0000147
Unable to get current machine context, NTSTATUS 0xC0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
Unable to get current machine context, NTSTATUS 0xC0000147
GetContextState failed, 0xD0000147
Unable to get current machine context, NTSTATUS 0xC0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
Unable to get current machine context, NTSTATUS 0xC0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
Unable to get current machine context, NTSTATUS 0xC0000147
GetContextState failed, 0xD0000147
Unable to get current machine context, NTSTATUS 0xC0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
Unable to get current machine context, NTSTATUS 0xC0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
Unable to get current machine context, NTSTATUS 0xC0000147
GetContextState failed, 0xD0000147
Unable to get current machine context, NTSTATUS 0xC0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147

BUGCHECK_STR: 0x10D_4

DEFAULT_BUCKET_ID: WIN7_DRIVER_FAULT

CURRENT_IRQL: 0

ANALYSIS_VERSION: 6.3.9600.17237 (debuggers(dbg).140716-0327) amd64fre

STACK_TEXT:
GetContextState failed, 0xD0000147
Unable to get current machine context, NTSTATUS 0xC0000147

STACK_COMMAND: kb

SYMBOL_NAME: ANALYSIS_INCONCLUSIVE

FOLLOWUP_NAME: MachineOwner

MODULE_NAME: Unknown_Module

IMAGE_NAME: Unknown_Image

DEBUG_FLR_IMAGE_TIMESTAMP: 0

IMAGE_VERSION:

BUCKET_ID: CORRUPT_MODULELIST

FAILURE_BUCKET_ID: CORRUPT_MODULELIST

ANALYSIS_SOURCE: KM

FAILURE_ID_HASH_STRING: km:corrupt_modulelist

FAILURE_ID_HASH: {6a10ab2d-36f9-3117-3ae8-89baa6e43dd5}

Followup: MachineOwner

GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147

===============================================
Other dump for !wdfkd.wdflogdump
Unable to get current machine context, NTSTATUS 0xC0000147
GetContextState failed, 0xD0000147
Unable to get current machine context, NTSTATUS 0xC0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147

BUGCHECK_STR: 0x10D_4

DEFAULT_BUCKET_ID: WIN7_DRIVER_FAULT

CURRENT_IRQL: 0

ANALYSIS_VERSION: 6.3.9600.17237 (debuggers(dbg).140716-0327) amd64fre

STACK_TEXT:
GetContextState failed, 0xD0000147
Unable to get current machine context, NTSTATUS 0xC0000147

STACK_COMMAND: kb

SYMBOL_NAME: ANALYSIS_INCONCLUSIVE

FOLLOWUP_NAME: MachineOwner

MODULE_NAME: Unknown_Module

IMAGE_NAME: Unknown_Image

DEBUG_FLR_IMAGE_TIMESTAMP: 0

IMAGE_VERSION:

BUCKET_ID: CORRUPT_MODULELIST

FAILURE_BUCKET_ID: CORRUPT_MODULELIST

ANALYSIS_SOURCE: KM

FAILURE_ID_HASH_STRING: km:corrupt_modulelist

FAILURE_ID_HASH: {6a10ab2d-36f9-3117-3ae8-89baa6e43dd5}

Followup: MachineOwner

GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
0: kd> !wdfkd.wdflogdump
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
Unable to get program counter
error: Could not retrieve driver name parameter.
hint: Did you give the driver name parameter?
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147
GetContextState failed, 0xD0000147

I fixed the problem, it was no major problem. It was just a small tiny variable defined the wrong way, thanks any way!