Hi,
I’m trying to query the address information in TDI_CONNECT’s complete
routine of my TDI filter driver, originally I’m using
TdiBuildInternalDeviceControlIrp and it works only in passive level, then I
changed to use the IoAllocateIrp but system crashes inside IoCallDriver(…)
everytime. I also tried useing workqueue for dispatch level, most time it
works good but still get BSOD intermittently on some computers, what I guess
is that it’s because of the object was invalid at that moment.
After searched on the web, I found lot of people have the simillar
questions, seems the IoAllocateIrp(…) should work, but I can not get it
passed, here is my code (in the complete routine of TDI_CONNECT handler):
…
PIRP query_irp = NULL;
query_irp = IoAllocateIrp( devobj->StackSize, FALSE );
if( query_irp )
{
ctx = (PTDI_ADDROBJEX_CTX)ExAllocatePool( NonPagedPool, sizeof
(TDI_ADDROBJEX_CTX) );
if( ctx )
{
ctx->fileobj = connobj;
ctx->tai = (TDI_ADDRESS_INFO *)ExAllocatePool( NonPagedPool,
TDI_ADDRESS_INFO_MAX );
if( ctx->tai )
{
memset( ctx->tai, 0, TDI_ADDRESS_INFO_MAX );
pMdl = IoAllocateMdl( ctx->tai, TDI_ADDRESS_INFO_MAX, FALSE, FALSE,
NULL );
if( pMdl )
{
MmBuildMdlForNonPagedPool( pMdl );
TdiBuildQueryInformation( query_irp, devobj, connobj,
TDI_ConnCompleteEx, ctx, TDI_QUERY_ADDRESS_INFO, pMdl );
Status = IoCallDriver( devobj, query_irp ); **************** crash
inside
…
The crash dump says:
*******************************************************************************
*
*
* Bugcheck Analysis
*
*
*
*******************************************************************************
IRQL_NOT_LESS_OR_EQUAL (a)
An attempt was made to access a pageable (or completely invalid) address at
an
interrupt request level (IRQL) that is too high. This is usually
caused by drivers using improper addresses.
If a kernel debugger is available get the stack backtrace.
Arguments:
Arg1: 00000166, memory referenced
Arg2: 00000002, IRQL
Arg3: 00000000, value 0 = read operation, 1 = write operation
Arg4: 804fb726, address which referenced memory
Debugging Details:
READ_ADDRESS: 00000166
CURRENT_IRQL: 2
FAULTING_IP:
nt!KeInsertQueueApc+22
804fb726 389e66010000 cmp [esi+0x166],bl
DEFAULT_BUCKET_ID: INTEL_CPU_MICROCODE_ZERO
BUGCHECK_STR: 0xA
LAST_CONTROL_TRANSFER: from 804f880d to 80527da8
STACK_TEXT:
f79ee120 804f880d 00000003 f79ee47c 00000000
nt!RtlpBreakWithStatusInstruction
f79ee16c 804f93fa 00000003 00000166 804fb726 nt!KiBugCheckDebugBreak+0x19
f79ee54c 80540853 0000000a 00000166 00000002 nt!KeBugCheck2+0x574
f79ee54c 804fb726 0000000a 00000166 00000002 nt!KiTrap0E+0x233
f79ee5f8 804f1498 829f5768 00000000 00000000 nt!KeInsertQueueApc+0x22
f79ee62c f5ce9ad2 829f5798 829f5728 829f579c nt!IopfCompleteRequest+0x1d8
f79ee644 f5cf005b 829f5702 00000000 0000001a
tcpip!TCPDataRequestComplete+0xa6
f79ee67c f5cefbe5 829f5728 829f5798 829f5728 tcpip!TCPQueryInformation+0xba
f79ee698 f7340b0f 82810958 829f5728 829b3d7d
tcpip!TCPDispatchInternalDeviceControl+0x182
WARNING: Stack unwind information not available. Following frames may be
wrong.
f79ee6b4 804eedf9 82810958 829f5728 828d8300 fsdfw+0x7b0f
f79ee6c4 f50fab27 828d8397 00000001 82901320 nt!IopfCallDriver+0x31
f79ee6f4 f50fa46a 829cde80 82901320 829f5728 testnet!TDI_ConnComplete+0x2a3
[D:\testnet\testKTdi.cpp @ 1980]
…
Anyone can shed some lights on this problem?
thanks in advance,
AFei