Set up my Win7 in debug mode. On the debugger, I set a bp at the beginning of the read callback. It never reaches this callback…suggestions?
For some reason, WDF_IO_QUEUE_CONFIG_INIT keeps getting called whenever I do an IO request…i.e. read/write, well before it even reaches the first line in those callbacks.
xxxxx@gmail.com wrote:
For some reason, WDF_IO_QUEUE_CONFIG_INIT keeps getting called whenever I do an IO request…i.e. read/write, well before it even reaches the first line in those callbacks.
I just noticed something in your code. You aren’t creating a default
queue at all. The comments say so, but the code doesn’t. Change this call:
WDF_IO_QUEUE_CONFIG_INIT
to this:
WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE
and see what happens.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
I actually changed it from WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE…same result
xxxxx@gmail.com wrote:
I actually changed it from WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE…same result
Are you loading this on a real piece of hardware, or is it still based
on the toaster bus? How did you load the driver?
You may have to set a blind breakpoint inside KMDF, at
FxIoQueueIoRead::Invoke, for example, and trace it until it calls your
driver to see where it’s going.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
I am loading the driver as a software-only driver “devcon install basic.sys Root\RobertDriver” ;
I’ll be testing it as a software only driver making registry changes install of READ/WRITE calls to read/write a buffer to/from a PCI BAR until we get our hardware in.
I’ll try the blind breakpoint.
I still don’t know what is wrong! I’ve tried to change everything. My code is below. It’s very simple so it makes no sense why I’m still getting an assertion error. I install it as a software-only driver.
#include “ProtoTypes.h”
/*…*/
/* Entry point of the device driver. */
/*…*/
NTSTATUS DriverEntry(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath
)
{
WDF_DRIVER_CONFIG config;
NTSTATUS status;
KdPrint((__DRIVER_NAME “–> DriverEntry\n”));
WDF_DRIVER_CONFIG_INIT(&config, EvtDeviceAdd);
status = WdfDriverCreate(
DriverObject,
RegistryPath,
WDF_NO_OBJECT_ATTRIBUTES,
&config,
WDF_NO_HANDLE);
if(!NT_SUCCESS(status))
{
KdPrint((__DRIVER_NAME “WdfDriverCreate failed with status 0x%08x\n”, status));
}
return status;
}
#include “ProtoTypes.h”
#include <initguid.h>
#include “public.h”
NTSTATUS EvtDeviceAdd(
IN WDFDRIVER Driver,
IN PWDFDEVICE_INIT DeviceInit
)
{
NTSTATUS status;
WDFDEVICE device;
PDEVICE_CONTEXT devCtx = NULL;
WDF_OBJECT_ATTRIBUTES devAttributes;
WDF_PNPPOWER_EVENT_CALLBACKS pnpPowerCallbacks;
WDF_IO_QUEUE_CONFIG ioQConfig;
WDF_FILEOBJECT_CONFIG fileObjectConfig;
WDF_OBJECT_ATTRIBUTES fileObjAttributes;
DECLARE_CONST_UNICODE_STRING(dosDeviceName, L"\DosDevices\RobertDriver") ;
DECLARE_CONST_UNICODE_STRING(ntDeviceName, L"\Device\RobertDriver") ;
UNREFERENCED_PARAMETER(Driver);
KdPrint((__DRIVER_NAME “–> EvtDeviceAdd\n”));
/set the callback functions that will be executed on PNP and Power events/
WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&pnpPowerCallbacks);
pnpPowerCallbacks.EvtDevicePrepareHardware = EvtDevicePrepareHardware;
WdfDeviceInitSetPnpPowerEventCallbacks(DeviceInit, &pnpPowerCallbacks);
// Set IO Type: Buffered, Direct I/O, Neither I/O
WdfDeviceInitSetIoType(DeviceInit, WdfDeviceIoBuffered);
//
// Setup the file object stuff
//
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(
&fileObjAttributes,
BASIC_FILEOBJECT_CONTEXT
);
fileObjAttributes.SynchronizationScope = WdfSynchronizationScopeNone;
WDF_FILEOBJECT_CONFIG_INIT(
&fileObjectConfig,
BasicEvtDeviceFileCreate, // New handle opened
WDF_NO_EVENT_CALLBACK, // Close when last ref released
BasicEvtFileCleanup // Cleanup when handle closed
);
WdfDeviceInitSetFileObjectConfig(
DeviceInit,
&fileObjectConfig,
&fileObjAttributes
);
if (!NT_SUCCESS(status))
{
return(status);
}
/initialize storage for the device context/
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&devAttributes, DEVICE_CONTEXT);
devAttributes.SynchronizationScope = WdfSynchronizationScopeDevice;
/create a device instance./
status = WdfDeviceCreate(&DeviceInit, &devAttributes, &device);
if(!NT_SUCCESS(status))
{
KdPrint((__DRIVER_NAME
“WdfDeviceCreate failed with status 0x%08x\n”, status));
return status;
}
// Set up device context
devCtx = BasicGetDeviceContext(device);
devCtx->WdfDevice = device;
/create the default IO queue. this one will be used for ioctl requests/
WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&ioQConfig,WdfIoQueueDispatchSequential);
ioQConfig.EvtIoRead = BasicEvtRead;
ioQConfig.EvtIoWrite = BasicEvtWrite;
ioQConfig.EvtIoDeviceControl = BasicEvtDeviceControl;
//ioQConfig.EvtIoDefault = BasicEvtIoDefault;
status = WdfIoQueueCreate(
device,
&ioQConfig,
WDF_NO_OBJECT_ATTRIBUTES,
NULL);
if(!NT_SUCCESS(status))
{
KdPrint((__DRIVER_NAME
“WdfIoQueueCreate failed with status 0x%08x\n”, status));
return status;
}
status = WdfDeviceCreateDeviceInterface(device, &GUID_DEV_IF_BASIC, NULL);
if(!NT_SUCCESS(status))
{
KdPrint((__DRIVER_NAME
“WdfDeviceCreateDeviceInterface failed with status 0x%08x\n”, status));
return status;
}
KdPrint((__DRIVER_NAME “<– EvtDeviceAdd\n”));
//
// We want our device object NAMED, thank you very much
//
status = WdfDeviceInitAssignName(DeviceInit, &ntDeviceName);
// Create a symbolic link for control object so that usermode can open
// the device.
//
status = WdfDeviceCreateSymbolicLink(device, &dosDeviceName);
return status;
}
/…/
/* call-back function that will be called by the pnp/power manager after the /
/ Plug and Play manager has assigned hardware resources to the device and /
/ after the device has entered its uninitialized D0 state. The framework /
/ calls the driver’s EvtDevicePrepareHardware callback function before /
/ calling the driver’s EvtDeviceD0Entry callback function. /
/…/
NTSTATUS
EvtDevicePrepareHardware(
IN WDFDEVICE Device,
IN WDFCMRESLIST ResourceList,
IN WDFCMRESLIST ResourceListTranslated
)
{
NTSTATUS status = STATUS_SUCCESS;
KdPrint((__DRIVER_NAME “–> EvtDevicePrepareHardware\n”));
UNREFERENCED_PARAMETER(Device);
UNREFERENCED_PARAMETER(ResourceList);
UNREFERENCED_PARAMETER(ResourceListTranslated);
KdPrint((__DRIVER_NAME “<– EvtDevicePrepareHardware\n”));
return status;
}
VOID
BasicEvtDeviceFileCreate (
IN WDFDEVICE Device,
IN WDFREQUEST Request,
IN WDFFILEOBJECT FileObject
)
{
NTSTATUS status = STATUS_SUCCESS;
PBASIC_FILEOBJECT_CONTEXT foContext = BasicGetFileObjectData(FileObject);
UNREFERENCED_PARAMETER(Device);
// Set initial function_code
foContext->function_code = 0x0;
WdfRequestComplete(Request, status);
}
VOID
BasicEvtFileCleanup(
IN WDFFILEOBJECT FileObject
)
{
PDEVICE_CONTEXT devContext;
PBASIC_FILEOBJECT_CONTEXT foContext;
UNREFERENCED_PARAMETER(devContext);
UNREFERENCED_PARAMETER(FileObject);
UNREFERENCED_PARAMETER(foContext);
// foContext = BasicGetFileObjectData(FileObject);
// // Since this was the file with authentication
// // clear the authenticated flag no that it’s going away
// if ( foContext->function_code )
// {
// foContext->function_code = 0x0;
// }
}
#include “ProtoTypes.h”
VOID
BasicEvtIoDefault(
IN WDFQUEUE Queue,
IN WDFREQUEST Request
)
{
NTSTATUS status = STATUS_SUCCESS;
WDF_REQUEST_PARAMETERS params;
PRESPONSE output_buffer;
PDEVICE_CONTEXT devExt;
PBASIC_FILEOBJECT_CONTEXT file_object_context;
ULONG_PTR bytesWritten = 0;
size_t output_buffer_length;
size_t Length;
WdfRequestGetParameters(Request, ¶ms);
// Get a pointer to our device extension
devExt = BasicGetDeviceContext( WdfIoQueueGetDevice(Queue) );
// Get a pointer to our file object context
file_object_context = BasicGetFileObjectData(WdfRequestGetFileObject(Request));
switch (params.Type) {
case WdfRequestTypeRead:
Length = params.Parameters.Read.Length;
// Get the response buffer. Since the device is set to do buffered
// I/O, this function will retrieve Irp->AssociatedIrp.SystemBuffer.
//
status = WdfRequestRetrieveOutputBuffer(Request,0, &output_buffer, &output_buffer_length);
if(!NT_SUCCESS(status))
{
WdfRequestComplete(Request, status);
return;
}
else{
switch (file_object_context->function_code)
{
case 0x1:
output_buffer->function_code = (file_object_context->function_code);
output_buffer->data = 2390;
bytesWritten = Length;
break;
default:
bytesWritten = 0;
}
}
break;
case WdfRequestTypeWrite:
Length = params.Parameters.Write.Length;
break;
default:
WdfRequestComplete(Request, STATUS_INVALID_PARAMETER);
return;
}
WdfRequestCompleteWithInformation(Request, status, bytesWritten);
}
VOID
BasicEvtRead(
IN WDFQUEUE Queue,
IN WDFREQUEST Request,
IN size_t Length
)
/++
Routine Description:
This event is called when the framework receives IRP_MJ_READ requests.
Arguments:
Queue - Handle to the framework queue object that is associated with the
I/O request.
Request - Handle to a framework request object.
Length - number of bytes to be written.
Queue is by default configured to fail zero length read & write requests.
Return Value:
None
–/
{
NTSTATUS status = STATUS_SUCCESS;
PRESPONSE output_buffer;
PDEVICE_CONTEXT devExt;
PBASIC_FILEOBJECT_CONTEXT file_object_context;
ULONG_PTR bytesWritten = 0;
size_t output_buffer_length;
//UNREFERENCED_PARAMETER(devExt);
//UNREFERENCED_PARAMETER(Queue);
// Get a pointer to our device extension
devExt = BasicGetDeviceContext( WdfIoQueueGetDevice(Queue) );
// Get a pointer to our file object context
file_object_context = BasicGetFileObjectData(WdfRequestGetFileObject(Request));
//
// Get the response buffer. Since the device is set to do buffered
// I/O, this function will retrieve Irp->AssociatedIrp.SystemBuffer.
//
status = WdfRequestRetrieveOutputBuffer(Request,0, &output_buffer, &output_buffer_length);
if(!NT_SUCCESS(status))
{
WdfRequestComplete(Request, status);
return;
}
else{
switch (file_object_context->function_code)
{
case 0x1:
output_buffer->function_code = (file_object_context->function_code);
output_buffer->data = 2390;
bytesWritten = Length;
break;
default:
bytesWritten = 0;
}
}
WdfRequestCompleteWithInformation(Request, status, bytesWritten);
}
VOID
BasicEvtWrite (
WDFQUEUE Queue,
WDFREQUEST Request,
size_t Length
)
/++
Routine Description:
Performs read from the toaster device. This event is called when the
framework receives IRP_MJ_READ requests.
Arguments:
Queue - Handle to the framework queue object that is associated with the
I/O request.
Request - Handle to a framework request object.
Lenght - Length of the data buffer associated with the request.
By default, the queue does not dispatch
zero length read & write requests to the driver and instead to
complete such requests with status success. So we will never get
a zero length request.
Return Value:
None.
–/
{
NTSTATUS status = STATUS_SUCCESS;
PDEVICE_CONTEXT devExt;
PBASIC_FILEOBJECT_CONTEXT file_object_context;
PREQUEST input_buffer;
ULONG_PTR bytesWritten = 0;
size_t input_buffer_length;
// Get a pointer to our device extension
devExt = BasicGetDeviceContext( WdfIoQueueGetDevice(Queue) );
// Get a pointer to our file object context
file_object_context = BasicGetFileObjectData(WdfRequestGetFileObject(Request));
//
// Get the request memory and perform read operation here
//
status = WdfRequestRetrieveInputBuffer(Request, 0, &input_buffer, &input_buffer_length);
if( NT_SUCCESS(status) )
{
file_object_context->function_code = (input_buffer->function_code);
bytesWritten = Length;
}
else
{
WdfRequestComplete(Request, status);
return;
}
WdfRequestCompleteWithInformation(Request, status, bytesWritten);
}
VOID
BasicEvtDeviceControl(
IN WDFQUEUE Queue,
IN WDFREQUEST Request,
IN size_t OutputBufferLength,
IN size_t InputBufferLength,
IN ULONG IoControlCode
)
/++
Routine Description:
This event is called when the framework receives IRP_MJ_DEVICE_CONTROL
requests from the system.
Arguments:
Queue - Handle to the framework queue object that is associated
with the I/O request.
Request - Handle to a framework request object.
OutputBufferLength - length of the request’s output buffer,
if an output buffer is available.
InputBufferLength - length of the request’s input buffer,
if an input buffer is available.
IoControlCode - the driver-defined or system-defined I/O control code
(IOCTL) that is associated with the request.
Return Value:
VOID
–*/
{
NTSTATUS status= STATUS_SUCCESS;
UNREFERENCED_PARAMETER(Queue);
UNREFERENCED_PARAMETER(OutputBufferLength);
UNREFERENCED_PARAMETER(InputBufferLength);
//
// Use WdfRequestRetrieveInputBuffer and WdfRequestRetrieveOutputBuffer
// to get the request buffers.
//
switch (IoControlCode) {
default:
status = STATUS_INVALID_DEVICE_REQUEST;
}
//
// Complete the Request.
//
WdfRequestCompleteWithInformation(Request, status, (ULONG_PTR) 0);
}
#include <ntddk.h>
#include <wdf.h>
#include <ntstrsafe.h>
#define__DRIVER_NAME "BASIC: "
DRIVER_INITIALIZE DriverEntry;
EVT_WDF_DRIVER_DEVICE_ADD EvtDeviceAdd;
EVT_WDF_IO_QUEUE_IO_READ BasicEvtRead;
EVT_WDF_IO_QUEUE_IO_WRITE BasicEvtWrite;
EVT_WDF_IO_QUEUE_IO_DEVICE_CONTROL BasicEvtDeviceControl;
EVT_WDF_IO_QUEUE_IO_DEFAULT BasicEvtIoDefault;
EVT_WDF_DEVICE_PREPARE_HARDWARE EvtDevicePrepareHardware;
EVT_WDF_DEVICE_FILE_CREATE BasicEvtDeviceFileCreate;
EVT_WDF_FILE_CLEANUP BasicEvtFileCleanup;
typedef struct _DEVICE_CONTEXT {
WDFDEVICE WdfDevice;
} DEVICE_CONTEXT, *PDEVICE_CONTEXT;
WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DEVICE_CONTEXT, BasicGetDeviceContext);
typedef struct _BASIC_FILEOBJECT_CONTEXT
{
UINT8 function_code;
} BASIC_FILEOBJECT_CONTEXT, *PBASIC_FILEOBJECT_CONTEXT;
WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(BASIC_FILEOBJECT_CONTEXT, BasicGetFileObjectData)
typedef struct _RESPONSE
{
UINT8 function_code;
UINT16 data;
} RESPONSE, *PRESPONSE;
typedef struct _REQUEST
{
UINT8 function_code;
} REQUEST, *PREQUEST;
NTSTATUS
DriverEntry(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath
);
NTSTATUS
EvtDeviceAdd(
IN WDFDRIVER Driver,
IN PWDFDEVICE_INIT DeviceInit
);
NTSTATUS
EvtDevicePrepareHardware(
IN WDFDEVICE Device,
IN WDFCMRESLIST ResourceList,
IN WDFCMRESLIST ResourceListTranslated
);
VOID
BasicEvtDeviceControl(
WDFQUEUE Queue,
WDFREQUEST Request,
size_t OutputBufferLength,
size_t InputBufferLength,
ULONG IoControlCode
);
VOID
BasicEvtIoDefault(
IN WDFQUEUE Queue,
IN WDFREQUEST Request
);
VOID
BasicEvtRead(
WDFQUEUE Queue,
WDFREQUEST Request,
size_t Length
);
VOID
BasicEvtWrite(
WDFQUEUE Queue,
WDFREQUEST Request,
size_t Length
);
VOID
BasicEvtDeviceFileCreate(
IN WDFDEVICE Device,
IN WDFREQUEST Request,
IN WDFFILEOBJECT FileObject
);
VOID
BasicEvtFileCleanup(
IN WDFFILEOBJECT FileObject
);</ntstrsafe.h></wdf.h></ntddk.h></initguid.h>
My error continues to be:
Assertion failure - code c0000420 (!!! second chance !!!)
basic!WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE+0x15:
but it doesn’t make any sense why this function is called on a read/write. It fails on sizeof(). Any help would be greatly appreciated.
VOID
FORCEINLINE
WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(
__out PWDF_IO_QUEUE_CONFIG Config,
__in WDF_IO_QUEUE_DISPATCH_TYPE DispatchType
)
{
RtlZeroMemory(Config, sizeof(WDF_IO_QUEUE_CONFIG));
Config->Size = sizeof(WDF_IO_QUEUE_CONFIG);
Config->PowerManaged = WdfUseDefault;
Config->DefaultQueue = TRUE;
Config->DispatchType = DispatchType;
if (Config->DispatchType == WdfIoQueueDispatchParallel) {
Config->Settings.Parallel.NumberOfPresentedRequests = (ULONG)-1;
}
}
Have you stepped through the code line by line to see exactly what is happening ?
d
debt from my phone
-----Original Message-----
From: xxxxx@gmail.com
Sent: Wednesday, August 24, 2011 5:27 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Basic Driver Assertion Failure
My error continues to be:
Assertion failure - code c0000420 (!!! second chance !!!)
basic!WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE+0x15:
but it doesn’t make any sense why this function is called on a read/write. It fails on sizeof(). Any help would be greatly appreciated.
VOID
FORCEINLINE
WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(
__out PWDF_IO_QUEUE_CONFIG Config,
__in WDF_IO_QUEUE_DISPATCH_TYPE DispatchType
)
{
RtlZeroMemory(Config, sizeof(WDF_IO_QUEUE_CONFIG));
Config->Size = sizeof(WDF_IO_QUEUE_CONFIG);
Config->PowerManaged = WdfUseDefault;
Config->DefaultQueue = TRUE;
Config->DispatchType = DispatchType;
if (Config->DispatchType == WdfIoQueueDispatchParallel) {
Config->Settings.Parallel.NumberOfPresentedRequests = (ULONG)-1;
}
}
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
Yes. On WinXP it steps thru fine. on Win7, I can’t step through because the assertion error happens before it reaches the EvtIORead Callback, meaning I can’t step through it unless I start at createfile. The create file function works fine however.
You should try to trace why WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE is
everytime called during read/write request operation. You can follow Tim’s
suggestion to break inside KMDF. Good luck.
My error continues to be:
Assertion failure - code c0000420 (!!! second chance !!!)
basic!WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE+0x15:
but it doesn’t make any sense why this function is called on a read/write.
It fails on sizeof(). Any help would be greatly appreciated.
VOID
FORCEINLINE
WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(
__out PWDF_IO_QUEUE_CONFIG Config,
__in WDF_IO_QUEUE_DISPATCH_TYPE DispatchType
)
{
RtlZeroMemory(Config, sizeof(WDF_IO_QUEUE_CONFIG));
Config->Size = sizeof(WDF_IO_QUEUE_CONFIG);
Config->PowerManaged = WdfUseDefault;
Config->DefaultQueue = TRUE;
Config->DispatchType = DispatchType;
if (Config->DispatchType == WdfIoQueueDispatchParallel) {
Config->Settings.Parallel.NumberOfPresentedRequests = (ULONG)-1;
}
}
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
It fails on sizeof()? I’m not really sure what that means, since that’s a
compile time deal.
This sizeof():
Config->Size = sizeof(WDF_IO_QUEUE_CONFIG);
If so, is ‘Config’ valid?
Sorry if this has already been covered; just really started reading this
thread.
mm
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Wednesday, August 24, 2011 8:22 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Basic Driver Assertion Failure
My error continues to be:
Assertion failure - code c0000420 (!!! second chance !!!)
basic!WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE+0x15:
but it doesn’t make any sense why this function is called on a read/write.
It fails on sizeof(). Any help would be greatly appreciated.
VOID
FORCEINLINE
WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(
__out PWDF_IO_QUEUE_CONFIG Config,
__in WDF_IO_QUEUE_DISPATCH_TYPE DispatchType
)
{
RtlZeroMemory(Config, sizeof(WDF_IO_QUEUE_CONFIG));
Config->Size = sizeof(WDF_IO_QUEUE_CONFIG);
Config->PowerManaged = WdfUseDefault;
Config->DefaultQueue = TRUE;
Config->DispatchType = DispatchType;
if (Config->DispatchType == WdfIoQueueDispatchParallel) {
Config->Settings.Parallel.NumberOfPresentedRequests = (ULONG)-1;
}
}
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
Yes, config is valid. I set it up in the driveradd function
On Wed, Aug 24, 2011 at 7:27 PM, M. M. O’Brien <
xxxxx@gmail.com> wrote:
It fails on sizeof()? I’m not really sure what that means, since that’s a
compile time deal.This sizeof():
Config->Size = sizeof(WDF_IO_QUEUE_CONFIG);
If so, is ‘Config’ valid?
Sorry if this has already been covered; just really started reading this
thread.mm
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Wednesday, August 24, 2011 8:22 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Basic Driver Assertion FailureMy error continues to be:
Assertion failure - code c0000420 (!!! second chance !!!)
basic!WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE+0x15:but it doesn’t make any sense why this function is called on a read/write.
It fails on sizeof(). Any help would be greatly appreciated.VOID
FORCEINLINE
WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(
__out PWDF_IO_QUEUE_CONFIG Config,
__in WDF_IO_QUEUE_DISPATCH_TYPE DispatchType
)
{
RtlZeroMemory(Config, sizeof(WDF_IO_QUEUE_CONFIG));Config->Size = sizeof(WDF_IO_QUEUE_CONFIG);
Config->PowerManaged = WdfUseDefault;
Config->DefaultQueue = TRUE;
Config->DispatchType = DispatchType;
if (Config->DispatchType == WdfIoQueueDispatchParallel) {
Config->Settings.Parallel.NumberOfPresentedRequests = (ULONG)-1;
}
}
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminarsTo unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminarsTo unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
–
Robert Graham
Schweitzer Engineering Laboratories, Inc.
Associate Software Engineer
Research & Development - Automation
(509)332-1890 ext. 1757 (desk)
(404)493-6032 (cell)
http://www.selinc.com
Hi OP:
Check if you are using the .sys file build under XP build enviroment.
2011/8/25 M. M. O’Brien
> It fails on sizeof()? I’m not really sure what that means, since that’s a
> compile time deal.
>
> This sizeof():
>
> Config->Size = sizeof(WDF_IO_QUEUE_CONFIG);
>
> If so, is ‘Config’ valid?
>
> Sorry if this has already been covered; just really started reading this
> thread.
>
>
> mm
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of
> xxxxx@gmail.com
> Sent: Wednesday, August 24, 2011 8:22 PM
> To: Windows System Software Devs Interest List
> Subject: RE:[ntdev] Basic Driver Assertion Failure
>
> My error continues to be:
>
> Assertion failure - code c0000420 (!!! second chance !!!)
> basic!WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE+0x15:
>
> but it doesn’t make any sense why this function is called on a read/write.
> It fails on sizeof(). Any help would be greatly appreciated.
>
> VOID
> FORCEINLINE
> WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(
> out PWDF_IO_QUEUE_CONFIG Config,
> in WDF_IO_QUEUE_DISPATCH_TYPE DispatchType
> )
> {
> RtlZeroMemory(Config, sizeof(WDF_IO_QUEUE_CONFIG));
>
> Config->Size = sizeof(WDF_IO_QUEUE_CONFIG);
> Config->PowerManaged = WdfUseDefault;
> Config->DefaultQueue = TRUE;
> Config->DispatchType = DispatchType;
> if (Config->DispatchType == WdfIoQueueDispatchParallel) {
> Config->Settings.Parallel.NumberOfPresentedRequests = (ULONG)-1;
> }
> }
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
–
=================================
Best Regards!
Moore.Zhang (Zhang Pei)
I rewrote the entire code and it works. I’m going to check my files and see what was causing the assertion failure…
xxxxx@gmail.com wrote:
I rewrote the entire code and it works. I’m going to check my files and see what was causing the assertion failure…
Yes – not understanding why something works is just as bad as not
understanding why something DOESN’T work.
If you send me the entire original source via private email, I’ll take a
quick scan.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
The source files are located here: http://dl.dropbox.com/u/10133862/KMDFTest.zip
xxxxx@gmail.com wrote:
The source files are located here: http://dl.dropbox.com/u/10133862/KMDFTest.zip
Found the problem. You are calling WdfDeviceInitAssignName after the
call to WdfDeviceCreate. The DeviceInit structure only lives until
WdfDeviceCreate. After that, the memory becomes invalid and you can’t
touch it. All of the WdfDeviceInitXxx calls must be made before
WdfDeviceCreate.
Move that call, and your driver loads just fine.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
Wow, such a small mistake causing a huge problem. Thanks Tim!
Guess when I rewrote the code I moved it without knowing