ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

PDEVICE_OBJECT_POWER_EXTENSION NTAPI PopGetDope ( IN PDEVICE_OBJECT  DeviceObject)

Definition at line 34 of file povolume.c.

Referenced by PoVolumeDevice().

{
    PEXTENDED_DEVOBJ_EXTENSION DeviceExtension;
    PDEVICE_OBJECT_POWER_EXTENSION Dope;
    KIRQL OldIrql;
    PAGED_CODE();

    /* If the device already has the dope, return it */
    DeviceExtension = IoGetDevObjExtension(DeviceObject);
    if (DeviceExtension->Dope) goto Return;

    /* Allocate some dope for the device */
    Dope = ExAllocatePoolWithTag(NonPagedPool,
                                 sizeof(DEVICE_OBJECT_POWER_EXTENSION),
                                 'Dope');
    if (!Dope) goto Return;

    /* Initialize the initial contents of the dope */
    RtlZeroMemory(Dope, sizeof(DEVICE_OBJECT_POWER_EXTENSION));
    Dope->DeviceObject = DeviceObject;
    Dope->State = PowerDeviceUnspecified;
    InitializeListHead(&Dope->IdleList);

    /* Make sure only one caller can assign dope to a device */
    KeAcquireSpinLock(&PopDopeGlobalLock, &OldIrql);
    
    /* Make sure the device still has no dope */
    if (!DeviceExtension->Dope)
    {
        /* Give the local dope to this device, and remember we won the race */
        DeviceExtension->Dope = (PVOID)Dope;
        Dope = NULL;
    }

    /* Allow other dope transactions now */
    KeReleaseSpinLock(&PopDopeGlobalLock, OldIrql);
    
    /* Check if someone other than us already assigned the dope, so free ours */
    if (Dope) ExFreePoolWithTag(Dope, 'Dope');

    /* Return the dope to the caller */
Return:
    return (PDEVICE_OBJECT_POWER_EXTENSION)DeviceExtension->Dope;
}

Generated on Sun May 27 2012 06:08:34 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.