///////////////////////////////////////////////////////////////////////////// //++ // // CBasePropertyPage::OnSetActive // // Description: // Handler for the PSN_SETACTIVE message. // // Arguments: // None. // // Return Value: // TRUE // Page successfully initialized. // // FALSE // Page not initialized. // //-- ///////////////////////////////////////////////////////////////////////////// BOOL CBasePropertyPage::OnSetActive( void ) { HRESULT hr = S_OK; ASSERT( Peo() != NULL); ASSERT( Peo()->PodObjData() != NULL ); AFX_MANAGE_STATE( AfxGetStaticModuleState() ); // // Reread the data. // hr = Peo()->HrGetObjectInfo(); if ( FAILED( hr ) ) { return FALSE; } // if: error getting object info // // Set the title string. // m_strTitle = Peo()->PodObjData()->StrName(); m_bBackPressed = FALSE; m_bSaved = FALSE; return CPropertyPage::OnSetActive(); } //*** CBasePropertyPage::OnSetActive
///////////////////////////////////////////////////////////////////////////// //++ // // CBasePropertyPage::OnSetActive // // Routine Description: // Handler for the PSN_SETACTIVE message. // // Arguments: // None. // // Return Value: // TRUE Page successfully initialized. // FALSE Page not initialized. // //-- ///////////////////////////////////////////////////////////////////////////// BOOL CBasePropertyPage::OnSetActive(void) { HRESULT hr; ASSERT(Peo() != NULL); ASSERT(Peo()->PodObjData() != NULL); AFX_MANAGE_STATE(AfxGetStaticModuleState()); // Reread the data. hr = Peo()->HrGetObjectInfo(); if (hr != NOERROR) return FALSE; // Set the title string. m_strTitle = Peo()->PodObjData()->m_strName; m_bBackPressed = FALSE; return CPropertyPage::OnSetActive(); } //*** CBasePropertyPage::OnSetActive()
///////////////////////////////////////////////////////////////////////////// //++ // // CBasePropertyPage::OnInitDialog // // Routine Description: // Handler for the WM_INITDIALOG message. // // Arguments: // None. // // Return Value: // TRUE We need the focus to be set for us. // FALSE We already set the focus to the proper control. // //-- ///////////////////////////////////////////////////////////////////////////// BOOL CBasePropertyPage::OnInitDialog(void) { ASSERT(Peo() != NULL); ASSERT(Peo()->PodObjData() != NULL); AFX_MANAGE_STATE(AfxGetStaticModuleState()); // Set the title string. m_strTitle = Peo()->PodObjData()->m_strName; // Call the base class method. CPropertyPage::OnInitDialog(); // Display an icon for the object. if (Peo()->Hicon() != NULL) m_staticIcon.SetIcon(Peo()->Hicon()); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } //*** CBasePropertyPage::OnInitDialog()
///////////////////////////////////////////////////////////////////////////// //++ // // CBasePropertyPage::BSetPrivateProps // // Routine Description: // Set the private properties for this object. // // Arguments: // bValidateOnly [IN] TRUE = only validate the data. // // Return Value: // ERROR_SUCCESS The operation was completed successfully. // !0 Failure. // //-- ///////////////////////////////////////////////////////////////////////////// BOOL CBasePropertyPage::BSetPrivateProps(IN BOOL bValidateOnly) { BOOL bSuccess = TRUE; CClusPropList cpl(BWizard() /*bAlwaysAddProp*/); CWaitCursor wc; ASSERT(Peo() != NULL); // Build the property list. try { BuildPropList(cpl); } // try catch (CException * pe) { pe->ReportError(); pe->Delete(); bSuccess = FALSE; } // catch: CException // Set the data. if (bSuccess) { if ((cpl.PbProplist() != NULL) && (cpl.CbProplist() > 0)) { DWORD dwStatus; DWORD dwControlCode; DWORD cbProps; switch (Cot()) { case CLUADMEX_OT_NODE: ASSERT(Peo()->PndNodeData() != NULL); ASSERT(Peo()->PndNodeData()->m_hnode != NULL); // Determine which control code to use. if (bValidateOnly) dwControlCode = CLUSCTL_NODE_VALIDATE_PRIVATE_PROPERTIES; else dwControlCode = CLUSCTL_NODE_SET_PRIVATE_PROPERTIES; // Set private properties. dwStatus = ClusterNodeControl( Peo()->PndNodeData()->m_hnode, NULL, // hNode dwControlCode, cpl.PbProplist(), cpl.CbProplist(), NULL, // lpOutBuffer 0, // nOutBufferSize &cbProps ); break; case CLUADMEX_OT_GROUP: ASSERT(Peo()->PgdGroupData() != NULL); ASSERT(Peo()->PgdGroupData()->m_hgroup != NULL); // Determine which control code to use. if (bValidateOnly) dwControlCode = CLUSCTL_GROUP_VALIDATE_PRIVATE_PROPERTIES; else dwControlCode = CLUSCTL_GROUP_SET_PRIVATE_PROPERTIES; // Set private properties. dwStatus = ClusterGroupControl( Peo()->PgdGroupData()->m_hgroup, NULL, // hNode dwControlCode, cpl.PbProplist(), cpl.CbProplist(), NULL, // lpOutBuffer 0, // nOutBufferSize &cbProps ); break; case CLUADMEX_OT_RESOURCE: ASSERT(Peo()->PrdResData() != NULL); ASSERT(Peo()->PrdResData()->m_hresource != NULL); // Determine which control code to use. if (bValidateOnly) dwControlCode = CLUSCTL_RESOURCE_VALIDATE_PRIVATE_PROPERTIES; else dwControlCode = CLUSCTL_RESOURCE_SET_PRIVATE_PROPERTIES; // Set private properties. dwStatus = ClusterResourceControl( Peo()->PrdResData()->m_hresource, NULL, // hNode dwControlCode, cpl.PbProplist(), cpl.CbProplist(), NULL, // lpOutBuffer 0, // nOutBufferSize &cbProps ); break; case CLUADMEX_OT_RESOURCETYPE: ASSERT(Peo()->PodObjData() != NULL); ASSERT(Peo()->PodObjData()->m_strName.GetLength() > 0); // Determine which control code to use. if (bValidateOnly) dwControlCode = CLUSCTL_RESOURCE_TYPE_VALIDATE_PRIVATE_PROPERTIES; else dwControlCode = CLUSCTL_RESOURCE_TYPE_SET_PRIVATE_PROPERTIES; // Set private properties. dwStatus = ClusterResourceTypeControl( Hcluster(), Peo()->PodObjData()->m_strName, NULL, // hNode dwControlCode, cpl.PbProplist(), cpl.CbProplist(), NULL, // lpOutBuffer 0, // nOutBufferSize &cbProps ); break; case CLUADMEX_OT_NETWORK: ASSERT(Peo()->PndNetworkData() != NULL); ASSERT(Peo()->PndNetworkData()->m_hnetwork != NULL); // Determine which control code to use. if (bValidateOnly) dwControlCode = CLUSCTL_NETWORK_VALIDATE_PRIVATE_PROPERTIES; else dwControlCode = CLUSCTL_NETWORK_SET_PRIVATE_PROPERTIES; // Set private properties. dwStatus = ClusterNetworkControl( Peo()->PndNetworkData()->m_hnetwork, NULL, // hNode dwControlCode, cpl.PbProplist(), cpl.CbProplist(), NULL, // lpOutBuffer 0, // nOutBufferSize &cbProps ); break; case CLUADMEX_OT_NETINTERFACE: ASSERT(Peo()->PndNetInterfaceData() != NULL); ASSERT(Peo()->PndNetInterfaceData()->m_hnetinterface != NULL); // Determine which control code to use. if (bValidateOnly) dwControlCode = CLUSCTL_NETINTERFACE_VALIDATE_PRIVATE_PROPERTIES; else dwControlCode = CLUSCTL_NETINTERFACE_SET_PRIVATE_PROPERTIES; // Set private properties. dwStatus = ClusterNetInterfaceControl( Peo()->PndNetInterfaceData()->m_hnetinterface, NULL, // hNode dwControlCode, cpl.PbProplist(), cpl.CbProplist(), NULL, // lpOutBuffer 0, // nOutBufferSize &cbProps ); break; default: ASSERT(0); } // switch: object type // Handle errors. if (dwStatus != ERROR_SUCCESS) { CString strMsg; FormatError(strMsg, dwStatus); AfxMessageBox(strMsg); if (bValidateOnly || (dwStatus != ERROR_RESOURCE_PROPERTIES_STORED)) bSuccess = FALSE; } // if: error setting/validating data } // if: there is data to set } // if: no errors building the property list // Save data locally. if (!bValidateOnly && bSuccess) { // Save new values as previous values. try { DWORD cprop; const CObjectProperty * pprop; for (pprop = Pprops(), cprop = Cprops() ; cprop > 0 ; pprop++, cprop--) { switch (pprop->m_propFormat) { case CLUSPROP_FORMAT_SZ: case CLUSPROP_FORMAT_EXPAND_SZ: ASSERT(pprop->m_value.pstr != NULL); ASSERT(pprop->m_valuePrev.pstr != NULL); *pprop->m_valuePrev.pstr = *pprop->m_value.pstr; break; case CLUSPROP_FORMAT_DWORD: ASSERT(pprop->m_value.pdw != NULL); ASSERT(pprop->m_valuePrev.pdw != NULL); *pprop->m_valuePrev.pdw = *pprop->m_value.pdw; break; case CLUSPROP_FORMAT_BINARY: case CLUSPROP_FORMAT_MULTI_SZ: ASSERT(pprop->m_value.ppb != NULL); ASSERT(*pprop->m_value.ppb != NULL); ASSERT(pprop->m_value.pcb != NULL); ASSERT(pprop->m_valuePrev.ppb != NULL); ASSERT(*pprop->m_valuePrev.ppb != NULL); ASSERT(pprop->m_valuePrev.pcb != NULL); delete [] *pprop->m_valuePrev.ppb; *pprop->m_valuePrev.ppb = new BYTE[*pprop->m_value.pcb]; CopyMemory(*pprop->m_valuePrev.ppb, *pprop->m_value.ppb, *pprop->m_value.pcb); *pprop->m_valuePrev.pcb = *pprop->m_value.pcb; break; default: ASSERT(0); // don't know how to deal with this type } // switch: property format } // for: each property } // try catch (CException * pe) { pe->ReportError(); pe->Delete(); bSuccess = FALSE; } // catch: CException } // if: not just validating and successful so far return bSuccess; } //*** CBasePropertyPage::BSetPrivateProps()
///////////////////////////////////////////////////////////////////////////// //++ // // CBasePropertyPage::BInit // // Routine Description: // Initialize the page. // // Arguments: // peo [IN OUT] Pointer to the extension object. // // Return Value: // TRUE Page initialized successfully. // FALSE Page failed to initialize. // //-- ///////////////////////////////////////////////////////////////////////////// BOOL CBasePropertyPage::BInit(IN OUT CExtObject * peo) { ASSERT(peo != NULL); AFX_MANAGE_STATE(AfxGetStaticModuleState()); CWaitCursor wc; m_peo = peo; // Don't display a help button. m_psp.dwFlags &= ~PSP_HASHELP; // Construct the property page. if (Peo()->BWizard()) { ASSERT(IddWizardPage() != NULL); Construct(IddWizardPage(), IdsCaption()); } // if: adding page to wizard else { ASSERT(IddPropertyPage() != NULL); Construct(IddPropertyPage(), IdsCaption()); } // else: adding page to property sheet // Read the properties private to this resource and parse them. { DWORD dwStatus; CClusPropList cpl; ASSERT(Peo() != NULL); ASSERT(Peo()->PodObjData()); // Read the properties. switch (Cot()) { case CLUADMEX_OT_NODE: ASSERT(Peo()->PndNodeData()->m_hnode != NULL); dwStatus = cpl.DwGetNodeProperties( Peo()->PndNodeData()->m_hnode, CLUSCTL_NODE_GET_PRIVATE_PROPERTIES ); break; case CLUADMEX_OT_GROUP: ASSERT(Peo()->PgdGroupData()->m_hgroup != NULL); dwStatus = cpl.DwGetGroupProperties( Peo()->PgdGroupData()->m_hgroup, CLUSCTL_GROUP_GET_PRIVATE_PROPERTIES ); break; case CLUADMEX_OT_RESOURCE: ASSERT(Peo()->PrdResData()->m_hresource != NULL); dwStatus = cpl.DwGetResourceProperties( Peo()->PrdResData()->m_hresource, CLUSCTL_RESOURCE_GET_PRIVATE_PROPERTIES ); break; case CLUADMEX_OT_RESOURCETYPE: ASSERT(Peo()->PodObjData()->m_strName.GetLength() > 0); dwStatus = cpl.DwGetResourceTypeProperties( Hcluster(), Peo()->PodObjData()->m_strName, CLUSCTL_RESOURCE_TYPE_GET_PRIVATE_PROPERTIES ); break; case CLUADMEX_OT_NETWORK: ASSERT(Peo()->PndNetworkData()->m_hnetwork != NULL); dwStatus = cpl.DwGetNetworkProperties( Peo()->PndNetworkData()->m_hnetwork, CLUSCTL_NETWORK_GET_PRIVATE_PROPERTIES ); break; case CLUADMEX_OT_NETINTERFACE: ASSERT(Peo()->PndNetInterfaceData()->m_hnetinterface != NULL); dwStatus = cpl.DwGetNetInterfaceProperties( Peo()->PndNetInterfaceData()->m_hnetinterface, CLUSCTL_NETINTERFACE_GET_PRIVATE_PROPERTIES ); break; default: ASSERT(0); } // switch: object type // Parse the properties. if (dwStatus == ERROR_SUCCESS) { // Parse the properties. try { dwStatus = DwParseProperties(cpl); } // try catch (CMemoryException * pme) { dwStatus = ERROR_NOT_ENOUGH_MEMORY; pme->Delete(); } // catch: CMemoryException } // if: properties read successfully if (dwStatus != ERROR_SUCCESS) { return FALSE; } // if: error parsing getting or parsing properties } // Read the properties private to this resource and parse them return TRUE; } //*** CBasePropertyPage::BInit()
///////////////////////////////////////////////////////////////////////////// //++ // // CBasePropertyPage::HrInit // // Description: // Initialize the page. // // Arguments: // peoInout // Pointer to the extension object. // // Return Value: // S_OK // Page initialized successfully. // // Other HRESULTs // Page failed to initialize. // //-- ///////////////////////////////////////////////////////////////////////////// HRESULT CBasePropertyPage::HrInit( CExtObject * peoInout ) { ASSERT( peoInout != NULL ); AFX_MANAGE_STATE( AfxGetStaticModuleState() ); HRESULT hr = S_OK; CWaitCursor wc; DWORD sc = ERROR_SUCCESS; CClusPropList cpl; m_peo = peoInout; // // Don't display a help button. // m_psp.dwFlags &= ~PSP_HASHELP; // // Construct the property page. // if ( Peo()->BWizard() ) { ASSERT( IddWizardPage() != NULL); Construct( IddWizardPage(), IdsCaption() ); } // if: adding page to wizard else { ASSERT( IddPropertyPage() != NULL ); Construct( IddPropertyPage(), IdsCaption() ); } // else: adding page to property sheet // // Read the properties private to this resource and parse them. // ASSERT( Peo() != NULL ); ASSERT( Peo()->PodObjData() ); // // Read the properties. // switch ( Cot() ) { case CLUADMEX_OT_CLUSTER: { CClusterData * pccd = reinterpret_cast< CClusterData * >( Peo()->PodObjData() ); ASSERT( pccd && (pccd->GetHCluster() != NULL) ); sc = cpl.ScGetClusterProperties( pccd->GetHCluster() , CLUSCTL_CLUSTER_GET_PRIVATE_PROPERTIES ); break; } case CLUADMEX_OT_NODE: { CNodeData * pcnd = reinterpret_cast< CNodeData * >( Peo()->PodObjData() ); ASSERT( pcnd && (pcnd->GetHNode() != NULL) ); sc = cpl.ScGetNodeProperties( pcnd->GetHNode() , CLUSCTL_NODE_GET_PRIVATE_PROPERTIES ); break; } case CLUADMEX_OT_GROUP: { CGroupData * pcgd = reinterpret_cast< CGroupData * >( Peo()->PodObjData() ); ASSERT( pcgd && (pcgd->GetHGroup() != NULL) ); sc = cpl.ScGetGroupProperties( pcgd->GetHGroup() , CLUSCTL_GROUP_GET_PRIVATE_PROPERTIES ); break; } case CLUADMEX_OT_RESOURCE: { CResData * pcrd = reinterpret_cast< CResData * >( Peo()->PodObjData() ); ASSERT( pcrd && (pcrd->GetHResource() != NULL) ); sc = cpl.ScGetResourceProperties( pcrd->GetHResource() , CLUSCTL_RESOURCE_GET_PRIVATE_PROPERTIES ); break; } case CLUADMEX_OT_RESOURCETYPE: { CResTypeData * pcrd = reinterpret_cast< CResTypeData * >( Peo()->PodObjData() ); ASSERT( pcrd && (pcrd->StrName().GetLength() > 0) ); sc = cpl.ScGetResourceTypeProperties( Hcluster() , pcrd->StrName() , CLUSCTL_RESOURCE_TYPE_GET_PRIVATE_PROPERTIES ); break; } case CLUADMEX_OT_NETWORK: { CNetworkData * pcnd = reinterpret_cast< CNetworkData * >( Peo()->PodObjData() ); ASSERT( pcnd && (pcnd->GetHNetwork() != NULL) ); sc = cpl.ScGetNetworkProperties( pcnd->GetHNetwork() , CLUSCTL_NETWORK_GET_PRIVATE_PROPERTIES ); break; } case CLUADMEX_OT_NETINTERFACE: { CNetInterfaceData * pcnd = reinterpret_cast< CNetInterfaceData * >( Peo()->PodObjData() ); ASSERT( pcnd && (pcnd->GetHNetInterface() != NULL) ); sc = cpl.ScGetNetInterfaceProperties( pcnd->GetHNetInterface() , CLUSCTL_NETINTERFACE_GET_PRIVATE_PROPERTIES ); break; } default: ASSERT( 0 ); } // switch: object type // // Parse the properties. // if ( sc == ERROR_SUCCESS ) { // Parse the properties. try { sc = ScParseProperties( cpl ); } // try catch ( CMemoryException * pme ) { hr = E_OUTOFMEMORY; pme->Delete(); } // catch: CMemoryException } // if: properties read successfully if ( sc != ERROR_SUCCESS ) { hr = HRESULT_FROM_WIN32( sc ); goto Cleanup; } // if: error parsing getting or parsing properties Cleanup: return hr; } //*** CBasePropertyPage::HrInit
///////////////////////////////////////////////////////////////////////////// //++ // // CBasePropertyPage::BSetPrivateProps // // Description: // Set the private properties for this object. // // Arguments: // fValidateOnlyIn // TRUE = only validate the data. // // fNoNewPropsIn // TRUE = exclude properties marked with opfNew. // // Return Value: // ERROR_SUCCESS // The operation was completed successfully. // // Other Win32 values. // Failure. // //-- ///////////////////////////////////////////////////////////////////////////// BOOL CBasePropertyPage::BSetPrivateProps( BOOL fValidateOnlyIn // = FALSE , BOOL fNoNewPropsIn // = FALSE ) { BOOL fSuccess = TRUE; CClusPropList cpl( BWizard() /*bAlwaysAddProp*/ ); ASSERT( Peo() != NULL ); ASSERT( Peo()->PodObjData() ); // // Build the property list. // try { fSuccess = BBuildPropList( cpl, fNoNewPropsIn ); } // try catch ( CException * pe ) { pe->ReportError(); pe->Delete(); fSuccess = FALSE; } // catch: CException // // Set the data. // if ( fSuccess ) { if ( (cpl.PbPropList() != NULL) && (cpl.CbPropList() > 0) ) { DWORD sc = ERROR_SUCCESS; DWORD dwControlCode; DWORD cbProps; switch ( Cot() ) { case CLUADMEX_OT_NODE: { CNodeData * pcnd = reinterpret_cast< CNodeData * >( Peo()->PodObjData() ); ASSERT( pcnd && (pcnd->GetHNode() != NULL) ); // // Determine which control code to use. // if ( fValidateOnlyIn ) { dwControlCode = CLUSCTL_NODE_VALIDATE_PRIVATE_PROPERTIES; } // if: only validating data else { dwControlCode = CLUSCTL_NODE_SET_PRIVATE_PROPERTIES; } // else: setting data // // Set private properties. // sc = ClusterNodeControl( pcnd->GetHNode() , NULL // hNode , dwControlCode , cpl.PbPropList() , static_cast< DWORD >( cpl.CbPropList() ) , NULL // lpOutBuffer , 0 // nOutBufferSize , &cbProps ); break; } // case: case CLUADMEX_OT_GROUP: { CGroupData * pcgd = reinterpret_cast< CGroupData * >( Peo()->PodObjData() ); ASSERT( pcgd && (pcgd->GetHGroup() != NULL) ); // // Determine which control code to use. // if ( fValidateOnlyIn ) { dwControlCode = CLUSCTL_GROUP_VALIDATE_PRIVATE_PROPERTIES; } // if: only validating data else { dwControlCode = CLUSCTL_GROUP_SET_PRIVATE_PROPERTIES; } // else: setting data // // Set private properties. // sc = ClusterGroupControl( pcgd->GetHGroup() , NULL // hNode , dwControlCode , cpl.PbPropList() , static_cast< DWORD >( cpl.CbPropList() ) , NULL // lpOutBuffer , 0 // nOutBufferSize , &cbProps ); break; } // case: case CLUADMEX_OT_RESOURCE: { CResData * pcrd = reinterpret_cast< CResData * >( Peo()->PodObjData() ); ASSERT( pcrd && (pcrd->GetHResource() != NULL) ); // // Determine which control code to use. // if ( fValidateOnlyIn ) { dwControlCode = CLUSCTL_RESOURCE_VALIDATE_PRIVATE_PROPERTIES; } // if: only validating data else { dwControlCode = CLUSCTL_RESOURCE_SET_PRIVATE_PROPERTIES; } // else: setting data // // Set private properties. // sc = ClusterResourceControl( pcrd->GetHResource() , NULL // hNode , dwControlCode , cpl.PbPropList() , static_cast< DWORD >( cpl.CbPropList() ) , NULL // lpOutBuffer , 0 // nOutBufferSize , &cbProps ); break; } // case: case CLUADMEX_OT_RESOURCETYPE: { CResTypeData * pcrd = reinterpret_cast< CResTypeData * >( Peo()->PodObjData() ); ASSERT( pcrd && (pcrd->StrName().GetLength() > 0) ); // // Determine which control code to use. // if ( fValidateOnlyIn ) { dwControlCode = CLUSCTL_RESOURCE_TYPE_VALIDATE_PRIVATE_PROPERTIES; } // if: only validating data else { dwControlCode = CLUSCTL_RESOURCE_TYPE_SET_PRIVATE_PROPERTIES; } // else: setting data // // Set private properties. // sc = ClusterResourceTypeControl( Hcluster() , pcrd->StrName() , NULL // hNode , dwControlCode , cpl.PbPropList() , static_cast< DWORD >( cpl.CbPropList() ) , NULL // lpOutBuffer , 0 // nOutBufferSize , &cbProps ); break; } // case: case CLUADMEX_OT_NETWORK: { CNetworkData * pcnd = reinterpret_cast< CNetworkData * >( Peo()->PodObjData() ); ASSERT( pcnd && (pcnd->GetHNetwork() != NULL) ); // // Determine which control code to use. // if ( fValidateOnlyIn ) { dwControlCode = CLUSCTL_NETWORK_VALIDATE_PRIVATE_PROPERTIES; } // if: only validating data else { dwControlCode = CLUSCTL_NETWORK_SET_PRIVATE_PROPERTIES; } // else: setting data // // Set private properties. // sc = ClusterNetworkControl( pcnd->GetHNetwork() , NULL // hNode , dwControlCode , cpl.PbPropList() , static_cast< DWORD >( cpl.CbPropList() ) , NULL // lpOutBuffer , 0 // nOutBufferSize , &cbProps ); break; } // case: case CLUADMEX_OT_NETINTERFACE: { CNetInterfaceData * pcnd = reinterpret_cast< CNetInterfaceData * >( Peo()->PodObjData() ); ASSERT( pcnd && (pcnd->GetHNetInterface() != NULL) ); // // Determine which control code to use. // if ( fValidateOnlyIn ) { dwControlCode = CLUSCTL_NETINTERFACE_VALIDATE_PRIVATE_PROPERTIES; } // if: only validating data else { dwControlCode = CLUSCTL_NETINTERFACE_SET_PRIVATE_PROPERTIES; } // else: setting data // // Set private properties. // sc = ClusterNetInterfaceControl( pcnd->GetHNetInterface() , NULL // hNode , dwControlCode , cpl.PbPropList() , static_cast< DWORD >( cpl.CbPropList() ) , NULL // lpOutBuffer , 0 // nOutBufferSize , &cbProps ); break; } // case: default: ASSERT( 0 ); } // switch: object type // // Handle errors. // if ( sc != ERROR_SUCCESS ) { if ( sc == ERROR_INVALID_PARAMETER ) { if ( ! fNoNewPropsIn ) { fSuccess = BSetPrivateProps( fValidateOnlyIn, TRUE /*fNoNewPropsIn*/ ); } // if: new props are allowed else fSuccess = FALSE; } // if: invalid parameter error occurred else { fSuccess = FALSE; } // else: some other error occurred // // If an error occurred, display an error message. // if ( ! fSuccess ) { DisplaySetPropsError( sc, fValidateOnlyIn ? IDS_ERROR_VALIDATING_PROPERTIES : IDS_ERROR_SETTING_PROPERTIES ); if ( sc == ERROR_RESOURCE_PROPERTIES_STORED ) { fSuccess = TRUE; } // if: properties only stored } // if: error occurred } // if: error setting/validating data } // if: there is data to set } // if: no errors building the property list // // Save data locally. // if ( ! fValidateOnlyIn && fSuccess ) { // // Save new values as previous values. // try { DWORD cprop; const CObjectProperty * pprop; for ( pprop = Pprops(), cprop = Cprops() ; cprop > 0 ; pprop++, cprop-- ) { switch ( pprop->m_propFormat ) { case CLUSPROP_FORMAT_SZ: case CLUSPROP_FORMAT_EXPAND_SZ: ASSERT(pprop->m_value.pstr != NULL); ASSERT(pprop->m_valuePrev.pstr != NULL); *pprop->m_valuePrev.pstr = *pprop->m_value.pstr; break; case CLUSPROP_FORMAT_DWORD: case CLUSPROP_FORMAT_LONG: ASSERT( pprop->m_value.pdw != NULL ); ASSERT( pprop->m_valuePrev.pdw != NULL ); *pprop->m_valuePrev.pdw = *pprop->m_value.pdw; break; case CLUSPROP_FORMAT_BINARY: case CLUSPROP_FORMAT_MULTI_SZ: ASSERT( pprop->m_value.ppb != NULL ); ASSERT( *pprop->m_value.ppb != NULL ); ASSERT( pprop->m_value.pcb != NULL ); ASSERT( pprop->m_valuePrev.ppb != NULL ); ASSERT( *pprop->m_valuePrev.ppb != NULL ); ASSERT( pprop->m_valuePrev.pcb != NULL ); delete [] *pprop->m_valuePrev.ppb; *pprop->m_valuePrev.ppb = new BYTE[ *pprop->m_value.pcb ]; CopyMemory( *pprop->m_valuePrev.ppb, *pprop->m_value.ppb, *pprop->m_value.pcb ); *pprop->m_valuePrev.pcb = *pprop->m_value.pcb; break; default: ASSERT( 0 ); // don't know how to deal with this type } // switch: property format } // for: each property } // try catch ( CException * pe ) { pe->ReportError(); pe->Delete(); fSuccess = FALSE; } // catch: CException } // if: not just validating and successful so far // // Indicate we successfully saved the properties. // if ( ! fValidateOnlyIn && fSuccess ) { m_bSaved = TRUE; } // if: successfully saved data return fSuccess; } //*** CBasePropertyPage::BSetPrivateProps