///////////////////////////////////////////////////////////////////////////// //++ // // CBasePropertyPage::ScParseProperties // // Description: // Parse the properties of the resource. This is in a separate function // from HrInit so that the optimizer can do a better job. // // Arguments: // rcplIn // Cluster property list to parse. // // Return Values: // ERROR_SUCCESS // Properties were parsed successfully. // // Other HRESULTs // Error parsing the properties. (Includes any error returned from // ScParseUnknownProperty().) // // Exceptions Thrown: // Any exceptions from CString::operator=(). // //-- ///////////////////////////////////////////////////////////////////////////// DWORD CBasePropertyPage::ScParseProperties( CClusPropList & rcplIn ) { DWORD sc = ERROR_SUCCESS; DWORD cprop; const CObjectProperty * pprop; ASSERT( rcplIn.PbPropList() != NULL ); sc = rcplIn.ScMoveToFirstProperty(); while ( sc == ERROR_SUCCESS ) { // // Parse known properties. // for ( pprop = Pprops(), cprop = Cprops() ; cprop > 0 ; pprop++, cprop-- ) { if ( NIStringCompareW( rcplIn.PszCurrentPropertyName() , pprop->m_pwszName , rcplIn.CbhCurrentPropertyName().pName->cbLength / sizeof( WCHAR ) ) == 0 ) { if ( rcplIn.CpfCurrentValueFormat() == pprop->m_propFormat ) { switch ( pprop->m_propFormat ) { case CLUSPROP_FORMAT_SZ: case CLUSPROP_FORMAT_EXPAND_SZ: ASSERT( (rcplIn.CbCurrentValueLength() == (lstrlenW( rcplIn.CbhCurrentValue().pStringValue->sz ) + 1) * sizeof( WCHAR )) || ( (rcplIn.CbCurrentValueLength() == 0) && (rcplIn.CbhCurrentValue().pStringValue->sz[ 0 ] == L'\0') ) ); *pprop->m_value.pstr = rcplIn.CbhCurrentValue().pStringValue->sz; *pprop->m_valuePrev.pstr = rcplIn.CbhCurrentValue().pStringValue->sz; // // See if we need to find an expanded version // if ( pprop->m_valueEx.pstr != NULL ) { // Copy the non-expanded one just in case there isn't an expanded version *pprop->m_valueEx.pstr = rcplIn.CbhCurrentValue().pStringValue->sz; // See if they included an expanded version rcplIn.ScMoveToNextPropertyValue( ); if ( rcplIn.CpfCurrentValueFormat( ) == CLUSPROP_FORMAT_EXPANDED_SZ ) { *pprop->m_valueEx.pstr = rcplIn.CbhCurrentValue().pStringValue->sz; } // if: found expanded version } // if: *pprop->m_valueEx.pstr is present break; case CLUSPROP_FORMAT_EXPANDED_SZ: ASSERT( (rcplIn.CbCurrentValueLength() == (lstrlenW( rcplIn.CbhCurrentValue().pStringValue->sz ) + 1) * sizeof( WCHAR )) || ( (rcplIn.CbCurrentValueLength() == 0) && (rcplIn.CbhCurrentValue().pStringValue->sz[ 0 ] == L'\0') ) ); *pprop->m_value.pstr = rcplIn.CbhCurrentValue().pStringValue->sz; *pprop->m_valuePrev.pstr = rcplIn.CbhCurrentValue().pStringValue->sz; // // See if we need to find an expanded version // if ( *pprop->m_valueEx.pstr ) // can not use != NULL because overloading tries to do a string compare! { // Copy the expanded version *pprop->m_valueEx.pstr = rcplIn.CbhCurrentValue().pStringValue->sz; // See if they included a non-expanded version rcplIn.ScMoveToNextPropertyValue( ); if ( rcplIn.CpfCurrentValueFormat( ) == CLUSPROP_FORMAT_SZ ) { *pprop->m_value.pstr = rcplIn.CbhCurrentValue().pStringValue->sz; *pprop->m_valuePrev.pstr = rcplIn.CbhCurrentValue().pStringValue->sz; } // if: found non-expanded version } // if: *pprop->m_valueEx.pstr is present break; case CLUSPROP_FORMAT_DWORD: case CLUSPROP_FORMAT_LONG: ASSERT( rcplIn.CbCurrentValueLength() == sizeof( DWORD ) ); *pprop->m_value.pdw = rcplIn.CbhCurrentValue().pDwordValue->dw; *pprop->m_valuePrev.pdw = rcplIn.CbhCurrentValue().pDwordValue->dw; break; case CLUSPROP_FORMAT_BINARY: case CLUSPROP_FORMAT_MULTI_SZ: *pprop->m_value.ppb = rcplIn.CbhCurrentValue().pBinaryValue->rgb; *pprop->m_value.pcb = rcplIn.CbhCurrentValue().pBinaryValue->cbLength; *pprop->m_valuePrev.ppb = rcplIn.CbhCurrentValue().pBinaryValue->rgb; *pprop->m_valuePrev.pcb = rcplIn.CbhCurrentValue().pBinaryValue->cbLength; break; default: ASSERT(0); // don't know how to deal with this type } // switch: property format // // Exit the loop since we found the parameter. // break; }// if: found a type match } // if: found a string match } // for: each property that we know about // // If the property wasn't known, ask the derived class to parse it. // if ( cprop == 0 ) { sc = ScParseUnknownProperty( rcplIn.CbhCurrentPropertyName().pName->sz , rcplIn.CbhCurrentValue() , rcplIn.RPvlPropertyValue().CbDataLeft() ); if ( sc != ERROR_SUCCESS ) { return sc; } // if: error parsing the unknown property } // if: property not parsed // // Advance the buffer pointer past the value in the value list. // sc = rcplIn.ScMoveToNextProperty(); } // while: more properties to parse // // If we reached the end of the properties, fix the return code. // if ( sc == ERROR_NO_MORE_ITEMS ) { sc = ERROR_SUCCESS; } // if: ended loop after parsing all properties return sc; } //*** CBasePropertyPage::ScParseProperties
////////////////////////////////////////////////////////////////////////////// //++ // // CPartitionInfo::HrIsNTFS // // Description: // Is this an NTFS partition? // // Arguments: // None. // // Return Value: // S_OK // Success, the partition is NTFS. // // S_FALSE // Success, the partition is not NTFS. // // Other // An error occurred. // // Remarks: // None. // //-- ////////////////////////////////////////////////////////////////////////////// STDMETHODIMP CPartitionInfo::HrIsNTFS( void ) { HRESULT hr = S_FALSE; VARIANT var; ULONG idx; IWbemClassObject * piwco = NULL; VariantInit( &var ); for ( idx = 0; idx < m_idxNextLogicalDisk; idx++ ) { hr = ((*m_prgLogicalDisks)[ idx ])->TypeSafeQI( IWbemClassObject, &piwco ); if ( FAILED( hr ) ) { goto Cleanup; } // if: VariantClear( &var ); hr = HrGetWMIProperty( piwco, L"FileSystem", VT_BSTR, &var ); if ( ( hr == E_PROPTYPEMISMATCH ) && ( var.vt == VT_NULL ) ) { VariantClear( &var ); hr = S_FALSE; HrGetWMIProperty( piwco, L"DeviceID", VT_BSTR, &var ); STATUS_REPORT_STRING_REF( TASKID_Major_Find_Devices , TASKID_Minor_Disk_No_File_System , IDS_ERROR_DISK_NO_FILE_SYSTEM , var.bstrVal , IDS_ERROR_DISK_NO_FILE_SYSTEM_REF , hr ); break; } // if: else if ( FAILED( hr ) ) { goto Cleanup; } // else if: if ( NIStringCompareW( var.bstrVal, SysStringLen( var.bstrVal ), L"NTFS", RTL_NUMBER_OF( L"NTFS" ) ) != 0 ) { VariantClear( &var ); hr = S_FALSE; HrGetWMIProperty( piwco, L"DeviceID", VT_BSTR, &var ); STATUS_REPORT_STRING_REF( TASKID_Major_Find_Devices , TASKID_Minor_Disk_Not_NTFS , IDS_WARN_DISK_NOT_NTFS , var.bstrVal , IDS_WARN_DISK_NOT_NTFS_REF , hr ); break; } // if: piwco->Release(); piwco = NULL; } // for: Cleanup: VariantClear( &var ); if ( piwco != NULL ) { piwco->Release(); } // if: return hr; } //*** CPartitionInfo::HrIsNTFS