Obtaining object reference counts

Hi guys,

Using the DeviceTree application, I found out that my driver does not unload
because the DRIVER_OBJECT has a number of references to it (its reference
count is higher than 0).

How can I obtain the actual reference count of an object from kernel-mode?
There are some kernel functions to increment (ObReferenceObject) and
decrement (ObDereferenceObject) the reference count of an object but I saw
nothing about obtaining it. And how does DeviceTree know about the
reference count?

Mathieu Routhier