Is this a WDFSPINLOCK leak?

pSync->status = WdfSpinLockCreate(WDF_NO_OBJECT_ATTRIBUTES, &pSync->fLock
);

Since there is no matching Free or Delete or Destroy function, I guess I
have to take it on faith that the docs are correct, the default parent is
the WDFDRIVER object created when I called WdfDriverCreate, which I never
touch again. How does the Framework know to make this spinlock a child of
a specific driver object, since I didn’t give it anything in the parameter
list to identify what device is creating the spinlock?

Thanks,

Phil

Philip D. Barila
Seagate Technology LLC
(720) 684-1842

If you look at each KMDF api, it is really a force inlined call to a
jump table. Part of the jump smuggles a “this” pointer for your entire
driver

__checkReturn

NTSTATUS

FORCEINLINE

WdfSpinLockCreate(

__in_opt

PWDF_OBJECT_ATTRIBUTES SpinLockAttributes,

__out

WDFSPINLOCK* SpinLock

)

{

return ((PFN_WDFSPINLOCKCREATE)
WdfFunctions[WdfSpinLockCreateTableIndex])(WdfDriverGlobals,
SpinLockAttributes, SpinLock);

}

The “this” pointer, or WdfDriverGlobals, contains the necessary info to
assign the spinlock as a child to the WDFDRIVER

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@seagate.com
Sent: Monday, May 14, 2007 12:32 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Is this a WDFSPINLOCK leak?

pSync->status = WdfSpinLockCreate(WDF_NO_OBJECT_ATTRIBUTES,
&pSync->fLock);

Since there is no matching Free or Delete or Destroy function, I guess I
have to take it on faith that the docs are correct, the default parent
is the WDFDRIVER object created when I called WdfDriverCreate, which I
never touch again. How does the Framework know to make this spinlock a
child of a specific driver object, since I didn’t give it anything in
the parameter list to identify what device is creating the spinlock?

Thanks,

Phil

Philip D. Barila
Seagate Technology LLC
(720) 684-1842 — Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the
List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Thanks for clearing that up. I'd seen that a year ago, but had long since
forgotten it.

Phil

Philip D. Barila Windows DDK MVP
Seagate Technology LLC
(720) 684-1842
As if I need to say it: Not speaking for Seagate.

"Doron Holan" wrote in message
news:xxxxx@ntdev...
If you look at each KMDF api, it is really a force inlined call to a
jump table. Part of the jump smuggles a "this" pointer for your entire
driver

__checkReturn

NTSTATUS

FORCEINLINE

WdfSpinLockCreate(

__in_opt

PWDF_OBJECT_ATTRIBUTES SpinLockAttributes,

__out

WDFSPINLOCK* SpinLock

)

{

return ((PFN_WDFSPINLOCKCREATE)
WdfFunctions[WdfSpinLockCreateTableIndex])(WdfDriverGlobals,
SpinLockAttributes, SpinLock);

}

The "this" pointer, or WdfDriverGlobals, contains the necessary info to
assign the spinlock as a child to the WDFDRIVER

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@seagate.com
Sent: Monday, May 14, 2007 12:32 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Is this a WDFSPINLOCK leak?

pSync->status = WdfSpinLockCreate(WDF_NO_OBJECT_ATTRIBUTES,
&pSync->fLock);

Since there is no matching Free or Delete or Destroy function, I guess I
have to take it on faith that the docs are correct, the default parent
is the WDFDRIVER object created when I called WdfDriverCreate, which I
never touch again. How does the Framework know to make this spinlock a
child of a specific driver object, since I didn't give it anything in
the parameter list to identify what device is creating the spinlock?

Thanks,

Phil

Philip D. Barila
Seagate Technology LLC
(720) 684-1842 --- Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the
List Server section of OSR Online at
ListServer/Forum