Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Driver Verifier & ExAcquireResourceExclusiveLite

OSR_Community_UserOSR_Community_User Member Posts: 110,217
Running a driver on Windows 2000 but compiled with the DDK for NT 4.0 the
"Driver Verifier" signals an undocumented error code on the call
ExAcquireResourceExclusiveLite if the IRQL is at PASSIVE_LEVEL. No errors at
APC_LEVEL. From the DDK 2000 documentation appears that the call at
PASSIVE_LEVEL is allowed.

Specifically the Verifier do the call
KeBugCheckEx(0xC4,0x37,0,0,resource_pointer), where 0xC4 is the Verifier
specific error code, but 0x37 is an undocumented (DDK 2000) sub error code.

The code is :

ERESOURCE* res;
NTSTATUS status;
unsigned size = sizeof(ERESOURCE);

ASSERT( KeGetCurrentIrql() < DISPATCH_LEVEL );

res = ExAllocatePool(NonPagedPool,size);
ASSERT( res );

status = ExInitializeResourceLite(res);
ASSERT(NT_SUCCESS(status));

ExAcquireResourceExclusiveLite(res,TRUE); // FAIL with
KeBugCheckEx(0xC4,0x37,0,0,res)

Comments

  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    I don't know about your ddk but mine says:

    "Normal kernel APCs must be disabled before calling
    ExAcquireResourceExclusiveLite. Otherwise a bugcheck occurs. Normal kernel
    APCs can be disabled by calling KeEnterCriticalRegion or by raising the
    calling thread's IRQL to APC_LEVEL."

    -the w2k ddk.

    The verifier is enforcing this rule.


    > -----Original Message-----
    > From: [email protected] [mailto:[email protected]]
    > Sent: Friday, March 17, 2000 10:52 AM
    > To: NT Developers Interest List
    > Subject: [ntdev] Driver Verifier & ExAcquireResourceExclusiveLite
    >
    >
    >
    >
    >
    > Running a driver on Windows 2000 but compiled with the DDK
    > for NT 4.0 the
    > "Driver Verifier" signals an undocumented error code on the call
    > ExAcquireResourceExclusiveLite if the IRQL is at
    > PASSIVE_LEVEL. No errors at
    > APC_LEVEL. From the DDK 2000 documentation appears that the call at
    > PASSIVE_LEVEL is allowed.
    >
    > Specifically the Verifier do the call
    > KeBugCheckEx(0xC4,0x37,0,0,resource_pointer), where 0xC4 is
    > the Verifier
    > specific error code, but 0x37 is an undocumented (DDK 2000)
    > sub error code.
    >
    > The code is :
    >
    > ERESOURCE* res;
    > NTSTATUS status;
    > unsigned size = sizeof(ERESOURCE);
    >
    > ASSERT( KeGetCurrentIrql() < DISPATCH_LEVEL );
    >
    > res = ExAllocatePool(NonPagedPool,size);
    > ASSERT( res );
    >
    > status = ExInitializeResourceLite(res);
    > ASSERT(NT_SUCCESS(status));
    >
    > ExAcquireResourceExclusiveLite(res,TRUE); // FAIL with
    > KeBugCheckEx(0xC4,0x37,0,0,res)
    >
    >
    >
    >
    >
    > ---
    > You are currently subscribed to ntdev as: [email protected]
    > To unsubscribe send a blank email to $subst('Email.Unsub')
    >
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 30 January 2023 Live, Online
Developing Minifilters 20 March 2023 Live, Online
Internals & Software Drivers 17 April 2023 Live, Online
Writing WDF Drivers 22 May 2023 Live, Online