device creation code: If I understood below code, I didn’t specify any execution scope or sync.
…
attributes.EvtCleanupCallback = EventCleanupDeviceObject;
pWDFDeviceInit = WdfControlDeviceInitAllocate(*pWDFDriver, &SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_RW_RES_R);
WdfDeviceInitSetExclusive(pWDFDeviceInit, TRUE);
WdfDeviceInitSetIoType(pWDFDeviceInit, WdfDeviceIoBuffered);
WdfDeviceInitAssignName (pWDFDeviceInit, &ntUnicodeString);
WdfControlDeviceInitSetShutdownNotification(pWDFDeviceInit,
NonPnpShutdown,
WdfDeviceShutdown);
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes,
CONTROL_DEVICE_EXTENSION);
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, DEVICE_CONTEXT);
status = WdfDeviceCreate(&pWDFDeviceInit,
&attributes,
&g_WDFDevice);
if(status != STATUS_SUCCESS)
{
HLPR_BAIL;
}
status = WdfDeviceCreateSymbolicLink(g_WDFDevice, &ntWin32NameString );
deviceContext = WdfObjectGet_DEVICE_CONTEXT(g_WDFDevice);
status = WdfDeviceCreateDeviceInterface(
g_WDFDevice,
&GUID_DEVINTERFACE_ECHO,
NULL // ReferenceString
);
WdfDeviceSetDeviceInterfaceState (
g_WDFDevice,
&GUID_DEVINTERFACE_ECHO,
NULL, // ReferenceString
TRUE
);
…
// Queue initialize
…
WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(
&queueConfig,
WdfIoQueueDispatchSequential
);
queueConfig.EvtIoRead = EchoEvtIoRead;
queueConfig.EvtIoWrite = EchoEvtIoWrite;
queueConfig.EvtIoDeviceControl = SioctlDeviceControl1;
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&queueAttributes, QUEUE_CONTEXT);
queueAttributes.SynchronizationScope = WdfSynchronizationScopeQueue;
queueAttributes.EvtDestroyCallback = EchoEvtIoQueueContextDestroy;
deviceContext = WdfObjectGet_DEVICE_CONTEXT(Device);
status = WdfIoQueueCreate(
Device,
&queueConfig,
&queueAttributes,
&deviceContext->queue
);
if( !NT_SUCCESS(status) ) {
KdPrint((“WdfIoQueueCreate failed 0x%x\n”,status));
return status;
}
Detailed Crash dump:
3: kd> !analyze -v
*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************
SYSTEM_SERVICE_EXCEPTION (3b)
An exception happened while executing a system service routine.
Arguments:
Arg1: 00000000c0000420, Exception code that caused the bugcheck
Arg2: fffff88006362aa0, Address of the instruction which caused the bugcheck
Arg3: fffff88007f98ca0, Address of the context record for the exception that caused the bugcheck
Arg4: 0000000000000000, zero.
Debugging Details:
EXCEPTION_CODE: (NTSTATUS) 0xc0000420 -
FAULTING_IP:
WFPSamplerCalloutDriver!SioctlDeviceControl1+70 [c:\samples\windows filtering platform sample\c++\sys\framework_wfpsamplercalloutdriver.cpp @ 2112]
fffff88006362aa0 cd2c int 2Ch<br><br>CONTEXT: fffff88007f98ca0 -- (.cxr 0xfffff88007f98ca0)<br>rax=0000000000000002 rbx=fffffa800ce40170 rcx=000000000000002e<br>rdx=0000057ff31bfe88 rsi=fffffa800ce98a70 rdi=fffffa800ce9ab30<br>rip=fffff88006362aa0 rsp=fffff88007f996a0 rbp=fffff88007f99770<br> r8=0000000000000100 r9=0000000000000000 r10=fffffa800ce98a70<br>r11=fffff88007f99728 r12=0000057ff31bfe88 r13=000000009c402408<br>r14=0000057ff31654c8 r15=0000000000000100<br>iopl=0 nv up ei pl nz na pe nc<br>cs=0010 ss=0018 ds=002b es=002b fs=0053 gs=002b efl=00000202<br>WFPSamplerCalloutDriver!SioctlDeviceControl1+0x70:<br>fffff880
06362aa0 cd2c int 2Ch
Resetting default scope
DEFAULT_BUCKET_ID: VISTA_DRIVER_FAULT
BUGCHECK_STR: 0x3B
PROCESS_NAME: Example.exe
CURRENT_IRQL: 2
LAST_CONTROL_TRANSFER: from fffff88001067f88 to fffff88006362aa0
STACK_TEXT:
fffff88007f996a0 fffff880
01067f88 : 0000057ff31654c8 0000057f
f31bfe88 0000000000000100 00000000
00000000 : WFPSamplerCalloutDriver!SioctlDeviceControl1+0x70 [c:\samples\windows filtering platform sample\c++\sys\framework_wfpsamplercalloutdriver.cpp @ 2112]
fffff88007f99730 fffff880
0106742f : fffffa800ce9ab00 fffffa80
00000000 fffffa800ce9ab30 fffffa80
0ce6ff48 : Wdf01000!FxIoQueue::DispatchRequestToDriver+0x488
fffff88007f997b0 fffff880
01072fbb : fffffa800ce98a70 fffffa80
0ce40100 0000000000000000 fffffa80
0ce40170 : Wdf01000!FxIoQueue::DispatchEvents+0x66f
fffff88007f99830 fffff880
0106c30a : fffffa800ce98a00 fffffa80
0ce40170 fffffa800cf39d90 fffff880
07f99910 : Wdf01000!FxIoQueue::QueueRequest+0x2ab
fffff88007f998a0 fffff880
0106b9da : fffffa800ce40170 fffffa80
0cf39d90 fffff88007f99c80 fffffa80
0cf39d90 : Wdf01000!FxPkgIo::Dispatch+0x4da
fffff88007f99910 fffff880
0106baa6 : fffffa800cf39d90 fffff880
07f99c80 fffffa800ce981c0 00000000
9c402408 : Wdf01000!FxDevice::Dispatch+0x19a
fffff88007f99950 fffff801
29e7342f : fffffa800cf39d90 fffff880
07f99c80 0000000000000001 fffff880
00000000 : Wdf01000!FxDevice::DispatchWithLock+0xa6
fffff88007f99990 fffff801
29e73db6 : 000000c7882a6f10 00000000
00000030 0000000000000000 000000c7
882a6f10 : nt!IopXxxControlFile+0x7dd
fffff88007f99b20 fffff801
29a89053 : 0000000000000000 00000000
00000000 0000000000000000 00000000
00000000 : nt!NtDeviceIoControlFile+0x56
fffff88007f99b90 000007fe
4d7c2c1a : 000007fe4a83f187 00000000
00000000 0000000000000000 00000000
00000020 : nt!KiSystemServiceCopyEnd+0x13
000000c7880ef8e8 000007fe
4a83f187 : 0000000000000000 00000000
00000000 0000000000000020 00000000
00000000 : ntdll!ZwDeviceIoControlFile+0xa
000000c7880ef8f0 000007fe
4d4a1880 : 000000009c402408 00000000
00000000 000000c7880ef980 00000000
00000000 : KERNELBASE!DeviceIoControl+0x1d7
000000c7880ef960 000007f7
3c41132e : 000000c7882a6f10 00000000
00000000 0000000000000000 00000000
00000000 : KERNEL32!DeviceIoControlImplementation+0x74
000000c7880ef9b0 000007f7
3c411e03 : 0000000000000000 00000000
00000000 0000000000000000 00000000
00000000 : Example+0x132e
000000c7880efb20 000007fe
4d4a167e : 0000000000000000 00000000
00000000 0000000000000000 00000000
00000000 : Example+0x1e03
000000c7880efb50 000007fe
4d7dc3f1 : 0000000000000000 00000000
00000000 0000000000000000 00000000
00000000 : KERNEL32!BaseThreadInitThunk+0x1a
000000c7880efb80 00000000
00000000 : 0000000000000000 00000000
00000000 0000000000000000 00000000
00000000 : ntdll!RtlUserThreadStart+0x1d
FOLLOWUP_IP:
WFPSamplerCalloutDriver!SioctlDeviceControl1+70 [c:\samples\windows filtering platform sample\c++\sys\framework_wfpsamplercalloutdriver.cpp @ 2112]
fffff880`06362aa0 cd2c int 2Ch
FAULTING_SOURCE_CODE:
2108: PCHAR data = “This String is from Device Driver !!! Ravindra”;
2109: size_t datalen = strlen(data)+1;//Length of data including null
2110: size_t inDataLenght;
2111: PVOID ptr;
> 2112: PAGED_CODE();
2113:
2114: if(!OutputBufferLength || !InputBufferLength)
2115: {
2116: WdfRequestComplete(Request, STATUS_INVALID_PARAMETER);
2117: return;
SYMBOL_STACK_INDEX: 0
SYMBOL_NAME: WFPSamplerCalloutDriver!SioctlDeviceControl1+70
FOLLOWUP_NAME: MachineOwner
MODULE_NAME: WFPSamplerCalloutDriver
IMAGE_NAME: WFPSamplerCalloutDriver.sys
DEBUG_FLR_IMAGE_TIMESTAMP: 5162360b
STACK_COMMAND: .cxr 0xfffff88007f98ca0 ; kb
FAILURE_BUCKET_ID: X64_0x3B_WFPSamplerCalloutDriver!SioctlDeviceControl1+70
BUCKET_ID: X64_0x3B_WFPSamplerCalloutDriver!SioctlDeviceControl1+70
Followup: MachineOwner
---------
Thanks.