HRESULT CNdasUnitImpl::ImplInitialize( __in INdasDevice* pNdasDevice, __in DWORD UnitNo, __in NDAS_UNITDEVICE_TYPE Type, __in NDAS_UNITDEVICE_SUBTYPE SubType, __in const NDAS_UNITDEVICE_HARDWARE_INFO& HardwareInfo, __in const NDAS_LOGICALUNIT_DEFINITION& NdasLogicalUnitDefinition, __in DWORD LuSequence) { m_pParentNdasDevice = pNdasDevice; m_unitDeviceId = pCreateUnitDeviceId(pNdasDevice,UnitNo); m_type = Type; m_subType = SubType; m_status = NDAS_UNITDEVICE_STATUS_NOT_MOUNTED; m_lastError = NDAS_UNITDEVICE_ERROR_NONE; m_udinfo = HardwareInfo; m_NdasLogicalUnitDefinition = NdasLogicalUnitDefinition; m_NdasLogicalUnitSequence = LuSequence; XTLTRACE2(NDASSVC_NDASUNITDEVICE, TRACE_LEVEL_INFORMATION, "NdasUnit=%p, %s\n", this, CNdasUnitDeviceId(m_unitDeviceId).ToStringA()); DWORD slotNo; COMVERIFY(pNdasDevice->get_SlotNo(&slotNo)); COMVERIFY( StringCchPrintf( m_szRegContainer, 30, _T("Devices\\%04d\\%04d"), slotNo, m_unitDeviceId.UnitNo)); return S_OK; }
CNdasUnitDevice::CNdasUnitDevice( CNdasDevicePtr pParentDevice, DWORD dwUnitNo, NDAS_UNITDEVICE_TYPE type, NDAS_UNITDEVICE_SUBTYPE subType, const NDAS_UNITDEVICE_HARDWARE_INFO& unitDeviceInfo, const NDAS_LOGICALDEVICE_GROUP& ldGroup, DWORD ldSequence) : CStringizerA<32>("%s.%02d", pParentDevice->ToStringA(), dwUnitNo), m_pParentDevice(pParentDevice), m_unitDeviceId(pCreateUnitDeviceId(pParentDevice,dwUnitNo)), m_type(type), m_subType(subType), m_status(NDAS_UNITDEVICE_STATUS_NOT_MOUNTED), m_lastError(NDAS_UNITDEVICE_ERROR_NONE), m_udinfo(unitDeviceInfo), m_ldGroup(ldGroup), m_ldSequence(ldSequence), m_bSupposeFault(FALSE) { XTLTRACE2(NDASSVC_NDASUNITDEVICE, TRACE_LEVEL_INFORMATION, __FUNCTION__ " %s\n", ToStringA()); ::ZeroMemory( &m_PrimaryHostInfo, sizeof(NDAS_UNITDEVICE_PRIMARY_HOST_INFO)); COMVERIFY( StringCchPrintf( m_szRegContainer, 30, _T("Devices\\%04d\\%04d"), pParentDevice->GetSlotNo(), m_unitDeviceId.UnitNo)); }
CNdasUnitDevice::CNdasUnitDevice( CNdasDevice& parentDevice, DWORD dwUnitNo, NDAS_UNITDEVICE_TYPE type, NDAS_UNITDEVICE_SUBTYPE subType, CONST NDAS_UNITDEVICE_INFORMATION& unitDeviceInfo, CONST NDAS_LOGICALDEVICE_GROUP& ldGroup, DWORD ldSequence) : m_unitDeviceId(pCreateUnitDeviceId(parentDevice,dwUnitNo)), m_pParentDevice(&parentDevice), m_type(type), m_subType(subType), m_status(NDAS_UNITDEVICE_STATUS_NOT_MOUNTED), m_lastError(NDAS_UNITDEVICE_ERROR_NONE), m_devInfo(unitDeviceInfo), m_ldGroup(ldGroup), m_ldSequence(ldSequence), m_pLogicalDevice(NULL), m_bSupposeFault(FALSE) { ::ZeroMemory( &m_PrimaryHostInfo, sizeof(NDAS_UNITDEVICE_PRIMARY_HOST_INFO)); HRESULT hr = ::StringCchPrintf( m_szRegContainer, 30, _T("Devices\\%04d\\%04d"), m_pParentDevice->GetSlotNo(), m_unitDeviceId.UnitNo); _ASSERTE(SUCCEEDED(hr)); hr = ::StringCchPrintf( m_szStrBuf, CCH_STR_BUF, _T("%s"), CNdasUnitDeviceId(m_unitDeviceId).ToString()); _ASSERTE(SUCCEEDED(hr)); DBGPRT_TRACE(_FT("ctor: %s\n"), ToString()); }