public bool DriveAsleep(int deviceId)
{
// call power state api and return if drive is asleep
bool fOn, ret = true;
var handle = GetDeviceHandle(deviceId);
if (handle != IntPtr.Zero && NativeMethods.GetDevicePowerState(handle, out fOn))
{
ret = fOn;
}
NativeMethods.CloseHandle(handle);
return !ret;
}