Ejemplo n.º 1
0
void 
CMainFrame::OnCmdMountDeviceRO(NDAS_LOGICALDEVICE_ID logDeviceId)
{
	ndas::LogicalDevicePtr pLogDevice;
	if (!ndas::FindLogicalDevice(pLogDevice, logDeviceId))
	{
		ATLTRACE("Invalid logical device id specified: %d\n", logDeviceId);
		return;
	}

	if (!pLogDevice->PlugIn(FALSE))
	{
		ErrorMessageBox(IDS_ERROR_MOUNT_DEVICE_RO);
		return;
	}

	if (!pLogDevice->UpdateStatus())
	{
		// Service Communication failure?
		return;
	}
	if (NDAS_LOGICALDEVICE_STATUS_MOUNT_PENDING == pLogDevice->GetStatus())
	{
		CWaitMountDialog().DoModal(m_hWnd, pLogDevice);
	}
}
Ejemplo n.º 2
0
void
CMainFrame::OnCmdMountDeviceRW(NDAS_LOGICALDEVICE_ID logDeviceId)
{
	ndas::LogicalDevicePtr pLogDevice;
	if (!ndas::FindLogicalDevice(pLogDevice, logDeviceId))
	{
		ATLTRACE("Invalid logical device id specified: %d\n", logDeviceId);
		return;
	}
	if (!pLogDevice->PlugIn(TRUE))
	{
		if (NDASSVC_ERROR_MULTIPLE_WRITE_ACCESS_NOT_ALLOWED == ::GetLastError())
		{
			int response = AtlMessageBox(
				m_hWnd, 
				IDS_REQUEST_SURRENDER_RW_ACCESS, 
				IDS_MAIN_TITLE,
				MB_YESNO | MB_ICONEXCLAMATION);
			if (IDYES == response) 
			{
				pRequestSurrenderAccess(m_hWnd,pLogDevice);
			}
		}
		else
		{
			ErrorMessageBox(IDS_ERROR_MOUNT_DEVICE_RW);
		}
		return;
	}

	//
	// Wait Mount Dialog
	//
	if (!pLogDevice->UpdateStatus())
	{
		// Service Communication failure?
		return;
	}
	if (NDAS_LOGICALDEVICE_STATUS_MOUNT_PENDING == pLogDevice->GetStatus())
	{
		CWaitMountDialog().DoModal(m_hWnd, pLogDevice);
	}
}