Hi Dan, I'm sure the bugcheck happen in the call as I've tried to step into the code using WinDbg and the problem occurs while I'm inside the call. As for the KSPIN_LOCK structure and KLOCK_QUEUE_HANDLE, I've tried declaring the spin lock in global non-paged memory with the queue handle on the stack, and also both in global non-paged memory, but the results seems the same. Thanks for your advise. KS -----Original Message----- From: wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Daniel E. Germann Sent: Monday, March 02, 2009 10:08 PM To: wdmaudiodev@xxxxxxxxxxxxx Subject: [wdmaudiodev] Re: Using KeAcquireInStackQueuedSpinLock Hi, KS. Are you sure the bugcheck happens in the call to KeXxxInStackQueuedSpinLock()? Bug check 0x7e with a first parameter of 0xC0000005 is a memory access violation, which means you might also be dereferencing a bad pointer somewhere. It's been a while since I've debugged one of these, so I'm not 100% sure about this, but the second parameter (0x000CAD66) should be the address of the fault, and it doesn't look like a kernel mode address to me. Are you trying to access something in user-mode memory? Take a look at this article, which provides information on this bugcheck. http://www.osronline.com/ddkx/ddtools/bccodes_192f.htm Doing an "analyze -v" from windbg will also provide some helpful information. Also, are you declaring the KSPIN_LOCK structure globally in non-paged memory, and the KLOCK_QUEUE_HANDLE on the stack? -Dan ----- Original Message ----- > Date: Mon, 2 Mar 2009 12:09:18 +0800 > Subject: [wdmaudiodev] Using KeAcquireInStackQueuedSpinLock > From: KS <wakeup1504@xxxxxxxxx> > > Hi, > Does anyone have any experience in using KeAcquireInStackQueuedSpinLock. > the > recommended way for getting spinlock for WinXP and above. > > I'm trying to use this, and it seems that the call will always BSOD with > the > following bugcheck code. > > *** Fatal System Error: 0x0000007e > (0xC0000005,0x000CAD66,0x8336B6A4,0x8336B3A0) > > Here's a short code extract of how I'm calling the function > > ... > KSPIN_LOCK mySpinLock; > KLOCK_QUEUE_HANDLE LockHandle; > BOOL acquireAtDpc = FALSE; > > KeInitializeSpinLock(&mySpinLock); > > if(KeGetCurrentIrql() == DISPATCH_LEVEL) > { > KeAcquireInStackQueuedSpinLockAtDpcLevel(&mySpinLock, &LockHandle); > acquireAtDpc = TRUE; > } > else > { > KeAcquireInStackQueuedSpinLock(&mySpinLock, &LockHandle); > } > > .... > // Do the protected actions > ... > > if(acquireAtDpc) > { > KeReleaseInStackQueuedSpinLockFromDpcLevel(&LockHandle); > } > else > { > KeReleaseInStackQueuedSpinLock(&LockHandle); > } > > > Thanks for any advise on what I might be doing wrongly. > > KS ****************** WDMAUDIODEV addresses: Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx Subscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe Unsubscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe Moderator: mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx URL to WDMAUDIODEV page: http://www.wdmaudiodev.com/ ****************** WDMAUDIODEV addresses: Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx Subscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe Unsubscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe Moderator: mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx URL to WDMAUDIODEV page: http://www.wdmaudiodev.com/